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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6b1efdbb660e37cbde645ec2aacd133b91b31f5e | 15,659,450,823,767 | 09e6690147eedf58189c09546a8b4d50300c725b | /weizu-parent/weizu-web-modules/weizu-channel/src/main/java/com/weizu/flowsys/web/http/ao/ChargeFacadeImpl.java | 3774332142265051edd177c545f99477c7a8be0e | [] | no_license | showlofans/weizu_channel | https://github.com/showlofans/weizu_channel | 3c846e8df738b28db539324c28500d2b82172e83 | 39de1347be4a988acd2aa929d0d52e95dc8dbba9 | refs/heads/master | 2022-01-27T09:35:10.396000 | 2022-01-23T12:25:32 | 2022-01-23T12:25:32 | 95,176,460 | 0 | 1 | null | false | 2018-04-14T10:01:38 | 2017-06-23T02:42:08 | 2018-04-05T02:31:04 | 2018-04-14T10:01:38 | 290,481 | 0 | 1 | 0 | Java | false | null | //package com.weizu.flowsys.web.http.ao;
//
//import java.util.Map;
//
//import javax.annotation.Resource;
//
//import org.apache.log4j.Logger;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.weizu.api.outter.enums.ChargeStatusEnum;
//import org.weizu.api.outter.facade.ChargeFacade;
//import org.weizu.api.outter.pojo.charge.ChargeDTO;
//import org.weizu.api.outter.pojo.charge.ChargeOrder;
//import org.weizu.api.outter.pojo.charge.ChargeParams;
//
//import com.weizu.flowsys.core.util.NumberTool;
//import com.weizu.flowsys.operatorPg.enums.AccountTypeEnum;
//import com.weizu.flowsys.operatorPg.enums.BillTypeEnum;
//import com.weizu.flowsys.operatorPg.enums.OrderStateEnum;
//import com.weizu.flowsys.operatorPg.enums.ScopeCityEnum;
//import com.weizu.flowsys.util.OrderUril;
//import com.weizu.flowsys.web.activity.dao.IOperatorDiscountDao;
//import com.weizu.flowsys.web.activity.pojo.OperatorDiscountPo;
//import com.weizu.flowsys.web.activity.pojo.OperatorScopeVO;
//import com.weizu.flowsys.web.agency.ao.ChargeAccountAo;
//import com.weizu.flowsys.web.agency.dao.impl.AgencyBackwardDao;
//import com.weizu.flowsys.web.agency.dao.impl.ChargeRecordDao;
//import com.weizu.flowsys.web.agency.pojo.AgencyBackwardPo;
//import com.weizu.flowsys.web.agency.pojo.ChargeAccountPo;
//import com.weizu.flowsys.web.agency.pojo.ChargeRecordPo;
//import com.weizu.flowsys.web.channel.ao.ChannelForwardAO;
//import com.weizu.flowsys.web.channel.ao.ProductCodeAO;
//import com.weizu.flowsys.web.channel.dao.impl.ChannelForwardDao;
//import com.weizu.flowsys.web.channel.dao.impl.ExchangePlatformDao;
//import com.weizu.flowsys.web.channel.pojo.BestChannelPO;
//import com.weizu.flowsys.web.channel.pojo.OperatorPgDataPo;
//import com.weizu.flowsys.web.channel.pojo.PgDataPo;
//import com.weizu.flowsys.web.trade.PurchaseUtil;
//import com.weizu.flowsys.web.trade.dao.PurchaseDao;
//import com.weizu.flowsys.web.trade.pojo.PurchasePo;
//
///**
// * @description: 充值对外接口实现类
// * @projectName:weizu-channel
// * @className:ChargeFacadeImpl.java
// * @author:POP产品研发部 宁强
// * @createTime:2017年6月23日 下午4:41:42
// * @version 1.0
// */
////@Service("chargeFacade")
////public class ChargeFacadeImpl implements ChargeFacade {
////
//// @Resource
//// private ValiUser valiUser;
//// @Resource
//// private AgencyBackwardDao agencyBackwardDao;
////
//// @Resource
//// private IOperatorDiscountDao operatorDiscountDao;
////
//// @Resource
//// private ChannelForwardAO channelForwardAO;
////
//// @Resource
//// private ProductCodeAO productCodeAO;
////
//// @Resource
//// private ExchangePlatformDao exchangePlatformDao;
//// @Resource
//// private ChannelForwardDao channelForwardDao;
//// @Resource
//// private PurchaseDao purchaseDAO;
////
//// @Resource
//// private ChargeAccountAo chargeAccountAO;
////
//// @Resource
//// private ChargeRecordDao chargeRecordDao;
////
//// /**
//// * @description: 充值接口
//// * @param chargeParams
//// * @return
//// * @author:POP产品研发部 宁强
//// * @createTime:2017年6月23日 下午4:41:57
//// */
//// @Transactional
//// @Override
////// public ChargeDTO charge(ChargeParams chargeParams) {
////// ChargeDTO chargeDTO = null;
////// AgencyBackwardPo backPo = valiUser.findAgency(chargeParams.getUsername(), chargeParams.getSign());
////// String chargeTel = chargeParams.getNumber();
////// Map<String, Object> resMap = PurchaseUtil.getOperatorsByTel(chargeTel);
////// int otype = -1;
////// otype = Integer.parseInt(resMap.get("operatorType").toString());
////// PgDataPo pgData = null;
////// ChargeStatusEnum chargeEnum = null;
////// int billType = chargeParams.getBillType();
////// BillTypeEnum billTypeE = BillTypeEnum.getEnum(billType);
////// if(billTypeE == null){
////// chargeEnum = ChargeStatusEnum.INVALID_BILL_TYPE;
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), null);
////// }
////// //初始化包体和运营商类型
////// try {
////// pgData = valiUser.findPg(chargeParams.getScope(), chargeParams.getFlowsize(),otype);//
////// } catch (NumberFormatException e) {
////// e.printStackTrace();
////// chargeEnum = ChargeStatusEnum.INT_REQUIRED;
////// return new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), null);
////// }
////// //充值用户不合法
////// if(backPo == null)
////// {
////// chargeEnum = ChargeStatusEnum.AUTHENTICATION_FAILURE;
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), null);
////// }
////// //充值流量包体不存在
////// else if(pgData == null)
////// {
////// chargeEnum = ChargeStatusEnum.PG_NOT_FOUND;
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), null);
////// }
////// else//开始有订单,也会返回订单
////// {//充值并返回最新的订单(状态)
//////
////// String scopeName = resMap.get("scopeName").toString();
////// String chargeTelCity = resMap.get("chargeTelCity").toString();
////// String chargeTelDetail = resMap.get("chargeTelDetail").toString();
//////
////// OperatorDiscountPo operatorDiscountPo = new OperatorDiscountPo();
////// operatorDiscountPo.setScopeName(scopeName);
////// operatorDiscountPo.setOperatorType(otype);
////// if(billType == BillTypeEnum.CORPORATE_BUSINESS.getValue())
////// {//通过接口传参,传错billType(区分用户)
//////// if(backPo.getBillRateId() == null){
//////// chargeEnum = ChargeStatusEnum.INVALID_BILL_TYPE;
//////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeTelDetail+chargeEnum.getDesc()+":没有开通对公业务", null);
//////// return chargeDTO;
//////// }else
//////// {
//////// operatorDiscountPo.setRateId(backPo.getBillRateId());
//////// }
////// }else
////// {
////// if(backPo.getRateId() == null)
////// {
////// chargeEnum = ChargeStatusEnum.INVALID_BILL_TYPE;
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeTelDetail+chargeEnum.getDesc()+":没有开通对私业务", null);
////// return chargeDTO;
////// }else
////// {
////// operatorDiscountPo.setRateId(backPo.getRateId());
////// }
////// }
////// OperatorDiscountPo discountPo = operatorDiscountDao.selectOneDiscountByPo(operatorDiscountPo);
//////
////// PurchasePo purchasePo = new PurchasePo();
////// purchasePo.setOrderArriveTime(System.currentTimeMillis());
////// /**订单号信息添加*/
////// OrderUril ou1 = new OrderUril(2);
////// try {
////// purchasePo.setOrderId(ou1.nextId());//设置订单号
////// } catch (Exception e) {
////// e.printStackTrace();
////// }
//////
////// purchasePo.setChargeTel(chargeTel);
//////
////// //没有找到相关地区折扣
////// if(discountPo == null)
////// {
////// purchasePo.setOrderResult(OrderStateEnum.UNCHARGE.getValue());//未充
////// purchasePo.setOrderResultDetail(ChargeStatusEnum.SCOPE_RATE_UNDEFINED.getDesc());//产品(费率)未配置
////// purchasePo.setBillType(chargeParams.getBillType());
////// int purResult = purchaseDAO.addPurchase(purchasePo);
////// if(purResult > 0){
////// chargeEnum = ChargeStatusEnum.SCOPE_RATE_UNDEFINED;
////// ChargeOrder chargeOrder = new ChargeOrder(purchasePo.getOrderId(), chargeTel, pgData.getPgSize(),billType);
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeTelDetail+chargeEnum.getDesc(), chargeOrder);
////// }else
////// {
////// Logger log = Logger.getLogger(ChargeFacadeImpl.class);
////// log.info("添加订单失败!");
////// }
////// }
////// else
////// {
////// Double rateDisccount = discountPo.getDiscount();//费率折扣
//////
////// purchasePo.setChargeTelCity(chargeTelCity);
////// purchasePo.setChargeTelDetail(chargeTelDetail);
//////
////// int pgId = pgData.getId();
////// Double orderAmount = NumberTool.mul(pgData.getPgPrice(), rateDisccount);
//////
////// purchasePo.setPgId(pgId);
////// purchasePo.setOrderAmount(orderAmount);
//////
//////// switch (chargeParams.getBillType()) {
//////// case 0:
//////// billType = BillTypeEnum.BUSINESS_INDIVIDUAL.getValue();
//////// break;
//////// case 1:
//////// billType = BillTypeEnum.CORPORATE_BUSINESS.getValue();
//////// break;
//////// default:
//////// break;
//////// }
////// ChargeAccountPo chargeAccount = chargeAccountAO.getAccountByAgencyId(backPo.getId(),billType);
////// Double balance = 0.00d;//账户余额信息
////// if(chargeAccount != null)
////// {
////// balance = chargeAccount.getAccountBalance();
////// }
////// if(balance < orderAmount)
////// {
////// //新增欠费订单(该订单没有走任何的通道)
////// purchasePo.setOrderResult(OrderStateEnum.UNCHARGE.getValue());//未充
////// purchasePo.setOrderResultDetail(ChargeStatusEnum.LACK_OF_BALANCE.getDesc());//欠费等待
////// purchasePo.setBillType(chargeParams.getBillType());
////// int purResult = purchaseDAO.addPurchase(purchasePo);
////// if(purResult > 0 )
////// {
////// chargeEnum = ChargeStatusEnum.LACK_OF_BALANCE;
////// return new ChargeDTO(chargeEnum.getValue(), chargeEnum.getDesc(), new ChargeOrder(purchasePo.getOrderId()+"", chargeTel+"", pgData.getPgSize()+"",billType));
////// }else
////// {
////// Logger log = Logger.getLogger(this.getClass());
////// log.info("添加订单失败!");
////// }
////// }else{
////// Long nextIdRecord = chargeRecordDao.nextId();
////// chargeRecordDao.add(new ChargeRecordPo(System
////// .currentTimeMillis(), orderAmount,
////// balance, NumberTool.sub(balance, orderAmount),
////// BillTypeEnum.BUSINESS_INDIVIDUAL.getValue(),AccountTypeEnum.DECREASE.getValue(), chargeAccount.getId(), purchasePo.getAgencyId(),1,purchasePo.getOrderId()));
////// /*******************最优通道*******************/
////// String scopeCityCode = "";
////// for (Map<String, Object> cityMap : ScopeCityEnum.toList()) {
////// String cityName = cityMap.get("desc").toString();
////// if(cityName.contains(scopeName))
////// {
////// scopeCityCode = cityMap.get("value").toString();
////// }
////// }
////// BestChannelPO bestChannel = channelForwardAO.getBestChannel(new OperatorScopeVO(scopeName, backPo.getId(), otype));
////// if(bestChannel != null){//走了通道
//////// if()
//////// purchasePo.setRecordId(nextIdRecord);
////// chargeDTO = doChannel( bestChannel, pgData, purchasePo, backPo, scopeCityCode, chargeTel, billType);
////// }
////// }
////// }
////// }
////// return chargeDTO;
////// }
////
//// /**
//// * @description: 走了通道后的操作
//// * @param chargeEnum
//// * @param bestChannel
//// * @param pgData
//// * @param purchasePo
//// * @param backPo
//// * @param scopeCityCode
//// * @param chargeTel
//// * @return
//// * @author:POP产品研发部 宁强
//// * @createTime:2017年6月29日 上午11:14:38
//// */
////// private ChargeDTO doChannel(BestChannelPO bestChannel,PgDataPo pgData,PurchasePo purchasePo,AgencyBackwardPo backPo,String scopeCityCode,String chargeTel,int billType) {
////// ChargeStatusEnum chargeEnum = null;
////// ProductCodePo product = productCodeAO.getOneProductCode(new OneCodePo(scopeCityCode, pgData.getPgSize(), pgData.getOperatorType(), pgData.getServiceType(),bestChannel.getEpd()));
////// if(product != null){
////// ExchangePlatformPo epPo = exchangePlatformDao.get(bestChannel.getEpd());
////// ChargeBase chargeBase = ChargeFactory.getChargeBase(bestChannel.getEpName());
//////
//////// purchasePo.setOrderPlatformPath(OrderPathEnum.CHARGE_SOCKET.getValue());
////// purchasePo.setAgencyId(backPo.getId());
//////// purchasePo.setRootAgencyId(backPo.getRootAgencyId());
////// //添加待充订单
////// purchasePo.setOrderResult(OrderStateEnum.DAICHONG.getValue());
//////// purchasePo.setOrderRe
//////// purchasePo.setChannelId(bestChannel.getChanneld());
////// int addPurResult = purchaseDAO.addPurchase(purchasePo);//数据库中有了待充订单,通过平台的查询页面可以查到,通过订单接口也可以查到
////// //充值:通过充值返回的订单查询订单详情,然后更新状态
////// ChargeResultPage chargeResultPage = chargeBase.charge(new ChargeParamsPage(epPo.getEpPurchaseIp(), epPo.getEpName(), epPo.getEpUserName(), epPo.getEpApikey(), chargeTel, product.getProductCode()));
////// ChargePageOrder chargePageOrder = chargeResultPage.getChargePageOrder();
////// if(chargePageOrder != null)
////// {
////// //查看订单状态
////// OrderStateBase orderStatePage = OrderStateFactory.getOrderStateBase(epPo.getEpName());
////// OrderStateResultPage osrp = orderStatePage.getOrderState(new OrderStateParamsPage(epPo.getPgdataCheckIp(), chargePageOrder.getTransaction_id(), epPo.getEpName(), epPo.getEpUserName(), epPo.getEpApikey()));
////// int orderStateAPI = osrp.getPageOrder().getStatus();
////// //如果成功,就更新该订单;失败就拦下来设置为未冲
////// int status = getStatusByStatus(orderStateAPI);
////// if(status == OrderStateEnum.CHARGED.getValue())
////// {//成功
////// //更新该订单状态
////// purchaseDAO.updatePurchaseState(new PurchaseStateParams(purchasePo.getOrderId(), chargePageOrder.getOrderBackTime(), status, ChargeStatusEnum.CHARGE_SUCCESS.getDesc(),chargePageOrder.getTransaction_id()));
////// }else if(status == OrderStateEnum.UNCHARGE.getValue())
////// {//失败(没有接口订单号)
////// purchaseDAO.updatePurchaseState(new PurchaseStateParams(purchasePo.getOrderId(), chargePageOrder.getOrderBackTime(), status, OrderStateEnum.WEICHONG.getDesc(),""));
////// }
////// }
////// }
////// else{//缺少通道编码
//////
////// }
////// int channelId = bestChannel.getChanneld();//
////// Double channelDiscount = bestChannel.getChannelDiscount();
////// Double channelAmount = NumberTool.mul(pgData.getPgPrice(), channelDiscount);//通道交易增加额
//////// purchasePo.setChannelId(channelId);
////// ChannelForwardPo channelPo = channelForwardDao.get(channelId);
////// channelPo.setId(channelId);
////// channelPo.addTotalUse();
////// channelPo.addTotalAmount(channelAmount);
////// int channelRes = channelForwardDao.update(channelPo);
////// //更新订单表
////// if(channelRes > 0){
////// ChargeOrder chargeOrder = new ChargeOrder(purchasePo.getOrderId()+"", purchasePo.getChargeTel(), pgData.getPgSize()+"",billType);
////// chargeEnum = ChargeStatusEnum.CHARGE_SUCCESS;
////// return new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), chargeOrder);
////// }
////// return null;
////// }
////
//// /**
//// * @description: 返回订单的状态
//// * @param orderStateAPI
//// * @return
//// * @author:POP产品研发部 宁强
//// * @createTime:2017年6月29日 上午10:11:00
//// */
////// public static int getStatusByStatus(int orderStateAPI) {
////// int status = -1;
////// switch (orderStateAPI) {
////// case 0 ://失败
////// status = OrderStateEnum.WEICHONG.getValue();//设置未冲
////// break;
////// case 1 ://成功
////// status = OrderStateEnum.CHARGED.getValue();
////// break;
////// case 2 ://正在充值
////// status = OrderStateEnum.DAICHONG.getValue();
////// break;
////// case 3 ://等待充值
////// status = OrderStateEnum.DAICHONG.getValue();
////// break;
////// case 4 ://未充值
////// status = OrderStateEnum.WEICHONG.getValue();
////// break;
//////
////// default:
////// break;
////// }
////// return status;
////// }
////
////}
| UTF-8 | Java | 15,924 | java | ChargeFacadeImpl.java | Java | [
{
"context": "sName:ChargeFacadeImpl.java\n// * @author:POP产品研发部 宁强\n// * @createTime:2017年6月23日 下午4:41:42\n// * @versi",
"end": 2142,
"score": 0.9957904815673828,
"start": 2140,
"tag": "NAME",
"value": "宁强"
},
{
"context": "geParams\n////\t * @return\n////\t * @author:POP产品研发部 宁强\n/... | null | [] | //package com.weizu.flowsys.web.http.ao;
//
//import java.util.Map;
//
//import javax.annotation.Resource;
//
//import org.apache.log4j.Logger;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.weizu.api.outter.enums.ChargeStatusEnum;
//import org.weizu.api.outter.facade.ChargeFacade;
//import org.weizu.api.outter.pojo.charge.ChargeDTO;
//import org.weizu.api.outter.pojo.charge.ChargeOrder;
//import org.weizu.api.outter.pojo.charge.ChargeParams;
//
//import com.weizu.flowsys.core.util.NumberTool;
//import com.weizu.flowsys.operatorPg.enums.AccountTypeEnum;
//import com.weizu.flowsys.operatorPg.enums.BillTypeEnum;
//import com.weizu.flowsys.operatorPg.enums.OrderStateEnum;
//import com.weizu.flowsys.operatorPg.enums.ScopeCityEnum;
//import com.weizu.flowsys.util.OrderUril;
//import com.weizu.flowsys.web.activity.dao.IOperatorDiscountDao;
//import com.weizu.flowsys.web.activity.pojo.OperatorDiscountPo;
//import com.weizu.flowsys.web.activity.pojo.OperatorScopeVO;
//import com.weizu.flowsys.web.agency.ao.ChargeAccountAo;
//import com.weizu.flowsys.web.agency.dao.impl.AgencyBackwardDao;
//import com.weizu.flowsys.web.agency.dao.impl.ChargeRecordDao;
//import com.weizu.flowsys.web.agency.pojo.AgencyBackwardPo;
//import com.weizu.flowsys.web.agency.pojo.ChargeAccountPo;
//import com.weizu.flowsys.web.agency.pojo.ChargeRecordPo;
//import com.weizu.flowsys.web.channel.ao.ChannelForwardAO;
//import com.weizu.flowsys.web.channel.ao.ProductCodeAO;
//import com.weizu.flowsys.web.channel.dao.impl.ChannelForwardDao;
//import com.weizu.flowsys.web.channel.dao.impl.ExchangePlatformDao;
//import com.weizu.flowsys.web.channel.pojo.BestChannelPO;
//import com.weizu.flowsys.web.channel.pojo.OperatorPgDataPo;
//import com.weizu.flowsys.web.channel.pojo.PgDataPo;
//import com.weizu.flowsys.web.trade.PurchaseUtil;
//import com.weizu.flowsys.web.trade.dao.PurchaseDao;
//import com.weizu.flowsys.web.trade.pojo.PurchasePo;
//
///**
// * @description: 充值对外接口实现类
// * @projectName:weizu-channel
// * @className:ChargeFacadeImpl.java
// * @author:POP产品研发部 宁强
// * @createTime:2017年6月23日 下午4:41:42
// * @version 1.0
// */
////@Service("chargeFacade")
////public class ChargeFacadeImpl implements ChargeFacade {
////
//// @Resource
//// private ValiUser valiUser;
//// @Resource
//// private AgencyBackwardDao agencyBackwardDao;
////
//// @Resource
//// private IOperatorDiscountDao operatorDiscountDao;
////
//// @Resource
//// private ChannelForwardAO channelForwardAO;
////
//// @Resource
//// private ProductCodeAO productCodeAO;
////
//// @Resource
//// private ExchangePlatformDao exchangePlatformDao;
//// @Resource
//// private ChannelForwardDao channelForwardDao;
//// @Resource
//// private PurchaseDao purchaseDAO;
////
//// @Resource
//// private ChargeAccountAo chargeAccountAO;
////
//// @Resource
//// private ChargeRecordDao chargeRecordDao;
////
//// /**
//// * @description: 充值接口
//// * @param chargeParams
//// * @return
//// * @author:POP产品研发部 宁强
//// * @createTime:2017年6月23日 下午4:41:57
//// */
//// @Transactional
//// @Override
////// public ChargeDTO charge(ChargeParams chargeParams) {
////// ChargeDTO chargeDTO = null;
////// AgencyBackwardPo backPo = valiUser.findAgency(chargeParams.getUsername(), chargeParams.getSign());
////// String chargeTel = chargeParams.getNumber();
////// Map<String, Object> resMap = PurchaseUtil.getOperatorsByTel(chargeTel);
////// int otype = -1;
////// otype = Integer.parseInt(resMap.get("operatorType").toString());
////// PgDataPo pgData = null;
////// ChargeStatusEnum chargeEnum = null;
////// int billType = chargeParams.getBillType();
////// BillTypeEnum billTypeE = BillTypeEnum.getEnum(billType);
////// if(billTypeE == null){
////// chargeEnum = ChargeStatusEnum.INVALID_BILL_TYPE;
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), null);
////// }
////// //初始化包体和运营商类型
////// try {
////// pgData = valiUser.findPg(chargeParams.getScope(), chargeParams.getFlowsize(),otype);//
////// } catch (NumberFormatException e) {
////// e.printStackTrace();
////// chargeEnum = ChargeStatusEnum.INT_REQUIRED;
////// return new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), null);
////// }
////// //充值用户不合法
////// if(backPo == null)
////// {
////// chargeEnum = ChargeStatusEnum.AUTHENTICATION_FAILURE;
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), null);
////// }
////// //充值流量包体不存在
////// else if(pgData == null)
////// {
////// chargeEnum = ChargeStatusEnum.PG_NOT_FOUND;
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), null);
////// }
////// else//开始有订单,也会返回订单
////// {//充值并返回最新的订单(状态)
//////
////// String scopeName = resMap.get("scopeName").toString();
////// String chargeTelCity = resMap.get("chargeTelCity").toString();
////// String chargeTelDetail = resMap.get("chargeTelDetail").toString();
//////
////// OperatorDiscountPo operatorDiscountPo = new OperatorDiscountPo();
////// operatorDiscountPo.setScopeName(scopeName);
////// operatorDiscountPo.setOperatorType(otype);
////// if(billType == BillTypeEnum.CORPORATE_BUSINESS.getValue())
////// {//通过接口传参,传错billType(区分用户)
//////// if(backPo.getBillRateId() == null){
//////// chargeEnum = ChargeStatusEnum.INVALID_BILL_TYPE;
//////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeTelDetail+chargeEnum.getDesc()+":没有开通对公业务", null);
//////// return chargeDTO;
//////// }else
//////// {
//////// operatorDiscountPo.setRateId(backPo.getBillRateId());
//////// }
////// }else
////// {
////// if(backPo.getRateId() == null)
////// {
////// chargeEnum = ChargeStatusEnum.INVALID_BILL_TYPE;
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeTelDetail+chargeEnum.getDesc()+":没有开通对私业务", null);
////// return chargeDTO;
////// }else
////// {
////// operatorDiscountPo.setRateId(backPo.getRateId());
////// }
////// }
////// OperatorDiscountPo discountPo = operatorDiscountDao.selectOneDiscountByPo(operatorDiscountPo);
//////
////// PurchasePo purchasePo = new PurchasePo();
////// purchasePo.setOrderArriveTime(System.currentTimeMillis());
////// /**订单号信息添加*/
////// OrderUril ou1 = new OrderUril(2);
////// try {
////// purchasePo.setOrderId(ou1.nextId());//设置订单号
////// } catch (Exception e) {
////// e.printStackTrace();
////// }
//////
////// purchasePo.setChargeTel(chargeTel);
//////
////// //没有找到相关地区折扣
////// if(discountPo == null)
////// {
////// purchasePo.setOrderResult(OrderStateEnum.UNCHARGE.getValue());//未充
////// purchasePo.setOrderResultDetail(ChargeStatusEnum.SCOPE_RATE_UNDEFINED.getDesc());//产品(费率)未配置
////// purchasePo.setBillType(chargeParams.getBillType());
////// int purResult = purchaseDAO.addPurchase(purchasePo);
////// if(purResult > 0){
////// chargeEnum = ChargeStatusEnum.SCOPE_RATE_UNDEFINED;
////// ChargeOrder chargeOrder = new ChargeOrder(purchasePo.getOrderId(), chargeTel, pgData.getPgSize(),billType);
////// chargeDTO = new ChargeDTO(chargeEnum.getValue(),chargeTelDetail+chargeEnum.getDesc(), chargeOrder);
////// }else
////// {
////// Logger log = Logger.getLogger(ChargeFacadeImpl.class);
////// log.info("添加订单失败!");
////// }
////// }
////// else
////// {
////// Double rateDisccount = discountPo.getDiscount();//费率折扣
//////
////// purchasePo.setChargeTelCity(chargeTelCity);
////// purchasePo.setChargeTelDetail(chargeTelDetail);
//////
////// int pgId = pgData.getId();
////// Double orderAmount = NumberTool.mul(pgData.getPgPrice(), rateDisccount);
//////
////// purchasePo.setPgId(pgId);
////// purchasePo.setOrderAmount(orderAmount);
//////
//////// switch (chargeParams.getBillType()) {
//////// case 0:
//////// billType = BillTypeEnum.BUSINESS_INDIVIDUAL.getValue();
//////// break;
//////// case 1:
//////// billType = BillTypeEnum.CORPORATE_BUSINESS.getValue();
//////// break;
//////// default:
//////// break;
//////// }
////// ChargeAccountPo chargeAccount = chargeAccountAO.getAccountByAgencyId(backPo.getId(),billType);
////// Double balance = 0.00d;//账户余额信息
////// if(chargeAccount != null)
////// {
////// balance = chargeAccount.getAccountBalance();
////// }
////// if(balance < orderAmount)
////// {
////// //新增欠费订单(该订单没有走任何的通道)
////// purchasePo.setOrderResult(OrderStateEnum.UNCHARGE.getValue());//未充
////// purchasePo.setOrderResultDetail(ChargeStatusEnum.LACK_OF_BALANCE.getDesc());//欠费等待
////// purchasePo.setBillType(chargeParams.getBillType());
////// int purResult = purchaseDAO.addPurchase(purchasePo);
////// if(purResult > 0 )
////// {
////// chargeEnum = ChargeStatusEnum.LACK_OF_BALANCE;
////// return new ChargeDTO(chargeEnum.getValue(), chargeEnum.getDesc(), new ChargeOrder(purchasePo.getOrderId()+"", chargeTel+"", pgData.getPgSize()+"",billType));
////// }else
////// {
////// Logger log = Logger.getLogger(this.getClass());
////// log.info("添加订单失败!");
////// }
////// }else{
////// Long nextIdRecord = chargeRecordDao.nextId();
////// chargeRecordDao.add(new ChargeRecordPo(System
////// .currentTimeMillis(), orderAmount,
////// balance, NumberTool.sub(balance, orderAmount),
////// BillTypeEnum.BUSINESS_INDIVIDUAL.getValue(),AccountTypeEnum.DECREASE.getValue(), chargeAccount.getId(), purchasePo.getAgencyId(),1,purchasePo.getOrderId()));
////// /*******************最优通道*******************/
////// String scopeCityCode = "";
////// for (Map<String, Object> cityMap : ScopeCityEnum.toList()) {
////// String cityName = cityMap.get("desc").toString();
////// if(cityName.contains(scopeName))
////// {
////// scopeCityCode = cityMap.get("value").toString();
////// }
////// }
////// BestChannelPO bestChannel = channelForwardAO.getBestChannel(new OperatorScopeVO(scopeName, backPo.getId(), otype));
////// if(bestChannel != null){//走了通道
//////// if()
//////// purchasePo.setRecordId(nextIdRecord);
////// chargeDTO = doChannel( bestChannel, pgData, purchasePo, backPo, scopeCityCode, chargeTel, billType);
////// }
////// }
////// }
////// }
////// return chargeDTO;
////// }
////
//// /**
//// * @description: 走了通道后的操作
//// * @param chargeEnum
//// * @param bestChannel
//// * @param pgData
//// * @param purchasePo
//// * @param backPo
//// * @param scopeCityCode
//// * @param chargeTel
//// * @return
//// * @author:POP产品研发部 宁强
//// * @createTime:2017年6月29日 上午11:14:38
//// */
////// private ChargeDTO doChannel(BestChannelPO bestChannel,PgDataPo pgData,PurchasePo purchasePo,AgencyBackwardPo backPo,String scopeCityCode,String chargeTel,int billType) {
////// ChargeStatusEnum chargeEnum = null;
////// ProductCodePo product = productCodeAO.getOneProductCode(new OneCodePo(scopeCityCode, pgData.getPgSize(), pgData.getOperatorType(), pgData.getServiceType(),bestChannel.getEpd()));
////// if(product != null){
////// ExchangePlatformPo epPo = exchangePlatformDao.get(bestChannel.getEpd());
////// ChargeBase chargeBase = ChargeFactory.getChargeBase(bestChannel.getEpName());
//////
//////// purchasePo.setOrderPlatformPath(OrderPathEnum.CHARGE_SOCKET.getValue());
////// purchasePo.setAgencyId(backPo.getId());
//////// purchasePo.setRootAgencyId(backPo.getRootAgencyId());
////// //添加待充订单
////// purchasePo.setOrderResult(OrderStateEnum.DAICHONG.getValue());
//////// purchasePo.setOrderRe
//////// purchasePo.setChannelId(bestChannel.getChanneld());
////// int addPurResult = purchaseDAO.addPurchase(purchasePo);//数据库中有了待充订单,通过平台的查询页面可以查到,通过订单接口也可以查到
////// //充值:通过充值返回的订单查询订单详情,然后更新状态
////// ChargeResultPage chargeResultPage = chargeBase.charge(new ChargeParamsPage(epPo.getEpPurchaseIp(), epPo.getEpName(), epPo.getEpUserName(), epPo.getEpApikey(), chargeTel, product.getProductCode()));
////// ChargePageOrder chargePageOrder = chargeResultPage.getChargePageOrder();
////// if(chargePageOrder != null)
////// {
////// //查看订单状态
////// OrderStateBase orderStatePage = OrderStateFactory.getOrderStateBase(epPo.getEpName());
////// OrderStateResultPage osrp = orderStatePage.getOrderState(new OrderStateParamsPage(epPo.getPgdataCheckIp(), chargePageOrder.getTransaction_id(), epPo.getEpName(), epPo.getEpUserName(), epPo.getEpApikey()));
////// int orderStateAPI = osrp.getPageOrder().getStatus();
////// //如果成功,就更新该订单;失败就拦下来设置为未冲
////// int status = getStatusByStatus(orderStateAPI);
////// if(status == OrderStateEnum.CHARGED.getValue())
////// {//成功
////// //更新该订单状态
////// purchaseDAO.updatePurchaseState(new PurchaseStateParams(purchasePo.getOrderId(), chargePageOrder.getOrderBackTime(), status, ChargeStatusEnum.CHARGE_SUCCESS.getDesc(),chargePageOrder.getTransaction_id()));
////// }else if(status == OrderStateEnum.UNCHARGE.getValue())
////// {//失败(没有接口订单号)
////// purchaseDAO.updatePurchaseState(new PurchaseStateParams(purchasePo.getOrderId(), chargePageOrder.getOrderBackTime(), status, OrderStateEnum.WEICHONG.getDesc(),""));
////// }
////// }
////// }
////// else{//缺少通道编码
//////
////// }
////// int channelId = bestChannel.getChanneld();//
////// Double channelDiscount = bestChannel.getChannelDiscount();
////// Double channelAmount = NumberTool.mul(pgData.getPgPrice(), channelDiscount);//通道交易增加额
//////// purchasePo.setChannelId(channelId);
////// ChannelForwardPo channelPo = channelForwardDao.get(channelId);
////// channelPo.setId(channelId);
////// channelPo.addTotalUse();
////// channelPo.addTotalAmount(channelAmount);
////// int channelRes = channelForwardDao.update(channelPo);
////// //更新订单表
////// if(channelRes > 0){
////// ChargeOrder chargeOrder = new ChargeOrder(purchasePo.getOrderId()+"", purchasePo.getChargeTel(), pgData.getPgSize()+"",billType);
////// chargeEnum = ChargeStatusEnum.CHARGE_SUCCESS;
////// return new ChargeDTO(chargeEnum.getValue(),chargeEnum.getDesc(), chargeOrder);
////// }
////// return null;
////// }
////
//// /**
//// * @description: 返回订单的状态
//// * @param orderStateAPI
//// * @return
//// * @author:POP产品研发部 宁强
//// * @createTime:2017年6月29日 上午10:11:00
//// */
////// public static int getStatusByStatus(int orderStateAPI) {
////// int status = -1;
////// switch (orderStateAPI) {
////// case 0 ://失败
////// status = OrderStateEnum.WEICHONG.getValue();//设置未冲
////// break;
////// case 1 ://成功
////// status = OrderStateEnum.CHARGED.getValue();
////// break;
////// case 2 ://正在充值
////// status = OrderStateEnum.DAICHONG.getValue();
////// break;
////// case 3 ://等待充值
////// status = OrderStateEnum.DAICHONG.getValue();
////// break;
////// case 4 ://未充值
////// status = OrderStateEnum.WEICHONG.getValue();
////// break;
//////
////// default:
////// break;
////// }
////// return status;
////// }
////
////}
| 15,924 | 0.64875 | 0.64399 | 361 | 40.900276 | 34.897968 | 216 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.238227 | false | false | 15 |
ac9c2bfaf082ab951390ffae67e57b3dc85912b2 | 4,724,464,033,470 | a91012944db12c0cb1a9cba9bd07d71543acbb85 | /app/src/main/java/com/example/aloha/avoidgame/ObstacleManager.java | 2f31f3617d12231baf11b9ed1f02e3afd7e19e58 | [] | no_license | z2486357/avoidgame | https://github.com/z2486357/avoidgame | 7bf3c3ed7d1655d8ac86be460f6d6359f720e255 | c3ef103ac2c77cb59f15e253d6afa7aa378c54fc | refs/heads/master | 2020-04-02T12:23:29.760000 | 2018-10-26T05:44:55 | 2018-10-26T05:44:55 | 154,431,466 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.aloha.avoidgame;
import android.graphics.Canvas;
import java.util.ArrayList;
public class ObstacleManager {
private ArrayList<Obstacle> obstacles;
private int playerGap;
private int obstacleGap;
private int obstacleHeight;
private int color;
private long startTime;
public ObstacleManager(int playerGap, int obstacleGap, int obstacleHeight, int color){
this.obstacleGap=obstacleGap;
this.playerGap=playerGap;
this.obstacleHeight=obstacleHeight;
this.color=color;
startTime=System.currentTimeMillis();
obstacles = new ArrayList<>();
populateObstacles();
}
private void populateObstacles(){
int currY=-5*Constants.SCREEN_HEIGHT/4;
while(currY<0){
int xStart=(int)(Math.random()*Constants.SCREEN_WIDTH-playerGap);
obstacles.add(new Obstacle(obstacleHeight,color, xStart,currY,playerGap));
currY+=obstacleHeight+obstacleGap;
}
}
public void update(){
int elapsedTime = (int)(System.currentTimeMillis()-startTime);
startTime=System.currentTimeMillis();
float speed = Constants.SCREEN_HEIGHT/10000.0f;
for (Obstacle ob : obstacles){
ob.increamentY(speed*elapsedTime);
}
if (obstacles.get(obstacles.size()-1).getRectangle().top>=Constants.SCREEN_HEIGHT){
int xStart=(int)(Math.random()*Constants.SCREEN_WIDTH-playerGap);
obstacles.add(0,new Obstacle(obstacleHeight,color,xStart,obstacles.get(0).getRectangle().top-obstacleHeight-obstacleGap,playerGap));
obstacles.remove(obstacles.size()-1);
}
}
public void draw(Canvas canvas){
for (Obstacle ob : obstacles)
ob.draw(canvas);
}
}
| UTF-8 | Java | 1,798 | java | ObstacleManager.java | Java | [] | null | [] | package com.example.aloha.avoidgame;
import android.graphics.Canvas;
import java.util.ArrayList;
public class ObstacleManager {
private ArrayList<Obstacle> obstacles;
private int playerGap;
private int obstacleGap;
private int obstacleHeight;
private int color;
private long startTime;
public ObstacleManager(int playerGap, int obstacleGap, int obstacleHeight, int color){
this.obstacleGap=obstacleGap;
this.playerGap=playerGap;
this.obstacleHeight=obstacleHeight;
this.color=color;
startTime=System.currentTimeMillis();
obstacles = new ArrayList<>();
populateObstacles();
}
private void populateObstacles(){
int currY=-5*Constants.SCREEN_HEIGHT/4;
while(currY<0){
int xStart=(int)(Math.random()*Constants.SCREEN_WIDTH-playerGap);
obstacles.add(new Obstacle(obstacleHeight,color, xStart,currY,playerGap));
currY+=obstacleHeight+obstacleGap;
}
}
public void update(){
int elapsedTime = (int)(System.currentTimeMillis()-startTime);
startTime=System.currentTimeMillis();
float speed = Constants.SCREEN_HEIGHT/10000.0f;
for (Obstacle ob : obstacles){
ob.increamentY(speed*elapsedTime);
}
if (obstacles.get(obstacles.size()-1).getRectangle().top>=Constants.SCREEN_HEIGHT){
int xStart=(int)(Math.random()*Constants.SCREEN_WIDTH-playerGap);
obstacles.add(0,new Obstacle(obstacleHeight,color,xStart,obstacles.get(0).getRectangle().top-obstacleHeight-obstacleGap,playerGap));
obstacles.remove(obstacles.size()-1);
}
}
public void draw(Canvas canvas){
for (Obstacle ob : obstacles)
ob.draw(canvas);
}
}
| 1,798 | 0.66129 | 0.65406 | 53 | 32.92453 | 28.839079 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.754717 | false | false | 15 |
22d81ee6fe21d5f5db579d672de0b5b8595c4d08 | 16,707,422,840,632 | ecb9ebca38fe3267d734656085be52853afb476f | /MusicPro/src/main/java/com/yc/mp/mapper/singerMapper.java | 6172a83937abc55ac5660499ca63a2f7f5187f92 | [] | no_license | random99i/MyMusic | https://github.com/random99i/MyMusic | 569a4cbc5e45e8c3b3eb7faaf0b4e61de5112c34 | 4c054a9ac9cc376163eae5c436a52ac51481df6e | refs/heads/master | 2021-01-19T11:46:01.961000 | 2017-07-29T06:49:57 | 2017-07-29T06:49:57 | 82,263,863 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yc.mp.mapper;
import java.util.List;
import com.yc.mp.entity.PaginationBean;
import com.yc.mp.entity.Singer;
import com.yc.mp.entity.Song;
public interface singerMapper {
List<Singer> findAllhot();
Singer findSingerbyid(Singer singer);
List<Singer> findAll();
List<Singer> findSinger(Singer singer);
List<Song> getsong(Singer singer);
List<Song> opensong(Song song);
PaginationBean<Singer> listAllSinger(PaginationBean<Singer> bean);
int addSong(Song song);
}
| UTF-8 | Java | 519 | java | singerMapper.java | Java | [] | null | [] | package com.yc.mp.mapper;
import java.util.List;
import com.yc.mp.entity.PaginationBean;
import com.yc.mp.entity.Singer;
import com.yc.mp.entity.Song;
public interface singerMapper {
List<Singer> findAllhot();
Singer findSingerbyid(Singer singer);
List<Singer> findAll();
List<Singer> findSinger(Singer singer);
List<Song> getsong(Singer singer);
List<Song> opensong(Song song);
PaginationBean<Singer> listAllSinger(PaginationBean<Singer> bean);
int addSong(Song song);
}
| 519 | 0.71869 | 0.71869 | 27 | 17.222221 | 18.306715 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777778 | false | false | 15 |
723f364c12ba94bbd74fe5e1010fe0a9da909e6e | 6,210,522,754,457 | b19f06156af58204d273fef7f1c974305a6e6da4 | /app/src/main/java/com/android/mrpi/kanmeiju/mvp/BaseModel.java | 6ebf183d8b72fe1be652ec421bf476a029bf24fe | [] | no_license | MrPisir/meiju | https://github.com/MrPisir/meiju | b29f97f6b826ac30e9f94c6e9d5c3ac9c2554726 | c97540c03fd92f212af47b028c4fdbfed9eefece | refs/heads/master | 2017-12-02T18:43:01.124000 | 2017-05-07T14:45:10 | 2017-05-07T14:45:10 | 85,462,671 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.android.mrpi.kanmeiju.mvp;
/**
* Created by MrPi on 2017/3/19.
*/
public interface BaseModel {
} | UTF-8 | Java | 113 | java | BaseModel.java | Java | [
{
"context": " com.android.mrpi.kanmeiju.mvp;\n\n/**\n * Created by MrPi on 2017/3/19.\n */\n\npublic interface BaseModel {\n\n",
"end": 62,
"score": 0.9992403984069824,
"start": 58,
"tag": "USERNAME",
"value": "MrPi"
}
] | null | [] | package com.android.mrpi.kanmeiju.mvp;
/**
* Created by MrPi on 2017/3/19.
*/
public interface BaseModel {
} | 113 | 0.690265 | 0.628319 | 9 | 11.666667 | 15.077578 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false | 15 |
66fee6d9adc5bd3f1275d3cf4c0dc6c8880980ed | 21,723,944,613,158 | 6abcced4a42d050f8d698cea7329cd75bcb3b439 | /app/src/main/java/edu/gatech/buzzmovieselector/dao/MovieDao.java | c622e72ef57a4ec30e1fe35b1dfeb9375f31bc3c | [] | no_license | YourTeamName/buzz-movie-selector | https://github.com/YourTeamName/buzz-movie-selector | 4e9819545dade54db963e445b4b6e39b6c389d66 | 5b49df1341af498be79a9f251471afbf42170093 | refs/heads/master | 2021-01-10T14:39:55.255000 | 2016-04-08T04:44:21 | 2016-04-08T04:44:21 | 50,383,619 | 3 | 1 | null | false | 2016-04-08T04:45:55 | 2016-01-25T21:53:29 | 2016-02-05T20:44:09 | 2016-04-08T04:45:55 | 640 | 3 | 0 | 5 | Java | null | null | package edu.gatech.buzzmovieselector.dao;
import com.j256.ormlite.dao.Dao;
import edu.gatech.buzzmovieselector.entity.Movie;
/**
* Movie DAO which has an Integer id (movie.id)
*/
public interface MovieDao extends Dao<Movie, Integer> {
}
| UTF-8 | Java | 241 | java | MovieDao.java | Java | [] | null | [] | package edu.gatech.buzzmovieselector.dao;
import com.j256.ormlite.dao.Dao;
import edu.gatech.buzzmovieselector.entity.Movie;
/**
* Movie DAO which has an Integer id (movie.id)
*/
public interface MovieDao extends Dao<Movie, Integer> {
}
| 241 | 0.763485 | 0.751037 | 10 | 23.1 | 22.411827 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 15 |
2037cb2b0334f3cd45538ce6669b6442bd1011c6 | 26,156,350,868,121 | 633de5e161ddcc67b134d828b6b4fe3f28405adb | /app/src/main/java/com/example/msi/familyhealth/Data/DbItemBean.java | 05b4a8739b48ad5142b851c43b0843f6657e30a9 | [] | no_license | w233p/FamilyHealth | https://github.com/w233p/FamilyHealth | 1ccac9955cad5a9e70a9604b2610b1de90ea9574 | 3b0d5b2acefb74487650a9306e289f1452f859c7 | refs/heads/master | 2020-04-28T11:26:50.263000 | 2019-06-12T05:54:01 | 2019-06-12T05:54:01 | 175,239,795 | 0 | 0 | null | false | 2019-04-20T02:42:30 | 2019-03-12T15:17:03 | 2019-04-10T15:20:14 | 2019-04-20T02:42:30 | 561 | 0 | 0 | 0 | Java | false | false | package com.example.msi.familyhealth.Data;
import org.litepal.annotation.Column;
import org.litepal.crud.DataSupport;
import java.util.ArrayList;
import java.util.List;
/**
* 具体数据项目表
*/
public class DbItemBean extends DataSupport {
private int id;
@Column(unique = true)
private String item;
/**
* 一个具体项目对应一个大类
*/
private DbProjectBean dbProjectBean;
/**
* 很多数据都引用具体项目
*/
private List<DbDailyDataBean> dbDailyDataBeanList = new ArrayList<DbDailyDataBean>();
/**
* 体检数据的项目引用具体项目
*/
private List<DbHealthDataBean> dbHealthDataBeanList = new ArrayList<DbHealthDataBean>();
public List<DbHealthDataBean> getDbHealthDataBeanList() {
return dbHealthDataBeanList;
}
public DbItemBean setDbHealthDataBeanList(List<DbHealthDataBean> dbHealthDataBeanList) {
this.dbHealthDataBeanList = dbHealthDataBeanList;
return this;
}
public List<DbDailyDataBean> getDbDailyDataBeanList() {
return dbDailyDataBeanList;
}
public DbItemBean setDbDailyDataBeanList(List<DbDailyDataBean> dbDailyDataBeanList) {
this.dbDailyDataBeanList = dbDailyDataBeanList;
return this;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getItem() {
return item;
}
public DbItemBean setItem(String item) {
this.item = item;
return this;
}
public DbProjectBean getDbProjectBean() {
return dbProjectBean;
}
public DbItemBean setDbProjectBean(DbProjectBean dbProjectBean) {
this.dbProjectBean = dbProjectBean;
return this;
}
}
| UTF-8 | Java | 1,789 | java | DbItemBean.java | Java | [] | null | [] | package com.example.msi.familyhealth.Data;
import org.litepal.annotation.Column;
import org.litepal.crud.DataSupport;
import java.util.ArrayList;
import java.util.List;
/**
* 具体数据项目表
*/
public class DbItemBean extends DataSupport {
private int id;
@Column(unique = true)
private String item;
/**
* 一个具体项目对应一个大类
*/
private DbProjectBean dbProjectBean;
/**
* 很多数据都引用具体项目
*/
private List<DbDailyDataBean> dbDailyDataBeanList = new ArrayList<DbDailyDataBean>();
/**
* 体检数据的项目引用具体项目
*/
private List<DbHealthDataBean> dbHealthDataBeanList = new ArrayList<DbHealthDataBean>();
public List<DbHealthDataBean> getDbHealthDataBeanList() {
return dbHealthDataBeanList;
}
public DbItemBean setDbHealthDataBeanList(List<DbHealthDataBean> dbHealthDataBeanList) {
this.dbHealthDataBeanList = dbHealthDataBeanList;
return this;
}
public List<DbDailyDataBean> getDbDailyDataBeanList() {
return dbDailyDataBeanList;
}
public DbItemBean setDbDailyDataBeanList(List<DbDailyDataBean> dbDailyDataBeanList) {
this.dbDailyDataBeanList = dbDailyDataBeanList;
return this;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getItem() {
return item;
}
public DbItemBean setItem(String item) {
this.item = item;
return this;
}
public DbProjectBean getDbProjectBean() {
return dbProjectBean;
}
public DbItemBean setDbProjectBean(DbProjectBean dbProjectBean) {
this.dbProjectBean = dbProjectBean;
return this;
}
}
| 1,789 | 0.669994 | 0.669994 | 76 | 21.407894 | 23.991323 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 15 |
2846f5120f068828bdf58d4fec864ecde5782164 | 27,109,833,633,426 | 897ff395a24191012a4aac62538354ff3d064a8c | /src/personnage/personnages/Poppy.java | 30d4e6d8cbb406e30ccda131af5272f6c22fba2c | [
"MIT"
] | permissive | Floliroy/MegaChess | https://github.com/Floliroy/MegaChess | e24bd417532bdcd33efffdb36cdc7d24155bcaa8 | f044bbc514acf246823faf27325e2df4311ff255 | refs/heads/main | 2023-04-07T21:47:45.203000 | 2021-04-18T18:40:32 | 2021-04-18T18:40:32 | 333,459,920 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package personnage.personnages;
import personnage.Personnage;
import personnage.elements.Terre;
import personnage.origines.Demacia;
public class Poppy extends Personnage implements Demacia, Terre {
/**
* Initialise le personnage Poppy avec pour capacités :
* - vie = 180
* - degats = 8
* - deplacements = 5
* - portee = 2
* - vitesse = 0,4
*/
private static final long serialVersionUID = 2509497404212620615L;
private static final String nom = "Poppy";
private static final Integer vie = 180;
private static final Integer deplacements = 5;
private static final Integer degats = 8;
private static final Integer portee = 2;
private static final Double vitesse = 0.4;
public Poppy() {
super(nom, vie, degats, deplacements, portee, vitesse);
}
}
| UTF-8 | Java | 781 | java | Poppy.java | Java | [
{
"context": "04212620615L;\n\tprivate static final String nom = \"Poppy\";\n\tprivate static final Integer vie = 180;\n\tpriva",
"end": 475,
"score": 0.9934893846511841,
"start": 470,
"tag": "NAME",
"value": "Poppy"
}
] | null | [] | package personnage.personnages;
import personnage.Personnage;
import personnage.elements.Terre;
import personnage.origines.Demacia;
public class Poppy extends Personnage implements Demacia, Terre {
/**
* Initialise le personnage Poppy avec pour capacités :
* - vie = 180
* - degats = 8
* - deplacements = 5
* - portee = 2
* - vitesse = 0,4
*/
private static final long serialVersionUID = 2509497404212620615L;
private static final String nom = "Poppy";
private static final Integer vie = 180;
private static final Integer deplacements = 5;
private static final Integer degats = 8;
private static final Integer portee = 2;
private static final Double vitesse = 0.4;
public Poppy() {
super(nom, vie, degats, deplacements, portee, vitesse);
}
}
| 781 | 0.723077 | 0.678205 | 29 | 25.896551 | 20.94878 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.37931 | false | false | 15 |
172c6c90e537df24e501532ac235f06a0173d9d7 | 30,434,138,307,699 | 5cb7fc5f14dfb1a2ac03305727e9598b6ea141e6 | /src/main/java/objects/Medical.java | 317411df32bbe21a74bcb08b1c646f0e106a49e0 | [] | no_license | YauhenBel/DocManager | https://github.com/YauhenBel/DocManager | 7fabd4129fbbab2448ff475ea9f4938240b6dd00 | e13d99d7650f17527d0ee71983f47bb6862f4e71 | refs/heads/master | 2022-10-29T07:34:06.197000 | 2019-06-08T10:39:01 | 2019-06-08T10:39:01 | 128,896,827 | 0 | 0 | null | false | 2022-10-05T19:16:49 | 2018-04-10T08:06:43 | 2019-06-08T10:39:38 | 2022-10-05T19:16:47 | 2,163 | 0 | 0 | 4 | Java | false | false | package objects;
import javafx.beans.property.SimpleStringProperty;
public class Medical {
private SimpleStringProperty fluoro = new SimpleStringProperty("");
private SimpleStringProperty ads = new SimpleStringProperty("");
public Medical(){}
public Medical(String fluoro, String ads){
this.fluoro = new SimpleStringProperty(fluoro);
this.ads = new SimpleStringProperty(ads);
}
public void setFluoro(String fluoro) { this.fluoro.set(fluoro);}
public String getFluoro() { return fluoro.get();}
public void setAds(String ads) { this.ads.set(ads);}
public String getAds() { return ads.get();}
}
| UTF-8 | Java | 653 | java | Medical.java | Java | [] | null | [] | package objects;
import javafx.beans.property.SimpleStringProperty;
public class Medical {
private SimpleStringProperty fluoro = new SimpleStringProperty("");
private SimpleStringProperty ads = new SimpleStringProperty("");
public Medical(){}
public Medical(String fluoro, String ads){
this.fluoro = new SimpleStringProperty(fluoro);
this.ads = new SimpleStringProperty(ads);
}
public void setFluoro(String fluoro) { this.fluoro.set(fluoro);}
public String getFluoro() { return fluoro.get();}
public void setAds(String ads) { this.ads.set(ads);}
public String getAds() { return ads.get();}
}
| 653 | 0.70291 | 0.70291 | 24 | 26.208334 | 26.809481 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458333 | false | false | 15 |
64084081278bc999be420081999dbf96f3cbf27c | 16,217,796,573,547 | ba86ae6bc218e7dea3e142e0dd02acca866dfd1a | /src/main/java/com/cheesy/pizzashopapi/PizzaController.java | bca22c3e0b59c843dffb7559051509b4a94340be | [] | no_license | priestpl/pppizzashop | https://github.com/priestpl/pppizzashop | 3926a8f87248796c29cfcbc5c244364937978833 | ad012fee2c2f983bf0306687b6257ed9e8c866a4 | refs/heads/master | 2020-04-01T18:14:54.862000 | 2018-10-17T16:33:17 | 2018-10-17T16:33:17 | 153,481,190 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cheesy.pizzashopapi;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class PizzaController {
@RequestMapping("/pizzas")
public String getPizzas() {
return "Pizza is gone";
}
}
| UTF-8 | Java | 312 | java | PizzaController.java | Java | [] | null | [] | package com.cheesy.pizzashopapi;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class PizzaController {
@RequestMapping("/pizzas")
public String getPizzas() {
return "Pizza is gone";
}
}
| 312 | 0.75641 | 0.75641 | 13 | 23 | 21.136917 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 15 |
eb5dea924242bd09d360ed7e38c4b904a05501ca | 16,217,796,576,036 | 9cd2e12dbc6ac861dc9a84eda938974a7d3509b4 | /app/src/main/java/io/tehtotalpwnage/keyclubinterface/camera/CameraSourcePreview.java | 40af294331095b5315df4c45e52fef69079e56d9 | [] | no_license | ttpcodes/KeyClubInterface-Android | https://github.com/ttpcodes/KeyClubInterface-Android | e20986bc6a0711cdb68f80beeda8a03c10eb42b8 | b9658696857ff2cfcb8c78db557846e46c7ea43a | refs/heads/master | 2021-06-24T15:31:17.477000 | 2017-09-12T07:21:51 | 2017-09-12T07:21:51 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (c) 2017 Michael Nguyen
*
* This file is part of KeyClubInterface.
*
* KeyClubInterface 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 3 of the License, or
* (at your option) any later version.
*
* KeyClubInterface 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 KeyClubInterface. If not, see <http://www.gnu.org/licenses/>.
*/
package io.tehtotalpwnage.keyclubinterface.camera;
import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
import com.google.android.gms.common.images.Size;
import com.google.android.gms.vision.CameraSource;
import java.io.IOException;
public class CameraSourcePreview extends ViewGroup implements SurfaceHolder.Callback {
private CameraSource mCameraSource;
private Context mContext;
private GraphicOverlay mOverlay;
private SurfaceView mSurfaceView;
private boolean mStartRequested;
private boolean mSurfaceAvailable;
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mStartRequested = false;
mSurfaceAvailable = false;
mSurfaceView = new SurfaceView(context);
mSurfaceView.getHolder().addCallback(this);
addView(mSurfaceView);
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
mSurfaceAvailable = true;
try {
startIfReady();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
mSurfaceAvailable = false;
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
int width = 320;
int height = 240;
if (mCameraSource != null) {
Size size = mCameraSource.getPreviewSize();
if (size != null) {
width = size.getWidth();
height = size.getHeight();
}
}
// If the camera is in portrait mode, we want to swap width and height for a proper display.
if (isPortraitMode()) {
int tmp = width;
// Yes Android Studio, I *really* want to swap width and height.
// noinspection SuspiciousNameCombination
width = height;
height = tmp;
}
final int layoutWidth = right - left;
final int layoutHeight = bottom - top;
int childWidth = layoutWidth;
int childHeight = (int) (((float) layoutWidth / (float) width) * height);
if (childHeight > layoutHeight) {
childHeight = layoutHeight;
childWidth = (int)(((float) layoutHeight / (float) height) * width);
}
for (int i = 0; i < getChildCount(); ++i) {
getChildAt(i).layout(0,0,childWidth,childHeight);
}
try {
startIfReady();
} catch (Exception e) {
e.printStackTrace();
}
}
private boolean isPortraitMode() {
int orientation = mContext.getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
return true;
}
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
return false;
}
return false;
}
public void release() {
if (mCameraSource != null) {
mCameraSource.release();
mCameraSource = null;
}
}
public void start(CameraSource cameraSource) throws IOException {
if (cameraSource == null) {
stop();
}
mCameraSource = cameraSource;
if (mCameraSource != null) {
mStartRequested = true;
startIfReady();
}
}
public void start(CameraSource cameraSource, GraphicOverlay overlay) throws IOException {
mOverlay = overlay;
start(cameraSource);
}
private void startIfReady() throws IOException, SecurityException {
if (mStartRequested && mSurfaceAvailable) {
mCameraSource.start(mSurfaceView.getHolder());
if (mOverlay != null) {
Size size = mCameraSource.getPreviewSize();
int min = Math.min(size.getWidth(), size.getHeight());
int max = Math.max(size.getWidth(), size.getHeight());
if (isPortraitMode()) {
mOverlay.setCameraInfo(min, max, mCameraSource.getCameraFacing());
} else {
mOverlay.setCameraInfo(max, min, mCameraSource.getCameraFacing());
}
mOverlay.clear();
}
mStartRequested = false;
}
}
public void stop() {
if (mCameraSource != null) {
mCameraSource.stop();
}
}
}
| UTF-8 | Java | 5,475 | java | CameraSourcePreview.java | Java | [
{
"context": "/*\n * Copyright (c) 2017 Michael Nguyen\n *\n * This file is part of KeyClubInterface.\n *\n ",
"end": 39,
"score": 0.9998362064361572,
"start": 25,
"tag": "NAME",
"value": "Michael Nguyen"
}
] | null | [] | /*
* Copyright (c) 2017 <NAME>
*
* This file is part of KeyClubInterface.
*
* KeyClubInterface 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 3 of the License, or
* (at your option) any later version.
*
* KeyClubInterface 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 KeyClubInterface. If not, see <http://www.gnu.org/licenses/>.
*/
package io.tehtotalpwnage.keyclubinterface.camera;
import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
import com.google.android.gms.common.images.Size;
import com.google.android.gms.vision.CameraSource;
import java.io.IOException;
public class CameraSourcePreview extends ViewGroup implements SurfaceHolder.Callback {
private CameraSource mCameraSource;
private Context mContext;
private GraphicOverlay mOverlay;
private SurfaceView mSurfaceView;
private boolean mStartRequested;
private boolean mSurfaceAvailable;
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mStartRequested = false;
mSurfaceAvailable = false;
mSurfaceView = new SurfaceView(context);
mSurfaceView.getHolder().addCallback(this);
addView(mSurfaceView);
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
mSurfaceAvailable = true;
try {
startIfReady();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
mSurfaceAvailable = false;
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
int width = 320;
int height = 240;
if (mCameraSource != null) {
Size size = mCameraSource.getPreviewSize();
if (size != null) {
width = size.getWidth();
height = size.getHeight();
}
}
// If the camera is in portrait mode, we want to swap width and height for a proper display.
if (isPortraitMode()) {
int tmp = width;
// Yes Android Studio, I *really* want to swap width and height.
// noinspection SuspiciousNameCombination
width = height;
height = tmp;
}
final int layoutWidth = right - left;
final int layoutHeight = bottom - top;
int childWidth = layoutWidth;
int childHeight = (int) (((float) layoutWidth / (float) width) * height);
if (childHeight > layoutHeight) {
childHeight = layoutHeight;
childWidth = (int)(((float) layoutHeight / (float) height) * width);
}
for (int i = 0; i < getChildCount(); ++i) {
getChildAt(i).layout(0,0,childWidth,childHeight);
}
try {
startIfReady();
} catch (Exception e) {
e.printStackTrace();
}
}
private boolean isPortraitMode() {
int orientation = mContext.getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
return true;
}
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
return false;
}
return false;
}
public void release() {
if (mCameraSource != null) {
mCameraSource.release();
mCameraSource = null;
}
}
public void start(CameraSource cameraSource) throws IOException {
if (cameraSource == null) {
stop();
}
mCameraSource = cameraSource;
if (mCameraSource != null) {
mStartRequested = true;
startIfReady();
}
}
public void start(CameraSource cameraSource, GraphicOverlay overlay) throws IOException {
mOverlay = overlay;
start(cameraSource);
}
private void startIfReady() throws IOException, SecurityException {
if (mStartRequested && mSurfaceAvailable) {
mCameraSource.start(mSurfaceView.getHolder());
if (mOverlay != null) {
Size size = mCameraSource.getPreviewSize();
int min = Math.min(size.getWidth(), size.getHeight());
int max = Math.max(size.getWidth(), size.getHeight());
if (isPortraitMode()) {
mOverlay.setCameraInfo(min, max, mCameraSource.getCameraFacing());
} else {
mOverlay.setCameraInfo(max, min, mCameraSource.getCameraFacing());
}
mOverlay.clear();
}
mStartRequested = false;
}
}
public void stop() {
if (mCameraSource != null) {
mCameraSource.stop();
}
}
}
| 5,467 | 0.615708 | 0.613151 | 175 | 30.285715 | 25.374195 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.537143 | false | false | 15 |
4cb3cca759b15436f1ffad93e7a19cf9cd9a0da6 | 3,109,556,361,386 | 1007965c02ca8c93c3cf8c09da065aad0cf5bd60 | /src/Main/MainStates.java | 477a28ed94b41630d495f267f501a9dfbe330ace | [] | no_license | MasashiAzuma/GameTesting | https://github.com/MasashiAzuma/GameTesting | 8a262b7b194fe1128d93516e8a9f11bdd4d7b5b1 | d637a9a96ec816b251030944cbf2119de7a52b7f | refs/heads/master | 2021-01-11T12:18:57.697000 | 2016-12-15T00:55:26 | 2016-12-15T00:55:26 | 76,489,703 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Main;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
public class MainStates extends StateBasedGame {
public final static int X_RES = 1920;
public final static int Y_RES = 1080;
public MainStates(String name) {
super(name);
}
public static void main(String[] args) {
try {
AppGameContainer appgc;
appgc = new AppGameContainer(new MainStates("Test"));
appgc.setVSync(true);
appgc.setDisplayMode(X_RES, Y_RES, true);
appgc.setShowFPS(true);
appgc.start();
} catch (SlickException ex) {
Logger.getLogger(GameState.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void initStatesList(GameContainer arg0) throws SlickException {
BasicGameState game = new GameState();
BasicGameState game2 = new GameOverState();
this.addState(game);
this.addState(game2);
}
}
| UTF-8 | Java | 1,076 | java | MainStates.java | Java | [] | null | [] | package Main;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
public class MainStates extends StateBasedGame {
public final static int X_RES = 1920;
public final static int Y_RES = 1080;
public MainStates(String name) {
super(name);
}
public static void main(String[] args) {
try {
AppGameContainer appgc;
appgc = new AppGameContainer(new MainStates("Test"));
appgc.setVSync(true);
appgc.setDisplayMode(X_RES, Y_RES, true);
appgc.setShowFPS(true);
appgc.start();
} catch (SlickException ex) {
Logger.getLogger(GameState.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void initStatesList(GameContainer arg0) throws SlickException {
BasicGameState game = new GameState();
BasicGameState game2 = new GameOverState();
this.addState(game);
this.addState(game2);
}
}
| 1,076 | 0.742565 | 0.732342 | 46 | 22.391304 | 20.900883 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.608696 | false | false | 15 |
225c664cb025a0941fdad5d1f56213bddcd54f7f | 24,816,321,064,839 | f2db200edc87653aaa446905e1782ac6b8b04b55 | /main4-daifa/main4-daifa-default/src/main/java/com/opentae/data/daifa/examples/CountTransExample.java | b1b8a23c44962913554e1b439a8c2b84c724a349 | [] | no_license | moutainhigh/main-pom | https://github.com/moutainhigh/main-pom | 4f5deada05053dd4d25675b6fd49b8829b435dff | dbe6b45afc1ecd1afde1c93826c35f2d38623dab | refs/heads/master | 2021-09-26T23:17:28.986000 | 2018-10-31T06:39:14 | 2018-10-31T06:39:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.opentae.data.daifa.examples;
import com.opentae.core.mybatis.SgExample;
import com.opentae.core.mybatis.example.EntityColumn;
import com.opentae.core.mybatis.example.EntityTable;
import com.opentae.core.mybatis.mapperhelper.EntityHelper;
import com.opentae.data.daifa.beans.CountTrans;
import java.util.*;
public class CountTransExample extends SgExample<CountTransExample.Criteria> {
public static final Class<CountTrans> beanClass = CountTrans.class;
public static final EntityTable entityTable = EntityHelper.getEntityTable(beanClass);
public static EntityColumn id;
public static EntityColumn finalShow;
public static EntityColumn finalNumber;
public static EntityColumn createDate;
public static EntityColumn createTime;
public static EntityColumn useSituation;
public static EntityColumn batch;
static {
Set<EntityColumn> columns = entityTable.getEntityClassColumns();
Map<String, EntityColumn> listMap = new HashMap<>();
for (EntityColumn column : columns) {
listMap.put(column.getProperty(), column);
}
id = listMap.get("id");
finalShow = listMap.get("finalShow");
finalNumber = listMap.get("finalNumber");
createDate = listMap.get("createDate");
createTime = listMap.get("createTime");
useSituation = listMap.get("useSituation");
batch = listMap.get("batch");
}
public CountTransExample() {
this.setTableAlias(entityTable.getName());
}
@Override
public EntityTable getEntityTable() {
return entityTable;
}
@Override
protected CountTransExample.Criteria createCriteriaInternal() {
return new CountTransExample.Criteria(this);
}
public static class Criteria extends SgExample.GeneratedCriteria<Criteria> {
protected Criteria(SgExample example) {
super(example);
}
public CountTransExample.Criteria andIdIsNull() {
return isNull(id);
}
public CountTransExample.Criteria andIdIsNotNull() {
return isNotNull(id);
}
public CountTransExample.Criteria andIdEqualTo(Long value) {
return equalTo(id, value);
}
public CountTransExample.Criteria andIdNotEqualTo(Long value) {
return notEqualTo(id, value);
}
public CountTransExample.Criteria andIdGreaterThan(Long value) {
return greaterThan(id, value);
}
public CountTransExample.Criteria andIdGreaterThanOrEqualTo(Long value) {
return greaterThanOrEqualTo(id, value);
}
public CountTransExample.Criteria andIdLessThan(Long value) {
return lessThan(id, value);
}
public CountTransExample.Criteria andIdLessThanOrEqualTo(Long value) {
return lessThanOrEqualTo(id, value);
}
public CountTransExample.Criteria andIdIn(List<Long> values) {
return in(id, values);
}
public CountTransExample.Criteria andIdNotIn(List<Long> values) {
return notIn(id, values);
}
public CountTransExample.Criteria andIdBetween(Long value1, Long value2) {
return between(id, value1, value2);
}
public CountTransExample.Criteria andIdNotBetween(Long value1, Long value2) {
return notBetween(id, value1, value2);
}
public CountTransExample.Criteria andFinalShowIsNull() {
return isNull(finalShow);
}
public CountTransExample.Criteria andFinalShowIsNotNull() {
return isNotNull(finalShow);
}
public CountTransExample.Criteria andFinalShowEqualTo(String value) {
return equalTo(finalShow, value);
}
public CountTransExample.Criteria andFinalShowNotEqualTo(String value) {
return notEqualTo(finalShow, value);
}
public CountTransExample.Criteria andFinalShowGreaterThan(String value) {
return greaterThan(finalShow, value);
}
public CountTransExample.Criteria andFinalShowGreaterThanOrEqualTo(String value) {
return greaterThanOrEqualTo(finalShow, value);
}
public CountTransExample.Criteria andFinalShowLessThan(String value) {
return lessThan(finalShow, value);
}
public CountTransExample.Criteria andFinalShowLessThanOrEqualTo(String value) {
return lessThanOrEqualTo(finalShow, value);
}
public CountTransExample.Criteria andFinalShowLike(String value) {
return like(finalShow, value);
}
public CountTransExample.Criteria andFinalShowNotLike(String value) {
return notLike(finalShow, value);
}
public CountTransExample.Criteria andFinalShowIn(List<String> values) {
return in(finalShow, values);
}
public CountTransExample.Criteria andFinalShowNotIn(List<String> values) {
return notIn(finalShow, values);
}
public CountTransExample.Criteria andFinalShowBetween(String value1, String value2) {
return between(finalShow, value1, value2);
}
public CountTransExample.Criteria andFinalShowNotBetween(String value1, String value2) {
return notBetween(finalShow, value1, value2);
}
public CountTransExample.Criteria andFinalNumberIsNull() {
return isNull(finalNumber);
}
public CountTransExample.Criteria andFinalNumberIsNotNull() {
return isNotNull(finalNumber);
}
public CountTransExample.Criteria andFinalNumberEqualTo(Long value) {
return equalTo(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberNotEqualTo(Long value) {
return notEqualTo(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberGreaterThan(Long value) {
return greaterThan(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberGreaterThanOrEqualTo(Long value) {
return greaterThanOrEqualTo(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberLessThan(Long value) {
return lessThan(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberLessThanOrEqualTo(Long value) {
return lessThanOrEqualTo(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberIn(List<Long> values) {
return in(finalNumber, values);
}
public CountTransExample.Criteria andFinalNumberNotIn(List<Long> values) {
return notIn(finalNumber, values);
}
public CountTransExample.Criteria andFinalNumberBetween(Long value1, Long value2) {
return between(finalNumber, value1, value2);
}
public CountTransExample.Criteria andFinalNumberNotBetween(Long value1, Long value2) {
return notBetween(finalNumber, value1, value2);
}
public CountTransExample.Criteria andCreateDateIsNull() {
return isNull(createDate);
}
public CountTransExample.Criteria andCreateDateIsNotNull() {
return isNotNull(createDate);
}
public CountTransExample.Criteria andCreateDateEqualTo(String value) {
return equalTo(createDate, value);
}
public CountTransExample.Criteria andCreateDateNotEqualTo(String value) {
return notEqualTo(createDate, value);
}
public CountTransExample.Criteria andCreateDateGreaterThan(String value) {
return greaterThan(createDate, value);
}
public CountTransExample.Criteria andCreateDateGreaterThanOrEqualTo(String value) {
return greaterThanOrEqualTo(createDate, value);
}
public CountTransExample.Criteria andCreateDateLessThan(String value) {
return lessThan(createDate, value);
}
public CountTransExample.Criteria andCreateDateLessThanOrEqualTo(String value) {
return lessThanOrEqualTo(createDate, value);
}
public CountTransExample.Criteria andCreateDateLike(String value) {
return like(createDate, value);
}
public CountTransExample.Criteria andCreateDateNotLike(String value) {
return notLike(createDate, value);
}
public CountTransExample.Criteria andCreateDateIn(List<String> values) {
return in(createDate, values);
}
public CountTransExample.Criteria andCreateDateNotIn(List<String> values) {
return notIn(createDate, values);
}
public CountTransExample.Criteria andCreateDateBetween(String value1, String value2) {
return between(createDate, value1, value2);
}
public CountTransExample.Criteria andCreateDateNotBetween(String value1, String value2) {
return notBetween(createDate, value1, value2);
}
public CountTransExample.Criteria andCreateTimeIsNull() {
return isNull(createTime);
}
public CountTransExample.Criteria andCreateTimeIsNotNull() {
return isNotNull(createTime);
}
public CountTransExample.Criteria andCreateTimeEqualTo(Date value) {
return equalTo(createTime, value);
}
public CountTransExample.Criteria andCreateTimeNotEqualTo(Date value) {
return notEqualTo(createTime, value);
}
public CountTransExample.Criteria andCreateTimeGreaterThan(Date value) {
return greaterThan(createTime, value);
}
public CountTransExample.Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
return greaterThanOrEqualTo(createTime, value);
}
public CountTransExample.Criteria andCreateTimeLessThan(Date value) {
return lessThan(createTime, value);
}
public CountTransExample.Criteria andCreateTimeLessThanOrEqualTo(Date value) {
return lessThanOrEqualTo(createTime, value);
}
public CountTransExample.Criteria andCreateTimeIn(List<Date> values) {
return in(createTime, values);
}
public CountTransExample.Criteria andCreateTimeNotIn(List<Date> values) {
return notIn(createTime, values);
}
public CountTransExample.Criteria andCreateTimeBetween(Date value1, Date value2) {
return between(createTime, value1, value2);
}
public CountTransExample.Criteria andCreateTimeNotBetween(Date value1, Date value2) {
return notBetween(createTime, value1, value2);
}
public CountTransExample.Criteria andUseSituationIsNull() {
return isNull(useSituation);
}
public CountTransExample.Criteria andUseSituationIsNotNull() {
return isNotNull(useSituation);
}
public CountTransExample.Criteria andUseSituationEqualTo(String value) {
return equalTo(useSituation, value);
}
public CountTransExample.Criteria andUseSituationNotEqualTo(String value) {
return notEqualTo(useSituation, value);
}
public CountTransExample.Criteria andUseSituationGreaterThan(String value) {
return greaterThan(useSituation, value);
}
public CountTransExample.Criteria andUseSituationGreaterThanOrEqualTo(String value) {
return greaterThanOrEqualTo(useSituation, value);
}
public CountTransExample.Criteria andUseSituationLessThan(String value) {
return lessThan(useSituation, value);
}
public CountTransExample.Criteria andUseSituationLessThanOrEqualTo(String value) {
return lessThanOrEqualTo(useSituation, value);
}
public CountTransExample.Criteria andUseSituationLike(String value) {
return like(useSituation, value);
}
public CountTransExample.Criteria andUseSituationNotLike(String value) {
return notLike(useSituation, value);
}
public CountTransExample.Criteria andUseSituationIn(List<String> values) {
return in(useSituation, values);
}
public CountTransExample.Criteria andUseSituationNotIn(List<String> values) {
return notIn(useSituation, values);
}
public CountTransExample.Criteria andUseSituationBetween(String value1, String value2) {
return between(useSituation, value1, value2);
}
public CountTransExample.Criteria andUseSituationNotBetween(String value1, String value2) {
return notBetween(useSituation, value1, value2);
}
public CountTransExample.Criteria andBatchIsNull() {
return isNull(batch);
}
public CountTransExample.Criteria andBatchIsNotNull() {
return isNotNull(batch);
}
public CountTransExample.Criteria andBatchEqualTo(Integer value) {
return equalTo(batch, value);
}
public CountTransExample.Criteria andBatchNotEqualTo(Integer value) {
return notEqualTo(batch, value);
}
public CountTransExample.Criteria andBatchGreaterThan(Integer value) {
return greaterThan(batch, value);
}
public CountTransExample.Criteria andBatchGreaterThanOrEqualTo(Integer value) {
return greaterThanOrEqualTo(batch, value);
}
public CountTransExample.Criteria andBatchLessThan(Integer value) {
return lessThan(batch, value);
}
public CountTransExample.Criteria andBatchLessThanOrEqualTo(Integer value) {
return lessThanOrEqualTo(batch, value);
}
public CountTransExample.Criteria andBatchIn(List<Integer> values) {
return in(batch, values);
}
public CountTransExample.Criteria andBatchNotIn(List<Integer> values) {
return notIn(batch, values);
}
public CountTransExample.Criteria andBatchBetween(Integer value1, Integer value2) {
return between(batch, value1, value2);
}
public CountTransExample.Criteria andBatchNotBetween(Integer value1, Integer value2) {
return notBetween(batch, value1, value2);
}
}
} | UTF-8 | Java | 14,502 | java | CountTransExample.java | Java | [] | null | [] | package com.opentae.data.daifa.examples;
import com.opentae.core.mybatis.SgExample;
import com.opentae.core.mybatis.example.EntityColumn;
import com.opentae.core.mybatis.example.EntityTable;
import com.opentae.core.mybatis.mapperhelper.EntityHelper;
import com.opentae.data.daifa.beans.CountTrans;
import java.util.*;
public class CountTransExample extends SgExample<CountTransExample.Criteria> {
public static final Class<CountTrans> beanClass = CountTrans.class;
public static final EntityTable entityTable = EntityHelper.getEntityTable(beanClass);
public static EntityColumn id;
public static EntityColumn finalShow;
public static EntityColumn finalNumber;
public static EntityColumn createDate;
public static EntityColumn createTime;
public static EntityColumn useSituation;
public static EntityColumn batch;
static {
Set<EntityColumn> columns = entityTable.getEntityClassColumns();
Map<String, EntityColumn> listMap = new HashMap<>();
for (EntityColumn column : columns) {
listMap.put(column.getProperty(), column);
}
id = listMap.get("id");
finalShow = listMap.get("finalShow");
finalNumber = listMap.get("finalNumber");
createDate = listMap.get("createDate");
createTime = listMap.get("createTime");
useSituation = listMap.get("useSituation");
batch = listMap.get("batch");
}
public CountTransExample() {
this.setTableAlias(entityTable.getName());
}
@Override
public EntityTable getEntityTable() {
return entityTable;
}
@Override
protected CountTransExample.Criteria createCriteriaInternal() {
return new CountTransExample.Criteria(this);
}
public static class Criteria extends SgExample.GeneratedCriteria<Criteria> {
protected Criteria(SgExample example) {
super(example);
}
public CountTransExample.Criteria andIdIsNull() {
return isNull(id);
}
public CountTransExample.Criteria andIdIsNotNull() {
return isNotNull(id);
}
public CountTransExample.Criteria andIdEqualTo(Long value) {
return equalTo(id, value);
}
public CountTransExample.Criteria andIdNotEqualTo(Long value) {
return notEqualTo(id, value);
}
public CountTransExample.Criteria andIdGreaterThan(Long value) {
return greaterThan(id, value);
}
public CountTransExample.Criteria andIdGreaterThanOrEqualTo(Long value) {
return greaterThanOrEqualTo(id, value);
}
public CountTransExample.Criteria andIdLessThan(Long value) {
return lessThan(id, value);
}
public CountTransExample.Criteria andIdLessThanOrEqualTo(Long value) {
return lessThanOrEqualTo(id, value);
}
public CountTransExample.Criteria andIdIn(List<Long> values) {
return in(id, values);
}
public CountTransExample.Criteria andIdNotIn(List<Long> values) {
return notIn(id, values);
}
public CountTransExample.Criteria andIdBetween(Long value1, Long value2) {
return between(id, value1, value2);
}
public CountTransExample.Criteria andIdNotBetween(Long value1, Long value2) {
return notBetween(id, value1, value2);
}
public CountTransExample.Criteria andFinalShowIsNull() {
return isNull(finalShow);
}
public CountTransExample.Criteria andFinalShowIsNotNull() {
return isNotNull(finalShow);
}
public CountTransExample.Criteria andFinalShowEqualTo(String value) {
return equalTo(finalShow, value);
}
public CountTransExample.Criteria andFinalShowNotEqualTo(String value) {
return notEqualTo(finalShow, value);
}
public CountTransExample.Criteria andFinalShowGreaterThan(String value) {
return greaterThan(finalShow, value);
}
public CountTransExample.Criteria andFinalShowGreaterThanOrEqualTo(String value) {
return greaterThanOrEqualTo(finalShow, value);
}
public CountTransExample.Criteria andFinalShowLessThan(String value) {
return lessThan(finalShow, value);
}
public CountTransExample.Criteria andFinalShowLessThanOrEqualTo(String value) {
return lessThanOrEqualTo(finalShow, value);
}
public CountTransExample.Criteria andFinalShowLike(String value) {
return like(finalShow, value);
}
public CountTransExample.Criteria andFinalShowNotLike(String value) {
return notLike(finalShow, value);
}
public CountTransExample.Criteria andFinalShowIn(List<String> values) {
return in(finalShow, values);
}
public CountTransExample.Criteria andFinalShowNotIn(List<String> values) {
return notIn(finalShow, values);
}
public CountTransExample.Criteria andFinalShowBetween(String value1, String value2) {
return between(finalShow, value1, value2);
}
public CountTransExample.Criteria andFinalShowNotBetween(String value1, String value2) {
return notBetween(finalShow, value1, value2);
}
public CountTransExample.Criteria andFinalNumberIsNull() {
return isNull(finalNumber);
}
public CountTransExample.Criteria andFinalNumberIsNotNull() {
return isNotNull(finalNumber);
}
public CountTransExample.Criteria andFinalNumberEqualTo(Long value) {
return equalTo(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberNotEqualTo(Long value) {
return notEqualTo(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberGreaterThan(Long value) {
return greaterThan(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberGreaterThanOrEqualTo(Long value) {
return greaterThanOrEqualTo(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberLessThan(Long value) {
return lessThan(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberLessThanOrEqualTo(Long value) {
return lessThanOrEqualTo(finalNumber, value);
}
public CountTransExample.Criteria andFinalNumberIn(List<Long> values) {
return in(finalNumber, values);
}
public CountTransExample.Criteria andFinalNumberNotIn(List<Long> values) {
return notIn(finalNumber, values);
}
public CountTransExample.Criteria andFinalNumberBetween(Long value1, Long value2) {
return between(finalNumber, value1, value2);
}
public CountTransExample.Criteria andFinalNumberNotBetween(Long value1, Long value2) {
return notBetween(finalNumber, value1, value2);
}
public CountTransExample.Criteria andCreateDateIsNull() {
return isNull(createDate);
}
public CountTransExample.Criteria andCreateDateIsNotNull() {
return isNotNull(createDate);
}
public CountTransExample.Criteria andCreateDateEqualTo(String value) {
return equalTo(createDate, value);
}
public CountTransExample.Criteria andCreateDateNotEqualTo(String value) {
return notEqualTo(createDate, value);
}
public CountTransExample.Criteria andCreateDateGreaterThan(String value) {
return greaterThan(createDate, value);
}
public CountTransExample.Criteria andCreateDateGreaterThanOrEqualTo(String value) {
return greaterThanOrEqualTo(createDate, value);
}
public CountTransExample.Criteria andCreateDateLessThan(String value) {
return lessThan(createDate, value);
}
public CountTransExample.Criteria andCreateDateLessThanOrEqualTo(String value) {
return lessThanOrEqualTo(createDate, value);
}
public CountTransExample.Criteria andCreateDateLike(String value) {
return like(createDate, value);
}
public CountTransExample.Criteria andCreateDateNotLike(String value) {
return notLike(createDate, value);
}
public CountTransExample.Criteria andCreateDateIn(List<String> values) {
return in(createDate, values);
}
public CountTransExample.Criteria andCreateDateNotIn(List<String> values) {
return notIn(createDate, values);
}
public CountTransExample.Criteria andCreateDateBetween(String value1, String value2) {
return between(createDate, value1, value2);
}
public CountTransExample.Criteria andCreateDateNotBetween(String value1, String value2) {
return notBetween(createDate, value1, value2);
}
public CountTransExample.Criteria andCreateTimeIsNull() {
return isNull(createTime);
}
public CountTransExample.Criteria andCreateTimeIsNotNull() {
return isNotNull(createTime);
}
public CountTransExample.Criteria andCreateTimeEqualTo(Date value) {
return equalTo(createTime, value);
}
public CountTransExample.Criteria andCreateTimeNotEqualTo(Date value) {
return notEqualTo(createTime, value);
}
public CountTransExample.Criteria andCreateTimeGreaterThan(Date value) {
return greaterThan(createTime, value);
}
public CountTransExample.Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
return greaterThanOrEqualTo(createTime, value);
}
public CountTransExample.Criteria andCreateTimeLessThan(Date value) {
return lessThan(createTime, value);
}
public CountTransExample.Criteria andCreateTimeLessThanOrEqualTo(Date value) {
return lessThanOrEqualTo(createTime, value);
}
public CountTransExample.Criteria andCreateTimeIn(List<Date> values) {
return in(createTime, values);
}
public CountTransExample.Criteria andCreateTimeNotIn(List<Date> values) {
return notIn(createTime, values);
}
public CountTransExample.Criteria andCreateTimeBetween(Date value1, Date value2) {
return between(createTime, value1, value2);
}
public CountTransExample.Criteria andCreateTimeNotBetween(Date value1, Date value2) {
return notBetween(createTime, value1, value2);
}
public CountTransExample.Criteria andUseSituationIsNull() {
return isNull(useSituation);
}
public CountTransExample.Criteria andUseSituationIsNotNull() {
return isNotNull(useSituation);
}
public CountTransExample.Criteria andUseSituationEqualTo(String value) {
return equalTo(useSituation, value);
}
public CountTransExample.Criteria andUseSituationNotEqualTo(String value) {
return notEqualTo(useSituation, value);
}
public CountTransExample.Criteria andUseSituationGreaterThan(String value) {
return greaterThan(useSituation, value);
}
public CountTransExample.Criteria andUseSituationGreaterThanOrEqualTo(String value) {
return greaterThanOrEqualTo(useSituation, value);
}
public CountTransExample.Criteria andUseSituationLessThan(String value) {
return lessThan(useSituation, value);
}
public CountTransExample.Criteria andUseSituationLessThanOrEqualTo(String value) {
return lessThanOrEqualTo(useSituation, value);
}
public CountTransExample.Criteria andUseSituationLike(String value) {
return like(useSituation, value);
}
public CountTransExample.Criteria andUseSituationNotLike(String value) {
return notLike(useSituation, value);
}
public CountTransExample.Criteria andUseSituationIn(List<String> values) {
return in(useSituation, values);
}
public CountTransExample.Criteria andUseSituationNotIn(List<String> values) {
return notIn(useSituation, values);
}
public CountTransExample.Criteria andUseSituationBetween(String value1, String value2) {
return between(useSituation, value1, value2);
}
public CountTransExample.Criteria andUseSituationNotBetween(String value1, String value2) {
return notBetween(useSituation, value1, value2);
}
public CountTransExample.Criteria andBatchIsNull() {
return isNull(batch);
}
public CountTransExample.Criteria andBatchIsNotNull() {
return isNotNull(batch);
}
public CountTransExample.Criteria andBatchEqualTo(Integer value) {
return equalTo(batch, value);
}
public CountTransExample.Criteria andBatchNotEqualTo(Integer value) {
return notEqualTo(batch, value);
}
public CountTransExample.Criteria andBatchGreaterThan(Integer value) {
return greaterThan(batch, value);
}
public CountTransExample.Criteria andBatchGreaterThanOrEqualTo(Integer value) {
return greaterThanOrEqualTo(batch, value);
}
public CountTransExample.Criteria andBatchLessThan(Integer value) {
return lessThan(batch, value);
}
public CountTransExample.Criteria andBatchLessThanOrEqualTo(Integer value) {
return lessThanOrEqualTo(batch, value);
}
public CountTransExample.Criteria andBatchIn(List<Integer> values) {
return in(batch, values);
}
public CountTransExample.Criteria andBatchNotIn(List<Integer> values) {
return notIn(batch, values);
}
public CountTransExample.Criteria andBatchBetween(Integer value1, Integer value2) {
return between(batch, value1, value2);
}
public CountTransExample.Criteria andBatchNotBetween(Integer value1, Integer value2) {
return notBetween(batch, value1, value2);
}
}
} | 14,502 | 0.666115 | 0.662253 | 408 | 34.54657 | 31.304213 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.553922 | false | false | 15 |
fbf0a9f45464657a6286dfdcf3768d482118ad98 | 28,604,482,238,257 | f69d5283b1d10aa924ab35efc04d4bebad8778ce | /CollaborationBackEnd/src/main/java/com/niit/collaboration/daoimpl/UserDAOImpl.java | fb3fc6c29898c58371e825557df41ba3fa7a9650 | [] | no_license | siparmar/Project-2 | https://github.com/siparmar/Project-2 | b1170124814e42c3c25cd0b606d9fd3137319477 | e7c5fbcde2dfaccdc687738d470be69a39d68cb6 | refs/heads/master | 2021-01-19T20:22:34.502000 | 2017-05-11T07:42:36 | 2017-05-11T07:42:36 | 88,500,940 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.niit.collaboration.daoimpl;
import java.util.List;
import javax.transaction.Transactional;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.niit.collaboration.dao.UserDAO;
import com.niit.collaboration.model.User;
@Transactional
@Repository("UserDAO")
public class UserDAOImpl implements UserDAO {
@Autowired
private SessionFactory sessionFactory;
private Session getSession() {
return sessionFactory.getCurrentSession();
}
public User get(String user_id) {
return (User) sessionFactory.getCurrentSession().load(User.class, user_id);
}
public List<User> list() {
return sessionFactory.getCurrentSession().createQuery("from User").list();
}
public boolean isvalidCredentials(String user_id, String password) {
Query query = sessionFactory.getCurrentSession().createQuery("from User where user_id= ? and password =?");
query.setString(1, user_id);
query.setString(2, password);
if (query.uniqueResult() == null) {
return false;
} else {
return true;
}
}
public boolean save(User user) {
try {
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
session.close();
return true;
} catch (HibernateException e) {
e.printStackTrace();
return false;
}
}
public boolean update(User user) {
try {
sessionFactory.getCurrentSession().update(user);
return true;
} catch (HibernateException e) {
e.printStackTrace();
return false;
}
}
}
| UTF-8 | Java | 1,727 | java | UserDAOImpl.java | Java | [] | null | [] | package com.niit.collaboration.daoimpl;
import java.util.List;
import javax.transaction.Transactional;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.niit.collaboration.dao.UserDAO;
import com.niit.collaboration.model.User;
@Transactional
@Repository("UserDAO")
public class UserDAOImpl implements UserDAO {
@Autowired
private SessionFactory sessionFactory;
private Session getSession() {
return sessionFactory.getCurrentSession();
}
public User get(String user_id) {
return (User) sessionFactory.getCurrentSession().load(User.class, user_id);
}
public List<User> list() {
return sessionFactory.getCurrentSession().createQuery("from User").list();
}
public boolean isvalidCredentials(String user_id, String password) {
Query query = sessionFactory.getCurrentSession().createQuery("from User where user_id= ? and password =?");
query.setString(1, user_id);
query.setString(2, password);
if (query.uniqueResult() == null) {
return false;
} else {
return true;
}
}
public boolean save(User user) {
try {
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
session.close();
return true;
} catch (HibernateException e) {
e.printStackTrace();
return false;
}
}
public boolean update(User user) {
try {
sessionFactory.getCurrentSession().update(user);
return true;
} catch (HibernateException e) {
e.printStackTrace();
return false;
}
}
}
| 1,727 | 0.740012 | 0.738854 | 75 | 22.026667 | 22.388077 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.626667 | false | false | 15 |
d92b9053e57df45a756c52ab942a886d2092b2d8 | 6,090,263,631,124 | 4a6f6973bb84f494924895af72fa381b29951868 | /WebberTechDataProcessor/src/WordsMock.java | 6ef30f196cb508f602f539a009ec3267c169bab2 | [] | no_license | xiaofengli/mockingtest | https://github.com/xiaofengli/mockingtest | 43fb9be4ef64b975cc63f2a56ada492fae76a5c1 | 1b14fd8904945ed85eb0e178b35ababc67e087f2 | refs/heads/master | 2020-05-23T05:20:37.990000 | 2018-10-31T13:49:19 | 2018-10-31T13:49:19 | 59,218,194 | 0 | 2 | null | false | 2018-06-23T00:39:39 | 2016-05-19T15:16:30 | 2018-06-21T21:33:23 | 2018-06-23T00:39:38 | 72,600 | 0 | 2 | 0 | JavaScript | false | null | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class WordsMock {
//the this the core method to generate sql script from curated data file
/**
@param String srcFile, a curated data file, possibly columns are seperated by one or more tab
@param String dstFile, a full path with file name specified, if it is a new file, it will be created. If there is a
file already, it will be overwritten
@return , void type
**/
public void processFile(String srcFile, String dstFile) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(srcFile));
//for writting to database
File file = new File(dstFile);
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
String line;
while( (line = br.readLine()) != null) {
String[] tokens= tokenize2(line);
//write tokens to new file
if (tokens.length > 1) {
bw.write(generateSQLStatement(tokens));
bw.newLine();
}
System.out.println(line);
}
br.close();
bw.close();
}
String formatLineData(String line) {
line = line.replace("*", "");
line = line.replace(".", "");
line = line.replace("&", ",");
return line;
}
//tokentize file that is using one or more spaces to seperate columns
public String[] tokenize(String line) {
String lineToProcess= formatLineData(line);
String[] tokens= lineToProcess.split("\\s+");
return tokens;
}
//tokenize file that is using one or more tabs to seperate columns
public String[] tokenize2(String line) {
String lineToProcess= formatLineData(line);
String[] tokens= lineToProcess.split("\\t");
return tokens;
}
/*
* The following method will generate the SQL insert statement from
* token arrays. It will not change the order of the tokens that
* should be repsent in the sql statement. So the raw data file
* should already have the right order.
*
* eg:
* insert highschool_cn values (null, "abandon","v","·ÅÆú£¬Åׯú");
* */
public String generateSQLStatement(String[] tokens ) {
String record = "insert words values (null, ";
for (int i=0;i<tokens.length;i++) {
record += "\"";
record += tokens[i];
record += "\"";
if (i != tokens.length-1)
record += ",";
}
record+= ");";
return record;
}
public void postProcessFile(String srcFile, String dstFile) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(srcFile));
//for writting to database
File file = new File(dstFile);
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
String line;
while( (line = br.readLine()) != null) {
bw.write(line+";");
bw.newLine();
}
br.close();
bw.close();
}
public static void main(String[] args) {
WordsMock m = new WordsMock();
try {
//m.postProcessFile("E:\\WordsMock\\highschool_cn.txt", "E:\\WordsMock\\highschool_cn_final.txt");
m.processFile("E:\\WordsMock\\toefl_ibt_category_new.txt", "E:\\WordsMock\\toefl_ibt_category_new.sql.txt");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| WINDOWS-1252 | Java | 3,444 | java | WordsMock.java | Java | [
{
"context": "* eg: \r\n\t * insert highschool_cn values (null, \"abandon\",\"v\",\"·ÅÆú£¬Åׯú\");\r\n\t * */\r\n\tpublic String gener",
"end": 2191,
"score": 0.6457163095474243,
"start": 2186,
"tag": "NAME",
"value": "andon"
}
] | null | [] | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class WordsMock {
//the this the core method to generate sql script from curated data file
/**
@param String srcFile, a curated data file, possibly columns are seperated by one or more tab
@param String dstFile, a full path with file name specified, if it is a new file, it will be created. If there is a
file already, it will be overwritten
@return , void type
**/
public void processFile(String srcFile, String dstFile) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(srcFile));
//for writting to database
File file = new File(dstFile);
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
String line;
while( (line = br.readLine()) != null) {
String[] tokens= tokenize2(line);
//write tokens to new file
if (tokens.length > 1) {
bw.write(generateSQLStatement(tokens));
bw.newLine();
}
System.out.println(line);
}
br.close();
bw.close();
}
String formatLineData(String line) {
line = line.replace("*", "");
line = line.replace(".", "");
line = line.replace("&", ",");
return line;
}
//tokentize file that is using one or more spaces to seperate columns
public String[] tokenize(String line) {
String lineToProcess= formatLineData(line);
String[] tokens= lineToProcess.split("\\s+");
return tokens;
}
//tokenize file that is using one or more tabs to seperate columns
public String[] tokenize2(String line) {
String lineToProcess= formatLineData(line);
String[] tokens= lineToProcess.split("\\t");
return tokens;
}
/*
* The following method will generate the SQL insert statement from
* token arrays. It will not change the order of the tokens that
* should be repsent in the sql statement. So the raw data file
* should already have the right order.
*
* eg:
* insert highschool_cn values (null, "abandon","v","·ÅÆú£¬Åׯú");
* */
public String generateSQLStatement(String[] tokens ) {
String record = "insert words values (null, ";
for (int i=0;i<tokens.length;i++) {
record += "\"";
record += tokens[i];
record += "\"";
if (i != tokens.length-1)
record += ",";
}
record+= ");";
return record;
}
public void postProcessFile(String srcFile, String dstFile) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(srcFile));
//for writting to database
File file = new File(dstFile);
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
String line;
while( (line = br.readLine()) != null) {
bw.write(line+";");
bw.newLine();
}
br.close();
bw.close();
}
public static void main(String[] args) {
WordsMock m = new WordsMock();
try {
//m.postProcessFile("E:\\WordsMock\\highschool_cn.txt", "E:\\WordsMock\\highschool_cn_final.txt");
m.processFile("E:\\WordsMock\\toefl_ibt_category_new.txt", "E:\\WordsMock\\toefl_ibt_category_new.sql.txt");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 3,444 | 0.642691 | 0.641235 | 117 | 27.350428 | 26.318338 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.25641 | false | false | 15 |
4e2e2b02105b4c069c535180709d99dc5c3bbd0a | 7,705,171,379,537 | 69deaf427edb0e9b9522edc08d496b60a2a5557e | /src/edu/gladstone/hts/microscope/Image.java | d9999736059c456028462132f7c69367e68243e6 | [] | no_license | codysjackson/oldRobo5_MM2 | https://github.com/codysjackson/oldRobo5_MM2 | b3ccbb2ab074f4e7950634393f3f5845f87d6275 | 4a350872358a64788e00bc06736be4e94e3f1493 | refs/heads/master | 2020-08-23T16:17:14.004000 | 2019-10-21T20:39:10 | 2019-10-21T20:39:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.gladstone.hts.microscope;
import edu.gladstone.hts.imaging.PlateImager;
import edu.gladstone.hts.parameters.BaseName;
import edu.gladstone.hts.parameters.FileData;
import edu.gladstone.hts.parameters.WellDataBean;
import ij.ImagePlus;
import ij.process.ShortProcessor;
import mmcorej.CMMCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
//import java.util.ArrayList;
public class Image {
static CMMCore core_;
static edu.gladstone.hts.imaging.Metadata md;
static FileData fd;
static WellDataBean wdb;
private int PIXEL_WIDTH;
private int PIXEL_HEIGHT;
private boolean flip;
final Logger logger = LoggerFactory.getLogger(Image.class);
public Image(Core htsCore, FileData fData, WellDataBean wellData) {
core_ = htsCore.innerCore;
fd = fData;
wdb = wellData;
core_.getCameraDevice();
//md = new edu.gladstone.hts.imaging.Metadata(); // file is already in memory no params needed
md = PlateImager.md;
PIXEL_WIDTH = (int)core_.getImageWidth();
PIXEL_HEIGHT = (int)core_.getImageHeight();
if (core_.getCameraDevice().contains("2")){
flip=true;
}else{
flip=false;
}
}
private void snapImage() {
try {
core_.snapImage();
} catch (Exception e) {
logger.error("Error taking an image");
logger.error(e.getMessage());
throw new RuntimeException("Error taking an image", e.getCause());
}
}
private ImagePlus retrieveImage(long i) {
try {
Object img = core_.getImage(i); //need to specify which camera to take the image from
ShortProcessor ip = new ShortProcessor(PIXEL_WIDTH, PIXEL_HEIGHT);
ip.setPixels(img);
if (i==1 || flip==true){
ip.flipHorizontal();
}
return new ImagePlus("Temp", ip);
} catch (Exception e) {
logger.error("Error retrieving the image");
logger.error(e.getMessage());
throw new RuntimeException("Error retrieving the image",
e.getCause());
}
}
public ImagePlus takeImage() {
snapImage();
try {
//core_.popNextImage();
}catch(Exception e){}
return retrieveImage(0);
}
public ImagePlus[] takeMultiImage(){
try {
ImagePlus[] imageArray = new ImagePlus[2];
snapImage();
//core_.popNextImage();
imageArray[0] = retrieveImage(0);
imageArray[1] = retrieveImage(1);
logger.debug("Snapped and retrieved multi-image");
return(imageArray);
}catch(Exception e){}
return null;
}
public static void saveWithoutClosingImage(ImagePlus imp, String path, BaseName base,
String imageWell, String imageNumber,String ChannelMode, String imageChannel,String interval, String burstFrame,String zIndex,String zStep) {
String fullName = base.getBase() + "-" + burstFrame + "_" + imageWell + "_" + imageNumber
+ "_" +ChannelMode+"-"+imageChannel +"_"+interval+"_"+ zIndex + "_" + zStep+".tif";
// Increment timepoint number if image already exists
File newImage = new File(path, fullName);
if (newImage.exists()) {
String name = base.getName();
int newTimepointNumber = base.getTimpointNumber() + 1;
String hour = base.getHour();
String date = base.getDate();
BaseName newBase = new BaseName(date, name, newTimepointNumber, hour);
saveWithoutClosingImage(imp, path, newBase, imageWell, imageNumber,
ChannelMode,imageChannel,interval,burstFrame,zIndex,zStep);
} else {
String fullPath = newImage.getAbsolutePath();
if (!fullPath.contains("MONTAGE")) {
//write the metadatafile
md.addImageToJSON(fullName,fd,wdb,core_,imp);
}
fullPath = fullPath.replace("Transmission-Automated-DAPIFITC-","");
fullPath = fullPath.replace("Transmission-Automated-CFPYFP-","");
ij.IJ.save(imp, fullPath);
System.out.println("saved: " + fullPath);
}
}
public static void saveImage(ImagePlus imp, String path, BaseName base, String imageWell, String imageNumber,
String ChannelMode, String imageChannel,String interval, String burstFrame,String zIndex,String zStep) {
saveWithoutClosingImage(imp, path, base, imageWell, imageNumber,ChannelMode, imageChannel,interval,burstFrame,zIndex,zStep);
destroyImage(imp);
}
public static void destroyImage(ImagePlus imp) {
imp.close();
}
}
| UTF-8 | Java | 4,879 | java | Image.java | Java | [] | null | [] | package edu.gladstone.hts.microscope;
import edu.gladstone.hts.imaging.PlateImager;
import edu.gladstone.hts.parameters.BaseName;
import edu.gladstone.hts.parameters.FileData;
import edu.gladstone.hts.parameters.WellDataBean;
import ij.ImagePlus;
import ij.process.ShortProcessor;
import mmcorej.CMMCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
//import java.util.ArrayList;
public class Image {
static CMMCore core_;
static edu.gladstone.hts.imaging.Metadata md;
static FileData fd;
static WellDataBean wdb;
private int PIXEL_WIDTH;
private int PIXEL_HEIGHT;
private boolean flip;
final Logger logger = LoggerFactory.getLogger(Image.class);
public Image(Core htsCore, FileData fData, WellDataBean wellData) {
core_ = htsCore.innerCore;
fd = fData;
wdb = wellData;
core_.getCameraDevice();
//md = new edu.gladstone.hts.imaging.Metadata(); // file is already in memory no params needed
md = PlateImager.md;
PIXEL_WIDTH = (int)core_.getImageWidth();
PIXEL_HEIGHT = (int)core_.getImageHeight();
if (core_.getCameraDevice().contains("2")){
flip=true;
}else{
flip=false;
}
}
private void snapImage() {
try {
core_.snapImage();
} catch (Exception e) {
logger.error("Error taking an image");
logger.error(e.getMessage());
throw new RuntimeException("Error taking an image", e.getCause());
}
}
private ImagePlus retrieveImage(long i) {
try {
Object img = core_.getImage(i); //need to specify which camera to take the image from
ShortProcessor ip = new ShortProcessor(PIXEL_WIDTH, PIXEL_HEIGHT);
ip.setPixels(img);
if (i==1 || flip==true){
ip.flipHorizontal();
}
return new ImagePlus("Temp", ip);
} catch (Exception e) {
logger.error("Error retrieving the image");
logger.error(e.getMessage());
throw new RuntimeException("Error retrieving the image",
e.getCause());
}
}
public ImagePlus takeImage() {
snapImage();
try {
//core_.popNextImage();
}catch(Exception e){}
return retrieveImage(0);
}
public ImagePlus[] takeMultiImage(){
try {
ImagePlus[] imageArray = new ImagePlus[2];
snapImage();
//core_.popNextImage();
imageArray[0] = retrieveImage(0);
imageArray[1] = retrieveImage(1);
logger.debug("Snapped and retrieved multi-image");
return(imageArray);
}catch(Exception e){}
return null;
}
public static void saveWithoutClosingImage(ImagePlus imp, String path, BaseName base,
String imageWell, String imageNumber,String ChannelMode, String imageChannel,String interval, String burstFrame,String zIndex,String zStep) {
String fullName = base.getBase() + "-" + burstFrame + "_" + imageWell + "_" + imageNumber
+ "_" +ChannelMode+"-"+imageChannel +"_"+interval+"_"+ zIndex + "_" + zStep+".tif";
// Increment timepoint number if image already exists
File newImage = new File(path, fullName);
if (newImage.exists()) {
String name = base.getName();
int newTimepointNumber = base.getTimpointNumber() + 1;
String hour = base.getHour();
String date = base.getDate();
BaseName newBase = new BaseName(date, name, newTimepointNumber, hour);
saveWithoutClosingImage(imp, path, newBase, imageWell, imageNumber,
ChannelMode,imageChannel,interval,burstFrame,zIndex,zStep);
} else {
String fullPath = newImage.getAbsolutePath();
if (!fullPath.contains("MONTAGE")) {
//write the metadatafile
md.addImageToJSON(fullName,fd,wdb,core_,imp);
}
fullPath = fullPath.replace("Transmission-Automated-DAPIFITC-","");
fullPath = fullPath.replace("Transmission-Automated-CFPYFP-","");
ij.IJ.save(imp, fullPath);
System.out.println("saved: " + fullPath);
}
}
public static void saveImage(ImagePlus imp, String path, BaseName base, String imageWell, String imageNumber,
String ChannelMode, String imageChannel,String interval, String burstFrame,String zIndex,String zStep) {
saveWithoutClosingImage(imp, path, base, imageWell, imageNumber,ChannelMode, imageChannel,interval,burstFrame,zIndex,zStep);
destroyImage(imp);
}
public static void destroyImage(ImagePlus imp) {
imp.close();
}
}
| 4,879 | 0.605247 | 0.602992 | 130 | 36.530769 | 31.482885 | 188 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.992308 | false | false | 15 |
325fecf65cccce3efded0e96198f11a6afca40b9 | 11,974,368,878,638 | b11a964362440a16ac25bad22ab6a8206aab2c18 | /app/src/main/java/cn/jb/widget/holder/ErrorVH.java | 468523a63122aba981fae43dbcb74536adfd41d9 | [] | no_license | bolig/JHolderView | https://github.com/bolig/JHolderView | 4cf87af501a236522ca577242cd58434c415f54e | edd636d76957ff21ff46439d0e997dcc08240907 | refs/heads/master | 2020-07-11T23:44:49.605000 | 2019-08-27T09:31:29 | 2019-08-27T09:31:29 | 204,668,391 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.jb.widget.holder;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import cn.jb.view.holder.BaseHolder;
/**
* Created by JustBlue on 2019-08-27.
*
* @email: bo.li@cdxzhi.com
* @desc:
*/
public class ErrorVH extends BaseHolder implements IRetry {
private Button btnRetry;
public ErrorVH() {
super(HolderStatus.ERROR);
}
@Override
protected View getContentView(Context mContext) {
return inflater(R.layout.layout_error);
}
@Override
protected void initContentView(View contentView) {
btnRetry = getView(R.id.btn_retry);
btnRetry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
retry.run();
}
});
}
private Runnable retry;
@Override
public void setRetryCallback(Runnable retryCallback) {
retry = retryCallback;
}
}
| UTF-8 | Java | 969 | java | ErrorVH.java | Java | [
{
"context": "t cn.jb.view.holder.BaseHolder;\n\n/**\n * Created by JustBlue on 2019-08-27.\n *\n * @email: bo.li@cdxzhi.com\n * ",
"end": 183,
"score": 0.9963680505752563,
"start": 175,
"tag": "USERNAME",
"value": "JustBlue"
},
{
"context": "* Created by JustBlue on 2019-08-27.\n *\... | null | [] | package cn.jb.widget.holder;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import cn.jb.view.holder.BaseHolder;
/**
* Created by JustBlue on 2019-08-27.
*
* @email: <EMAIL>
* @desc:
*/
public class ErrorVH extends BaseHolder implements IRetry {
private Button btnRetry;
public ErrorVH() {
super(HolderStatus.ERROR);
}
@Override
protected View getContentView(Context mContext) {
return inflater(R.layout.layout_error);
}
@Override
protected void initContentView(View contentView) {
btnRetry = getView(R.id.btn_retry);
btnRetry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
retry.run();
}
});
}
private Runnable retry;
@Override
public void setRetryCallback(Runnable retryCallback) {
retry = retryCallback;
}
}
| 960 | 0.639835 | 0.631579 | 46 | 20.065218 | 19.092911 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.282609 | false | false | 15 |
3356def623025ccc3acddc34d20f8478067dfa37 | 13,486,197,347,846 | bdbd049e7ea6f35619998a07c5e1190694aef5b0 | /OCA_Programs/oca/src/com/capgemini/oca/corrrected/Question147.java | bec2f756d03cdfb80aa7fca7c57906ee255bf861 | [] | no_license | AishuSakhare/OCAExamProject | https://github.com/AishuSakhare/OCAExamProject | a99c3d93631a089117a3bcb4aa1076b94275ce4a | c7d2dc1b2445a88826fde646ec5a8474e1d17f56 | refs/heads/master | 2022-11-09T00:20:08.490000 | 2020-06-23T13:19:44 | 2020-06-23T13:19:44 | 274,409,145 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.capgemini.oca.corrrected;
public class Question147 {
public static void main(String[] args) {
Vehical obj = new car(20);
System.out.println(obj.toString());
}
}
class Vehical {
int x;
Vehical() {
this(10);
}
Vehical(int x) {
this.x = x;
}
}
class car extends Vehical {
int y;
car() {
super(10);
}
car(int y) {
super(y);
this.y = y;
}
@Override
public String toString() {
return "car [y=" + this.y + ", x=" + super.x + "]";
}
// public String tostring() {
// return super.x + " " + this.y;
// }
} | UTF-8 | Java | 553 | java | Question147.java | Java | [] | null | [] | package com.capgemini.oca.corrrected;
public class Question147 {
public static void main(String[] args) {
Vehical obj = new car(20);
System.out.println(obj.toString());
}
}
class Vehical {
int x;
Vehical() {
this(10);
}
Vehical(int x) {
this.x = x;
}
}
class car extends Vehical {
int y;
car() {
super(10);
}
car(int y) {
super(y);
this.y = y;
}
@Override
public String toString() {
return "car [y=" + this.y + ", x=" + super.x + "]";
}
// public String tostring() {
// return super.x + " " + this.y;
// }
} | 553 | 0.573237 | 0.556962 | 47 | 10.787234 | 13.471698 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.021277 | false | false | 15 |
c0c9621495d52cbe8cb987c4240b15c7ac7ff408 | 2,087,354,106,787 | 8b5c8ab1370047828a8e1a4d47174afafd396a3c | /learn/src/com/tky/chapter14/map/MapFor.java | d515dd43f94ecd5a0cdfb54ea4e15dfc0265862a | [] | no_license | skyey6/JavaSE | https://github.com/skyey6/JavaSE | 04380e8465e5e27ea2c6288882c6a6083d00573e | a8f8388edd060165b8764eb619787a8b6153137b | refs/heads/master | 2023-08-11T12:14:32.351000 | 2021-09-23T11:47:56 | 2021-09-23T11:47:56 | 397,597,778 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tky.chapter14.map;
import java.util.*;
/**
* @author tky
* @version 1.0
* @date 2021/8/30 21:17
*/
public class MapFor {
@SuppressWarnings({"all"})
public static void main(String[] args) {
Map map = new HashMap();
map.put("邓超", "孙俪");//OK
map.put("王宝强", "马蓉");//OK
map.put("宋喆", "马蓉");//OK
map.put("刘令博", null);//OK
map.put(null, "刘亦菲");//OK
map.put("鹿晗", "关晓彤");//OK
System.out.println("map=" + map);
//方式1:取出所有的key,通过key获取value
//增强for 或 iterator 均可
for (Object key : map.keySet()) {
System.out.println(key + "-" + map.get(key));
}
//方式2:如果不关心key,可以直接取出values
//增强for 或 iterator 均可
Collection values = map.values();
Iterator it = values.iterator();
while (it.hasNext()) {
Object value = it.next();
System.out.print(value+" ");
}
System.out.println();
System.out.println("==============");
//方式3:通过EntrySet 来获取 key-value
//增强for 或 iterator 均可
Set entrySet = map.entrySet();
Iterator iter = entrySet.iterator();
while (iter.hasNext()) {
Map.Entry node = (Map.Entry)iter.next();
System.out.println(node.getKey()+"-"+node.getValue());
}
}
}
| UTF-8 | Java | 1,493 | java | MapFor.java | Java | [
{
"context": "hapter14.map;\n\nimport java.util.*;\n\n/**\n * @author tky\n * @version 1.0\n * @date 2021/8/30 21:17\n */\npubl",
"end": 71,
"score": 0.9995685815811157,
"start": 68,
"tag": "USERNAME",
"value": "tky"
},
{
"context": " Map map = new HashMap();\n\n map.put... | null | [] | package com.tky.chapter14.map;
import java.util.*;
/**
* @author tky
* @version 1.0
* @date 2021/8/30 21:17
*/
public class MapFor {
@SuppressWarnings({"all"})
public static void main(String[] args) {
Map map = new HashMap();
map.put("邓超", "孙俪");//OK
map.put("王宝强", "马蓉");//OK
map.put("宋喆", "马蓉");//OK
map.put("刘令博", null);//OK
map.put(null, "刘亦菲");//OK
map.put("鹿晗", "关晓彤");//OK
System.out.println("map=" + map);
//方式1:取出所有的key,通过key获取value
//增强for 或 iterator 均可
for (Object key : map.keySet()) {
System.out.println(key + "-" + map.get(key));
}
//方式2:如果不关心key,可以直接取出values
//增强for 或 iterator 均可
Collection values = map.values();
Iterator it = values.iterator();
while (it.hasNext()) {
Object value = it.next();
System.out.print(value+" ");
}
System.out.println();
System.out.println("==============");
//方式3:通过EntrySet 来获取 key-value
//增强for 或 iterator 均可
Set entrySet = map.entrySet();
Iterator iter = entrySet.iterator();
while (iter.hasNext()) {
Map.Entry node = (Map.Entry)iter.next();
System.out.println(node.getKey()+"-"+node.getValue());
}
}
}
| 1,493 | 0.510797 | 0.497394 | 51 | 25.333334 | 17.165478 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false | 15 |
9c1585bfe9f356c39e5bc96aab14f46ab4449704 | 16,071,767,675,455 | 7ff1c3fa7410c06b4838c5c5b14a223317ea9c67 | /Curso/src/cl/curso/java/ejemplos/semaforo/programa.java | 8d3833933bf21cb4ba9e244fa4c0613a75f698c1 | [] | no_license | Kueck/workspace | https://github.com/Kueck/workspace | 351699a60eae28d28ef67e434bd7a653cf807697 | 050dea61dce38a9f19bcf7d849363df85ff7be44 | refs/heads/master | 2020-04-02T06:55:31.898000 | 2016-06-28T16:48:12 | 2016-06-28T16:48:12 | 60,852,561 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cl.curso.java.ejemplos.semaforo;
public class programa {
public static void main(String[] args) throws InterruptedException {
Rojo rojo=new Rojo();
Semaforo semaforo=new Semaforo(rojo);
while(true){
System.out.println(semaforo.getEstado().getClass().getSimpleName());
Thread.sleep(1000);
semaforo.cambiarEstado();
}
}
}
| UTF-8 | Java | 360 | java | programa.java | Java | [] | null | [] | package cl.curso.java.ejemplos.semaforo;
public class programa {
public static void main(String[] args) throws InterruptedException {
Rojo rojo=new Rojo();
Semaforo semaforo=new Semaforo(rojo);
while(true){
System.out.println(semaforo.getEstado().getClass().getSimpleName());
Thread.sleep(1000);
semaforo.cambiarEstado();
}
}
}
| 360 | 0.705556 | 0.694444 | 20 | 17 | 21.743965 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 15 |
a19bd6c9e763e52717448202a005634552d9ece8 | 12,335,146,143,719 | 29fc3d5cb94439443ac7878c3e8ce3c0f6eb3319 | /8.SpringDataIntro - Exercise/spring-intro-exercise/src/main/java/com/softuni/springintroexercise/constants/GlobalConstants.java | cbde5408f46df64029cbc089a63a83697418919b | [
"Apache-2.0"
] | permissive | StoqnBorislavov/SpringData | https://github.com/StoqnBorislavov/SpringData | d97d7fc49847b57fc1a9e1efc24fa8a9c8c151f6 | 6eda6fdfa5eb59709b63e88fb49bac2980052d72 | refs/heads/main | 2023-07-31T02:42:21.407000 | 2021-09-12T17:23:15 | 2021-09-12T17:23:15 | 397,986,598 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.softuni.springintroexercise.constants;
public class GlobalConstants {
public static final String AUTHORS_FILE_PATH =
"src/main/resources/files/authors.txt";
public static final String BOOKS_FILE_PATH =
"src/main/resources/files/books.txt";
public static final String CATEGORIES_FILE_PATH =
"src/main/resources/files/categories.txt";
}
| UTF-8 | Java | 408 | java | GlobalConstants.java | Java | [] | null | [] | package com.softuni.springintroexercise.constants;
public class GlobalConstants {
public static final String AUTHORS_FILE_PATH =
"src/main/resources/files/authors.txt";
public static final String BOOKS_FILE_PATH =
"src/main/resources/files/books.txt";
public static final String CATEGORIES_FILE_PATH =
"src/main/resources/files/categories.txt";
}
| 408 | 0.686275 | 0.686275 | 11 | 35.090908 | 22.129595 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 15 |
6fb773dd007e298108d0945460a597c97e052f58 | 16,252,156,303,892 | 8dd70534dc1921cbeb5f04fcfae3e48ddcf2393a | /src/platform/game/Exit.java | 51b7ba71c63f7d9366007216e3a76f192f809ba7 | [] | no_license | gkarray/platform-game | https://github.com/gkarray/platform-game | 3c56e89857eb6cc1cb46d8069b4c0103f2590f55 | 89035328be952370550be7968f38ac2f45ee54c9 | refs/heads/master | 2020-12-30T00:52:06.963000 | 2020-02-07T00:18:03 | 2020-02-07T00:18:03 | 238,803,882 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package platform.game;
import platform.game.level.Level;
import platform.util.Box;
import platform.util.Input;
import platform.util.Output;
import platform.util.Vector;
public class Exit extends Actor
{
private Vector position ;
private Level next ;
private Signal signal ;
private Signal signalDoor ;
private Level otherNext ;
private boolean dynamic ;
public Exit(Vector pos, Level nex, Signal s)
{
position = pos ;
next = nex ;
signal = s ;
dynamic = false ;
}
public Exit(Vector pos, Level nex, Level otherNex, Signal s, Signal signalDoo)
{
position = pos ;
next = nex ;
signal = s ;
otherNext = otherNex ;
signalDoor = signalDoo ;
dynamic = true;
}
public void update(Input input)
{
super.update(input);
if(dynamic)
{
if(signalDoor.isActive())
next = otherNext ;
}
}
public void draw(Input input, Output output)
{
super.draw(input, output);
if(signal.isActive())
output.drawSprite(getSprite("door.open"), getBox());
else
output.drawSprite(getSprite("door.closed"), getBox());
}
public Box getBox()
{
return new Box(position, 1, 1) ;
}
public void interact(Actor other)
{
super.interact(other);
if (other.isSolid ())
{
Vector delta = other.getBox ().getCollision(getBox ()) ;
if (delta != null)
{
position = position.add(delta) ;
}
}
if(other instanceof Player && signal.isActive() && other.getBox().isColliding(getBox()))
{
getWorld().nextLevel();
getWorld().setNextLevel(next);
}
}
@Override
public int getPriority()
{
// TODO Auto-generated method stub
return 500;
}
}
| UTF-8 | Java | 1,617 | java | Exit.java | Java | [] | null | [] | package platform.game;
import platform.game.level.Level;
import platform.util.Box;
import platform.util.Input;
import platform.util.Output;
import platform.util.Vector;
public class Exit extends Actor
{
private Vector position ;
private Level next ;
private Signal signal ;
private Signal signalDoor ;
private Level otherNext ;
private boolean dynamic ;
public Exit(Vector pos, Level nex, Signal s)
{
position = pos ;
next = nex ;
signal = s ;
dynamic = false ;
}
public Exit(Vector pos, Level nex, Level otherNex, Signal s, Signal signalDoo)
{
position = pos ;
next = nex ;
signal = s ;
otherNext = otherNex ;
signalDoor = signalDoo ;
dynamic = true;
}
public void update(Input input)
{
super.update(input);
if(dynamic)
{
if(signalDoor.isActive())
next = otherNext ;
}
}
public void draw(Input input, Output output)
{
super.draw(input, output);
if(signal.isActive())
output.drawSprite(getSprite("door.open"), getBox());
else
output.drawSprite(getSprite("door.closed"), getBox());
}
public Box getBox()
{
return new Box(position, 1, 1) ;
}
public void interact(Actor other)
{
super.interact(other);
if (other.isSolid ())
{
Vector delta = other.getBox ().getCollision(getBox ()) ;
if (delta != null)
{
position = position.add(delta) ;
}
}
if(other instanceof Player && signal.isActive() && other.getBox().isColliding(getBox()))
{
getWorld().nextLevel();
getWorld().setNextLevel(next);
}
}
@Override
public int getPriority()
{
// TODO Auto-generated method stub
return 500;
}
}
| 1,617 | 0.664193 | 0.661101 | 87 | 17.586206 | 17.931896 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.977011 | false | false | 15 |
b5b5eed302d8a03fa9595bc13a84e248882f8b92 | 17,952,963,321,343 | 2dd92155ddef846b303e7244a1e573fbc91f38f4 | /src/main/java/example/network/Client.java | 33e8aee731171912ef01a2b152d7ee2409f2100c | [] | no_license | lucajako97/TicTacToe | https://github.com/lucajako97/TicTacToe | 22bfac693e1c99d30382fc06814c854ef284cc2e | c09a0187b7784f2ed021c384bc236e06ce27bf08 | refs/heads/master | 2021-03-15T15:35:44.577000 | 2020-03-22T17:34:04 | 2020-03-22T17:34:04 | 246,861,799 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package example.network;
import example.view.CLI;
import example.view.UI;
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Client {
public static void main(String[] args) {
int port = 12345;
short whereTheSymbol = 0;
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
Socket socket = null;
UI cli = new CLI();
try {
InetAddress host = InetAddress.getLocalHost();
//initializing the socket connection with the server
socket = new Socket(host, port);
Scanner scanner = new Scanner(System.in);
String s;
System.out.println("Welcome to the TicTacToc game");
//create the streams to link to the server
oos = new ObjectOutputStream(socket.getOutputStream());
ois = new ObjectInputStream(socket.getInputStream());
boolean in = true;
//the client insert a nickname and he has to rewrite it, if it is already chosen
s = " ";
while (in) {
//write the nickname in a correct way
while (s.equals(" ") || s.equals("")) {
System.out.println("Write your nickname:");
s = scanner.nextLine();
}
//playerName = s;
oos.writeObject(s);
s = (String) ois.readObject();
//if it is not already chosen s, contains "ok"
if (s.equals("ok")) {
in = false;
System.out.println("Your nickname is valid!");
}
else {
System.out.println("Your nickname is not valid!");
s = " ";
}
}
//waiting the game starts
System.out.println("Waiting for the other client...");
while (!s.equals("start")) {
s = (String) ois.readObject();
oos.writeObject("keep alive");
}
//the game can start
in = true;
System.out.println("The game is starting!");
char updateSymbol1;
char updateSymbol2;
char updateSymbol3;
char updateSymbol4;
char updateSymbol5;
char updateSymbol6;
char updateSymbol7;
char updateSymbol8;
char updateSymbol9;
while (in) {
s = (String) ois.readObject();
switch(s) {
case "map":
updateSymbol1 = (char) ois.readObject();
updateSymbol2 = (char) ois.readObject();
updateSymbol3 = (char) ois.readObject();
updateSymbol4 = (char) ois.readObject();
updateSymbol5 = (char) ois.readObject();
updateSymbol6 = (char) ois.readObject();
updateSymbol7 = (char) ois.readObject();
updateSymbol8 = (char) ois.readObject();
updateSymbol9 = (char) ois.readObject();
//i have to update the CLI and use it to print the board table
cli.updateTable( updateSymbol1, updateSymbol2, updateSymbol3, updateSymbol4, updateSymbol5, updateSymbol6, updateSymbol7, updateSymbol8, updateSymbol9 );
cli.printTable();
break;
case "your turn":
System.out.println("It is your turn!");
while (in) {
//i have to decide where put my symbol (1-9)
boolean goOn = false;
while (!goOn) {
goOn = true;
try {
System.out.println("Choose the space from 1 to 9, where put your symbol: ");
whereTheSymbol = scanner.nextShort();
} catch (InputMismatchException e) {
System.out.println("Invalid type, please insert a number...");
goOn = false;
scanner.nextLine();
}
}
oos.writeObject(whereTheSymbol);
//and waiting the server check
s = (String) ois.readObject();
if (s.equals("ok")) {
System.out.println("It is a valid move!");
in = false;
}
else {
System.out.println("It is not a valid move!");
System.out.println("Try again with another space...");
}
}
in = true;
break;
case "not your turn":
System.out.println("Now is the turn of your opponent!");
System.out.println("Wait your turn!");
break;
case "result":
//if the message receive from the server is the result of the match
//i have to print it and terminate the game
s = (String) ois.readObject();
if ( s.equals("you win"))
System.out.println("You are the winner! Congratulations!! :D ");
else if ( s.equals("tie") )
System.out.println("That's a tie! Anyway, well game! :) ");
else
System.out.println("You are the loser! I'm sorry :( ");
in = false;
break;
case "keep alive":
//only to keep alive the connection
//oos.writeObject("keep alive");
case "you win for retired":
System.out.println("You are the winner! The other player is retired!! Congratulations!! :D ");
default:
System.out.println("This is the default case, something is going wrong!?");
break;
}
}
//the game is finished, close the streams and the socket connection
System.out.println("We will see at the next match! ;)");
} catch (IOException | ClassNotFoundException e) {
System.out.println("The server connection is down...");
System.out.println("Try again...");
} finally {
try {
System.out.println("Closing the output stream...");
oos.close();
} catch (IOException | NullPointerException e) {
System.out.println("The output stream is not been set up ...");
System.out.println("Or it was open when the connection crashed...");
}
try {
System.out.println("Closing the input stream...");
ois.close();
} catch (IOException | NullPointerException e) {
System.out.println("The input stream is not been set up ...");
System.out.println("Or it was open when the connection crashed...");
}
try {
System.out.println("Closing the socket...");
socket.close();
} catch (IOException | NullPointerException e) {
System.out.println("The socket is not been set up ...");
}
}
}// END OF MAIN
}
| UTF-8 | Java | 8,026 | java | Client.java | Java | [] | null | [] | package example.network;
import example.view.CLI;
import example.view.UI;
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Client {
public static void main(String[] args) {
int port = 12345;
short whereTheSymbol = 0;
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
Socket socket = null;
UI cli = new CLI();
try {
InetAddress host = InetAddress.getLocalHost();
//initializing the socket connection with the server
socket = new Socket(host, port);
Scanner scanner = new Scanner(System.in);
String s;
System.out.println("Welcome to the TicTacToc game");
//create the streams to link to the server
oos = new ObjectOutputStream(socket.getOutputStream());
ois = new ObjectInputStream(socket.getInputStream());
boolean in = true;
//the client insert a nickname and he has to rewrite it, if it is already chosen
s = " ";
while (in) {
//write the nickname in a correct way
while (s.equals(" ") || s.equals("")) {
System.out.println("Write your nickname:");
s = scanner.nextLine();
}
//playerName = s;
oos.writeObject(s);
s = (String) ois.readObject();
//if it is not already chosen s, contains "ok"
if (s.equals("ok")) {
in = false;
System.out.println("Your nickname is valid!");
}
else {
System.out.println("Your nickname is not valid!");
s = " ";
}
}
//waiting the game starts
System.out.println("Waiting for the other client...");
while (!s.equals("start")) {
s = (String) ois.readObject();
oos.writeObject("keep alive");
}
//the game can start
in = true;
System.out.println("The game is starting!");
char updateSymbol1;
char updateSymbol2;
char updateSymbol3;
char updateSymbol4;
char updateSymbol5;
char updateSymbol6;
char updateSymbol7;
char updateSymbol8;
char updateSymbol9;
while (in) {
s = (String) ois.readObject();
switch(s) {
case "map":
updateSymbol1 = (char) ois.readObject();
updateSymbol2 = (char) ois.readObject();
updateSymbol3 = (char) ois.readObject();
updateSymbol4 = (char) ois.readObject();
updateSymbol5 = (char) ois.readObject();
updateSymbol6 = (char) ois.readObject();
updateSymbol7 = (char) ois.readObject();
updateSymbol8 = (char) ois.readObject();
updateSymbol9 = (char) ois.readObject();
//i have to update the CLI and use it to print the board table
cli.updateTable( updateSymbol1, updateSymbol2, updateSymbol3, updateSymbol4, updateSymbol5, updateSymbol6, updateSymbol7, updateSymbol8, updateSymbol9 );
cli.printTable();
break;
case "your turn":
System.out.println("It is your turn!");
while (in) {
//i have to decide where put my symbol (1-9)
boolean goOn = false;
while (!goOn) {
goOn = true;
try {
System.out.println("Choose the space from 1 to 9, where put your symbol: ");
whereTheSymbol = scanner.nextShort();
} catch (InputMismatchException e) {
System.out.println("Invalid type, please insert a number...");
goOn = false;
scanner.nextLine();
}
}
oos.writeObject(whereTheSymbol);
//and waiting the server check
s = (String) ois.readObject();
if (s.equals("ok")) {
System.out.println("It is a valid move!");
in = false;
}
else {
System.out.println("It is not a valid move!");
System.out.println("Try again with another space...");
}
}
in = true;
break;
case "not your turn":
System.out.println("Now is the turn of your opponent!");
System.out.println("Wait your turn!");
break;
case "result":
//if the message receive from the server is the result of the match
//i have to print it and terminate the game
s = (String) ois.readObject();
if ( s.equals("you win"))
System.out.println("You are the winner! Congratulations!! :D ");
else if ( s.equals("tie") )
System.out.println("That's a tie! Anyway, well game! :) ");
else
System.out.println("You are the loser! I'm sorry :( ");
in = false;
break;
case "keep alive":
//only to keep alive the connection
//oos.writeObject("keep alive");
case "you win for retired":
System.out.println("You are the winner! The other player is retired!! Congratulations!! :D ");
default:
System.out.println("This is the default case, something is going wrong!?");
break;
}
}
//the game is finished, close the streams and the socket connection
System.out.println("We will see at the next match! ;)");
} catch (IOException | ClassNotFoundException e) {
System.out.println("The server connection is down...");
System.out.println("Try again...");
} finally {
try {
System.out.println("Closing the output stream...");
oos.close();
} catch (IOException | NullPointerException e) {
System.out.println("The output stream is not been set up ...");
System.out.println("Or it was open when the connection crashed...");
}
try {
System.out.println("Closing the input stream...");
ois.close();
} catch (IOException | NullPointerException e) {
System.out.println("The input stream is not been set up ...");
System.out.println("Or it was open when the connection crashed...");
}
try {
System.out.println("Closing the socket...");
socket.close();
} catch (IOException | NullPointerException e) {
System.out.println("The socket is not been set up ...");
}
}
}// END OF MAIN
}
| 8,026 | 0.451906 | 0.447296 | 198 | 39.535355 | 28.407856 | 177 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.631313 | false | false | 15 |
48675fde049d7e6db7e28cc907b4ace4be69f74d | 32,461,362,854,526 | a39fd5020f79629eb18b362337b2ea997ca4e655 | /src/api/Security.java | d05a41afa4756f652a585f1604b5e4ad5e9996ff | [] | no_license | Atunala/Qora2 | https://github.com/Atunala/Qora2 | 8cbf7020911912df32178eb3d2b1dbddb18fb526 | 24ae771867cb4a6cdbe39b66117a91efedcd90db | refs/heads/master | 2021-09-26T15:17:20.203000 | 2018-10-31T09:40:27 | 2018-10-31T09:40:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package api;
import javax.servlet.http.HttpServletRequest;
public class Security {
public static void checkApiCallAllowed(final String messageToDisplay, HttpServletRequest request) {
// TODO
}
}
| UTF-8 | Java | 210 | java | Security.java | Java | [] | null | [] | package api;
import javax.servlet.http.HttpServletRequest;
public class Security {
public static void checkApiCallAllowed(final String messageToDisplay, HttpServletRequest request) {
// TODO
}
}
| 210 | 0.761905 | 0.761905 | 10 | 20 | 29.986664 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 15 |
e5f059897d33ad27714bb67ced2f17589949f6a3 | 27,238,682,607,502 | 87a7dfee8ecc4feb7aea40a6ac3c91711be47235 | /src/main/java/com/auditseverity/auditseverity/service/AuditDetailsService.java | 60c44c752027f0e8918c2b489f60219c7ccc9b7b | [] | no_license | NaveenJoyGit/AuditSeverity | https://github.com/NaveenJoyGit/AuditSeverity | 194ff64f02ed0a10006decacbb26b8cfb6146312 | 82dfe2332b22681ea56bcca6d6d7cfdc04583dd0 | refs/heads/master | 2023-04-16T08:18:26.260000 | 2021-04-30T05:03:14 | 2021-04-30T05:03:14 | 359,697,179 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.auditseverity.auditseverity.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.auditseverity.auditseverity.client.BenchMarkClient;
import com.auditseverity.auditseverity.models.AuditDetails;
import com.auditseverity.auditseverity.models.Benchmark;
import com.auditseverity.auditseverity.repository.AuditDetailsRepository;
import lombok.extern.slf4j.Slf4j;
@Service
@Slf4j
public class AuditDetailsService {
@Autowired
AuditDetailsRepository auditDetailsRepository;
@Autowired
BenchMarkClient benchClientt;
public List<Benchmark> getBechmarks(String token) {
return benchClientt.getBenchmarks(token);
}
@Transactional
public List<AuditDetails> getAuditDetails() {
return auditDetailsRepository.findAll();
}
@Transactional
public void saveResponse(AuditDetails auditDetails) {
auditDetailsRepository.save(auditDetails);
}
public Long getScore(AuditDetails aud, String token) {
List<Benchmark> benchmark = getBechmarks(token);
log.info("-----from aud-service------" + benchmark.get(0).getAudit_type());
Long score = null;
if(aud.getType().equals(benchmark.get(0).getAudit_type())) {
score = benchmark.get(0).getScore();
}
if(aud.getType().equals(benchmark.get(1).getAudit_type())) {
score = benchmark.get(1).getScore();
}
return score;
}
}
| UTF-8 | Java | 1,491 | java | AuditDetailsService.java | Java | [] | null | [] | package com.auditseverity.auditseverity.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.auditseverity.auditseverity.client.BenchMarkClient;
import com.auditseverity.auditseverity.models.AuditDetails;
import com.auditseverity.auditseverity.models.Benchmark;
import com.auditseverity.auditseverity.repository.AuditDetailsRepository;
import lombok.extern.slf4j.Slf4j;
@Service
@Slf4j
public class AuditDetailsService {
@Autowired
AuditDetailsRepository auditDetailsRepository;
@Autowired
BenchMarkClient benchClientt;
public List<Benchmark> getBechmarks(String token) {
return benchClientt.getBenchmarks(token);
}
@Transactional
public List<AuditDetails> getAuditDetails() {
return auditDetailsRepository.findAll();
}
@Transactional
public void saveResponse(AuditDetails auditDetails) {
auditDetailsRepository.save(auditDetails);
}
public Long getScore(AuditDetails aud, String token) {
List<Benchmark> benchmark = getBechmarks(token);
log.info("-----from aud-service------" + benchmark.get(0).getAudit_type());
Long score = null;
if(aud.getType().equals(benchmark.get(0).getAudit_type())) {
score = benchmark.get(0).getScore();
}
if(aud.getType().equals(benchmark.get(1).getAudit_type())) {
score = benchmark.get(1).getScore();
}
return score;
}
}
| 1,491 | 0.771965 | 0.7666 | 59 | 24.271187 | 24.765223 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.338983 | false | false | 15 |
ef4a04279ccead94280812b0469663aea679efe0 | 17,360,257,813,153 | 14746c4b8511abe301fd470a152de627327fe720 | /soroush-android-1.10.0_source_from_JADX/p056c/C5044q.java | 7a53ff0abc4b9fd7caa022928da61ee5e847036b | [] | no_license | maasalan/soroush-messenger-apis | https://github.com/maasalan/soroush-messenger-apis | 3005c4a43123c6543dbcca3dd9084f95e934a6f4 | 29867bf53a113a30b1aa36719b1c7899b991d0a8 | refs/heads/master | 2020-03-21T21:23:20.693000 | 2018-06-28T19:57:01 | 2018-06-28T19:57:01 | 139,060,676 | 3 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package p056c;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import p056c.p057a.C0885c;
import p206d.C5682d;
import p206d.C6623c;
public final class C5044q extends ab {
private static final C0952v f14061a = C0952v.m2385a("application/x-www-form-urlencoded");
private final List<String> f14062b;
private final List<String> f14063c;
public static final class C0943a {
public final List<String> f2983a;
public final List<String> f2984b;
public final Charset f2985c;
public C0943a() {
this((byte) 0);
}
private C0943a(byte b) {
this.f2983a = new ArrayList();
this.f2984b = new ArrayList();
this.f2985c = null;
}
}
public C5044q(List<String> list, List<String> list2) {
this.f14062b = C0885c.m2094a((List) list);
this.f14063c = C0885c.m2094a((List) list2);
}
private long m10217a(C5682d c5682d, boolean z) {
C6623c c6623c = z ? new C6623c() : c5682d.mo3124b();
int size = this.f14062b.size();
for (int i = 0; i < size; i++) {
if (i > 0) {
c6623c.m17033b(38);
}
c6623c.m17026a((String) this.f14062b.get(i));
c6623c.m17033b(61);
c6623c.m17026a((String) this.f14063c.get(i));
}
if (!z) {
return 0;
}
long j = c6623c.f18884b;
c6623c.m17071p();
return j;
}
public final C0952v mo998a() {
return f14061a;
}
public final void mo999a(C5682d c5682d) {
m10217a(c5682d, false);
}
public final long mo1000b() {
return m10217a(null, true);
}
}
| UTF-8 | Java | 1,738 | java | C5044q.java | Java | [] | null | [] | package p056c;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import p056c.p057a.C0885c;
import p206d.C5682d;
import p206d.C6623c;
public final class C5044q extends ab {
private static final C0952v f14061a = C0952v.m2385a("application/x-www-form-urlencoded");
private final List<String> f14062b;
private final List<String> f14063c;
public static final class C0943a {
public final List<String> f2983a;
public final List<String> f2984b;
public final Charset f2985c;
public C0943a() {
this((byte) 0);
}
private C0943a(byte b) {
this.f2983a = new ArrayList();
this.f2984b = new ArrayList();
this.f2985c = null;
}
}
public C5044q(List<String> list, List<String> list2) {
this.f14062b = C0885c.m2094a((List) list);
this.f14063c = C0885c.m2094a((List) list2);
}
private long m10217a(C5682d c5682d, boolean z) {
C6623c c6623c = z ? new C6623c() : c5682d.mo3124b();
int size = this.f14062b.size();
for (int i = 0; i < size; i++) {
if (i > 0) {
c6623c.m17033b(38);
}
c6623c.m17026a((String) this.f14062b.get(i));
c6623c.m17033b(61);
c6623c.m17026a((String) this.f14063c.get(i));
}
if (!z) {
return 0;
}
long j = c6623c.f18884b;
c6623c.m17071p();
return j;
}
public final C0952v mo998a() {
return f14061a;
}
public final void mo999a(C5682d c5682d) {
m10217a(c5682d, false);
}
public final long mo1000b() {
return m10217a(null, true);
}
}
| 1,738 | 0.571346 | 0.411968 | 66 | 25.333334 | 19.502396 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.575758 | false | false | 15 |
4b525a3afb5173a4726f3ed41cb4df874d352e80 | 23,098,334,176,467 | 0840e7c4bb62571c3b4c744cc08f1f1fb34e6627 | /IIOTDataVisualizer/src/main/java/com/kishorekumarkorada/IIOTDataVisualizer/model/IIOTMachineModel.java | 3d471c02a2811b8d64978bb026e00109b8025e83 | [] | no_license | Kishore-Kumar-Korada/IIOTRepoMaster | https://github.com/Kishore-Kumar-Korada/IIOTRepoMaster | 2fe21ff97f094d5dc2baa0cd77d9f597bd2bf16a | b3300823e0f24016aa65639f1efa7b96a0126db6 | refs/heads/master | 2023-02-02T02:34:01.531000 | 2020-12-17T21:51:23 | 2020-12-17T21:51:23 | 322,418,619 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kishorekumarkorada.IIOTDataVisualizer.model;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "iiot_machine")
public class IIOTMachineModel {
@Id
@Column(name = "machine_id")
private String machineId;
@Column(name = "machine_name")
private String machineName;
@Column(name = "machine_description")
private String machineDescription;
@Column(name="created_on", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime createdOn;
public String getMachineId() {
return machineId;
}
public void setMachineId(String machineId) {
System.err.println("inside setMachineId: "+machineId);
this.machineId = machineId;
}
public String getMachineName() {
return machineName;
}
public void setMachineName(String machineName) {
this.machineName = machineName;
}
public String getMachineDescription() {
return machineDescription;
}
public void setMachineDescription(String machineDescription) {
this.machineDescription = machineDescription;
}
public LocalDateTime getCreatedOn() {
return createdOn;
}
public void setCreatedOn(LocalDateTime createdOn) {
this.createdOn = createdOn;
}
public IIOTMachineModel(String machineId, String machineName, String machineDescription, LocalDateTime createdOn) {
super();
this.machineId = machineId;
this.machineName = machineName;
this.machineDescription = machineDescription;
this.createdOn = createdOn;
}
public IIOTMachineModel() {
}
@Override
public String toString() {
return "IIOTMachineModel [machineId=" + machineId + ", machineName=" + machineName + ", machineDescription="
+ machineDescription + ", createdOn=" + createdOn + "]";
}
}
| UTF-8 | Java | 1,830 | java | IIOTMachineModel.java | Java | [] | null | [] | package com.kishorekumarkorada.IIOTDataVisualizer.model;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "iiot_machine")
public class IIOTMachineModel {
@Id
@Column(name = "machine_id")
private String machineId;
@Column(name = "machine_name")
private String machineName;
@Column(name = "machine_description")
private String machineDescription;
@Column(name="created_on", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime createdOn;
public String getMachineId() {
return machineId;
}
public void setMachineId(String machineId) {
System.err.println("inside setMachineId: "+machineId);
this.machineId = machineId;
}
public String getMachineName() {
return machineName;
}
public void setMachineName(String machineName) {
this.machineName = machineName;
}
public String getMachineDescription() {
return machineDescription;
}
public void setMachineDescription(String machineDescription) {
this.machineDescription = machineDescription;
}
public LocalDateTime getCreatedOn() {
return createdOn;
}
public void setCreatedOn(LocalDateTime createdOn) {
this.createdOn = createdOn;
}
public IIOTMachineModel(String machineId, String machineName, String machineDescription, LocalDateTime createdOn) {
super();
this.machineId = machineId;
this.machineName = machineName;
this.machineDescription = machineDescription;
this.createdOn = createdOn;
}
public IIOTMachineModel() {
}
@Override
public String toString() {
return "IIOTMachineModel [machineId=" + machineId + ", machineName=" + machineName + ", machineDescription="
+ machineDescription + ", createdOn=" + createdOn + "]";
}
}
| 1,830 | 0.752459 | 0.752459 | 81 | 21.592592 | 24.443827 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.320988 | false | false | 15 |
a154adfd33fe77fc54aecfdd1c6b5585ce82113b | 28,870,770,176,255 | 2b49321054e14262032d12f07d7f2dfddfe160d9 | /srv/application/src/main/java/com/sap/cloud/s4hana/examples/addressmgr/blockchain/commands/GetEmailBlacklistStatusCommand.java | ce7ea817a6bc44b037beee97cf7bd683b27c8166 | [
"Apache-2.0"
] | permissive | sacnl/scp-customer-forum | https://github.com/sacnl/scp-customer-forum | cf03f85b9d778aa1cc232f4c6a12582abc02a054 | b97c9223ee91e95e7b8bc16277302bee395d36ba | refs/heads/master | 2020-05-30T07:46:06.033000 | 2019-06-19T16:30:14 | 2019-06-19T16:30:14 | 189,605,170 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sap.cloud.s4hana.examples.addressmgr.blockchain.commands;
import com.netflix.hystrix.HystrixCommandGroupKey;
import com.sap.cloud.s4hana.examples.addressmgr.blockchain.BlacklistService;
import com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory;
import com.sap.cloud.sdk.frameworks.hystrix.Command;
import org.slf4j.Logger;
import java.util.Collections;
import java.util.Map;
public class GetEmailBlacklistStatusCommand extends Command<Map<String, Integer>> {
private static final Logger logger = CloudLoggerFactory.getLogger(GetEmailBlacklistStatusCommand.class);
private final BlacklistService blacklistService;
private final String email;
public GetEmailBlacklistStatusCommand(BlacklistService blacklistService, final String email) {
super(HystrixCommandGroupKey.Factory.asKey("LeonardoHyperledgerFabric-blackliststatus"), 5000);
this.blacklistService = blacklistService;
this.email = email;
}
@Override
protected Map<String, Integer> run()
throws Exception {
return Collections.singletonMap(getEmail(), blacklistService.getEmailBlacklistCount(getEmail()));
}
public String getEmail() {
return email;
}
@Override
protected Map<String, Integer> getFallback() {
logger.error("Fallback called because of exception:", getExecutionException());
return Collections.emptyMap();
}
@Override
public String toString() {
return "GetEmailBlacklistStatusCommand{" +
"email='" + email + '\'' +
'}';
}
}
| UTF-8 | Java | 1,594 | java | GetEmailBlacklistStatusCommand.java | Java | [
{
"context": " super(HystrixCommandGroupKey.Factory.asKey(\"LeonardoHyperledgerFabric-blackliststatus\"), 5000);\n\n this.blacklistService = blackl",
"end": 871,
"score": 0.8629217743873596,
"start": 830,
"tag": "KEY",
"value": "LeonardoHyperledgerFabric-blackliststatus"
}
] | null | [] | package com.sap.cloud.s4hana.examples.addressmgr.blockchain.commands;
import com.netflix.hystrix.HystrixCommandGroupKey;
import com.sap.cloud.s4hana.examples.addressmgr.blockchain.BlacklistService;
import com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory;
import com.sap.cloud.sdk.frameworks.hystrix.Command;
import org.slf4j.Logger;
import java.util.Collections;
import java.util.Map;
public class GetEmailBlacklistStatusCommand extends Command<Map<String, Integer>> {
private static final Logger logger = CloudLoggerFactory.getLogger(GetEmailBlacklistStatusCommand.class);
private final BlacklistService blacklistService;
private final String email;
public GetEmailBlacklistStatusCommand(BlacklistService blacklistService, final String email) {
super(HystrixCommandGroupKey.Factory.asKey("LeonardoHyperledgerFabric-blackliststatus"), 5000);
this.blacklistService = blacklistService;
this.email = email;
}
@Override
protected Map<String, Integer> run()
throws Exception {
return Collections.singletonMap(getEmail(), blacklistService.getEmailBlacklistCount(getEmail()));
}
public String getEmail() {
return email;
}
@Override
protected Map<String, Integer> getFallback() {
logger.error("Fallback called because of exception:", getExecutionException());
return Collections.emptyMap();
}
@Override
public String toString() {
return "GetEmailBlacklistStatusCommand{" +
"email='" + email + '\'' +
'}';
}
}
| 1,594 | 0.724592 | 0.720201 | 48 | 32.208332 | 32.370872 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.541667 | false | false | 15 |
05b8e7062344d2c335a79cc068f41dd895e508c0 | 32,177,895,034,253 | aa869adcb583399c74db8cd58ff1b8daa592248f | /src/main/java/infrastructure/KafkaPersistanceImpl.java | aa19eee22eef47f8bdb794e40c95810e24417b0b | [] | no_license | karjunan/kafkaIntegration | https://github.com/karjunan/kafkaIntegration | 88dd9183ea0e7b42436d284b4b7b64dfaed6c489 | 7345244e4330875bf483568afa2422753a172c9e | refs/heads/master | 2020-05-25T01:29:34.820000 | 2019-11-11T23:07:22 | 2019-11-11T23:07:22 | 187,557,403 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package infrastructure;
public class KafkaPersistanceImpl implements MessagePersistance {
//
// private static final Logger logger = Logger.getLogger(KafkaPersistanceImpl.class.getName());
//
// private Properties properties;
// private static final String TOPIC_NAME = "topic";
// private static final String AVRO_SCHEMA = "avroSchema";
//
// @Override
// public void save(Messages.ProducerRequest request, Properties properties,
// StreamObserver<Messages.OkResponse> responseObserver) {
//
//
// Descriptors.FieldDescriptor avroSchemaDescriptor = request.getDescriptorForType().findFieldByName(AVRO_SCHEMA);
//
// if( request.getTopicList().isEmpty() ) {
// Exception ex = new Exception("Topic name cannot be null");
// responseObserver.onError(Status.INTERNAL.withDescription(ex.getMessage())
// .augmentDescription("Custom exception")
// .withCause(ex)
// .asRuntimeException());
// return;
// }
//
// if( !request.hasField(avroSchemaDescriptor) || request.getAvroSchema().length() == 0 ) {
// Exception ex = new Exception("Avro schema or schema name has to be provided");
// responseObserver.onError(Status.INTERNAL.withDescription(ex.getMessage())
// .augmentDescription("Custom exception")
// .withCause(ex)
// .asRuntimeException());
// return;
// }
//
// try(KafkaProducer<String,GenericRecord> producer = new KafkaProducer<>(properties)) {
//
// // call the generic implementation
// saveDefault(request,producer);
//
// Messages.OkResponse response =
// Messages.OkResponse.newBuilder()
// .setIsOk(true)
// .build();
// responseObserver.onNext(response);
// responseObserver.onCompleted();
// return;
// } catch (Exception ex) {
// logger.severe("Exception while persisting data - " + ex);
// responseObserver.onError(Status.INTERNAL.withDescription(ex.getMessage())
// .augmentDescription("Custom exception")
// .withCause(ex)
// .asRuntimeException());
// }
//
// }
}
| UTF-8 | Java | 2,370 | java | KafkaPersistanceImpl.java | Java | [] | null | [] | package infrastructure;
public class KafkaPersistanceImpl implements MessagePersistance {
//
// private static final Logger logger = Logger.getLogger(KafkaPersistanceImpl.class.getName());
//
// private Properties properties;
// private static final String TOPIC_NAME = "topic";
// private static final String AVRO_SCHEMA = "avroSchema";
//
// @Override
// public void save(Messages.ProducerRequest request, Properties properties,
// StreamObserver<Messages.OkResponse> responseObserver) {
//
//
// Descriptors.FieldDescriptor avroSchemaDescriptor = request.getDescriptorForType().findFieldByName(AVRO_SCHEMA);
//
// if( request.getTopicList().isEmpty() ) {
// Exception ex = new Exception("Topic name cannot be null");
// responseObserver.onError(Status.INTERNAL.withDescription(ex.getMessage())
// .augmentDescription("Custom exception")
// .withCause(ex)
// .asRuntimeException());
// return;
// }
//
// if( !request.hasField(avroSchemaDescriptor) || request.getAvroSchema().length() == 0 ) {
// Exception ex = new Exception("Avro schema or schema name has to be provided");
// responseObserver.onError(Status.INTERNAL.withDescription(ex.getMessage())
// .augmentDescription("Custom exception")
// .withCause(ex)
// .asRuntimeException());
// return;
// }
//
// try(KafkaProducer<String,GenericRecord> producer = new KafkaProducer<>(properties)) {
//
// // call the generic implementation
// saveDefault(request,producer);
//
// Messages.OkResponse response =
// Messages.OkResponse.newBuilder()
// .setIsOk(true)
// .build();
// responseObserver.onNext(response);
// responseObserver.onCompleted();
// return;
// } catch (Exception ex) {
// logger.severe("Exception while persisting data - " + ex);
// responseObserver.onError(Status.INTERNAL.withDescription(ex.getMessage())
// .augmentDescription("Custom exception")
// .withCause(ex)
// .asRuntimeException());
// }
//
// }
}
| 2,370 | 0.583966 | 0.583544 | 57 | 40.578949 | 31.864267 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.438596 | false | false | 15 |
32d2f43624683765ea7eede50506648379c60683 | 18,227,841,212,245 | fc8d281bc43b0e50fec51c07a8f281180f89ee06 | /app/src/main/java/io/awesome/gagtube/local/playlist/LocalPlaylistFragment.java | f374cac75da3b47d997f2f51a4422964121e25e8 | [] | no_license | madilekci/BenimYoutube | https://github.com/madilekci/BenimYoutube | 00a1701ee50a63eba1894e2fb95e31d41f92caaf | f7e9e9c847ad06003388c5e0f9dba4f7228e3739 | refs/heads/master | 2022-12-26T09:02:39.913000 | 2022-02-20T17:16:36 | 2022-02-20T17:16:36 | 297,576,293 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.awesome.gagtube.local.playlist;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import icepick.State;
import io.awesome.gagtube.R;
import io.awesome.gagtube.database.GAGTubeDatabase;
import io.awesome.gagtube.database.LocalItem;
import io.awesome.gagtube.database.playlist.PlaylistStreamEntry;
import io.awesome.gagtube.fragments.BackPressable;
import io.awesome.gagtube.local.BaseLocalListFragment;
import io.awesome.gagtube.player.playqueue.PlayQueue;
import io.awesome.gagtube.player.playqueue.SinglePlayQueue;
import io.awesome.gagtube.report.UserAction;
import io.awesome.gagtube.util.AnimationUtils;
import io.awesome.gagtube.util.Localization;
import io.awesome.gagtube.util.NavigationHelper;
import io.awesome.gagtube.util.OnClickGesture;
import io.awesome.gagtube.util.SharedUtils;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.disposables.Disposables;
import io.reactivex.subjects.PublishSubject;
public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistStreamEntry>, Void> implements BackPressable {
// Save the list 10 seconds after the last change occurred
private static final long SAVE_DEBOUNCE_MILLIS = 10000;
private static final int MINIMUM_INITIAL_DRAG_VELOCITY = 10;
@BindView(R.id.playlist_control) View playlistControl;
@BindView(R.id.playlist_ctrl_play_all_button) View headerPlayAllButton;
@BindView(R.id.playlist_ctrl_play_popup_button) View headerPopupButton;
@BindView(R.id.default_toolbar) Toolbar mToolbar;
@State
protected Long playlistId;
@State
protected String name;
private ItemTouchHelper itemTouchHelper;
private LocalPlaylistManager playlistManager;
private Subscription databaseSubscription;
private PublishSubject<Long> debouncedSaveSignal;
private CompositeDisposable disposables;
/* Has the playlist been fully loaded from db */
private AtomicBoolean isLoadingComplete;
/* Has the playlist been modified (e.g. items reordered or deleted) */
private AtomicBoolean isModified;
public static LocalPlaylistFragment getInstance(long playlistId, String name) {
LocalPlaylistFragment instance = new LocalPlaylistFragment();
instance.setInitialData(playlistId, name);
return instance;
}
// Fragment LifeCycle - Creation
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
playlistManager = new LocalPlaylistManager(GAGTubeDatabase.getInstance(activity));
debouncedSaveSignal = PublishSubject.create();
disposables = new CompositeDisposable();
isLoadingComplete = new AtomicBoolean();
isModified = new AtomicBoolean();
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_local_playlist, container, false);
ButterKnife.bind(this, view);
return view;
}
// Fragment Lifecycle - Views
@Override
protected void initViews(View rootView, Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState);
// toolbar
activity.getDelegate().setSupportActionBar(mToolbar);
}
@Override
public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
ActionBar actionBar = activity.getDelegate().getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
}
}
@Override
public void onViewCreated(@NonNull View rootView, Bundle savedInstanceState) {
super.onViewCreated(rootView, savedInstanceState);
mToolbar.setNavigationOnClickListener(view -> onPopBackStack());
}
@Override
protected View getListHeader() {
return null;
}
@Override
protected void initListeners() {
super.initListeners();
itemTouchHelper = new ItemTouchHelper(getItemTouchCallback());
itemTouchHelper.attachToRecyclerView(itemsList);
itemListAdapter.setSelectedListener(new OnClickGesture<LocalItem>() {
@Override
public void selected(LocalItem selectedItem) {
if (selectedItem instanceof PlaylistStreamEntry) {
final PlaylistStreamEntry item = (PlaylistStreamEntry) selectedItem;
StreamInfoItem streamInfoItem = item.toStreamInfoItem();
NavigationHelper.openVideoDetailFragment(streamInfoItem, getFragmentManager(), item.serviceId, item.url, item.title);
}
}
@Override
public void held(LocalItem selectedItem, View view) {
if (selectedItem instanceof PlaylistStreamEntry) {
showPopupMenu((PlaylistStreamEntry) selectedItem, view);
}
}
@Override
public void drag(LocalItem selectedItem, RecyclerView.ViewHolder viewHolder) {
if (itemTouchHelper != null) itemTouchHelper.startDrag(viewHolder);
}
});
}
// Fragment Lifecycle - Loading
@Override
public void showLoading() {
super.showLoading();
if (playlistControl != null) AnimationUtils.animateView(playlistControl, false, 200);
}
@Override
public void hideLoading() {
super.hideLoading();
if (playlistControl != null) {
AnimationUtils.animateView(playlistControl, true, 200);
}
}
@Override
public void startLoading(boolean forceLoad) {
super.startLoading(forceLoad);
if (disposables != null) {
disposables.clear();
disposables.add(getDebouncedSaver());
}
isLoadingComplete.set(false);
isModified.set(false);
playlistManager.getPlaylistStreams(playlistId)
.onBackpressureLatest()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getPlaylistObserver());
}
// Fragment Lifecycle - Destruction
@Override
public void onPause() {
super.onPause();
// Save on exit
saveImmediate();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (itemListAdapter != null) itemListAdapter.unsetSelectedListener();
if (headerPlayAllButton != null) headerPlayAllButton.setOnClickListener(null);
if (headerPopupButton != null) headerPopupButton.setOnClickListener(null);
if (databaseSubscription != null) databaseSubscription.cancel();
if (disposables != null) disposables.clear();
databaseSubscription = null;
itemTouchHelper = null;
mToolbar.setSubtitle(null);
}
@Override
public void onDestroy() {
super.onDestroy();
if (debouncedSaveSignal != null) debouncedSaveSignal.onComplete();
if (disposables != null) disposables.dispose();
debouncedSaveSignal = null;
playlistManager = null;
disposables = null;
isLoadingComplete = null;
isModified = null;
}
// Playlist Stream Loader
private Subscriber<List<PlaylistStreamEntry>> getPlaylistObserver() {
return new Subscriber<List<PlaylistStreamEntry>>() {
@Override
public void onSubscribe(Subscription s) {
showLoading();
isLoadingComplete.set(false);
if (databaseSubscription != null) databaseSubscription.cancel();
databaseSubscription = s;
databaseSubscription.request(1);
}
@Override
public void onNext(List<PlaylistStreamEntry> streams) {
// Skip handling the result after it has been modified
if (isModified == null || !isModified.get()) {
handleResult(streams);
isLoadingComplete.set(true);
}
if (databaseSubscription != null) databaseSubscription.request(1);
}
@Override
public void onError(Throwable exception) {
LocalPlaylistFragment.this.onError(exception);
}
@Override
public void onComplete() {
}
};
}
@Override
public void handleResult(@NonNull List<PlaylistStreamEntry> result) {
super.handleResult(result);
if (itemListAdapter == null) return;
itemListAdapter.clearStreamItemList();
setTitle(name);
setVideoCount(result.size());
if (result.isEmpty()) {
showEmptyState();
return;
}
itemListAdapter.addItems(result);
headerPlayAllButton.setOnClickListener(view -> {
if (!itemListAdapter.getItemsList().isEmpty()) {
NavigationHelper.playOnMainPlayer(activity, getPlayQueue());
}
});
headerPopupButton.setOnClickListener(view -> {
if (!itemListAdapter.getItemsList().isEmpty()) {
NavigationHelper.playOnPopupPlayer(activity, getPlayQueue() );
}
});
hideLoading();
}
// Fragment Error Handling
@Override
protected void resetFragment() {
super.resetFragment();
if (databaseSubscription != null) databaseSubscription.cancel();
}
@Override
protected boolean onError(Throwable exception) {
if (super.onError(exception)) return true;
onUnrecoverableError(exception, UserAction.SOMETHING_ELSE, "none", "Local Playlist", R.string.general_error);
return true;
}
// Playlist Metadata/Streams Manipulation
private void changePlaylistName(final String name) {
if (playlistManager == null) return;
this.name = name;
setTitle(name);
final Disposable disposable = playlistManager.renamePlaylist(playlistId, name)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(longs -> {/*Do nothing on success*/}, this::onError);
disposables.add(disposable);
}
private void changeThumbnailUrl(final String thumbnailUrl) {
if (playlistManager == null) return;
final Toast successToast = Toast.makeText(getActivity(), R.string.playlist_thumbnail_change_success, Toast.LENGTH_SHORT);
final Disposable disposable = playlistManager
.changePlaylistThumbnail(playlistId, thumbnailUrl)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignore -> successToast.show(), this::onError);
disposables.add(disposable);
}
private void deleteItem(final PlaylistStreamEntry item) {
if (itemListAdapter == null) return;
itemListAdapter.removeItem(item);
Toast.makeText(activity, R.string.msg_delete_successfully, Toast.LENGTH_SHORT).show();
// update count in toolbar
setVideoCount(itemListAdapter.getItemsList().size());
saveChanges();
}
private void saveChanges() {
if (isModified == null || debouncedSaveSignal == null) return;
isModified.set(true);
debouncedSaveSignal.onNext(System.currentTimeMillis());
}
private Disposable getDebouncedSaver() {
if (debouncedSaveSignal == null) return Disposables.empty();
return debouncedSaveSignal
.debounce(SAVE_DEBOUNCE_MILLIS, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignored -> saveImmediate(), this::onError);
}
private void saveImmediate() {
if (playlistManager == null || itemListAdapter == null) return;
// List must be loaded and modified in order to save
if (isLoadingComplete == null || isModified == null || !isLoadingComplete.get() || !isModified.get()) {
return;
}
final List<Object> items = itemListAdapter.getItemsList();
List<Long> streamIds = new ArrayList<>(items.size());
for (final Object item : items) {
if (item instanceof PlaylistStreamEntry) {
streamIds.add(((PlaylistStreamEntry) item).streamId);
}
}
final Disposable disposable = playlistManager.updateJoin(playlistId, streamIds)
.observeOn(AndroidSchedulers.mainThread()).subscribe(
// onNext
() -> {
if (isModified != null) {
isModified.set(false);
}
},
// onError
this::onError
);
disposables.add(disposable);
}
private ItemTouchHelper.SimpleCallback getItemTouchCallback() {
return new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.ACTION_STATE_IDLE) {
@Override
public int interpolateOutOfBoundsScroll(@NonNull RecyclerView recyclerView, int viewSize, int viewSizeOutOfBounds, int totalSize, long msSinceStartScroll) {
final int standardSpeed = super.interpolateOutOfBoundsScroll(recyclerView, viewSize, viewSizeOutOfBounds, totalSize, msSinceStartScroll);
final int minimumAbsVelocity = Math.max(MINIMUM_INITIAL_DRAG_VELOCITY, Math.abs(standardSpeed));
return minimumAbsVelocity * (int) Math.signum(viewSizeOutOfBounds);
}
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder source, @NonNull RecyclerView.ViewHolder target) {
if (source.getItemViewType() != target.getItemViewType() || itemListAdapter == null) {
return false;
}
final int sourceIndex = source.getAdapterPosition();
final int targetIndex = target.getAdapterPosition();
final boolean isSwapped = itemListAdapter.swapItems(sourceIndex, targetIndex);
if (isSwapped) saveChanges();
return isSwapped;
}
@Override
public boolean isLongPressDragEnabled() {
return false;
}
@Override
public boolean isItemViewSwipeEnabled() {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int swipeDir) {
}
};
}
// Utils
protected void showPopupMenu(final PlaylistStreamEntry playlistStreamEntry, final View view) {
final Context context = getContext();
if (context == null || context.getResources() == null || getActivity() == null) return;
PopupMenu popup = new PopupMenu(getContext(), view, Gravity.END, 0, R.style.mPopupMenu);
popup.getMenuInflater().inflate(R.menu.menu_popup_playlist_local, popup.getMenu());
popup.show();
popup.setOnMenuItemClickListener(item -> {
int id = item.getItemId();
final int index = Math.max(itemListAdapter.getItemsList().indexOf(playlistStreamEntry), 0);
switch (id) {
case R.id.action_play:
NavigationHelper.playOnMainPlayer(context, getPlayQueue(index) );
break;
case R.id.action_set_thumbnail:
changeThumbnailUrl(playlistStreamEntry.thumbnailUrl);
break;
case R.id.action_share:
SharedUtils.shareUrl(getContext(), playlistStreamEntry.toStreamInfoItem().getName(), playlistStreamEntry.toStreamInfoItem().getUrl());
break;
case R.id.action_delete:
deleteItem(playlistStreamEntry);
if (itemListAdapter.getItemsList().isEmpty()) showEmptyState();
break;
}
return true;
});
}
private void setInitialData(long playlistId, String name) {
this.playlistId = playlistId;
this.name = !TextUtils.isEmpty(name) ? name : "";
}
private void setVideoCount(final long count) {
if (activity != null) {
mToolbar.setSubtitle(Localization.localizeStreamCount(activity, count));
}
}
private PlayQueue getPlayQueue() {
return getPlayQueue(0);
}
private PlayQueue getPlayQueue(final int index) {
if (itemListAdapter == null) {
return new SinglePlayQueue(Collections.emptyList(), 0);
}
final List<Object> infoItems = itemListAdapter.getItemsList();
List<StreamInfoItem> streamInfoItems = new ArrayList<>(infoItems.size());
for (final Object item : infoItems) {
if (item instanceof PlaylistStreamEntry) {
streamInfoItems.add(((PlaylistStreamEntry) item).toStreamInfoItem());
}
}
return new SinglePlayQueue(streamInfoItems, index);
}
private void onPopBackStack() {
// pop back stack
if (getFragmentManager() != null) {
getFragmentManager().popBackStack();
}
}
@Override
public boolean onBackPressed() {
onPopBackStack();
return true;
}
}
| UTF-8 | Java | 16,419 | java | LocalPlaylistFragment.java | Java | [] | null | [] | package io.awesome.gagtube.local.playlist;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import icepick.State;
import io.awesome.gagtube.R;
import io.awesome.gagtube.database.GAGTubeDatabase;
import io.awesome.gagtube.database.LocalItem;
import io.awesome.gagtube.database.playlist.PlaylistStreamEntry;
import io.awesome.gagtube.fragments.BackPressable;
import io.awesome.gagtube.local.BaseLocalListFragment;
import io.awesome.gagtube.player.playqueue.PlayQueue;
import io.awesome.gagtube.player.playqueue.SinglePlayQueue;
import io.awesome.gagtube.report.UserAction;
import io.awesome.gagtube.util.AnimationUtils;
import io.awesome.gagtube.util.Localization;
import io.awesome.gagtube.util.NavigationHelper;
import io.awesome.gagtube.util.OnClickGesture;
import io.awesome.gagtube.util.SharedUtils;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.disposables.Disposables;
import io.reactivex.subjects.PublishSubject;
public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistStreamEntry>, Void> implements BackPressable {
// Save the list 10 seconds after the last change occurred
private static final long SAVE_DEBOUNCE_MILLIS = 10000;
private static final int MINIMUM_INITIAL_DRAG_VELOCITY = 10;
@BindView(R.id.playlist_control) View playlistControl;
@BindView(R.id.playlist_ctrl_play_all_button) View headerPlayAllButton;
@BindView(R.id.playlist_ctrl_play_popup_button) View headerPopupButton;
@BindView(R.id.default_toolbar) Toolbar mToolbar;
@State
protected Long playlistId;
@State
protected String name;
private ItemTouchHelper itemTouchHelper;
private LocalPlaylistManager playlistManager;
private Subscription databaseSubscription;
private PublishSubject<Long> debouncedSaveSignal;
private CompositeDisposable disposables;
/* Has the playlist been fully loaded from db */
private AtomicBoolean isLoadingComplete;
/* Has the playlist been modified (e.g. items reordered or deleted) */
private AtomicBoolean isModified;
public static LocalPlaylistFragment getInstance(long playlistId, String name) {
LocalPlaylistFragment instance = new LocalPlaylistFragment();
instance.setInitialData(playlistId, name);
return instance;
}
// Fragment LifeCycle - Creation
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
playlistManager = new LocalPlaylistManager(GAGTubeDatabase.getInstance(activity));
debouncedSaveSignal = PublishSubject.create();
disposables = new CompositeDisposable();
isLoadingComplete = new AtomicBoolean();
isModified = new AtomicBoolean();
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_local_playlist, container, false);
ButterKnife.bind(this, view);
return view;
}
// Fragment Lifecycle - Views
@Override
protected void initViews(View rootView, Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState);
// toolbar
activity.getDelegate().setSupportActionBar(mToolbar);
}
@Override
public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
ActionBar actionBar = activity.getDelegate().getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
}
}
@Override
public void onViewCreated(@NonNull View rootView, Bundle savedInstanceState) {
super.onViewCreated(rootView, savedInstanceState);
mToolbar.setNavigationOnClickListener(view -> onPopBackStack());
}
@Override
protected View getListHeader() {
return null;
}
@Override
protected void initListeners() {
super.initListeners();
itemTouchHelper = new ItemTouchHelper(getItemTouchCallback());
itemTouchHelper.attachToRecyclerView(itemsList);
itemListAdapter.setSelectedListener(new OnClickGesture<LocalItem>() {
@Override
public void selected(LocalItem selectedItem) {
if (selectedItem instanceof PlaylistStreamEntry) {
final PlaylistStreamEntry item = (PlaylistStreamEntry) selectedItem;
StreamInfoItem streamInfoItem = item.toStreamInfoItem();
NavigationHelper.openVideoDetailFragment(streamInfoItem, getFragmentManager(), item.serviceId, item.url, item.title);
}
}
@Override
public void held(LocalItem selectedItem, View view) {
if (selectedItem instanceof PlaylistStreamEntry) {
showPopupMenu((PlaylistStreamEntry) selectedItem, view);
}
}
@Override
public void drag(LocalItem selectedItem, RecyclerView.ViewHolder viewHolder) {
if (itemTouchHelper != null) itemTouchHelper.startDrag(viewHolder);
}
});
}
// Fragment Lifecycle - Loading
@Override
public void showLoading() {
super.showLoading();
if (playlistControl != null) AnimationUtils.animateView(playlistControl, false, 200);
}
@Override
public void hideLoading() {
super.hideLoading();
if (playlistControl != null) {
AnimationUtils.animateView(playlistControl, true, 200);
}
}
@Override
public void startLoading(boolean forceLoad) {
super.startLoading(forceLoad);
if (disposables != null) {
disposables.clear();
disposables.add(getDebouncedSaver());
}
isLoadingComplete.set(false);
isModified.set(false);
playlistManager.getPlaylistStreams(playlistId)
.onBackpressureLatest()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getPlaylistObserver());
}
// Fragment Lifecycle - Destruction
@Override
public void onPause() {
super.onPause();
// Save on exit
saveImmediate();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (itemListAdapter != null) itemListAdapter.unsetSelectedListener();
if (headerPlayAllButton != null) headerPlayAllButton.setOnClickListener(null);
if (headerPopupButton != null) headerPopupButton.setOnClickListener(null);
if (databaseSubscription != null) databaseSubscription.cancel();
if (disposables != null) disposables.clear();
databaseSubscription = null;
itemTouchHelper = null;
mToolbar.setSubtitle(null);
}
@Override
public void onDestroy() {
super.onDestroy();
if (debouncedSaveSignal != null) debouncedSaveSignal.onComplete();
if (disposables != null) disposables.dispose();
debouncedSaveSignal = null;
playlistManager = null;
disposables = null;
isLoadingComplete = null;
isModified = null;
}
// Playlist Stream Loader
private Subscriber<List<PlaylistStreamEntry>> getPlaylistObserver() {
return new Subscriber<List<PlaylistStreamEntry>>() {
@Override
public void onSubscribe(Subscription s) {
showLoading();
isLoadingComplete.set(false);
if (databaseSubscription != null) databaseSubscription.cancel();
databaseSubscription = s;
databaseSubscription.request(1);
}
@Override
public void onNext(List<PlaylistStreamEntry> streams) {
// Skip handling the result after it has been modified
if (isModified == null || !isModified.get()) {
handleResult(streams);
isLoadingComplete.set(true);
}
if (databaseSubscription != null) databaseSubscription.request(1);
}
@Override
public void onError(Throwable exception) {
LocalPlaylistFragment.this.onError(exception);
}
@Override
public void onComplete() {
}
};
}
@Override
public void handleResult(@NonNull List<PlaylistStreamEntry> result) {
super.handleResult(result);
if (itemListAdapter == null) return;
itemListAdapter.clearStreamItemList();
setTitle(name);
setVideoCount(result.size());
if (result.isEmpty()) {
showEmptyState();
return;
}
itemListAdapter.addItems(result);
headerPlayAllButton.setOnClickListener(view -> {
if (!itemListAdapter.getItemsList().isEmpty()) {
NavigationHelper.playOnMainPlayer(activity, getPlayQueue());
}
});
headerPopupButton.setOnClickListener(view -> {
if (!itemListAdapter.getItemsList().isEmpty()) {
NavigationHelper.playOnPopupPlayer(activity, getPlayQueue() );
}
});
hideLoading();
}
// Fragment Error Handling
@Override
protected void resetFragment() {
super.resetFragment();
if (databaseSubscription != null) databaseSubscription.cancel();
}
@Override
protected boolean onError(Throwable exception) {
if (super.onError(exception)) return true;
onUnrecoverableError(exception, UserAction.SOMETHING_ELSE, "none", "Local Playlist", R.string.general_error);
return true;
}
// Playlist Metadata/Streams Manipulation
private void changePlaylistName(final String name) {
if (playlistManager == null) return;
this.name = name;
setTitle(name);
final Disposable disposable = playlistManager.renamePlaylist(playlistId, name)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(longs -> {/*Do nothing on success*/}, this::onError);
disposables.add(disposable);
}
private void changeThumbnailUrl(final String thumbnailUrl) {
if (playlistManager == null) return;
final Toast successToast = Toast.makeText(getActivity(), R.string.playlist_thumbnail_change_success, Toast.LENGTH_SHORT);
final Disposable disposable = playlistManager
.changePlaylistThumbnail(playlistId, thumbnailUrl)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignore -> successToast.show(), this::onError);
disposables.add(disposable);
}
private void deleteItem(final PlaylistStreamEntry item) {
if (itemListAdapter == null) return;
itemListAdapter.removeItem(item);
Toast.makeText(activity, R.string.msg_delete_successfully, Toast.LENGTH_SHORT).show();
// update count in toolbar
setVideoCount(itemListAdapter.getItemsList().size());
saveChanges();
}
private void saveChanges() {
if (isModified == null || debouncedSaveSignal == null) return;
isModified.set(true);
debouncedSaveSignal.onNext(System.currentTimeMillis());
}
private Disposable getDebouncedSaver() {
if (debouncedSaveSignal == null) return Disposables.empty();
return debouncedSaveSignal
.debounce(SAVE_DEBOUNCE_MILLIS, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignored -> saveImmediate(), this::onError);
}
private void saveImmediate() {
if (playlistManager == null || itemListAdapter == null) return;
// List must be loaded and modified in order to save
if (isLoadingComplete == null || isModified == null || !isLoadingComplete.get() || !isModified.get()) {
return;
}
final List<Object> items = itemListAdapter.getItemsList();
List<Long> streamIds = new ArrayList<>(items.size());
for (final Object item : items) {
if (item instanceof PlaylistStreamEntry) {
streamIds.add(((PlaylistStreamEntry) item).streamId);
}
}
final Disposable disposable = playlistManager.updateJoin(playlistId, streamIds)
.observeOn(AndroidSchedulers.mainThread()).subscribe(
// onNext
() -> {
if (isModified != null) {
isModified.set(false);
}
},
// onError
this::onError
);
disposables.add(disposable);
}
private ItemTouchHelper.SimpleCallback getItemTouchCallback() {
return new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.ACTION_STATE_IDLE) {
@Override
public int interpolateOutOfBoundsScroll(@NonNull RecyclerView recyclerView, int viewSize, int viewSizeOutOfBounds, int totalSize, long msSinceStartScroll) {
final int standardSpeed = super.interpolateOutOfBoundsScroll(recyclerView, viewSize, viewSizeOutOfBounds, totalSize, msSinceStartScroll);
final int minimumAbsVelocity = Math.max(MINIMUM_INITIAL_DRAG_VELOCITY, Math.abs(standardSpeed));
return minimumAbsVelocity * (int) Math.signum(viewSizeOutOfBounds);
}
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder source, @NonNull RecyclerView.ViewHolder target) {
if (source.getItemViewType() != target.getItemViewType() || itemListAdapter == null) {
return false;
}
final int sourceIndex = source.getAdapterPosition();
final int targetIndex = target.getAdapterPosition();
final boolean isSwapped = itemListAdapter.swapItems(sourceIndex, targetIndex);
if (isSwapped) saveChanges();
return isSwapped;
}
@Override
public boolean isLongPressDragEnabled() {
return false;
}
@Override
public boolean isItemViewSwipeEnabled() {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int swipeDir) {
}
};
}
// Utils
protected void showPopupMenu(final PlaylistStreamEntry playlistStreamEntry, final View view) {
final Context context = getContext();
if (context == null || context.getResources() == null || getActivity() == null) return;
PopupMenu popup = new PopupMenu(getContext(), view, Gravity.END, 0, R.style.mPopupMenu);
popup.getMenuInflater().inflate(R.menu.menu_popup_playlist_local, popup.getMenu());
popup.show();
popup.setOnMenuItemClickListener(item -> {
int id = item.getItemId();
final int index = Math.max(itemListAdapter.getItemsList().indexOf(playlistStreamEntry), 0);
switch (id) {
case R.id.action_play:
NavigationHelper.playOnMainPlayer(context, getPlayQueue(index) );
break;
case R.id.action_set_thumbnail:
changeThumbnailUrl(playlistStreamEntry.thumbnailUrl);
break;
case R.id.action_share:
SharedUtils.shareUrl(getContext(), playlistStreamEntry.toStreamInfoItem().getName(), playlistStreamEntry.toStreamInfoItem().getUrl());
break;
case R.id.action_delete:
deleteItem(playlistStreamEntry);
if (itemListAdapter.getItemsList().isEmpty()) showEmptyState();
break;
}
return true;
});
}
private void setInitialData(long playlistId, String name) {
this.playlistId = playlistId;
this.name = !TextUtils.isEmpty(name) ? name : "";
}
private void setVideoCount(final long count) {
if (activity != null) {
mToolbar.setSubtitle(Localization.localizeStreamCount(activity, count));
}
}
private PlayQueue getPlayQueue() {
return getPlayQueue(0);
}
private PlayQueue getPlayQueue(final int index) {
if (itemListAdapter == null) {
return new SinglePlayQueue(Collections.emptyList(), 0);
}
final List<Object> infoItems = itemListAdapter.getItemsList();
List<StreamInfoItem> streamInfoItems = new ArrayList<>(infoItems.size());
for (final Object item : infoItems) {
if (item instanceof PlaylistStreamEntry) {
streamInfoItems.add(((PlaylistStreamEntry) item).toStreamInfoItem());
}
}
return new SinglePlayQueue(streamInfoItems, index);
}
private void onPopBackStack() {
// pop back stack
if (getFragmentManager() != null) {
getFragmentManager().popBackStack();
}
}
@Override
public boolean onBackPressed() {
onPopBackStack();
return true;
}
}
| 16,419 | 0.736098 | 0.734819 | 587 | 26.969336 | 28.235003 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.575809 | false | false | 15 |
8e3ecddac6aaed3fb845759e140c478b029813ab | 3,710,851,784,353 | e949234d89a346b1856ab4adb8fa282d2c3816be | /rosa-tool/src/main/java/rosa/tool/deriv/WebsiteFSIDerivative.java | f8f2e21e30c0c653ef3942b018e23f5bdf00965e | [
"Apache-2.0"
] | permissive | jhu-digital-manuscripts/rosa | https://github.com/jhu-digital-manuscripts/rosa | 3ca54443829448114faea4d3a49d257d77c0b677 | 04b1f15f830750743ec148b8c8b3b25a5bc47437 | refs/heads/master | 2021-01-19T00:46:37.628000 | 2014-09-05T19:32:10 | 2014-09-05T19:32:10 | 11,903,740 | 2 | 0 | null | false | 2014-05-28T08:11:40 | 2013-08-05T16:57:34 | 2014-01-13T14:54:35 | 2014-01-13T14:54:34 | 5,412 | 0 | 1 | 1 | Java | null | null | package rosa.tool.deriv;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;
import javax.xml.transform.stream.StreamResult;
import org.xml.sax.SAXException;
import rosa.core.BookArchive;
import rosa.core.BookCollection;
import rosa.tool.Config;
import rosa.core.util.XMLWriter;
/**
* Write out config files for FSI server.
*/
public class WebsiteFSIDerivative extends Derivative {
public static String NAME = "website-fsi";
public WebsiteFSIDerivative(Config site, PrintStream report)
throws IOException {
super(site, report);
}
public String name() {
return NAME;
}
public boolean update(BookArchive archive, boolean force) {
try {
writeFSIPagesConfig(archive,
site.dataPath(archive.id(), archive.id() + ".pages.fsi"));
writeFSIShowcaseConfig(archive,
site.dataPath(archive.id(), archive.id() + ".showcase.fsi"));
} catch (SAXException e) {
reportError("Writing fsi config", e);
return false;
} catch (IOException e) {
reportError("Writing fsi config", e);
return false;
}
return true;
}
private void writeFSIPagesConfig(BookArchive archive, File file)
throws SAXException, IOException {
List<BookArchive.Image> images = archive.images();
int start = -1;
int end = -1;
String frontcover = null;
String backcover = null;
for (int i = 0; i < images.size(); i++) {
BookArchive.Image image = images.get(i);
if (image.fileName().contains("binding.frontcover")) {
if (!image.missing()) {
frontcover = image.fileName();
}
start = i + 1;
} else if (image.fileName().contains("binding.backcover")) {
if (!image.missing()) {
backcover = image.fileName();
}
end = i;
}
}
XMLWriter w = new XMLWriter(new StreamResult(file));
w.startDocument();
w.startElement("fsi_parameter");
w.startElement("PLUGINS");
w.attribute("src", "pages");
w.startElement("PLUGIN");
w.attribute("value", "0");
w.emptyElement("BendEffectIntensity");
w.attribute("value", "0");
w.emptyElement("Print");
w.attribute("value", "0");
w.emptyElement("Save");
w.attribute("value", "0");
w.emptyElement("Search");
File cropdir = archive.cropDir();
boolean hascrop = cropdir.exists();
String basepath = site.fsiServerShare() + "/" + archive.id() + "/"
+ (hascrop ? cropdir.getName() + "/" : "");
if (frontcover == null) {
w.attribute("value", "true");
w.emptyElement("BlankFrontCover");
} else {
w.attribute("value", basepath + frontcover);
w.emptyElement("FrontCoverImage");
}
if (backcover == null) {
w.attribute("value", "true");
w.emptyElement("BlankBackCover");
} else {
w.attribute("value", basepath + backcover);
w.emptyElement("BackCoverImage");
}
w.endElement("PLUGIN");
w.attribute("src", "fullscreen");
w.emptyElement("PLUGIN");
w.attribute("src", "resize");
w.emptyElement("PLUGIN");
w.endElement("PLUGINS");
w.startElement("Images");
for (int i = start; i < end; i++) {
BookArchive.Image image = images.get(i);
String filename = image.fileName();
String label = filename.replace(".tif", "");
label = label.replace(archive.id() + ".", "");
String imagepath = basepath + filename;
if (image.missing()) {
imagepath = site.fsiServerShare() + "/"
+ BookCollection.MISSING_IMAGE_NAME;
} else if (!new File(archive.dir(), filename).exists()
|| (hascrop && !new File(cropdir, filename).exists())) {
report.println("Error: Missing image: " + filename
+ (hascrop ? " (cropped)" : ""));
}
w.attribute("label", label);
w.startElement("Image");
w.startElement("FPX");
w.attribute("value", imagepath);
w.emptyElement("Src");
w.endElement("FPX");
w.endElement("Image");
}
w.endElement("Images");
w.endElement("fsi_parameter");
w.endDocument();
}
private void writeFSIShowcaseConfig(BookArchive archive, File file)
throws SAXException, IOException {
XMLWriter w = new XMLWriter(new StreamResult(file));
w.startDocument();
w.startElement("fsi_parameter");
w.startElement("PLUGINS");
w.attribute("src", "showcase");
w.startElement("PLUGIN");
w.attribute("value", "11");
w.emptyElement("LabelTextSize");
w.attribute("value", "2");
w.emptyElement("LabelMarginTop");
w.attribute("value", "<b><ImageLabel /></b>");
w.emptyElement("LabelContent");
w.attribute("value", "000000");
w.emptyElement("LabelTextColor");
w.attribute("value", "outside");
w.emptyElement("Layout");
w.attribute("value", "75");
w.emptyElement("BackgroundAlpha");
w.attribute("value", "true");
w.emptyElement("Tooltips");
w.attribute("value", "bottom");
w.emptyElement("Align");
w.attribute("value", "CCCCCC");
w.emptyElement("ThumbFace");
w.attribute("value", "F2984C");
w.emptyElement("ThumbActiveFace");
w.attribute("value", "FFF0AA");
w.emptyElement("ThumbSelectedFace");
String basepath = site.fsiServerShare() + "/" + archive.id() + "/";
w.endElement("PLUGIN");
w.attribute("src", "fullscreen");
w.emptyElement("PLUGIN");
w.attribute("src", "resize");
w.emptyElement("PLUGIN");
w.endElement("PLUGINS");
w.startElement("Images");
for (BookArchive.Image image : archive.images()) {
if (!image.missing()) {
String label = image.fileName().replace(".tif", "");
label = label.replace(archive.id() + ".", "");
w.attribute("label", label);
w.startElement("Image");
w.startElement("FPX");
w.attribute("value", basepath + image.fileName());
w.emptyElement("Src");
w.endElement("FPX");
w.endElement("Image");
}
}
w.endElement("Images");
w.endElement("fsi_parameter");
w.endDocument();
}
// TODO
public boolean check(BookArchive archive) {
return false;
}
public boolean validate(BookArchive archive) {
return check(archive);
}
}
| UTF-8 | Java | 5,879 | java | WebsiteFSIDerivative.java | Java | [] | null | [] | package rosa.tool.deriv;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;
import javax.xml.transform.stream.StreamResult;
import org.xml.sax.SAXException;
import rosa.core.BookArchive;
import rosa.core.BookCollection;
import rosa.tool.Config;
import rosa.core.util.XMLWriter;
/**
* Write out config files for FSI server.
*/
public class WebsiteFSIDerivative extends Derivative {
public static String NAME = "website-fsi";
public WebsiteFSIDerivative(Config site, PrintStream report)
throws IOException {
super(site, report);
}
public String name() {
return NAME;
}
public boolean update(BookArchive archive, boolean force) {
try {
writeFSIPagesConfig(archive,
site.dataPath(archive.id(), archive.id() + ".pages.fsi"));
writeFSIShowcaseConfig(archive,
site.dataPath(archive.id(), archive.id() + ".showcase.fsi"));
} catch (SAXException e) {
reportError("Writing fsi config", e);
return false;
} catch (IOException e) {
reportError("Writing fsi config", e);
return false;
}
return true;
}
private void writeFSIPagesConfig(BookArchive archive, File file)
throws SAXException, IOException {
List<BookArchive.Image> images = archive.images();
int start = -1;
int end = -1;
String frontcover = null;
String backcover = null;
for (int i = 0; i < images.size(); i++) {
BookArchive.Image image = images.get(i);
if (image.fileName().contains("binding.frontcover")) {
if (!image.missing()) {
frontcover = image.fileName();
}
start = i + 1;
} else if (image.fileName().contains("binding.backcover")) {
if (!image.missing()) {
backcover = image.fileName();
}
end = i;
}
}
XMLWriter w = new XMLWriter(new StreamResult(file));
w.startDocument();
w.startElement("fsi_parameter");
w.startElement("PLUGINS");
w.attribute("src", "pages");
w.startElement("PLUGIN");
w.attribute("value", "0");
w.emptyElement("BendEffectIntensity");
w.attribute("value", "0");
w.emptyElement("Print");
w.attribute("value", "0");
w.emptyElement("Save");
w.attribute("value", "0");
w.emptyElement("Search");
File cropdir = archive.cropDir();
boolean hascrop = cropdir.exists();
String basepath = site.fsiServerShare() + "/" + archive.id() + "/"
+ (hascrop ? cropdir.getName() + "/" : "");
if (frontcover == null) {
w.attribute("value", "true");
w.emptyElement("BlankFrontCover");
} else {
w.attribute("value", basepath + frontcover);
w.emptyElement("FrontCoverImage");
}
if (backcover == null) {
w.attribute("value", "true");
w.emptyElement("BlankBackCover");
} else {
w.attribute("value", basepath + backcover);
w.emptyElement("BackCoverImage");
}
w.endElement("PLUGIN");
w.attribute("src", "fullscreen");
w.emptyElement("PLUGIN");
w.attribute("src", "resize");
w.emptyElement("PLUGIN");
w.endElement("PLUGINS");
w.startElement("Images");
for (int i = start; i < end; i++) {
BookArchive.Image image = images.get(i);
String filename = image.fileName();
String label = filename.replace(".tif", "");
label = label.replace(archive.id() + ".", "");
String imagepath = basepath + filename;
if (image.missing()) {
imagepath = site.fsiServerShare() + "/"
+ BookCollection.MISSING_IMAGE_NAME;
} else if (!new File(archive.dir(), filename).exists()
|| (hascrop && !new File(cropdir, filename).exists())) {
report.println("Error: Missing image: " + filename
+ (hascrop ? " (cropped)" : ""));
}
w.attribute("label", label);
w.startElement("Image");
w.startElement("FPX");
w.attribute("value", imagepath);
w.emptyElement("Src");
w.endElement("FPX");
w.endElement("Image");
}
w.endElement("Images");
w.endElement("fsi_parameter");
w.endDocument();
}
private void writeFSIShowcaseConfig(BookArchive archive, File file)
throws SAXException, IOException {
XMLWriter w = new XMLWriter(new StreamResult(file));
w.startDocument();
w.startElement("fsi_parameter");
w.startElement("PLUGINS");
w.attribute("src", "showcase");
w.startElement("PLUGIN");
w.attribute("value", "11");
w.emptyElement("LabelTextSize");
w.attribute("value", "2");
w.emptyElement("LabelMarginTop");
w.attribute("value", "<b><ImageLabel /></b>");
w.emptyElement("LabelContent");
w.attribute("value", "000000");
w.emptyElement("LabelTextColor");
w.attribute("value", "outside");
w.emptyElement("Layout");
w.attribute("value", "75");
w.emptyElement("BackgroundAlpha");
w.attribute("value", "true");
w.emptyElement("Tooltips");
w.attribute("value", "bottom");
w.emptyElement("Align");
w.attribute("value", "CCCCCC");
w.emptyElement("ThumbFace");
w.attribute("value", "F2984C");
w.emptyElement("ThumbActiveFace");
w.attribute("value", "FFF0AA");
w.emptyElement("ThumbSelectedFace");
String basepath = site.fsiServerShare() + "/" + archive.id() + "/";
w.endElement("PLUGIN");
w.attribute("src", "fullscreen");
w.emptyElement("PLUGIN");
w.attribute("src", "resize");
w.emptyElement("PLUGIN");
w.endElement("PLUGINS");
w.startElement("Images");
for (BookArchive.Image image : archive.images()) {
if (!image.missing()) {
String label = image.fileName().replace(".tif", "");
label = label.replace(archive.id() + ".", "");
w.attribute("label", label);
w.startElement("Image");
w.startElement("FPX");
w.attribute("value", basepath + image.fileName());
w.emptyElement("Src");
w.endElement("FPX");
w.endElement("Image");
}
}
w.endElement("Images");
w.endElement("fsi_parameter");
w.endDocument();
}
// TODO
public boolean check(BookArchive archive) {
return false;
}
public boolean validate(BookArchive archive) {
return check(archive);
}
}
| 5,879 | 0.6496 | 0.645518 | 250 | 22.516001 | 18.654804 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.428 | false | false | 13 |
f163b9af3117409327df5b72ff41715c2a592e8c | 6,631,429,505,224 | fbde3c5767a67cae2f0c1eda7c65bb1aa8b13eec | /space/ia_pal/main/herschel/ia/pal/managers/jython/JythonConfigReader.java | 5b7f5bdcb5ffe18c826ce4699b049e2d94c8330b | [] | no_license | libooo/libooo | https://github.com/libooo/libooo | 78d6549e49780dda18414519268e6846a050f702 | 85128e28a961b615578e16d82aac2f99dbcfa8bc | refs/heads/master | 2016-09-06T07:55:00.882000 | 2008-11-21T11:29:55 | 2008-11-21T11:29:55 | 32,122,552 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* $Id: JythonConfigReader.java,v 1.3 2008/04/30 16:38:40 jsaiz Exp $
* Copyright (c) 2008 ESA, STFC
*/
package herschel.ia.pal.managers.jython;
import herschel.share.interpreter.InterpreterFactory;
import java.util.logging.Logger;
import org.python.util.PythonInterpreter;
abstract class JythonConfigReader {
@SuppressWarnings("unused")
private static Logger _LOGGER = Logger.getLogger (JythonConfigReader.class.getName());
static PythonInterpreter _interp;
static {
_interp = InterpreterFactory.newInterpreter();
_interp.exec ("from herschel.ia.pal.all import *");
}
} | UTF-8 | Java | 632 | java | JythonConfigReader.java | Java | [
{
"context": " JythonConfigReader.java,v 1.3 2008/04/30 16:38:40 jsaiz Exp $\r\n * Copyright (c) 2008 ESA, STFC\r\n */\r\n\r\npa",
"end": 63,
"score": 0.8177423477172852,
"start": 58,
"tag": "USERNAME",
"value": "jsaiz"
}
] | null | [] | /* $Id: JythonConfigReader.java,v 1.3 2008/04/30 16:38:40 jsaiz Exp $
* Copyright (c) 2008 ESA, STFC
*/
package herschel.ia.pal.managers.jython;
import herschel.share.interpreter.InterpreterFactory;
import java.util.logging.Logger;
import org.python.util.PythonInterpreter;
abstract class JythonConfigReader {
@SuppressWarnings("unused")
private static Logger _LOGGER = Logger.getLogger (JythonConfigReader.class.getName());
static PythonInterpreter _interp;
static {
_interp = InterpreterFactory.newInterpreter();
_interp.exec ("from herschel.ia.pal.all import *");
}
} | 632 | 0.707278 | 0.675633 | 20 | 29.65 | 25.965891 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
44a37f51301a9261058392639b26ad8c65a60d54 | 22,995,254,909,515 | 79a1a80b3c2bf34e0d1aef9821ed197f2dcc49a5 | /app/src/main/java/com/thumninh/thumninh/views/base/BaseView.java | e75b1e86d272cbac38adee0c22e9273f533dd103 | [] | no_license | Soklundy/ThumNinh | https://github.com/Soklundy/ThumNinh | 65ee96892c5a43d404a662dea6c7d9346ab6ea74 | bfb2694f6dcc15ce559bd09b6385c54d52b9894e | refs/heads/master | 2020-04-11T20:09:53.093000 | 2018-12-17T02:10:51 | 2018-12-17T02:10:51 | 162,061,916 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.thumninh.thumninh.views.base;
/**
* Created by Lenovo on 8/12/2017.
*/
public interface BaseView {
void loading();
void hideLoading();
}
| UTF-8 | Java | 163 | java | BaseView.java | Java | [
{
"context": "m.thumninh.thumninh.views.base;\n\n/**\n * Created by Lenovo on 8/12/2017.\n */\n\npublic interface BaseView {\n\n ",
"end": 67,
"score": 0.997276782989502,
"start": 61,
"tag": "USERNAME",
"value": "Lenovo"
}
] | null | [] | package com.thumninh.thumninh.views.base;
/**
* Created by Lenovo on 8/12/2017.
*/
public interface BaseView {
void loading();
void hideLoading();
}
| 163 | 0.662577 | 0.619632 | 12 | 12.583333 | 14.648426 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 13 |
758cebf52afaf553c2849cc421e4ff6995c0325e | 27,917,287,486,502 | 4cd1c1b9d8111e9d782e005960449d0dbb2034a1 | /services/src/main/java/com/itibo/services/AccountService.java | eaad09cc2b62420aa9907d11e7186b1156d99bc9 | [] | no_license | kamaz1k/ProjectImagine | https://github.com/kamaz1k/ProjectImagine | 750cbc7b22a72421d4f2e455f2b0961b505e54c9 | 82f501a8ae8ab292104d2bb315ff3a730f277de6 | refs/heads/master | 2017-12-04T18:56:34.584000 | 2016-06-02T09:00:46 | 2016-06-02T09:00:46 | 54,834,813 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.itibo.services;
import com.itibo.data.model.Account;
import com.itibo.services.common.GenericService;
public interface AccountService extends GenericService<Account, Integer> {
Account findOneAccountById(Integer id);
Account findOneAccountByLogin(String login);
Account findOneAccountByEmail(String email);
Account deleteByLogin(String login);
}
| UTF-8 | Java | 380 | java | AccountService.java | Java | [] | null | [] | package com.itibo.services;
import com.itibo.data.model.Account;
import com.itibo.services.common.GenericService;
public interface AccountService extends GenericService<Account, Integer> {
Account findOneAccountById(Integer id);
Account findOneAccountByLogin(String login);
Account findOneAccountByEmail(String email);
Account deleteByLogin(String login);
}
| 380 | 0.794737 | 0.794737 | 15 | 24.333334 | 24.469482 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false | 13 |
4b9926ff528d40f67f0868635395af80218ec6a6 | 42,949,741,203 | eed5340d6e3d5150eec5dd0f3d17e86bd7310905 | /src/GUI/Listeners/WindowClosedListener.java | b99fa49af027436bdc212356a8416446cbf860fb | [] | no_license | Lukas-Arts/Jarvis | https://github.com/Lukas-Arts/Jarvis | a55d23a391dcd973036a3778cee16fd1de859397 | b63d82c0551ba52a50754d03bd6b8fab7d819bba | refs/heads/master | 2021-01-10T19:03:50.675000 | 2015-08-12T00:27:16 | 2015-08-12T00:27:16 | 40,554,026 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package GUI.Listeners;
import API.LanguageManager;
import logic.Main;
import logic.RadixTree;
import sun.awt.WindowClosingListener;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.File;
import java.io.IOException;
/**
* Created by lukas on 14.04.15.
*/
public class WindowClosedListener implements WindowListener, ActionListener {
private static JFrame jf;
public WindowClosedListener(JFrame jf)
{
this.jf=jf;
}
@Override
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
System.out.println("test asdf 1234");
try {
Main.getQuestionTree().save(new File("./questions." + LanguageManager.lang));
} catch (IOException e2) {
e2.printStackTrace();
}
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
@Override
public void actionPerformed(ActionEvent e) {
try {
Main.getQuestionTree().save(new File("./questions." + LanguageManager.lang));
Main.getQuestionTree().save2(new File("./test2.txt"));
} catch (IOException e2) {
e2.printStackTrace();
}
jf.dispose();
}
}
| UTF-8 | Java | 1,638 | java | WindowClosedListener.java | Java | [
{
"context": "le;\nimport java.io.IOException;\n\n/**\n * Created by lukas on 14.04.15.\n */\npublic class WindowClosedListene",
"end": 375,
"score": 0.9836973547935486,
"start": 370,
"tag": "USERNAME",
"value": "lukas"
}
] | null | [] | package GUI.Listeners;
import API.LanguageManager;
import logic.Main;
import logic.RadixTree;
import sun.awt.WindowClosingListener;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.File;
import java.io.IOException;
/**
* Created by lukas on 14.04.15.
*/
public class WindowClosedListener implements WindowListener, ActionListener {
private static JFrame jf;
public WindowClosedListener(JFrame jf)
{
this.jf=jf;
}
@Override
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
System.out.println("test asdf 1234");
try {
Main.getQuestionTree().save(new File("./questions." + LanguageManager.lang));
} catch (IOException e2) {
e2.printStackTrace();
}
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
@Override
public void actionPerformed(ActionEvent e) {
try {
Main.getQuestionTree().save(new File("./questions." + LanguageManager.lang));
Main.getQuestionTree().save2(new File("./test2.txt"));
} catch (IOException e2) {
e2.printStackTrace();
}
jf.dispose();
}
}
| 1,638 | 0.650794 | 0.641026 | 73 | 21.438356 | 21.510103 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.30137 | false | false | 13 |
b07596c66caf7a5bd7f3e74442ff56ea8677640a | 29,076,928,658,012 | 2d90436c97fb49e949b375db0b5c827e96d4dc21 | /itinerario/src/motor/MathUtil.java | 1e37045580d3e20296210a90bcf490533321dc37 | [] | no_license | rogeriodometerco/itinerario | https://github.com/rogeriodometerco/itinerario | 93556aee3bea2ef5132e584001e0685040a9201c | f8804999c76a7ef8b1e3e93f8b5ce7dea0e26cb2 | refs/heads/master | 2016-09-06T12:31:37.103000 | 2015-05-13T01:25:51 | 2015-05-13T01:25:51 | 35,521,389 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package motor;
import modelo.PosicaoVeiculo;
public class MathUtil {
public static double calcularDistanciaEmKm(PosicaoVeiculo p1, PosicaoVeiculo p2) {
double segundos = Math.abs(p2.getDataHora().getTime() - p1.getDataHora().getTime()) / 1000;
return p2.getVelocidade() * segundos / 3600;
}
public static double calcularDistanciaEmMetros(PosicaoVeiculo p1, PosicaoVeiculo p2) {
double segundos = Math.abs(p2.getDataHora().getTime() - p1.getDataHora().getTime()) / 1000;
return p2.getVelocidade() * 1000 * segundos / 3600;
}
}
| UTF-8 | Java | 558 | java | MathUtil.java | Java | [] | null | [] | package motor;
import modelo.PosicaoVeiculo;
public class MathUtil {
public static double calcularDistanciaEmKm(PosicaoVeiculo p1, PosicaoVeiculo p2) {
double segundos = Math.abs(p2.getDataHora().getTime() - p1.getDataHora().getTime()) / 1000;
return p2.getVelocidade() * segundos / 3600;
}
public static double calcularDistanciaEmMetros(PosicaoVeiculo p1, PosicaoVeiculo p2) {
double segundos = Math.abs(p2.getDataHora().getTime() - p1.getDataHora().getTime()) / 1000;
return p2.getVelocidade() * 1000 * segundos / 3600;
}
}
| 558 | 0.722222 | 0.668459 | 16 | 32.875 | 36.197159 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false | 13 |
a87c8f1bcc5134611d448fcbafb006dae4a08f03 | 11,063,835,779,429 | 6277b169eae6891d9db4063361cb4b696e689008 | /src/main/java/com/example/leo/global/GlobalData.java | 1b39d08770fa616f6b45d48459958b0152700e05 | [] | no_license | xyeison2010/shopping_cv | https://github.com/xyeison2010/shopping_cv | 5cafe440c42b0275a6a8a90560ee9a1f97318446 | 0020156307baed38bf61dd93af7ebf78cd26f028 | refs/heads/master | 2023-07-11T13:39:00.659000 | 2023-02-17T03:48:30 | 2023-02-17T03:48:30 | 397,660,376 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.leo.global;
import java.util.ArrayList;
import java.util.List;
import com.example.leo.entity.CartItem;
import com.example.leo.entity.Product;
public class GlobalData {
public static List<Product> cart;
static {
cart = new ArrayList<Product>();
}
public static List<CartItem> cartItem;
static {
cartItem = new ArrayList<CartItem>();
}
}
| UTF-8 | Java | 366 | java | GlobalData.java | Java | [] | null | [] | package com.example.leo.global;
import java.util.ArrayList;
import java.util.List;
import com.example.leo.entity.CartItem;
import com.example.leo.entity.Product;
public class GlobalData {
public static List<Product> cart;
static {
cart = new ArrayList<Product>();
}
public static List<CartItem> cartItem;
static {
cartItem = new ArrayList<CartItem>();
}
}
| 366 | 0.751366 | 0.751366 | 23 | 14.913043 | 15.942595 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.478261 | false | false | 13 |
7e2a53d9f0695f56a43af513e258527f2242777b | 25,082,609,027,709 | 8633a4982a54c92f7e46052e008101475f93399f | /src/game/Map.java | 1e1f32f0c3f5bac681689bb6f40c30936526f666 | [] | no_license | jdavod95/Shrumz-2.0 | https://github.com/jdavod95/Shrumz-2.0 | 349bcc59e8fbfa5503262e8c83bdf8cf36ae0f0c | 966463f79f4993a8896d08ce61b1e57dc85a5374 | refs/heads/master | 2020-04-13T21:23:58.502000 | 2019-08-12T12:11:04 | 2019-08-12T12:11:04 | 163,455,225 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package game;
import java.util.ArrayList;
import java.util.List;
import render2d.elements.Point;
public class Map {
private static final int MARGIN_X = 5;
private static final int MARGIN_Y = 95;
private static int dx,dy;
private static Tile[][] table;
private static List<Tile> spreadingPlants = new ArrayList<>();
private static List<Tile> dyingPlants = new ArrayList<>();
private static List<Tile> affectors = new ArrayList<>();
public static int getX(){
return dx;
}
public static int getY(){
return dy;
}
public static Tile[][] getTable() {
return table;
}
public static Tile getTile(int x, int y){
return table[x][y];
}
public static void setTable(int x, int y){
table = new Tile[x][y];
dx = x;
dy = y;
for(int i = 0; i < dx;i++)
for(int j = 0; j < dy;j++)
table[i][j] = new Tile(
MARGIN_X + (16-i-1)*(Tile.getScale()) + j*Tile.getScale(),
MARGIN_Y + (i+1)*Tile.getScale()/2 + j*Tile.getScale()/2,
new Point(i, j)
);
}
public static void load(int x, int y, int scale){
Tile.setScale(scale);
setTable(x,y);
}
public static void toRender(){
for(Tile[] line : table)
for(Tile field : line)
field.toRender();
}
public static void toClick() {
for(Tile[] line : table)
for(Tile field : line)
field.toClick();
}
public static void reScale(int scale){
int scaledif = Tile.getScale() - scale;
Tile.setScale(scale);
for(int i = 0;i<dx;i++)
for(int j = 0;j<dy;j++)
table[i][j].reScale(
-scaledif * j + scaledif * i,
-scaledif * j / 2 - scaledif / 2 * i);
}
public static void cycle(){
for(Tile[] tbl : table)
for(Tile t : tbl)
t.cycle();
for(Tile t : spreadingPlants)
spread(t);
spreadingPlants.clear();
for(Tile t : dyingPlants)
t.killPlant();
dyingPlants.clear();
for(Tile t : affectors)
applyEffects(t);
affectors.clear();
}
public static void subSpread(Tile t){
spreadingPlants.add(t);
}
public static void subDead(Tile t){
dyingPlants.add(t);
}
public static void subAffect(Tile t){
affectors.add(t);
}
public static void spread(Tile source){
Point[] pairs = source.spreadPlant();
Point sourcePos = source.getPos();
Tile t;
for(Point ip : pairs){
try {
t = getTile(
sourcePos.getX() + ip.getX(),
sourcePos.getY() + ip.getY());
if (!t.hasPlant())
t.setPlant(source.getNewPlant());
} catch (Exception e) {}
}
}
public static void applyEffects(Tile source){
Point[] pairs = source.affectorRange();
Point sourcePos = source.getPos();
Tile t;
for(Point ip : pairs){
try {
t = getTile(
sourcePos.getX() + ip.getX(),
sourcePos.getY() + ip.getY());
t.applySoilEffect(source.affectorEffects());
} catch (Exception e) {}
}
}
}
| UTF-8 | Java | 2,804 | java | Map.java | Java | [] | null | [] | package game;
import java.util.ArrayList;
import java.util.List;
import render2d.elements.Point;
public class Map {
private static final int MARGIN_X = 5;
private static final int MARGIN_Y = 95;
private static int dx,dy;
private static Tile[][] table;
private static List<Tile> spreadingPlants = new ArrayList<>();
private static List<Tile> dyingPlants = new ArrayList<>();
private static List<Tile> affectors = new ArrayList<>();
public static int getX(){
return dx;
}
public static int getY(){
return dy;
}
public static Tile[][] getTable() {
return table;
}
public static Tile getTile(int x, int y){
return table[x][y];
}
public static void setTable(int x, int y){
table = new Tile[x][y];
dx = x;
dy = y;
for(int i = 0; i < dx;i++)
for(int j = 0; j < dy;j++)
table[i][j] = new Tile(
MARGIN_X + (16-i-1)*(Tile.getScale()) + j*Tile.getScale(),
MARGIN_Y + (i+1)*Tile.getScale()/2 + j*Tile.getScale()/2,
new Point(i, j)
);
}
public static void load(int x, int y, int scale){
Tile.setScale(scale);
setTable(x,y);
}
public static void toRender(){
for(Tile[] line : table)
for(Tile field : line)
field.toRender();
}
public static void toClick() {
for(Tile[] line : table)
for(Tile field : line)
field.toClick();
}
public static void reScale(int scale){
int scaledif = Tile.getScale() - scale;
Tile.setScale(scale);
for(int i = 0;i<dx;i++)
for(int j = 0;j<dy;j++)
table[i][j].reScale(
-scaledif * j + scaledif * i,
-scaledif * j / 2 - scaledif / 2 * i);
}
public static void cycle(){
for(Tile[] tbl : table)
for(Tile t : tbl)
t.cycle();
for(Tile t : spreadingPlants)
spread(t);
spreadingPlants.clear();
for(Tile t : dyingPlants)
t.killPlant();
dyingPlants.clear();
for(Tile t : affectors)
applyEffects(t);
affectors.clear();
}
public static void subSpread(Tile t){
spreadingPlants.add(t);
}
public static void subDead(Tile t){
dyingPlants.add(t);
}
public static void subAffect(Tile t){
affectors.add(t);
}
public static void spread(Tile source){
Point[] pairs = source.spreadPlant();
Point sourcePos = source.getPos();
Tile t;
for(Point ip : pairs){
try {
t = getTile(
sourcePos.getX() + ip.getX(),
sourcePos.getY() + ip.getY());
if (!t.hasPlant())
t.setPlant(source.getNewPlant());
} catch (Exception e) {}
}
}
public static void applyEffects(Tile source){
Point[] pairs = source.affectorRange();
Point sourcePos = source.getPos();
Tile t;
for(Point ip : pairs){
try {
t = getTile(
sourcePos.getX() + ip.getX(),
sourcePos.getY() + ip.getY());
t.applySoilEffect(source.affectorEffects());
} catch (Exception e) {}
}
}
}
| 2,804 | 0.617332 | 0.611626 | 136 | 19.617647 | 16.33296 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.411765 | false | false | 13 |
bb116f18245fc19c4068d6d4e07659e315cdb0ba | 12,833,362,339,377 | 65befe28d69189681a2c79c77d9fcbdceab3dc27 | /Algorithms/new2018/src/practice/Day2HWbfsNdfs.java | 8df8b3cb5db821fb1a85ef88b012a97c3af0f8ed | [] | no_license | solwish/TIL | https://github.com/solwish/TIL | 554a67f79c66ed5d5a5075f08b6f0369aa363249 | 4314767fa763de73238aa141e105a5cf3641a9fc | refs/heads/master | 2023-01-08T01:11:34.677000 | 2021-01-07T13:43:56 | 2021-01-07T13:43:56 | 101,876,124 | 10 | 0 | null | false | 2023-01-03T14:41:06 | 2017-08-30T12:03:25 | 2022-08-24T11:11:19 | 2023-01-03T14:41:05 | 235,506 | 6 | 0 | 171 | CSS | false | false | package practice;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Day2HWbfsNdfs {
static int N;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
int M = sc.nextInt();
int V = sc.nextInt();
int[][] map = new int[N + 1][N + 1];
int[] isVisited = new int[N + 1];
for (int i = 0; i < M; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
map[x][y] = 1;
map[y][x] = 1;
}
// dfs
isVisited[V] = 1; // 1-방문 0-미방문
dfs(V, map, isVisited);
// init
System.out.println();
for (int i = 0; i <= N; i++)
isVisited[i] = 0;
// bfs
Queue<Integer> Q = new LinkedList<>();
isVisited[V] = 1;
Q.offer(V);
while (!Q.isEmpty()) {
int u = Q.poll();
System.out.print(u + " ");
for (int i = 1; i <= N; i++) {
if (map[u][i] == 1 && isVisited[i] == 0) {
isVisited[i] = 1;
Q.offer(i);
}
}
}
}
static void dfs(int u, int[][] map, int[] isVisited) {
System.out.print(u + " ");
for (int i = 1; i <= N; i++) {
if (map[u][i] == 1 && isVisited[i] == 0) {
isVisited[i] = 1;
dfs(i, map, isVisited);
}
}
}
}
| UHC | Java | 1,190 | java | Day2HWbfsNdfs.java | Java | [] | null | [] | package practice;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Day2HWbfsNdfs {
static int N;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
int M = sc.nextInt();
int V = sc.nextInt();
int[][] map = new int[N + 1][N + 1];
int[] isVisited = new int[N + 1];
for (int i = 0; i < M; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
map[x][y] = 1;
map[y][x] = 1;
}
// dfs
isVisited[V] = 1; // 1-방문 0-미방문
dfs(V, map, isVisited);
// init
System.out.println();
for (int i = 0; i <= N; i++)
isVisited[i] = 0;
// bfs
Queue<Integer> Q = new LinkedList<>();
isVisited[V] = 1;
Q.offer(V);
while (!Q.isEmpty()) {
int u = Q.poll();
System.out.print(u + " ");
for (int i = 1; i <= N; i++) {
if (map[u][i] == 1 && isVisited[i] == 0) {
isVisited[i] = 1;
Q.offer(i);
}
}
}
}
static void dfs(int u, int[][] map, int[] isVisited) {
System.out.print(u + " ");
for (int i = 1; i <= N; i++) {
if (map[u][i] == 1 && isVisited[i] == 0) {
isVisited[i] = 1;
dfs(i, map, isVisited);
}
}
}
}
| 1,190 | 0.516102 | 0.498305 | 62 | 18.032259 | 14.321164 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.467742 | false | false | 13 |
646608758cb3ec5363bb59b5cb3ccc81d60d2479 | 28,398,323,829,281 | ad6ad544defae6f13fff651639395f894f58b94d | /ROOT/WEB-INF/classes/ConnectToMySql.java | 2a76c63a525df3d973deec9d4b6de35a95f5ff68 | [] | no_license | logiczny/bank2 | https://github.com/logiczny/bank2 | 4668e6a4bbd0e58acab80e98726d7ea841924b9e | 1ceb91006535c1a1cb9ccfbd7f3c6738d8d61215 | refs/heads/master | 2021-04-29T23:45:47.344000 | 2018-02-14T21:36:26 | 2018-02-14T21:36:26 | 121,563,535 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import javax.servlet.http.*;
import javax.servlet.*;
import javax.*;
import java.io.*;
import java.lang.System;
import java.sql.*;
import java.lang.*;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Random;
import com.mysql.*;
public class ConnectToMySql extends HttpServlet
{
public final String DB_URL = "jdbc:mysql://localhost:3306/jkbase";
public final String DB_USER = "root";
public final String DB_PW = "xxxxx";
public void init() throws ServletException
{
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = request.getSession(true);
String loggedInUser = (String)session.getAttribute("userName");
if (request.getParameter("gotoLogIn") != null)
{
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else if (request.getParameter("logIn") != null)
{
logIn(request, response);
}
else if (session.getAttribute("userName") == null)
{
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else if (request.getParameter("logOut") != null)
{
session.invalidate();
request.setAttribute("logStatus", "You are logged out.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else if (request.getParameter("gotoNewUser") != null)
{
request.getRequestDispatcher("/WEB-INF/newuser.jsp").forward(request, response);
}
else if (request.getParameter("newUser") != null)
{
newUser(request, response);
}
else if (request.getParameter("doMoneyTransfer") != null)
{
request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
}
else if (request.getParameter("codeToMail") != null)
{
moneyTransfer(request, response);
}
else if (request.getParameter("finalizeTransfer") != null)
{
finalizeTransfer(request, response);
}
else
{
showMainPage(request, response);
}
}
public void showMainPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = request.getSession(true);
request.setAttribute("accountBalance", (Double)session.getAttribute("accountBalance"));
request.setAttribute("userName", (String)session.getAttribute("userName"));
request.getRequestDispatcher("/WEB-INF/result.jsp").forward(request, response);
}
public void finalizeTransfer(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = request.getSession(true);
String enteredTransferCode = request.getParameter("transferCode");
String sentTransferCode = (String)session.getAttribute("transactionCode");
Double transferAmount = (Double)session.getAttribute("transferAmount");
String transferRecipient = (String)session.getAttribute("transferRecipient");
String userName = (String)session.getAttribute("userName");
Double newAccountBalance = (Double)session.getAttribute("accountBalance") - transferAmount;
Double newAccountBalanceRecipient = (Double)session.getAttribute("accountBalanceRecipient") + transferAmount;
String sqlquery = "";
Double accountBalanceRecipient = 0.0;
if (sentTransferCode.equals(enteredTransferCode) && !enteredTransferCode.equals(""))
{
session.setAttribute("transactionCode", "");
//request.setAttribute("transferStatus", "Transfer done");
//request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
sqlquery = "update logindata set accountbalance='" + newAccountBalance + "' where lower(username)='" + userName +"'";
PreparedStatement stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
sqlquery = "update logindata set accountbalance='" + newAccountBalanceRecipient + "' where lower(username)='" + transferRecipient +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
request.setAttribute("statusLog", "Transfer successful");
request.setAttribute("accountBalance", newAccountBalance);
request.setAttribute("userName", userName);
request.getRequestDispatcher("/WEB-INF/result.jsp").forward(request, response);
conn.close();
}
catch (Exception se){}
}
else
{
request.setAttribute("statusLog", "Wrong code. Try again or generate new code");
request.getRequestDispatcher("/WEB-INF/finalize.jsp").forward(request, response);
}
}
public void moneyTransfer(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = request.getSession(true);
Double accountBalance = (Double)session.getAttribute("accountBalance");
String userName = request.getParameter("userName");
String transferRecipient = request.getParameter("transferRecipient");
String transferAmount = request.getParameter("transferAmount");
Double transferAmountDbl = Double.parseDouble(transferAmount);
String currRecipient;
if (transferAmountDbl == 0.0)
{
request.setAttribute("transferStatus", "Enter transfer amount");
request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
return;
}
int counter = 0;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select username, accountbalance from logindata where username='" + transferRecipient + "'");
while (rs.next())
{
counter++;
session.setAttribute("accountBalanceRecipient", rs.getDouble("accountbalance"));
}
rs.close();
stmt.close();
conn.close();
}
catch (Exception x) {}
if (counter == 0)
{
request.setAttribute("transferStatus", "Recipient does not exists");
request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
return;
}
if (accountBalance < transferAmountDbl)
{
request.setAttribute("transferStatus", "You do not have enough money to make this transfer");
request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
return;
}
else
{
/*Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(1000000);
SendMail sendmail = new SendMail();
session.setAttribute("transactionCode", String.valueOf(randomInt));
session.setAttribute("transferAmount", transferAmountDbl);
session.setAttribute("transferRecipient", transferRecipient);
System.out.println(randomInt);
sendmail.SendTransferCode("pawtek@gmail.com", String.valueOf(randomInt), transferAmount, userName, transferRecipient);*/
request.setAttribute("statusLog", "Transfercode was sent to your mail address");
request.setAttribute("transferAmount", transferAmountDbl);
request.setAttribute("transferRecipient", transferRecipient);
request.getRequestDispatcher("/WEB-INF/finalize.jsp").forward(request, response);
}
}
public int resultSetCount(ResultSet rs)
{
int counter = 0;
try
{
while (rs.next())
counter++;
}
catch (Exception x) {}
return counter;
}
public void newUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String enteredUser = request.getParameter("name");
String enteredPw1 = request.getParameter("password1");
String enteredPw2 = request.getParameter("password2");
String currUser = "";
String sqlquery = "";
boolean isUser = false;
if (!enteredPw1.equals(enteredPw2))
{
request.setAttribute("userStatus", "Password 1 and password 2 and not the same. Try again.");
request.getRequestDispatcher("/WEB-INF/newuser.jsp").forward(request, response);
}
else
{
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
Statement stmt = conn.createStatement();
sqlquery = "select username from logindata where username='" + enteredUser +"'";
ResultSet rs = stmt.executeQuery(sqlquery);
while (rs.next())
{
currUser = rs.getString("username");
if (currUser.toLowerCase().equals(enteredUser.toLowerCase()))
{
isUser = true;
break;
}
}
rs.close();
stmt.close();
conn.close();
if(isUser)
{
request.setAttribute("userStatus", "User already exists. Try again.");
request.getRequestDispatcher("/WEB-INF/newuser.jsp").forward(request, response);
}
else
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn1 = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
sqlquery = "insert into logindata (username, password) values ('" + enteredUser + "','" + enteredPw1 + "')";
PreparedStatement stmt1 = conn1.prepareStatement(sqlquery);
stmt1.execute();
request.setAttribute("logStatus", "New user added. Please log on.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
stmt1.close();
conn1.close();
}
}
catch (Exception se){}
}
}
public ResultSet doSqlQuery(String sqlQuery)
{
ResultSet rsFinal = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sqlQuery);
rsFinal = rs;
rs.close();
stmt.close();
conn.close();
}
catch (Exception x) {}
int counter = 0;
try
{
while (rsFinal.next())
counter++;
}
catch (Exception x) {}
return rsFinal;
}
public void logIn(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
boolean accessGranted = false;
boolean accountBlocked = false;
Date dateNow = new Date();
Date lockedUntil;
String lockedUntilString;
HttpSession session = request.getSession(true);
int loginCounter = 0;
String enteredUser = request.getParameter("name").toLowerCase();
String enteredPw = request.getParameter("password");
if (enteredUser == "" || enteredPw == "")
{
request.setAttribute("logStatus", "Password or user cannot be empty. Try again.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
return;
}
response.setContentType("text/html");
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
Statement stmt = conn.createStatement();
PreparedStatement stmt1;
String sqlquery = "select username, password, accountbalance, lockeduntil, logincounter from logindata where lower(username)='" + enteredUser + "'";
ResultSet rs = stmt.executeQuery(sqlquery);
while (rs.next())
{
session.setAttribute("userName", rs.getString("username"));
session.setAttribute("accountBalance", rs.getDouble("accountbalance"));
loginCounter = rs.getInt("logincounter");
String test = rs.getString("logincounter");
System.out.println("AAA " + test);
lockedUntilString = rs.getString("lockeduntil");
String passwordDB = rs.getString("password");
if (lockedUntilString != null)
{
lockedUntil = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(lockedUntilString);
if (dateNow.before(lockedUntil))
accountBlocked = true;
}
if (!accountBlocked)
{
if (passwordDB.equals(enteredPw))
accessGranted = true;
}
}
rs.close();
if (accessGranted)
{
sqlquery = "update logindata set logincounter=0 where lower(username)='" + enteredUser +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
showMainPage(request, response);
}
else if (accountBlocked)
{
request.setAttribute("logStatus", "The account is blocked");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
return;
}
else
{
loginCounter++;
int triesLeft = 3 - loginCounter;
if (loginCounter >=3)
{
Date plusFifteenMinutes = new Date(System.currentTimeMillis()+15*60*1000);
String plusFifteenMinutesString = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(plusFifteenMinutes);
sqlquery = "update logindata set lockeduntil='" + plusFifteenMinutesString + "' where lower(username)='" + enteredUser +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
sqlquery = "update logindata set logincounter=0 where lower(username)='" + enteredUser +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
request.setAttribute("logStatus", "Your account is locked for 15 minutes.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else
{
sqlquery = "update logindata set logincounter=" + loginCounter +" where lower(username)='" + enteredUser +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
request.setAttribute("logStatus", "Wrong login data. You have " + triesLeft + " tries left.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
}
stmt.close();
conn.close();
}
catch (Exception se)
{System.out.println(se);}
}
public void destroy()
{
}
} | UTF-8 | Java | 17,374 | java | ConnectToMySql.java | Java | [
{
"context": "ER = \"root\";\n public final String DB_PW = \"xxxxx\";\n\n\n\n public void init() throws ServletExcepti",
"end": 473,
"score": 0.9981323480606079,
"start": 468,
"tag": "PASSWORD",
"value": "xxxxx"
},
{
"context": "tribute(\"userName\", (String)session.getAttr... | null | [] | import javax.servlet.http.*;
import javax.servlet.*;
import javax.*;
import java.io.*;
import java.lang.System;
import java.sql.*;
import java.lang.*;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Random;
import com.mysql.*;
public class ConnectToMySql extends HttpServlet
{
public final String DB_URL = "jdbc:mysql://localhost:3306/jkbase";
public final String DB_USER = "root";
public final String DB_PW = "<PASSWORD>";
public void init() throws ServletException
{
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = request.getSession(true);
String loggedInUser = (String)session.getAttribute("userName");
if (request.getParameter("gotoLogIn") != null)
{
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else if (request.getParameter("logIn") != null)
{
logIn(request, response);
}
else if (session.getAttribute("userName") == null)
{
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else if (request.getParameter("logOut") != null)
{
session.invalidate();
request.setAttribute("logStatus", "You are logged out.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else if (request.getParameter("gotoNewUser") != null)
{
request.getRequestDispatcher("/WEB-INF/newuser.jsp").forward(request, response);
}
else if (request.getParameter("newUser") != null)
{
newUser(request, response);
}
else if (request.getParameter("doMoneyTransfer") != null)
{
request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
}
else if (request.getParameter("codeToMail") != null)
{
moneyTransfer(request, response);
}
else if (request.getParameter("finalizeTransfer") != null)
{
finalizeTransfer(request, response);
}
else
{
showMainPage(request, response);
}
}
public void showMainPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = request.getSession(true);
request.setAttribute("accountBalance", (Double)session.getAttribute("accountBalance"));
request.setAttribute("userName", (String)session.getAttribute("userName"));
request.getRequestDispatcher("/WEB-INF/result.jsp").forward(request, response);
}
public void finalizeTransfer(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = request.getSession(true);
String enteredTransferCode = request.getParameter("transferCode");
String sentTransferCode = (String)session.getAttribute("transactionCode");
Double transferAmount = (Double)session.getAttribute("transferAmount");
String transferRecipient = (String)session.getAttribute("transferRecipient");
String userName = (String)session.getAttribute("userName");
Double newAccountBalance = (Double)session.getAttribute("accountBalance") - transferAmount;
Double newAccountBalanceRecipient = (Double)session.getAttribute("accountBalanceRecipient") + transferAmount;
String sqlquery = "";
Double accountBalanceRecipient = 0.0;
if (sentTransferCode.equals(enteredTransferCode) && !enteredTransferCode.equals(""))
{
session.setAttribute("transactionCode", "");
//request.setAttribute("transferStatus", "Transfer done");
//request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
sqlquery = "update logindata set accountbalance='" + newAccountBalance + "' where lower(username)='" + userName +"'";
PreparedStatement stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
sqlquery = "update logindata set accountbalance='" + newAccountBalanceRecipient + "' where lower(username)='" + transferRecipient +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
request.setAttribute("statusLog", "Transfer successful");
request.setAttribute("accountBalance", newAccountBalance);
request.setAttribute("userName", userName);
request.getRequestDispatcher("/WEB-INF/result.jsp").forward(request, response);
conn.close();
}
catch (Exception se){}
}
else
{
request.setAttribute("statusLog", "Wrong code. Try again or generate new code");
request.getRequestDispatcher("/WEB-INF/finalize.jsp").forward(request, response);
}
}
public void moneyTransfer(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = request.getSession(true);
Double accountBalance = (Double)session.getAttribute("accountBalance");
String userName = request.getParameter("userName");
String transferRecipient = request.getParameter("transferRecipient");
String transferAmount = request.getParameter("transferAmount");
Double transferAmountDbl = Double.parseDouble(transferAmount);
String currRecipient;
if (transferAmountDbl == 0.0)
{
request.setAttribute("transferStatus", "Enter transfer amount");
request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
return;
}
int counter = 0;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select username, accountbalance from logindata where username='" + transferRecipient + "'");
while (rs.next())
{
counter++;
session.setAttribute("accountBalanceRecipient", rs.getDouble("accountbalance"));
}
rs.close();
stmt.close();
conn.close();
}
catch (Exception x) {}
if (counter == 0)
{
request.setAttribute("transferStatus", "Recipient does not exists");
request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
return;
}
if (accountBalance < transferAmountDbl)
{
request.setAttribute("transferStatus", "You do not have enough money to make this transfer");
request.getRequestDispatcher("/WEB-INF/moneytransfer.jsp").forward(request, response);
return;
}
else
{
/*Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(1000000);
SendMail sendmail = new SendMail();
session.setAttribute("transactionCode", String.valueOf(randomInt));
session.setAttribute("transferAmount", transferAmountDbl);
session.setAttribute("transferRecipient", transferRecipient);
System.out.println(randomInt);
sendmail.SendTransferCode("<EMAIL>", String.valueOf(randomInt), transferAmount, userName, transferRecipient);*/
request.setAttribute("statusLog", "Transfercode was sent to your mail address");
request.setAttribute("transferAmount", transferAmountDbl);
request.setAttribute("transferRecipient", transferRecipient);
request.getRequestDispatcher("/WEB-INF/finalize.jsp").forward(request, response);
}
}
public int resultSetCount(ResultSet rs)
{
int counter = 0;
try
{
while (rs.next())
counter++;
}
catch (Exception x) {}
return counter;
}
public void newUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String enteredUser = request.getParameter("name");
String enteredPw1 = request.getParameter("password1");
String enteredPw2 = request.getParameter("password2");
String currUser = "";
String sqlquery = "";
boolean isUser = false;
if (!enteredPw1.equals(enteredPw2))
{
request.setAttribute("userStatus", "Password 1 and password 2 and not the same. Try again.");
request.getRequestDispatcher("/WEB-INF/newuser.jsp").forward(request, response);
}
else
{
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
Statement stmt = conn.createStatement();
sqlquery = "select username from logindata where username='" + enteredUser +"'";
ResultSet rs = stmt.executeQuery(sqlquery);
while (rs.next())
{
currUser = rs.getString("username");
if (currUser.toLowerCase().equals(enteredUser.toLowerCase()))
{
isUser = true;
break;
}
}
rs.close();
stmt.close();
conn.close();
if(isUser)
{
request.setAttribute("userStatus", "User already exists. Try again.");
request.getRequestDispatcher("/WEB-INF/newuser.jsp").forward(request, response);
}
else
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn1 = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
sqlquery = "insert into logindata (username, password) values ('" + enteredUser + "','" + enteredPw1 + "')";
PreparedStatement stmt1 = conn1.prepareStatement(sqlquery);
stmt1.execute();
request.setAttribute("logStatus", "New user added. Please log on.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
stmt1.close();
conn1.close();
}
}
catch (Exception se){}
}
}
public ResultSet doSqlQuery(String sqlQuery)
{
ResultSet rsFinal = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sqlQuery);
rsFinal = rs;
rs.close();
stmt.close();
conn.close();
}
catch (Exception x) {}
int counter = 0;
try
{
while (rsFinal.next())
counter++;
}
catch (Exception x) {}
return rsFinal;
}
public void logIn(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
boolean accessGranted = false;
boolean accountBlocked = false;
Date dateNow = new Date();
Date lockedUntil;
String lockedUntilString;
HttpSession session = request.getSession(true);
int loginCounter = 0;
String enteredUser = request.getParameter("name").toLowerCase();
String enteredPw = request.getParameter("password");
if (enteredUser == "" || enteredPw == "")
{
request.setAttribute("logStatus", "Password or user cannot be empty. Try again.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
return;
}
response.setContentType("text/html");
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PW);
Statement stmt = conn.createStatement();
PreparedStatement stmt1;
String sqlquery = "select username, password, accountbalance, lockeduntil, logincounter from logindata where lower(username)='" + enteredUser + "'";
ResultSet rs = stmt.executeQuery(sqlquery);
while (rs.next())
{
session.setAttribute("userName", rs.getString("username"));
session.setAttribute("accountBalance", rs.getDouble("accountbalance"));
loginCounter = rs.getInt("logincounter");
String test = rs.getString("logincounter");
System.out.println("AAA " + test);
lockedUntilString = rs.getString("lockeduntil");
String passwordDB = rs.getString("<PASSWORD>");
if (lockedUntilString != null)
{
lockedUntil = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(lockedUntilString);
if (dateNow.before(lockedUntil))
accountBlocked = true;
}
if (!accountBlocked)
{
if (passwordDB.equals(enteredPw))
accessGranted = true;
}
}
rs.close();
if (accessGranted)
{
sqlquery = "update logindata set logincounter=0 where lower(username)='" + enteredUser +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
showMainPage(request, response);
}
else if (accountBlocked)
{
request.setAttribute("logStatus", "The account is blocked");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
return;
}
else
{
loginCounter++;
int triesLeft = 3 - loginCounter;
if (loginCounter >=3)
{
Date plusFifteenMinutes = new Date(System.currentTimeMillis()+15*60*1000);
String plusFifteenMinutesString = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(plusFifteenMinutes);
sqlquery = "update logindata set lockeduntil='" + plusFifteenMinutesString + "' where lower(username)='" + enteredUser +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
sqlquery = "update logindata set logincounter=0 where lower(username)='" + enteredUser +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
request.setAttribute("logStatus", "Your account is locked for 15 minutes.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else
{
sqlquery = "update logindata set logincounter=" + loginCounter +" where lower(username)='" + enteredUser +"'";
stmt1 = conn.prepareStatement(sqlquery);
stmt1.execute();
stmt1.close();
request.setAttribute("logStatus", "Wrong login data. You have " + triesLeft + " tries left.");
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
}
stmt.close();
conn.close();
}
catch (Exception se)
{System.out.println(se);}
}
public void destroy()
{
}
} | 17,372 | 0.554679 | 0.550766 | 459 | 36.849674 | 35.376179 | 160 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.664488 | false | false | 13 |
9ab3d1985090ad14987ecc34f3c42c851eee2fca | 15,092,515,084,089 | 6f79e2f4555228fcdeb20e5d68c6f5e6c7b93db1 | /nexus/nexus-test-harness/nexus-test-harness-its/src/test/java/org/sonatype/nexus/integrationtests/nexus533/Nexus533TaskCronIT.java | 9834c338dd5706507ab8aa7298caf15c465011b8 | [] | no_license | mcculls/nexus | https://github.com/mcculls/nexus | 5321b47cfc0bbcffa13f9b49f65ce031f6dbbaf6 | a45c5340718b6c7493f0a4b68399712a5558d2a6 | refs/heads/master | 2021-01-18T10:26:52.854000 | 2012-08-27T13:59:01 | 2012-08-27T13:59:01 | 1,614,895 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2007-2012 Sonatype, Inc.
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.nexus.integrationtests.nexus533;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.lang.time.DateUtils;
import org.sonatype.nexus.rest.model.ScheduledServiceAdvancedResource;
import org.sonatype.nexus.rest.model.ScheduledServicePropertyResource;
import org.sonatype.nexus.tasks.descriptors.UpdateIndexTaskDescriptor;
public class Nexus533TaskCronIT
extends AbstractNexusTasksIntegrationIT<ScheduledServiceAdvancedResource>
{
private static ScheduledServiceAdvancedResource scheduledTask;
@Override
public ScheduledServiceAdvancedResource getTaskScheduled()
{
if ( scheduledTask == null )
{
scheduledTask = new ScheduledServiceAdvancedResource();
scheduledTask.setEnabled( true );
scheduledTask.setId( null );
scheduledTask.setName( "taskAdvanced" );
scheduledTask.setSchedule( "advanced" );
// A future date
Date startDate = DateUtils.addDays( new Date(), 10 );
startDate = DateUtils.round( startDate, Calendar.DAY_OF_MONTH );
scheduledTask.setCronCommand( "0 0 12 ? * WED" );
scheduledTask.setTypeId( UpdateIndexTaskDescriptor.ID );
ScheduledServicePropertyResource prop = new ScheduledServicePropertyResource();
prop.setKey( "repositoryId" );
prop.setValue( "all_repo" );
scheduledTask.addProperty( prop );
}
return scheduledTask;
}
@Override
public void updateTask( ScheduledServiceAdvancedResource scheduledTask )
{
scheduledTask.setCronCommand( "0 0 12 ? * WED,FRI" );
}
}
| UTF-8 | Java | 2,463 | java | Nexus533TaskCronIT.java | Java | [
{
"context": "vicePropertyResource();\n prop.setKey( \"repositoryId\" );\n prop.setValue( \"all_repo\" );\n ",
"end": 2155,
"score": 0.7746487259864807,
"start": 2143,
"tag": "KEY",
"value": "repositoryId"
}
] | null | [] | /**
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2007-2012 Sonatype, Inc.
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.nexus.integrationtests.nexus533;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.lang.time.DateUtils;
import org.sonatype.nexus.rest.model.ScheduledServiceAdvancedResource;
import org.sonatype.nexus.rest.model.ScheduledServicePropertyResource;
import org.sonatype.nexus.tasks.descriptors.UpdateIndexTaskDescriptor;
public class Nexus533TaskCronIT
extends AbstractNexusTasksIntegrationIT<ScheduledServiceAdvancedResource>
{
private static ScheduledServiceAdvancedResource scheduledTask;
@Override
public ScheduledServiceAdvancedResource getTaskScheduled()
{
if ( scheduledTask == null )
{
scheduledTask = new ScheduledServiceAdvancedResource();
scheduledTask.setEnabled( true );
scheduledTask.setId( null );
scheduledTask.setName( "taskAdvanced" );
scheduledTask.setSchedule( "advanced" );
// A future date
Date startDate = DateUtils.addDays( new Date(), 10 );
startDate = DateUtils.round( startDate, Calendar.DAY_OF_MONTH );
scheduledTask.setCronCommand( "0 0 12 ? * WED" );
scheduledTask.setTypeId( UpdateIndexTaskDescriptor.ID );
ScheduledServicePropertyResource prop = new ScheduledServicePropertyResource();
prop.setKey( "repositoryId" );
prop.setValue( "all_repo" );
scheduledTask.addProperty( prop );
}
return scheduledTask;
}
@Override
public void updateTask( ScheduledServiceAdvancedResource scheduledTask )
{
scheduledTask.setCronCommand( "0 0 12 ? * WED,FRI" );
}
}
| 2,463 | 0.716606 | 0.704831 | 60 | 40.049999 | 36.142506 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
c89d87d904a8bb679853daf127bb207c27935132 | 2,723,009,324,727 | 2e479470e6870e0bb98448baba85d6a33153745d | /src/main/java/com/ebstrada/formreturn/manager/gef/base/NearAction.java | c8a0a684afca4c9a765141fff1627141b5f025a5 | [
"MIT"
] | permissive | rvkmar/formreturn | https://github.com/rvkmar/formreturn | b0fae5814583f27218690f760bc6a9830e3f247b | a4398aeef6c58c7a568b55b4da64aac4f9299eba | refs/heads/master | 2023-07-16T01:05:34.688000 | 2020-08-06T00:22:29 | 2020-08-06T00:22:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ebstrada.formreturn.manager.gef.base;
import java.awt.event.ActionEvent;
import javax.swing.Icon;
import com.ebstrada.formreturn.manager.gef.undo.UndoableAction;
import com.ebstrada.formreturn.manager.gef.util.Localizer;
/**
* Action to SelectNear Figs by a small distance. This is useful when you want
* to get diagrams to look just right and you are not to steady with the mouse.
* Also allows user to keep hands on keyboard.
*/
public class NearAction extends UndoableAction {
private static final long serialVersionUID = -4295539588596245495L;
// //////////////////////////////////////////////////////////////
// constants
public static final int LEFT = 1;
public static final int RIGHT = 2;
public static final int UP = 3;
public static final int DOWN = 4;
// //////////////////////////////////////////////////////////////
// instance variables
private int direction;
private int magnitude;
// //////////////////////////////////////////////////////////////
// constructor
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param direction The direction of the nudge
*/
public NearAction(String name, int direction) {
this(name, direction, 1, false);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param direction The direction of the nudge
* @param magnitude The magnitude of the nudge
*/
public NearAction(String name, int direction, int magnitude) {
this(name, direction, magnitude, false);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param icon The icon of the action
* @param direction The direction of the nudge
*/
public NearAction(String name, Icon icon, int direction) {
this(name, icon, direction, 1, false);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param icon The icon of the action
* @param direction The direction of the nudge
* @param magnitude The magnitude of the nudge
*/
public NearAction(String name, Icon icon, int direction, int magnitude) {
this(name, icon, direction, magnitude, false);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param direction The direction of the nudge
* @param localize Whether to localize the name or not
*/
public NearAction(String name, int direction, boolean localize) {
this(name, direction, 1, localize);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param direction The direction of the nudge
* @param magnitude The magnitude of the nudge
* @param localize Whether to localize the name or not
*/
public NearAction(String name, int direction, int magnitude, boolean localize) {
super(localize ? Localizer.localize("GefBase", name) : name);
this.direction = direction;
this.magnitude = magnitude;
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param icon The icon of the action
* @param direction The direction of the nudge
* @param localize Whether to localize the name or not
*/
public NearAction(String name, Icon icon, int direction, boolean localize) {
this(name, icon, direction, 1, localize);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param icon The icon of the action
* @param direction The direction of the nudge
* @param magnitude The magnitude of the nudge
* @param localize Whether to localize the name or not
*/
public NearAction(String name, Icon icon, int direction, int magnitude, boolean localize) {
super(localize ? Localizer.localize("GefBase", name) : name, icon);
this.direction = direction;
this.magnitude = magnitude;
}
// //////////////////////////////////////////////////////////////
// Action API
/**
* Move the selected items a few pixels in the given direction. Note that
* the sign convention is the opposite of ScrollAction.
*/
@Override public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
Editor ce = Globals.curEditor();
SelectionManager sm = ce.getSelectionManager();
if (sm.getLocked()) {
Globals.showStatus("Cannot Modify Locked Objects");
return;
}
int dx = 0, dy = 0;
switch (direction) {
case LEFT:
dx = 0 - magnitude;
break;
case RIGHT:
dx = magnitude;
break;
case UP:
dy = 0 - magnitude;
break;
case DOWN:
dy = magnitude;
break;
}
// Should I move it so that it aligns with the next grid?
sm.translate(dx, dy);
sm.endTrans();
}
}
| UTF-8 | Java | 5,370 | java | NearAction.java | Java | [] | null | [] | package com.ebstrada.formreturn.manager.gef.base;
import java.awt.event.ActionEvent;
import javax.swing.Icon;
import com.ebstrada.formreturn.manager.gef.undo.UndoableAction;
import com.ebstrada.formreturn.manager.gef.util.Localizer;
/**
* Action to SelectNear Figs by a small distance. This is useful when you want
* to get diagrams to look just right and you are not to steady with the mouse.
* Also allows user to keep hands on keyboard.
*/
public class NearAction extends UndoableAction {
private static final long serialVersionUID = -4295539588596245495L;
// //////////////////////////////////////////////////////////////
// constants
public static final int LEFT = 1;
public static final int RIGHT = 2;
public static final int UP = 3;
public static final int DOWN = 4;
// //////////////////////////////////////////////////////////////
// instance variables
private int direction;
private int magnitude;
// //////////////////////////////////////////////////////////////
// constructor
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param direction The direction of the nudge
*/
public NearAction(String name, int direction) {
this(name, direction, 1, false);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param direction The direction of the nudge
* @param magnitude The magnitude of the nudge
*/
public NearAction(String name, int direction, int magnitude) {
this(name, direction, magnitude, false);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param icon The icon of the action
* @param direction The direction of the nudge
*/
public NearAction(String name, Icon icon, int direction) {
this(name, icon, direction, 1, false);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param icon The icon of the action
* @param direction The direction of the nudge
* @param magnitude The magnitude of the nudge
*/
public NearAction(String name, Icon icon, int direction, int magnitude) {
this(name, icon, direction, magnitude, false);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param direction The direction of the nudge
* @param localize Whether to localize the name or not
*/
public NearAction(String name, int direction, boolean localize) {
this(name, direction, 1, localize);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param direction The direction of the nudge
* @param magnitude The magnitude of the nudge
* @param localize Whether to localize the name or not
*/
public NearAction(String name, int direction, int magnitude, boolean localize) {
super(localize ? Localizer.localize("GefBase", name) : name);
this.direction = direction;
this.magnitude = magnitude;
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param icon The icon of the action
* @param direction The direction of the nudge
* @param localize Whether to localize the name or not
*/
public NearAction(String name, Icon icon, int direction, boolean localize) {
this(name, icon, direction, 1, localize);
}
/**
* Creates a new NearAction
*
* @param name The name of the action
* @param icon The icon of the action
* @param direction The direction of the nudge
* @param magnitude The magnitude of the nudge
* @param localize Whether to localize the name or not
*/
public NearAction(String name, Icon icon, int direction, int magnitude, boolean localize) {
super(localize ? Localizer.localize("GefBase", name) : name, icon);
this.direction = direction;
this.magnitude = magnitude;
}
// //////////////////////////////////////////////////////////////
// Action API
/**
* Move the selected items a few pixels in the given direction. Note that
* the sign convention is the opposite of ScrollAction.
*/
@Override public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
Editor ce = Globals.curEditor();
SelectionManager sm = ce.getSelectionManager();
if (sm.getLocked()) {
Globals.showStatus("Cannot Modify Locked Objects");
return;
}
int dx = 0, dy = 0;
switch (direction) {
case LEFT:
dx = 0 - magnitude;
break;
case RIGHT:
dx = magnitude;
break;
case UP:
dy = 0 - magnitude;
break;
case DOWN:
dy = magnitude;
break;
}
// Should I move it so that it aligns with the next grid?
sm.translate(dx, dy);
sm.endTrans();
}
}
| 5,370 | 0.559404 | 0.553631 | 165 | 30.545454 | 24.19002 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.521212 | false | false | 13 |
f3d5cc0156361686493bbd5e9550c1d413e15719 | 3,770,981,313,576 | 47e764469f118690f569626a194100951c145aa6 | /scripts/java/database_scripts/src/main/java/tables/Manufacturer.java | ab0d75a2e6e05c64db099bb5669e5a277f15aaa8 | [] | no_license | cdiebold/adellis_product_catalog | https://github.com/cdiebold/adellis_product_catalog | 91b7e0764e0d04d7434e05b5f1854a305abc14ac | 7bafe69c2ac07cef113885e8d4ec0fcc69973e80 | refs/heads/master | 2020-03-28T13:24:06.400000 | 2018-09-11T23:21:39 | 2018-09-11T23:21:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tables;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.*;
import java.util.*;
public class Manufacturer {
private String partNumber;
private String agency;
private String name;
public Manufacturer(String partNumber, String agency, String name) {
this.partNumber = partNumber;
this.name = name;
if(agency == null) {
agency = "";
}
else {
this.agency = agency;
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Manufacturer that = (Manufacturer) o;
return Objects.equals(partNumber, that.partNumber) &&
Objects.equals(agency, that.agency) &&
Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(partNumber, agency, name);
}
public String toElixir() {
if(!agency.isEmpty()) {
return String.format("%%Manufacturer{part_number: \"%s\", agency_code: \"%s\", name: \"%s\"}",
partNumber, agency, name);
}
return String.format("%%Manufacturer{part_number: \"%s\", name: \"%s\"}",
partNumber, name);
}
public static List<Manufacturer> parse(File file) throws IOException {
FileInputStream excelFile = new FileInputStream(file);
Set<Manufacturer> manufacturers = new HashSet<>();
Workbook workbook = new XSSFWorkbook(excelFile);
Sheet sheet = workbook.getSheetAt(1);
Iterator<Row> rowIterator = sheet.rowIterator();
rowIterator.next(); // skip header row
while(rowIterator.hasNext()) {
Row row = rowIterator.next();
Cell partNumberCell = row.getCell(1);
Cell agencyCell = row.getCell(7);
Cell nameCell = row.getCell(8);
String partNumber = "";
if(partNumberCell != null && partNumberCell.getCellTypeEnum() != CellType.BLANK) {
if(partNumberCell.getCellTypeEnum() == CellType.NUMERIC) {
partNumber = String.valueOf(partNumberCell.getNumericCellValue());
}
else {
partNumber = partNumberCell.getStringCellValue();
}
}
String agency = "";
if(agencyCell != null && agencyCell.getCellTypeEnum() != CellType.BLANK) {
if(agencyCell.getCellTypeEnum() == CellType.NUMERIC) {
agency = String.valueOf((int)agencyCell.getNumericCellValue());
}
else {
agency = agencyCell.getStringCellValue();
}
}
String name = "";
if(nameCell != null && nameCell.getCellTypeEnum() != CellType.BLANK) {
name = nameCell.getStringCellValue();
}
manufacturers.add(new Manufacturer(partNumber, agency, name));
}
return new ArrayList<>(manufacturers);
}
public static void main(String[] args) {
List<Manufacturer> manufacturers = new ArrayList<>();
try {
manufacturers = Manufacturer.parse(new File("/home/chris/developer/adellis_phx/scripts/java/database_scripts/src/main/resources/data/export_table_NSNMCRL(1).xlsx"));
}catch (Exception e) {
e.printStackTrace();
}
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter("manufacturer.exs");
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(manufacturers.size());
PrintWriter printWriter = new PrintWriter(fileWriter);
printWriter.write("alias Adellis.Catalog.Manufacturer\n");
printWriter.write("alias Adellis.Repo\n");
printWriter.write("manufacturers = [ \n");
for (int i = 0; i < manufacturers.size(); i++) {
printWriter.write(manufacturers.get(i).toElixir());
if (i < manufacturers.size() - 1) {
printWriter.write(",\n");
}
}
printWriter.write("\n");
printWriter.write("]\n\n\n");
printWriter.write("Enum.map(manufacturers, fn manufacturer -> Repo.insert!(manufacturer) end)");
printWriter.close();
}
}
| UTF-8 | Java | 4,448 | java | Manufacturer.java | Java | [] | null | [] | package tables;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.*;
import java.util.*;
public class Manufacturer {
private String partNumber;
private String agency;
private String name;
public Manufacturer(String partNumber, String agency, String name) {
this.partNumber = partNumber;
this.name = name;
if(agency == null) {
agency = "";
}
else {
this.agency = agency;
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Manufacturer that = (Manufacturer) o;
return Objects.equals(partNumber, that.partNumber) &&
Objects.equals(agency, that.agency) &&
Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(partNumber, agency, name);
}
public String toElixir() {
if(!agency.isEmpty()) {
return String.format("%%Manufacturer{part_number: \"%s\", agency_code: \"%s\", name: \"%s\"}",
partNumber, agency, name);
}
return String.format("%%Manufacturer{part_number: \"%s\", name: \"%s\"}",
partNumber, name);
}
public static List<Manufacturer> parse(File file) throws IOException {
FileInputStream excelFile = new FileInputStream(file);
Set<Manufacturer> manufacturers = new HashSet<>();
Workbook workbook = new XSSFWorkbook(excelFile);
Sheet sheet = workbook.getSheetAt(1);
Iterator<Row> rowIterator = sheet.rowIterator();
rowIterator.next(); // skip header row
while(rowIterator.hasNext()) {
Row row = rowIterator.next();
Cell partNumberCell = row.getCell(1);
Cell agencyCell = row.getCell(7);
Cell nameCell = row.getCell(8);
String partNumber = "";
if(partNumberCell != null && partNumberCell.getCellTypeEnum() != CellType.BLANK) {
if(partNumberCell.getCellTypeEnum() == CellType.NUMERIC) {
partNumber = String.valueOf(partNumberCell.getNumericCellValue());
}
else {
partNumber = partNumberCell.getStringCellValue();
}
}
String agency = "";
if(agencyCell != null && agencyCell.getCellTypeEnum() != CellType.BLANK) {
if(agencyCell.getCellTypeEnum() == CellType.NUMERIC) {
agency = String.valueOf((int)agencyCell.getNumericCellValue());
}
else {
agency = agencyCell.getStringCellValue();
}
}
String name = "";
if(nameCell != null && nameCell.getCellTypeEnum() != CellType.BLANK) {
name = nameCell.getStringCellValue();
}
manufacturers.add(new Manufacturer(partNumber, agency, name));
}
return new ArrayList<>(manufacturers);
}
public static void main(String[] args) {
List<Manufacturer> manufacturers = new ArrayList<>();
try {
manufacturers = Manufacturer.parse(new File("/home/chris/developer/adellis_phx/scripts/java/database_scripts/src/main/resources/data/export_table_NSNMCRL(1).xlsx"));
}catch (Exception e) {
e.printStackTrace();
}
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter("manufacturer.exs");
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(manufacturers.size());
PrintWriter printWriter = new PrintWriter(fileWriter);
printWriter.write("alias Adellis.Catalog.Manufacturer\n");
printWriter.write("alias Adellis.Repo\n");
printWriter.write("manufacturers = [ \n");
for (int i = 0; i < manufacturers.size(); i++) {
printWriter.write(manufacturers.get(i).toElixir());
if (i < manufacturers.size() - 1) {
printWriter.write(",\n");
}
}
printWriter.write("\n");
printWriter.write("]\n\n\n");
printWriter.write("Enum.map(manufacturers, fn manufacturer -> Repo.insert!(manufacturer) end)");
printWriter.close();
}
}
| 4,448 | 0.566996 | 0.565423 | 128 | 33.75 | 29.173243 | 177 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.617188 | false | false | 13 |
65ddcb650fac40d0a6e69cb8e1660aa4cbf93665 | 30,425,548,327,452 | b342daa4ab78afe77eb2e324bfc2a904e98a7cca | /Minesweeper/task/test/MinesweeperTest.java | a34d4429e0d4962565f25b33eb29033ccad92cb2 | [] | no_license | 6ofhearts/Minesweeper | https://github.com/6ofhearts/Minesweeper | fae0f0b69b6a2c53e690d9a98e2e744199acbbab | 266706b9a225eb9675b318deeb655707479a5900 | refs/heads/master | 2023-08-28T04:09:05.548000 | 2021-11-02T14:30:49 | 2021-11-02T14:30:49 | 423,877,362 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import org.hyperskill.hstest.stage.StageTest;
import org.hyperskill.hstest.testcase.CheckResult;
import org.hyperskill.hstest.testcase.TestCase;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
public class MinesweeperTest extends StageTest {
@Override
public List<TestCase> generate() {
return Arrays.asList(
new TestCase<>()
);
}
@Override
public CheckResult check(String reply, Object attach) {
List<String> lines =
Arrays.stream(reply.split("\n"))
.map(String::trim)
.collect(Collectors.toList());
if (lines.isEmpty()) {
return CheckResult.wrong(
"Looks like you didn't output a single line!"
);
}
int firstLineLength = lines.get(0).length();
if (lines.size() < 2) {
return CheckResult.wrong("Your game field should contain at least 2 lines.");
}
Set<Character> symbols = new TreeSet<>();
for (String line : lines) {
int currLineLength = line.length();
if (currLineLength != firstLineLength) {
return CheckResult.wrong(
"You have lines with different lengths!\n" +
"Found lines with " + currLineLength + " and " +
firstLineLength + " length."
);
}
for (char c : line.toCharArray()) {
symbols.add(c);
if (symbols.size() == 3) {
Character[] ch = symbols.toArray(new Character[0]);
char first = ch[0];
char second = ch[1];
char third = ch[2];
return CheckResult.wrong(
"There are three different symbols, " +
"but there must be two - " +
"one for mines, one for safe zones. " +
"Symbols found: " +
"\'" + first + "\', " +
"\'" + second + "\', " +
"\'" + third + "\'."
);
}
}
}
if (symbols.size() < 2) {
return CheckResult.wrong("Your field should contain 2 different symbols: " +
"one for mines, one for safe zones.");
}
return CheckResult.correct();
}
}
| UTF-8 | Java | 2,545 | java | MinesweeperTest.java | Java | [] | null | [] | import org.hyperskill.hstest.stage.StageTest;
import org.hyperskill.hstest.testcase.CheckResult;
import org.hyperskill.hstest.testcase.TestCase;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
public class MinesweeperTest extends StageTest {
@Override
public List<TestCase> generate() {
return Arrays.asList(
new TestCase<>()
);
}
@Override
public CheckResult check(String reply, Object attach) {
List<String> lines =
Arrays.stream(reply.split("\n"))
.map(String::trim)
.collect(Collectors.toList());
if (lines.isEmpty()) {
return CheckResult.wrong(
"Looks like you didn't output a single line!"
);
}
int firstLineLength = lines.get(0).length();
if (lines.size() < 2) {
return CheckResult.wrong("Your game field should contain at least 2 lines.");
}
Set<Character> symbols = new TreeSet<>();
for (String line : lines) {
int currLineLength = line.length();
if (currLineLength != firstLineLength) {
return CheckResult.wrong(
"You have lines with different lengths!\n" +
"Found lines with " + currLineLength + " and " +
firstLineLength + " length."
);
}
for (char c : line.toCharArray()) {
symbols.add(c);
if (symbols.size() == 3) {
Character[] ch = symbols.toArray(new Character[0]);
char first = ch[0];
char second = ch[1];
char third = ch[2];
return CheckResult.wrong(
"There are three different symbols, " +
"but there must be two - " +
"one for mines, one for safe zones. " +
"Symbols found: " +
"\'" + first + "\', " +
"\'" + second + "\', " +
"\'" + third + "\'."
);
}
}
}
if (symbols.size() < 2) {
return CheckResult.wrong("Your field should contain 2 different symbols: " +
"one for mines, one for safe zones.");
}
return CheckResult.correct();
}
}
| 2,545 | 0.479371 | 0.475442 | 80 | 30.8125 | 23.014721 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 13 |
727092ff89ec0c3d5ee356b44fbc75fe477a555b | 31,963,146,633,737 | 1e22bceaa08b63f02f537b446a21a18c7211bfee | /src/semanticAction/ValidateConstant.java | 9fe995912db552e688227b5a09560e03e8304f78 | [] | no_license | mcordischi/UNICEN-compiler | https://github.com/mcordischi/UNICEN-compiler | 66c50342656a1f264d81c153b14cc7ffad48cc04 | cb7904cb0515ca183275d180bed8e778bc9ea012 | refs/heads/master | 2020-04-23T14:24:04.011000 | 2014-06-13T02:39:58 | 2014-06-13T02:39:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package semanticAction;
import symbolTable.*;
public class ValidateConstant extends ValidationAction {
public static int MAXVALUE = 65535;
@Override
public String validate() {
if (buffer.length() < 6){
Integer uint = new Integer(buffer);
if (MAXVALUE > uint.intValue() ){
critical = false;
return null;
}
}
critical = true ;
return "Valor fuera de rango";
}
@Override
public TableEntry generateEntry() {
UintEntry result = new UintEntry(buffer);
return result ;
}
@Override
public boolean unget() {
return true;
}
@Override
public void run(char c) {
}
}
| UTF-8 | Java | 609 | java | ValidateConstant.java | Java | [] | null | [] | package semanticAction;
import symbolTable.*;
public class ValidateConstant extends ValidationAction {
public static int MAXVALUE = 65535;
@Override
public String validate() {
if (buffer.length() < 6){
Integer uint = new Integer(buffer);
if (MAXVALUE > uint.intValue() ){
critical = false;
return null;
}
}
critical = true ;
return "Valor fuera de rango";
}
@Override
public TableEntry generateEntry() {
UintEntry result = new UintEntry(buffer);
return result ;
}
@Override
public boolean unget() {
return true;
}
@Override
public void run(char c) {
}
}
| 609 | 0.673235 | 0.663383 | 37 | 15.459459 | 15.000171 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.513514 | false | false | 13 |
b2ee6b2540ec8ff092aad7c92012d4ed74826807 | 31,233,002,236,544 | f9bfb14ce796f485e084c56254db342cb087198f | /HJB-Spider/src/main/java/com/hjb/spider/service/SpiderRunService.java | 797d38a9a591962ca905691365618ecdec305337 | [] | no_license | bensonHe/HJB | https://github.com/bensonHe/HJB | 81b5c050f11000448a4a984460514c61932878cb | 710b79f790162c8c3c040064b50320f9eded50d8 | refs/heads/master | 2021-01-17T21:09:26.185000 | 2017-05-24T11:47:17 | 2017-05-24T11:47:17 | 84,162,931 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hjb.spider.service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hjb.spider.db.HouseInfoDao;
import com.hjb.spider.entity.HourseInfo;
import com.hjb.spider.resource.LianjiaResource;
@Service
public class SpiderRunService {
@Autowired
private LianjiaResource resource;
public static final Logger logger = LoggerFactory.getLogger(SpiderRunService.class);
@Autowired
private HouseInfoDao houseInfoDao;
public void startCatch(int page) {
List<HourseInfo> listHouses = resource.getNewPub(page);
for (HourseInfo hourseInfo : listHouses) {
Map<String, Object> data = houseInfoDao.selectByHouseId(hourseInfo.getHourseId());
// if house record exist
if (data == null) {
houseInfoDao.insert(hourseInfo);
} else {
BigDecimal firstTotalPrice = (BigDecimal) data.get("first_total_price");
BigDecimal lastTotalPrice = (BigDecimal) data.get("total_price");
if (lastTotalPrice.compareTo(hourseInfo.getTotalPrice()) != 0) {
hourseInfo.setChangePrice(hourseInfo.getTotalPrice().subtract(firstTotalPrice));
hourseInfo.setLastTotalPrice(lastTotalPrice);
houseInfoDao.updateByHouseId(hourseInfo);
}
}
}
}
}
| UTF-8 | Java | 1,421 | java | SpiderRunService.java | Java | [] | null | [] | package com.hjb.spider.service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hjb.spider.db.HouseInfoDao;
import com.hjb.spider.entity.HourseInfo;
import com.hjb.spider.resource.LianjiaResource;
@Service
public class SpiderRunService {
@Autowired
private LianjiaResource resource;
public static final Logger logger = LoggerFactory.getLogger(SpiderRunService.class);
@Autowired
private HouseInfoDao houseInfoDao;
public void startCatch(int page) {
List<HourseInfo> listHouses = resource.getNewPub(page);
for (HourseInfo hourseInfo : listHouses) {
Map<String, Object> data = houseInfoDao.selectByHouseId(hourseInfo.getHourseId());
// if house record exist
if (data == null) {
houseInfoDao.insert(hourseInfo);
} else {
BigDecimal firstTotalPrice = (BigDecimal) data.get("first_total_price");
BigDecimal lastTotalPrice = (BigDecimal) data.get("total_price");
if (lastTotalPrice.compareTo(hourseInfo.getTotalPrice()) != 0) {
hourseInfo.setChangePrice(hourseInfo.getTotalPrice().subtract(firstTotalPrice));
hourseInfo.setLastTotalPrice(lastTotalPrice);
houseInfoDao.updateByHouseId(hourseInfo);
}
}
}
}
}
| 1,421 | 0.743842 | 0.741731 | 45 | 29.577778 | 25.925953 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.911111 | false | false | 13 |
57b06632660a8d5e18405af011d4200ab20a730b | 6,262,062,366,282 | 4236d05a2c2229281539593d350468279d4bfa18 | /src/main/java/tfc/twitter/dao/PlaceDAO.java | 21d0d30bcef0592b46a1e3afbf1dde972bf3c35b | [] | no_license | esau/tfc | https://github.com/esau/tfc | 29f198cc647a109650b78647afe13bf2f5d387b8 | e3747c9b69e1c02dbf9343b2ffa2fc8c40f9cd24 | refs/heads/master | 2021-01-23T08:39:47.892000 | 2014-06-07T18:40:00 | 2014-06-07T18:40:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tfc.twitter.dao;
import org.springframework.stereotype.Repository;
import tfc.twitter.TwitterManager;
import twitter4j.Place;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.api.PlacesGeoResources;
/**
* TFC
* User: Esaú González
* Date: 27/04/14
* Time: 17:55
*/
@Repository("TPlaceDAO")
public class PlaceDAO {
Twitter twitter;
PlacesGeoResources placesGeoResources;
public PlaceDAO() {
twitter = TwitterFactory.getSingleton();
placesGeoResources = twitter.placesGeo();
}
public Place findPlaceById(String pPlaceId) throws InterruptedException {
Place toReturn = null;
do {
try {
toReturn = placesGeoResources.getGeoDetails(pPlaceId);
} catch (TwitterException e) {
TwitterManager.handleTwitterException(e);
}
} while (toReturn==null);
return toReturn;
}
}
| UTF-8 | Java | 986 | java | PlaceDAO.java | Java | [
{
"context": "ter4j.api.PlacesGeoResources;\n\n/**\n * TFC\n * User: Esaú González\n * Date: 27/04/14\n * Time: 17:55\n */\n@Repository(",
"end": 304,
"score": 0.9998605847358704,
"start": 291,
"tag": "NAME",
"value": "Esaú González"
}
] | null | [] | package tfc.twitter.dao;
import org.springframework.stereotype.Repository;
import tfc.twitter.TwitterManager;
import twitter4j.Place;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.api.PlacesGeoResources;
/**
* TFC
* User: <NAME>
* Date: 27/04/14
* Time: 17:55
*/
@Repository("TPlaceDAO")
public class PlaceDAO {
Twitter twitter;
PlacesGeoResources placesGeoResources;
public PlaceDAO() {
twitter = TwitterFactory.getSingleton();
placesGeoResources = twitter.placesGeo();
}
public Place findPlaceById(String pPlaceId) throws InterruptedException {
Place toReturn = null;
do {
try {
toReturn = placesGeoResources.getGeoDetails(pPlaceId);
} catch (TwitterException e) {
TwitterManager.handleTwitterException(e);
}
} while (toReturn==null);
return toReturn;
}
}
| 977 | 0.671748 | 0.656504 | 40 | 23.6 | 19.610966 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.425 | false | false | 13 |
a64bae94cc452fc30cfd762c11744ced00444c30 | 14,018,773,299,278 | 82b10bd18dad3fe84a7a25a7a72506fbd0ac3701 | /claimcar-claim/src/main/java/ins/sino/claimcar/claim/po/PrpLCompensate.java | 10ba589c88e0561705af42aa5f265c5ca6c8b685 | [] | no_license | bellmit/claimcar2 | https://github.com/bellmit/claimcar2 | ddd1e48b0dd9cf1905a5e31f9fdb02882d4e3c99 | 1d5f44324b77c6064092f55b39261a352a26a05d | refs/heads/master | 2023-01-30T05:12:22.528000 | 2020-12-13T07:48:27 | 2020-12-13T07:48:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ins.sino.claimcar.claim.po;
// Generated by Hibernate Tools 3.2.5 (sinosoft version), Don't modify!
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Type;
/**
* POJO Class PrpLCompensate
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Table(name = "PRPLCOMPENSATE")
public class PrpLCompensate implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private String compensateNo;
private String claimNo;
private String registNo;
private String caseNo;
private String policyNo;
private String riskCode;
private String makeCom;
private String comCode;
private String caseType;
private String compensateType;
private String indemnityDuty;
private BigDecimal indemnityDutyRate;
private BigDecimal sumAmt;
private BigDecimal sumPreAmt;
private BigDecimal sumPaidAmt;
private BigDecimal sumFee;
private BigDecimal sumPreFee;
private BigDecimal sumPaidFee;
private BigDecimal sumBzPaid;
private BigDecimal sumRealPay;
private String allLossFlag;
private String recoveryFlag;
private String lawsuitFlag;
private String allowFlag;
private BigDecimal agreeAmt;
private String agreeDesc;
private String createUser;
private String underwriteFlag;
private String underwriteUser;
private Date underwriteDate;
private String flag;
private String remark;
private Date createTime;
private Date updateTime;
private String compensateKind;
private Integer times;
private String currency;
private String deductType;
private BigDecimal sumLoss;
private String lastModifyUser;
private String lcText;
private String handler1Code;
private BigDecimal carLossAmt;
private BigDecimal sumNoDeductFee;
private String insuredPhone;
private List<PrpLPayment> prpLPayments = new ArrayList<PrpLPayment>(0);
private List<PrpLLossItem> prpLLossItems = new ArrayList<PrpLLossItem>(0);
private List<PrpLLossProp> prpLLossProps = new ArrayList<PrpLLossProp>(0);
private List<PrpLLossPerson> prpLLossPersons = new ArrayList<PrpLLossPerson>(0);
private List<PrpLKindAmtSummary> prpLKindAmtSummaries = new ArrayList<PrpLKindAmtSummary>(0);
private List<PrpLCharge> prpLCharges = new ArrayList<PrpLCharge>(0);
private PrpLCompensateExt prpLCompensateExt;
private List<PrpLCompensateDef> prpLCompensateDefs = new ArrayList<PrpLCompensateDef>(0);
private String rescueReport;
private BigDecimal pisderoAmout;//人伤减损金额
private BigDecimal cisderoAmout;//车物减损金额
private String inSideDeroFlag;//是否车物内部减损
private String coinsFlag; //是否共保协议
private BigDecimal coinsAmt; //共保协议金额
private String coinsDesc; //共保协议备注
private String inSideDeroPersonFlag;//是否人伤内部减损标志
private BigDecimal personPisderoVerifyAmout;//人伤减损金额(审核)
private BigDecimal carCisderoVerifyAmout;//车物减损金额(审核)
private String impairmentType;//减损类型
private String fraudType;//欺诈类型
@Id
@Column(name = "COMPENSATENO", unique = true, nullable = false, length=25)
public String getCompensateNo() {
return this.compensateNo;
}
public void setCompensateNo(String compensateNo) {
this.compensateNo = compensateNo;
}
@Column(name = "CLAIMNO", nullable = false, length=25)
public String getClaimNo() {
return this.claimNo;
}
public void setClaimNo(String claimNo) {
this.claimNo = claimNo;
}
@Column(name = "REGISTNO", nullable = false, length=25)
public String getRegistNo() {
return this.registNo;
}
public void setRegistNo(String registNo) {
this.registNo = registNo;
}
@Column(name = "CASENO", length=25)
public String getCaseNo() {
return this.caseNo;
}
public void setCaseNo(String caseNo) {
this.caseNo = caseNo;
}
@Column(name = "POLICYNO", nullable = false, length=25)
public String getPolicyNo() {
return this.policyNo;
}
public void setPolicyNo(String policyNo) {
this.policyNo = policyNo;
}
@Column(name = "RISKCODE", nullable = false, length=10)
public String getRiskCode() {
return this.riskCode;
}
public void setRiskCode(String riskCode) {
this.riskCode = riskCode;
}
@Column(name = "MAKECOM", nullable = false, length=20)
public String getMakeCom() {
return this.makeCom;
}
public void setMakeCom(String makeCom) {
this.makeCom = makeCom;
}
@Column(name = "COMCODE", nullable = false, length=20)
public String getComCode() {
return this.comCode;
}
public void setComCode(String comCode) {
this.comCode = comCode;
}
@Column(name = "CASETYPE", nullable = false, length=3)
public String getCaseType() {
return this.caseType;
}
public void setCaseType(String caseType) {
this.caseType = caseType;
}
@Column(name = "COMPENSATETYPE", length=2)
public String getCompensateType() {
return this.compensateType;
}
public void setCompensateType(String compensateType) {
this.compensateType = compensateType;
}
@Column(name = "INDEMNITYDUTY", nullable = false, length=10)
public String getIndemnityDuty() {
return this.indemnityDuty;
}
public void setIndemnityDuty(String indemnityDuty) {
this.indemnityDuty = indemnityDuty;
}
@Column(name = "INDEMNITYDUTYRATE", nullable = false, precision=8, scale=4)
public BigDecimal getIndemnityDutyRate() {
return this.indemnityDutyRate;
}
public void setIndemnityDutyRate(BigDecimal indemnityDutyRate) {
this.indemnityDutyRate = indemnityDutyRate;
}
@Column(name = "SUMAMT", precision=14)
public BigDecimal getSumAmt() {
return this.sumAmt;
}
public void setSumAmt(BigDecimal sumAmt) {
this.sumAmt = sumAmt;
}
@Column(name = "SUMPREAMT", precision=14)
public BigDecimal getSumPreAmt() {
return this.sumPreAmt;
}
public void setSumPreAmt(BigDecimal sumPreAmt) {
this.sumPreAmt = sumPreAmt;
}
@Column(name = "SUMPAIDAMT", precision=14)
public BigDecimal getSumPaidAmt() {
return this.sumPaidAmt;
}
public void setSumPaidAmt(BigDecimal sumPaidAmt) {
this.sumPaidAmt = sumPaidAmt;
}
@Column(name = "SUMFEE", precision=14)
public BigDecimal getSumFee() {
return this.sumFee;
}
public void setSumFee(BigDecimal sumFee) {
this.sumFee = sumFee;
}
@Column(name = "SUMPREFEE", precision=14)
public BigDecimal getSumPreFee() {
return this.sumPreFee;
}
public void setSumPreFee(BigDecimal sumPreFee) {
this.sumPreFee = sumPreFee;
}
@Column(name = "SUMPAIDFEE", precision=14)
public BigDecimal getSumPaidFee() {
return this.sumPaidFee;
}
public void setSumPaidFee(BigDecimal sumPaidFee) {
this.sumPaidFee = sumPaidFee;
}
@Column(name = "SUMBZPAID", precision=14)
public BigDecimal getSumBzPaid() {
return this.sumBzPaid;
}
public void setSumBzPaid(BigDecimal sumBzPaid) {
this.sumBzPaid = sumBzPaid;
}
@Column(name = "SUMREALPAY", precision=14)
public BigDecimal getSumRealPay() {
return this.sumRealPay;
}
public void setSumRealPay(BigDecimal sumRealPay) {
this.sumRealPay = sumRealPay;
}
@Column(name = "ALLLOSSFLAG", length=3)
public String getAllLossFlag() {
return this.allLossFlag;
}
public void setAllLossFlag(String allLossFlag) {
this.allLossFlag = allLossFlag;
}
@Column(name = "RECOVERYFLAG", length=3)
public String getRecoveryFlag() {
return this.recoveryFlag;
}
public void setRecoveryFlag(String recoveryFlag) {
this.recoveryFlag = recoveryFlag;
}
@Column(name = "LAWSUITFLAG", length=3)
public String getLawsuitFlag() {
return this.lawsuitFlag;
}
public void setLawsuitFlag(String lawsuitFlag) {
this.lawsuitFlag = lawsuitFlag;
}
@Column(name = "ALLOWFLAG", length=3)
public String getAllowFlag() {
return this.allowFlag;
}
public void setAllowFlag(String allowFlag) {
this.allowFlag = allowFlag;
}
@Column(name = "AGREEAMT", precision=10)
public BigDecimal getAgreeAmt() {
return this.agreeAmt;
}
public void setAgreeAmt(BigDecimal agreeAmt) {
this.agreeAmt = agreeAmt;
}
@Column(name = "AGREEDESC", length=300)
public String getAgreeDesc() {
return this.agreeDesc;
}
public void setAgreeDesc(String agreeDesc) {
this.agreeDesc = agreeDesc;
}
@Column(name = "CREATEUSER", nullable = false, length=10)
public String getCreateUser() {
return this.createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
@Column(name = "UNDERWRITEFLAG", length=2)
public String getUnderwriteFlag() {
return this.underwriteFlag;
}
public void setUnderwriteFlag(String underwriteFlag) {
this.underwriteFlag = underwriteFlag;
}
@Column(name = "UNDERWRITEUSER", length=10)
public String getUnderwriteUser() {
return this.underwriteUser;
}
public void setUnderwriteUser(String underwriteUser) {
this.underwriteUser = underwriteUser;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "UNDERWRITEDATE", length=7)
public Date getUnderwriteDate() {
return this.underwriteDate;
}
public void setUnderwriteDate(Date underwriteDate) {
this.underwriteDate = underwriteDate;
}
@Column(name = "FLAG", length=10)
public String getFlag() {
return this.flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
@Column(name = "REMARK")
public String getRemark() {
return this.remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATETIME", nullable = false, length=7)
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "UPDATETIME", nullable = false, length=7)
public Date getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Column(name = "COMPENSATEKIND", length=2)
public String getCompensateKind() {
return this.compensateKind;
}
public void setCompensateKind(String compensateKind) {
this.compensateKind = compensateKind;
}
@Column(name = "TIMES", nullable = false, precision=38, scale=0)
public Integer getTimes() {
return this.times;
}
public void setTimes(Integer times) {
this.times = times;
}
@Column(name = "CURRENCY", nullable = false, length=3)
public String getCurrency() {
return this.currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
@Column(name = "DEDUCTTYPE", nullable = false, length=3)
public String getDeductType() {
return this.deductType;
}
public void setDeductType(String deductType) {
this.deductType = deductType;
}
@Column(name = "SUMLOSS", precision=14)
public BigDecimal getSumLoss() {
return this.sumLoss;
}
public void setSumLoss(BigDecimal sumLoss) {
this.sumLoss = sumLoss;
}
@Column(name = "LASTMODIFYUSER", nullable = false, length=10)
public String getLastModifyUser() {
return this.lastModifyUser;
}
public void setLastModifyUser(String lastModifyUser) {
this.lastModifyUser = lastModifyUser;
}
@Column(name = "LCTEXT")
@Basic(fetch = FetchType.LAZY)
@Type(type = "org.hibernate.type.MaterializedClobType")
public String getLcText() {
return this.lcText;
}
public void setLcText(String lcText) {
this.lcText = lcText;
}
@Column(name = "HANDLER1CODE", length=10)
public String getHandler1Code() {
return this.handler1Code;
}
public void setHandler1Code(String handler1Code) {
this.handler1Code = handler1Code;
}
@Column(name = "CARLOSSAMT", precision=14)
public BigDecimal getCarLossAmt() {
return this.carLossAmt;
}
public void setCarLossAmt(BigDecimal carLossAmt) {
this.carLossAmt = carLossAmt;
}
@Column(name = "SUMNODEDUCTFEE", precision=14)
public BigDecimal getSumNoDeductFee() {
return sumNoDeductFee;
}
public void setSumNoDeductFee(BigDecimal sumNoDeductFee) {
this.sumNoDeductFee = sumNoDeductFee;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLPayment> getPrpLPayments() {
return this.prpLPayments;
}
public void setPrpLPayments(List<PrpLPayment> prpLPayments) {
this.prpLPayments = prpLPayments;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLLossItem> getPrpLLossItems() {
return this.prpLLossItems;
}
public void setPrpLLossItems(List<PrpLLossItem> prpLLossItems) {
this.prpLLossItems = prpLLossItems;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLLossProp> getPrpLLossProps() {
return this.prpLLossProps;
}
public void setPrpLLossProps(List<PrpLLossProp> prpLLossProps) {
this.prpLLossProps = prpLLossProps;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLLossPerson> getPrpLLossPersons() {
return this.prpLLossPersons;
}
public void setPrpLLossPersons(List<PrpLLossPerson> prpLLossPersons) {
this.prpLLossPersons = prpLLossPersons;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLKindAmtSummary> getPrpLKindAmtSummaries() {
return this.prpLKindAmtSummaries;
}
public void setPrpLKindAmtSummaries(List<PrpLKindAmtSummary> prpLKindAmtSummaries) {
this.prpLKindAmtSummaries = prpLKindAmtSummaries;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLCharge> getPrpLCharges() {
return this.prpLCharges;
}
public void setPrpLCharges(List<PrpLCharge> prpLCharges) {
this.prpLCharges = prpLCharges;
}
@OneToOne(cascade = CascadeType.ALL,fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public PrpLCompensateExt getPrpLCompensateExt() {
return prpLCompensateExt;
}
public void setPrpLCompensateExt(PrpLCompensateExt prpLCompensateExt) {
this.prpLCompensateExt = prpLCompensateExt;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLCompensateDef> getPrpLCompensateDefs() {
return this.prpLCompensateDefs;
}
public void setPrpLCompensateDefs(List<PrpLCompensateDef> prpLCompensateDefs) {
this.prpLCompensateDefs = prpLCompensateDefs;
}
@Column(name = "RESCUEREPORT", length=500)
public String getRescueReport() {
return rescueReport;
}
public void setRescueReport(String rescueReport) {
this.rescueReport = rescueReport;
}
@Column(name = "INSUREDPHONE",length=20)
public String getinsuredPhone() {
return insuredPhone;
}
public void setinsuredPhone(String insuredPhone) {
this.insuredPhone = insuredPhone;
}
@Column(name = "PISDEROAMOUT", precision=14)
public BigDecimal getPisderoAmout() {
return pisderoAmout;
}
public void setPisderoAmout(BigDecimal pisderoAmout) {
this.pisderoAmout = pisderoAmout;
}
@Column(name = "CISDEROAMOUT", precision=14)
public BigDecimal getCisderoAmout() {
return cisderoAmout;
}
public void setCisderoAmout(BigDecimal cisderoAmout) {
this.cisderoAmout = cisderoAmout;
}
@Column(name = "INSIDEDEROFLAG",length=12)
public String getInSideDeroFlag() {
return inSideDeroFlag;
}
public void setInSideDeroFlag(String inSideDeroFlag) {
this.inSideDeroFlag = inSideDeroFlag;
}
@Column(name = "COINSFLAG", length=2)
public String getCoinsFlag() {
return coinsFlag;
}
public void setCoinsFlag(String coinsFlag) {
this.coinsFlag = coinsFlag;
}
@Column(name = "COINSAMT", precision=14)
public BigDecimal getCoinsAmt() {
return coinsAmt;
}
public void setCoinsAmt(BigDecimal coinsAmt) {
this.coinsAmt = coinsAmt;
}
@Column(name = "COINSDESC", length=200)
public String getCoinsDesc() {
return coinsDesc;
}
public void setCoinsDesc(String coinsDesc) {
this.coinsDesc = coinsDesc;
}
@Column(name = "INSIDEDEROPERSONFLAG",length=12)
public String getInSideDeroPersonFlag() {
return inSideDeroPersonFlag;
}
public void setInSideDeroPersonFlag(String inSideDeroPersonFlag) {
this.inSideDeroPersonFlag = inSideDeroPersonFlag;
}
@Column(name = "PERSONPISDEROVERIFYAMOUT", precision=14)
public BigDecimal getPersonPisderoVerifyAmout() {
return personPisderoVerifyAmout;
}
public void setPersonPisderoVerifyAmout(BigDecimal personPisderoVerifyAmout) {
this.personPisderoVerifyAmout = personPisderoVerifyAmout;
}
@Column(name = "CARCISDEROVERIFYAMOUT", precision=14)
public BigDecimal getCarCisderoVerifyAmout() {
return carCisderoVerifyAmout;
}
public void setCarCisderoVerifyAmout(BigDecimal carCisderoVerifyAmout) {
this.carCisderoVerifyAmout = carCisderoVerifyAmout;
}
@Column(name = "IMPAIRMENTTYPE",length=255)
public String getImpairmentType() {
return impairmentType;
}
public void setImpairmentType(String impairmentType) {
this.impairmentType = impairmentType;
}
@Column(name = "FRAUDTYPE",length=255)
public String getFraudType() {
return fraudType;
}
public void setFraudType(String fraudType) {
this.fraudType = fraudType;
}
}
| UTF-8 | Java | 17,453 | java | PrpLCompensate.java | Java | [] | null | [] | package ins.sino.claimcar.claim.po;
// Generated by Hibernate Tools 3.2.5 (sinosoft version), Don't modify!
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Type;
/**
* POJO Class PrpLCompensate
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Table(name = "PRPLCOMPENSATE")
public class PrpLCompensate implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private String compensateNo;
private String claimNo;
private String registNo;
private String caseNo;
private String policyNo;
private String riskCode;
private String makeCom;
private String comCode;
private String caseType;
private String compensateType;
private String indemnityDuty;
private BigDecimal indemnityDutyRate;
private BigDecimal sumAmt;
private BigDecimal sumPreAmt;
private BigDecimal sumPaidAmt;
private BigDecimal sumFee;
private BigDecimal sumPreFee;
private BigDecimal sumPaidFee;
private BigDecimal sumBzPaid;
private BigDecimal sumRealPay;
private String allLossFlag;
private String recoveryFlag;
private String lawsuitFlag;
private String allowFlag;
private BigDecimal agreeAmt;
private String agreeDesc;
private String createUser;
private String underwriteFlag;
private String underwriteUser;
private Date underwriteDate;
private String flag;
private String remark;
private Date createTime;
private Date updateTime;
private String compensateKind;
private Integer times;
private String currency;
private String deductType;
private BigDecimal sumLoss;
private String lastModifyUser;
private String lcText;
private String handler1Code;
private BigDecimal carLossAmt;
private BigDecimal sumNoDeductFee;
private String insuredPhone;
private List<PrpLPayment> prpLPayments = new ArrayList<PrpLPayment>(0);
private List<PrpLLossItem> prpLLossItems = new ArrayList<PrpLLossItem>(0);
private List<PrpLLossProp> prpLLossProps = new ArrayList<PrpLLossProp>(0);
private List<PrpLLossPerson> prpLLossPersons = new ArrayList<PrpLLossPerson>(0);
private List<PrpLKindAmtSummary> prpLKindAmtSummaries = new ArrayList<PrpLKindAmtSummary>(0);
private List<PrpLCharge> prpLCharges = new ArrayList<PrpLCharge>(0);
private PrpLCompensateExt prpLCompensateExt;
private List<PrpLCompensateDef> prpLCompensateDefs = new ArrayList<PrpLCompensateDef>(0);
private String rescueReport;
private BigDecimal pisderoAmout;//人伤减损金额
private BigDecimal cisderoAmout;//车物减损金额
private String inSideDeroFlag;//是否车物内部减损
private String coinsFlag; //是否共保协议
private BigDecimal coinsAmt; //共保协议金额
private String coinsDesc; //共保协议备注
private String inSideDeroPersonFlag;//是否人伤内部减损标志
private BigDecimal personPisderoVerifyAmout;//人伤减损金额(审核)
private BigDecimal carCisderoVerifyAmout;//车物减损金额(审核)
private String impairmentType;//减损类型
private String fraudType;//欺诈类型
@Id
@Column(name = "COMPENSATENO", unique = true, nullable = false, length=25)
public String getCompensateNo() {
return this.compensateNo;
}
public void setCompensateNo(String compensateNo) {
this.compensateNo = compensateNo;
}
@Column(name = "CLAIMNO", nullable = false, length=25)
public String getClaimNo() {
return this.claimNo;
}
public void setClaimNo(String claimNo) {
this.claimNo = claimNo;
}
@Column(name = "REGISTNO", nullable = false, length=25)
public String getRegistNo() {
return this.registNo;
}
public void setRegistNo(String registNo) {
this.registNo = registNo;
}
@Column(name = "CASENO", length=25)
public String getCaseNo() {
return this.caseNo;
}
public void setCaseNo(String caseNo) {
this.caseNo = caseNo;
}
@Column(name = "POLICYNO", nullable = false, length=25)
public String getPolicyNo() {
return this.policyNo;
}
public void setPolicyNo(String policyNo) {
this.policyNo = policyNo;
}
@Column(name = "RISKCODE", nullable = false, length=10)
public String getRiskCode() {
return this.riskCode;
}
public void setRiskCode(String riskCode) {
this.riskCode = riskCode;
}
@Column(name = "MAKECOM", nullable = false, length=20)
public String getMakeCom() {
return this.makeCom;
}
public void setMakeCom(String makeCom) {
this.makeCom = makeCom;
}
@Column(name = "COMCODE", nullable = false, length=20)
public String getComCode() {
return this.comCode;
}
public void setComCode(String comCode) {
this.comCode = comCode;
}
@Column(name = "CASETYPE", nullable = false, length=3)
public String getCaseType() {
return this.caseType;
}
public void setCaseType(String caseType) {
this.caseType = caseType;
}
@Column(name = "COMPENSATETYPE", length=2)
public String getCompensateType() {
return this.compensateType;
}
public void setCompensateType(String compensateType) {
this.compensateType = compensateType;
}
@Column(name = "INDEMNITYDUTY", nullable = false, length=10)
public String getIndemnityDuty() {
return this.indemnityDuty;
}
public void setIndemnityDuty(String indemnityDuty) {
this.indemnityDuty = indemnityDuty;
}
@Column(name = "INDEMNITYDUTYRATE", nullable = false, precision=8, scale=4)
public BigDecimal getIndemnityDutyRate() {
return this.indemnityDutyRate;
}
public void setIndemnityDutyRate(BigDecimal indemnityDutyRate) {
this.indemnityDutyRate = indemnityDutyRate;
}
@Column(name = "SUMAMT", precision=14)
public BigDecimal getSumAmt() {
return this.sumAmt;
}
public void setSumAmt(BigDecimal sumAmt) {
this.sumAmt = sumAmt;
}
@Column(name = "SUMPREAMT", precision=14)
public BigDecimal getSumPreAmt() {
return this.sumPreAmt;
}
public void setSumPreAmt(BigDecimal sumPreAmt) {
this.sumPreAmt = sumPreAmt;
}
@Column(name = "SUMPAIDAMT", precision=14)
public BigDecimal getSumPaidAmt() {
return this.sumPaidAmt;
}
public void setSumPaidAmt(BigDecimal sumPaidAmt) {
this.sumPaidAmt = sumPaidAmt;
}
@Column(name = "SUMFEE", precision=14)
public BigDecimal getSumFee() {
return this.sumFee;
}
public void setSumFee(BigDecimal sumFee) {
this.sumFee = sumFee;
}
@Column(name = "SUMPREFEE", precision=14)
public BigDecimal getSumPreFee() {
return this.sumPreFee;
}
public void setSumPreFee(BigDecimal sumPreFee) {
this.sumPreFee = sumPreFee;
}
@Column(name = "SUMPAIDFEE", precision=14)
public BigDecimal getSumPaidFee() {
return this.sumPaidFee;
}
public void setSumPaidFee(BigDecimal sumPaidFee) {
this.sumPaidFee = sumPaidFee;
}
@Column(name = "SUMBZPAID", precision=14)
public BigDecimal getSumBzPaid() {
return this.sumBzPaid;
}
public void setSumBzPaid(BigDecimal sumBzPaid) {
this.sumBzPaid = sumBzPaid;
}
@Column(name = "SUMREALPAY", precision=14)
public BigDecimal getSumRealPay() {
return this.sumRealPay;
}
public void setSumRealPay(BigDecimal sumRealPay) {
this.sumRealPay = sumRealPay;
}
@Column(name = "ALLLOSSFLAG", length=3)
public String getAllLossFlag() {
return this.allLossFlag;
}
public void setAllLossFlag(String allLossFlag) {
this.allLossFlag = allLossFlag;
}
@Column(name = "RECOVERYFLAG", length=3)
public String getRecoveryFlag() {
return this.recoveryFlag;
}
public void setRecoveryFlag(String recoveryFlag) {
this.recoveryFlag = recoveryFlag;
}
@Column(name = "LAWSUITFLAG", length=3)
public String getLawsuitFlag() {
return this.lawsuitFlag;
}
public void setLawsuitFlag(String lawsuitFlag) {
this.lawsuitFlag = lawsuitFlag;
}
@Column(name = "ALLOWFLAG", length=3)
public String getAllowFlag() {
return this.allowFlag;
}
public void setAllowFlag(String allowFlag) {
this.allowFlag = allowFlag;
}
@Column(name = "AGREEAMT", precision=10)
public BigDecimal getAgreeAmt() {
return this.agreeAmt;
}
public void setAgreeAmt(BigDecimal agreeAmt) {
this.agreeAmt = agreeAmt;
}
@Column(name = "AGREEDESC", length=300)
public String getAgreeDesc() {
return this.agreeDesc;
}
public void setAgreeDesc(String agreeDesc) {
this.agreeDesc = agreeDesc;
}
@Column(name = "CREATEUSER", nullable = false, length=10)
public String getCreateUser() {
return this.createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
@Column(name = "UNDERWRITEFLAG", length=2)
public String getUnderwriteFlag() {
return this.underwriteFlag;
}
public void setUnderwriteFlag(String underwriteFlag) {
this.underwriteFlag = underwriteFlag;
}
@Column(name = "UNDERWRITEUSER", length=10)
public String getUnderwriteUser() {
return this.underwriteUser;
}
public void setUnderwriteUser(String underwriteUser) {
this.underwriteUser = underwriteUser;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "UNDERWRITEDATE", length=7)
public Date getUnderwriteDate() {
return this.underwriteDate;
}
public void setUnderwriteDate(Date underwriteDate) {
this.underwriteDate = underwriteDate;
}
@Column(name = "FLAG", length=10)
public String getFlag() {
return this.flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
@Column(name = "REMARK")
public String getRemark() {
return this.remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATETIME", nullable = false, length=7)
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "UPDATETIME", nullable = false, length=7)
public Date getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Column(name = "COMPENSATEKIND", length=2)
public String getCompensateKind() {
return this.compensateKind;
}
public void setCompensateKind(String compensateKind) {
this.compensateKind = compensateKind;
}
@Column(name = "TIMES", nullable = false, precision=38, scale=0)
public Integer getTimes() {
return this.times;
}
public void setTimes(Integer times) {
this.times = times;
}
@Column(name = "CURRENCY", nullable = false, length=3)
public String getCurrency() {
return this.currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
@Column(name = "DEDUCTTYPE", nullable = false, length=3)
public String getDeductType() {
return this.deductType;
}
public void setDeductType(String deductType) {
this.deductType = deductType;
}
@Column(name = "SUMLOSS", precision=14)
public BigDecimal getSumLoss() {
return this.sumLoss;
}
public void setSumLoss(BigDecimal sumLoss) {
this.sumLoss = sumLoss;
}
@Column(name = "LASTMODIFYUSER", nullable = false, length=10)
public String getLastModifyUser() {
return this.lastModifyUser;
}
public void setLastModifyUser(String lastModifyUser) {
this.lastModifyUser = lastModifyUser;
}
@Column(name = "LCTEXT")
@Basic(fetch = FetchType.LAZY)
@Type(type = "org.hibernate.type.MaterializedClobType")
public String getLcText() {
return this.lcText;
}
public void setLcText(String lcText) {
this.lcText = lcText;
}
@Column(name = "HANDLER1CODE", length=10)
public String getHandler1Code() {
return this.handler1Code;
}
public void setHandler1Code(String handler1Code) {
this.handler1Code = handler1Code;
}
@Column(name = "CARLOSSAMT", precision=14)
public BigDecimal getCarLossAmt() {
return this.carLossAmt;
}
public void setCarLossAmt(BigDecimal carLossAmt) {
this.carLossAmt = carLossAmt;
}
@Column(name = "SUMNODEDUCTFEE", precision=14)
public BigDecimal getSumNoDeductFee() {
return sumNoDeductFee;
}
public void setSumNoDeductFee(BigDecimal sumNoDeductFee) {
this.sumNoDeductFee = sumNoDeductFee;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLPayment> getPrpLPayments() {
return this.prpLPayments;
}
public void setPrpLPayments(List<PrpLPayment> prpLPayments) {
this.prpLPayments = prpLPayments;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLLossItem> getPrpLLossItems() {
return this.prpLLossItems;
}
public void setPrpLLossItems(List<PrpLLossItem> prpLLossItems) {
this.prpLLossItems = prpLLossItems;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLLossProp> getPrpLLossProps() {
return this.prpLLossProps;
}
public void setPrpLLossProps(List<PrpLLossProp> prpLLossProps) {
this.prpLLossProps = prpLLossProps;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLLossPerson> getPrpLLossPersons() {
return this.prpLLossPersons;
}
public void setPrpLLossPersons(List<PrpLLossPerson> prpLLossPersons) {
this.prpLLossPersons = prpLLossPersons;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLKindAmtSummary> getPrpLKindAmtSummaries() {
return this.prpLKindAmtSummaries;
}
public void setPrpLKindAmtSummaries(List<PrpLKindAmtSummary> prpLKindAmtSummaries) {
this.prpLKindAmtSummaries = prpLKindAmtSummaries;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLCharge> getPrpLCharges() {
return this.prpLCharges;
}
public void setPrpLCharges(List<PrpLCharge> prpLCharges) {
this.prpLCharges = prpLCharges;
}
@OneToOne(cascade = CascadeType.ALL,fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public PrpLCompensateExt getPrpLCompensateExt() {
return prpLCompensateExt;
}
public void setPrpLCompensateExt(PrpLCompensateExt prpLCompensateExt) {
this.prpLCompensateExt = prpLCompensateExt;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="prpLCompensate")
public List<PrpLCompensateDef> getPrpLCompensateDefs() {
return this.prpLCompensateDefs;
}
public void setPrpLCompensateDefs(List<PrpLCompensateDef> prpLCompensateDefs) {
this.prpLCompensateDefs = prpLCompensateDefs;
}
@Column(name = "RESCUEREPORT", length=500)
public String getRescueReport() {
return rescueReport;
}
public void setRescueReport(String rescueReport) {
this.rescueReport = rescueReport;
}
@Column(name = "INSUREDPHONE",length=20)
public String getinsuredPhone() {
return insuredPhone;
}
public void setinsuredPhone(String insuredPhone) {
this.insuredPhone = insuredPhone;
}
@Column(name = "PISDEROAMOUT", precision=14)
public BigDecimal getPisderoAmout() {
return pisderoAmout;
}
public void setPisderoAmout(BigDecimal pisderoAmout) {
this.pisderoAmout = pisderoAmout;
}
@Column(name = "CISDEROAMOUT", precision=14)
public BigDecimal getCisderoAmout() {
return cisderoAmout;
}
public void setCisderoAmout(BigDecimal cisderoAmout) {
this.cisderoAmout = cisderoAmout;
}
@Column(name = "INSIDEDEROFLAG",length=12)
public String getInSideDeroFlag() {
return inSideDeroFlag;
}
public void setInSideDeroFlag(String inSideDeroFlag) {
this.inSideDeroFlag = inSideDeroFlag;
}
@Column(name = "COINSFLAG", length=2)
public String getCoinsFlag() {
return coinsFlag;
}
public void setCoinsFlag(String coinsFlag) {
this.coinsFlag = coinsFlag;
}
@Column(name = "COINSAMT", precision=14)
public BigDecimal getCoinsAmt() {
return coinsAmt;
}
public void setCoinsAmt(BigDecimal coinsAmt) {
this.coinsAmt = coinsAmt;
}
@Column(name = "COINSDESC", length=200)
public String getCoinsDesc() {
return coinsDesc;
}
public void setCoinsDesc(String coinsDesc) {
this.coinsDesc = coinsDesc;
}
@Column(name = "INSIDEDEROPERSONFLAG",length=12)
public String getInSideDeroPersonFlag() {
return inSideDeroPersonFlag;
}
public void setInSideDeroPersonFlag(String inSideDeroPersonFlag) {
this.inSideDeroPersonFlag = inSideDeroPersonFlag;
}
@Column(name = "PERSONPISDEROVERIFYAMOUT", precision=14)
public BigDecimal getPersonPisderoVerifyAmout() {
return personPisderoVerifyAmout;
}
public void setPersonPisderoVerifyAmout(BigDecimal personPisderoVerifyAmout) {
this.personPisderoVerifyAmout = personPisderoVerifyAmout;
}
@Column(name = "CARCISDEROVERIFYAMOUT", precision=14)
public BigDecimal getCarCisderoVerifyAmout() {
return carCisderoVerifyAmout;
}
public void setCarCisderoVerifyAmout(BigDecimal carCisderoVerifyAmout) {
this.carCisderoVerifyAmout = carCisderoVerifyAmout;
}
@Column(name = "IMPAIRMENTTYPE",length=255)
public String getImpairmentType() {
return impairmentType;
}
public void setImpairmentType(String impairmentType) {
this.impairmentType = impairmentType;
}
@Column(name = "FRAUDTYPE",length=255)
public String getFraudType() {
return fraudType;
}
public void setFraudType(String fraudType) {
this.fraudType = fraudType;
}
}
| 17,453 | 0.756601 | 0.74961 | 692 | 24.013006 | 21.800556 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.385838 | false | false | 13 |
5598e2a406184fa943b8c314396f8d0cf4136620 | 1,434,519,130,164 | 02328f340cf26fad929cef4864a69e4a9b083255 | /CoreJava/src/com/tyss/javaprogram/lamda/Morning.java | 6a717039f799681dadae53395a6a42cb35d9a7f2 | [] | no_license | bhavanigmgowda/ELF-06-june-Testyantra-Nilesh | https://github.com/bhavanigmgowda/ELF-06-june-Testyantra-Nilesh | c10d290f9a5d5536c5a00bc02309f8a60dc613d9 | e1a2abd8e5b7ca67c21b2c33a4b8b7a4cdb0820a | refs/heads/master | 2020-07-18T12:27:34.878000 | 2019-09-03T12:35:43 | 2019-09-03T12:35:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tyss.javaprogram.lamda;
public interface Morning {
void wish();
}
| UTF-8 | Java | 96 | java | Morning.java | Java | [] | null | [] | package com.tyss.javaprogram.lamda;
public interface Morning {
void wish();
}
| 96 | 0.625 | 0.625 | 6 | 15 | 13.012815 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 13 |
7b51e5e8abb9e01a90d93d3ab0288552dc7ab141 | 6,708,738,970,173 | 2fd9d77d529e9b90fd077d0aa5ed2889525129e3 | /DecompiledViberSrc/app/src/main/java/com/appnexus/opensdk/u.java | ab372fc28f3407f8a0dfbd1b26b50d2db8e29278 | [] | no_license | cga2351/code | https://github.com/cga2351/code | 703f5d49dc3be45eafc4521e931f8d9d270e8a92 | 4e35fb567d359c252c2feca1e21b3a2a386f2bdb | refs/heads/master | 2021-07-08T15:11:06.299000 | 2021-05-06T13:22:21 | 2021-05-06T13:22:21 | 60,314,071 | 1 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.appnexus.opensdk;
import com.appnexus.opensdk.utils.Clog;
import org.json.JSONObject;
class u
{
private f a;
private String b;
private boolean c = false;
private boolean d = false;
public u(f paramf)
{
this.a = paramf;
}
private void d()
{
if ((this.d) && (!this.c))
{
this.a.a.getAdDispatcher().d();
return;
}
this.a.f();
}
void a()
{
b();
}
protected void a(String paramString)
{
String str1 = paramString.replaceFirst("video://", "");
String str2;
try
{
JSONObject localJSONObject = new JSONObject(str1);
str2 = localJSONObject.getString("event");
localJSONObject.getJSONObject("params");
if (str2.equals("adReady"))
{
this.a.g();
this.d = true;
return;
}
if (str2.equals("videoStart"))
return;
if ((str2.equals("video-error")) || (str2.equals("Timed-out")))
{
d();
return;
}
}
catch (Exception localException)
{
Clog.e(Clog.videoLogTag, "Exception: JsonError::" + str1);
return;
}
if (str2.equals("video-complete"))
{
this.c = true;
return;
}
Clog.e(Clog.videoLogTag, "Error: Unhandled event::" + str1);
}
protected void b()
{
Object[] arrayOfObject = new Object[2];
arrayOfObject[0] = this.b;
arrayOfObject[1] = MediaType.BANNER;
String str = String.format("javascript:window.createVastPlayerWithContent('%s','%s')", arrayOfObject);
this.a.e(str);
}
public void b(String paramString)
{
this.b = paramString;
}
protected void c()
{
if (!this.d)
return;
boolean bool = this.a.u();
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = Boolean.valueOf(bool);
String str = String.format("javascript:window.viewabilityUpdate('%s')", arrayOfObject);
this.a.e(str);
}
}
/* Location: E:\Study\Tools\apktool2_2\dex2jar-0.0.9.15\classes_viber_dex2jar.jar
* Qualified Name: com.appnexus.opensdk.u
* JD-Core Version: 0.6.2
*/ | UTF-8 | Java | 2,182 | java | u.java | Java | [] | null | [] | package com.appnexus.opensdk;
import com.appnexus.opensdk.utils.Clog;
import org.json.JSONObject;
class u
{
private f a;
private String b;
private boolean c = false;
private boolean d = false;
public u(f paramf)
{
this.a = paramf;
}
private void d()
{
if ((this.d) && (!this.c))
{
this.a.a.getAdDispatcher().d();
return;
}
this.a.f();
}
void a()
{
b();
}
protected void a(String paramString)
{
String str1 = paramString.replaceFirst("video://", "");
String str2;
try
{
JSONObject localJSONObject = new JSONObject(str1);
str2 = localJSONObject.getString("event");
localJSONObject.getJSONObject("params");
if (str2.equals("adReady"))
{
this.a.g();
this.d = true;
return;
}
if (str2.equals("videoStart"))
return;
if ((str2.equals("video-error")) || (str2.equals("Timed-out")))
{
d();
return;
}
}
catch (Exception localException)
{
Clog.e(Clog.videoLogTag, "Exception: JsonError::" + str1);
return;
}
if (str2.equals("video-complete"))
{
this.c = true;
return;
}
Clog.e(Clog.videoLogTag, "Error: Unhandled event::" + str1);
}
protected void b()
{
Object[] arrayOfObject = new Object[2];
arrayOfObject[0] = this.b;
arrayOfObject[1] = MediaType.BANNER;
String str = String.format("javascript:window.createVastPlayerWithContent('%s','%s')", arrayOfObject);
this.a.e(str);
}
public void b(String paramString)
{
this.b = paramString;
}
protected void c()
{
if (!this.d)
return;
boolean bool = this.a.u();
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = Boolean.valueOf(bool);
String str = String.format("javascript:window.viewabilityUpdate('%s')", arrayOfObject);
this.a.e(str);
}
}
/* Location: E:\Study\Tools\apktool2_2\dex2jar-0.0.9.15\classes_viber_dex2jar.jar
* Qualified Name: com.appnexus.opensdk.u
* JD-Core Version: 0.6.2
*/ | 2,182 | 0.558662 | 0.54583 | 98 | 20.285715 | 21.698303 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.489796 | false | false | 13 |
c82baeec9b7f778021f2bd2671fadf376cc7f6ec | 6,708,738,971,622 | 02b0cb3881d15b5b4cd0154662a2f1a6d201fcc8 | /src/com/foorich/late/MyTest.java | ddbd0788431f78361af95352559f5f9db40b8223 | [] | no_license | laulee5135/ClockIn | https://github.com/laulee5135/ClockIn | bee1153525add33f0a8024c9558e6bff7f01de52 | f9730b515721f4343e97b3037b1cb027928c8f86 | refs/heads/master | 2020-11-29T21:59:30.165000 | 2017-07-08T09:26:34 | 2017-07-08T09:26:34 | 96,607,263 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.foorich.late;
public class MyTest {
// 0 ΙΟ°ΰ 1ΦάΔ© 2½ΪΌΩΘΥ
public static void main(String[] args) {
String httpArg = "20170501";
String request = StatisticsServlet.request(httpArg);
System.out.println(request);
}
}
| ISO-8859-7 | Java | 259 | java | MyTest.java | Java | [] | null | [] | package com.foorich.late;
public class MyTest {
// 0 ΙΟ°ΰ 1ΦάΔ© 2½ΪΌΩΘΥ
public static void main(String[] args) {
String httpArg = "20170501";
String request = StatisticsServlet.request(httpArg);
System.out.println(request);
}
}
| 259 | 0.697959 | 0.64898 | 13 | 17.846153 | 17.346453 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.307692 | false | false | 13 |
dbf0430a4c3ab2f4e0ef1ffa36a2249fada18f89 | 28,183,575,452,446 | fc53e63ad3266f244360d0e680dd5120da800a91 | /src/net/snow69it/kindle/controller/AssetBrowserActivity.java | bb88cc7779c7330121a016690a0a295b10ec36d0 | [] | no_license | gammodoking/kindle.android | https://github.com/gammodoking/kindle.android | cc7ab7e5c53838c97364275020e878483105e1df | 93437969038a510fa9da6ce263ae872f1d742b89 | refs/heads/master | 2016-08-11T04:18:35.016000 | 2016-03-12T12:42:40 | 2016-03-12T12:42:40 | 49,772,144 | 0 | 0 | null | false | 2016-10-02T12:08:47 | 2016-01-16T12:17:45 | 2016-01-16T12:34:53 | 2016-10-02T12:08:47 | 2,576 | 0 | 0 | 0 | Java | null | null | package net.snow69it.kindle.controller;
import net.snow69it.kindle.R;
import net.snow69it.kindle.util.ActivityBase;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;
/**
* assetsに保存したhtmlを表示する
* @author raix
*
*/
public class AssetBrowserActivity extends ActivityBase {
private static final String TAG = AssetBrowserActivity.class.getSimpleName();
public static final String PATH_CONFIRM_KINDLE_EMAIL = "confirm_kindle_email.html";
public static final String PATH_CONFIRM_APPROVED_EMAIL = "confirm_approved_email.html";
public static final String URL_ASSETS_HTML = "file:///android_asset/html/";
public static void startBrowser(Context context, String path) {
Intent intent = new Intent(context, AssetBrowserActivity.class);
intent.putExtra("path", path);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browser);
String path = getIntent().getStringExtra("path");
String locale = getString(R.string.locale);
WebView webView = (WebView)findViewById(R.id.web_browser);
String url = URL_ASSETS_HTML + locale + "/" + path;
webView.loadUrl(url);
}
}
| UTF-8 | Java | 1,421 | java | AssetBrowserActivity.java | Java | [
{
"context": "t.WebView;\n\n/**\n * assetsに保存したhtmlを表示する\n * @author raix\n *\n */\npublic class AssetBrowserActivity extends ",
"end": 281,
"score": 0.9995849132537842,
"start": 277,
"tag": "USERNAME",
"value": "raix"
}
] | null | [] | package net.snow69it.kindle.controller;
import net.snow69it.kindle.R;
import net.snow69it.kindle.util.ActivityBase;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;
/**
* assetsに保存したhtmlを表示する
* @author raix
*
*/
public class AssetBrowserActivity extends ActivityBase {
private static final String TAG = AssetBrowserActivity.class.getSimpleName();
public static final String PATH_CONFIRM_KINDLE_EMAIL = "confirm_kindle_email.html";
public static final String PATH_CONFIRM_APPROVED_EMAIL = "confirm_approved_email.html";
public static final String URL_ASSETS_HTML = "file:///android_asset/html/";
public static void startBrowser(Context context, String path) {
Intent intent = new Intent(context, AssetBrowserActivity.class);
intent.putExtra("path", path);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browser);
String path = getIntent().getStringExtra("path");
String locale = getString(R.string.locale);
WebView webView = (WebView)findViewById(R.id.web_browser);
String url = URL_ASSETS_HTML + locale + "/" + path;
webView.loadUrl(url);
}
}
| 1,421 | 0.695931 | 0.691649 | 42 | 32.357143 | 27.348562 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 13 |
f9ddefa9d0cf9d54df7f7eb061bbc448ea585398 | 26,104,811,225,795 | 0e306e4abba9c1badc39f7ad815e7a887ab8f522 | /src/main/java/com/bookkeep/controller/baseController/LoginController.java | a02b11069479a97e6d4ff233a6f576a7bd82aa80 | [] | no_license | scnna/bookkeeping | https://github.com/scnna/bookkeeping | d4c574b0eb9cee855cd82514a1fabe981f01ee55 | fc46e49d0fc7afc21ab16ce23a1c9abcd86b973f | refs/heads/master | 2020-03-23T07:28:57.634000 | 2018-07-17T10:49:40 | 2018-07-17T10:49:40 | 141,274,242 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bookkeep.controller.baseController;
import com.bookkeep.domain.User;
import com.bookkeep.service.LoginService;
import com.bookkeep.util.ReturnResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;
/**
* @author scn
* @create 2018-03-09 10:16
* @desc 登录Controller
**/
@RestController
@RequestMapping
public class LoginController {
@Autowired
LoginService loginService;
@RequestMapping("/loginIn")
public ReturnResult loginIn(User user, HttpSession session) {
try {
if (user == null || StringUtils.isEmpty(user.getLoginName()) || StringUtils.isEmpty(user.getPassword())) {
return ReturnResult.error("存在空值");
}
//校验用户名密码准确性
User userA = loginService.checkUser(user);
if (userA == null) {
return ReturnResult.error("手机号或密码错误");
}
session.setAttribute("userId", userA.getId());
session.setAttribute("loginName", userA.getLoginName());
session.setAttribute("type", userA.getType());
return ReturnResult.success("登录成功");
} catch (Exception e) {
return ReturnResult.error("登录失败" + e);
}
}
}
| UTF-8 | Java | 1,502 | java | LoginController.java | Java | [
{
"context": "rt javax.servlet.http.HttpSession;\n\n/**\n * @author scn\n * @create 2018-03-09 10:16\n * @desc 登录Controller",
"end": 456,
"score": 0.9996331334114075,
"start": 453,
"tag": "USERNAME",
"value": "scn"
}
] | null | [] | package com.bookkeep.controller.baseController;
import com.bookkeep.domain.User;
import com.bookkeep.service.LoginService;
import com.bookkeep.util.ReturnResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;
/**
* @author scn
* @create 2018-03-09 10:16
* @desc 登录Controller
**/
@RestController
@RequestMapping
public class LoginController {
@Autowired
LoginService loginService;
@RequestMapping("/loginIn")
public ReturnResult loginIn(User user, HttpSession session) {
try {
if (user == null || StringUtils.isEmpty(user.getLoginName()) || StringUtils.isEmpty(user.getPassword())) {
return ReturnResult.error("存在空值");
}
//校验用户名密码准确性
User userA = loginService.checkUser(user);
if (userA == null) {
return ReturnResult.error("手机号或密码错误");
}
session.setAttribute("userId", userA.getId());
session.setAttribute("loginName", userA.getLoginName());
session.setAttribute("type", userA.getType());
return ReturnResult.success("登录成功");
} catch (Exception e) {
return ReturnResult.error("登录失败" + e);
}
}
}
| 1,502 | 0.665508 | 0.657163 | 44 | 31.681818 | 25.097784 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590909 | false | false | 13 |
497f6fe458a872169bd402ede72e851be07d5f99 | 30,803,505,500,276 | afca78b556bdffbc2b01d651298dc1b7f7b49e93 | /app/src/main/java/com/ssy/pink/bean/weibo/LoopLogInfo.java | 89390f73dfa5a3ac78d7a245486e010d7910220e | [] | no_license | santarget/Pink | https://github.com/santarget/Pink | 01e70edd736b52a36ee1a1a03212d81d74b1b91b | be01e5f8019eb997c8429cfc89da649f6c1a0e2e | refs/heads/master | 2021-07-17T11:50:35.887000 | 2018-12-13T01:26:57 | 2018-12-13T01:26:57 | 144,799,869 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ssy.pink.bean.weibo;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Unique;
import java.io.Serializable;
import org.greenrobot.greendao.annotation.Generated;
/**
* @author ssy
* @date 2018/9/29
*/
@Entity
public class LoopLogInfo implements Serializable {
private static final long serialVersionUID = 670015756883531293L;
@Id(autoincrement = true)
@Unique
Long logId;//轮博日志主键,自增长
String time;
String weiboUid;
String log;
@Generated(hash = 1399392705)
public LoopLogInfo(Long logId, String time, String weiboUid, String log) {
this.logId = logId;
this.time = time;
this.weiboUid = weiboUid;
this.log = log;
}
@Generated(hash = 737786222)
public LoopLogInfo() {
}
public Long getLogId() {
return this.logId;
}
public void setLogId(Long logId) {
this.logId = logId;
}
public String getTime() {
return this.time;
}
public void setTime(String time) {
this.time = time;
}
public String getWeiboUid() {
return this.weiboUid;
}
public void setWeiboUid(String weiboUid) {
this.weiboUid = weiboUid;
}
public String getLog() {
return this.log;
}
public void setLog(String log) {
this.log = log;
}
@Override
public String toString() {
return "LoopLogInfo{" +
"logId=" + logId +
", time='" + time + '\'' +
", weiboUid='" + weiboUid + '\'' +
", log='" + log + '\'' +
'}';
}
}
| UTF-8 | Java | 1,718 | java | LoopLogInfo.java | Java | [
{
"context": "bot.greendao.annotation.Generated;\n\n/**\n * @author ssy\n * @date 2018/9/29\n */\n@Entity\npublic class LoopL",
"end": 283,
"score": 0.9996010065078735,
"start": 280,
"tag": "USERNAME",
"value": "ssy"
}
] | null | [] | package com.ssy.pink.bean.weibo;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Unique;
import java.io.Serializable;
import org.greenrobot.greendao.annotation.Generated;
/**
* @author ssy
* @date 2018/9/29
*/
@Entity
public class LoopLogInfo implements Serializable {
private static final long serialVersionUID = 670015756883531293L;
@Id(autoincrement = true)
@Unique
Long logId;//轮博日志主键,自增长
String time;
String weiboUid;
String log;
@Generated(hash = 1399392705)
public LoopLogInfo(Long logId, String time, String weiboUid, String log) {
this.logId = logId;
this.time = time;
this.weiboUid = weiboUid;
this.log = log;
}
@Generated(hash = 737786222)
public LoopLogInfo() {
}
public Long getLogId() {
return this.logId;
}
public void setLogId(Long logId) {
this.logId = logId;
}
public String getTime() {
return this.time;
}
public void setTime(String time) {
this.time = time;
}
public String getWeiboUid() {
return this.weiboUid;
}
public void setWeiboUid(String weiboUid) {
this.weiboUid = weiboUid;
}
public String getLog() {
return this.log;
}
public void setLog(String log) {
this.log = log;
}
@Override
public String toString() {
return "LoopLogInfo{" +
"logId=" + logId +
", time='" + time + '\'' +
", weiboUid='" + weiboUid + '\'' +
", log='" + log + '\'' +
'}';
}
}
| 1,718 | 0.585395 | 0.559482 | 80 | 20.225 | 18.060299 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 13 |
0c709bcd0ee55a476a96f5681f89bfa53591cb3b | 10,144,712,814,192 | f46001efda1a77d92107772d8d7ab40c5dc5d2d6 | /src/main/java/State.java | 893b3d3efb55bff0328b6f299519319cd801b831 | [] | no_license | IdlyBond/StatePatternHomeTask | https://github.com/IdlyBond/StatePatternHomeTask | 8d1f9d2dfffea968824496e4ce5a9ccce04204bc | 11cc46732e9431e567a81ef100f2ed8ec348c044 | refs/heads/master | 2020-08-01T16:28:48.909000 | 2019-09-26T09:08:13 | 2019-09-26T09:08:13 | 211,046,783 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public interface State {
void spend(Card card, double price);
String getName();
}
| UTF-8 | Java | 92 | java | State.java | Java | [] | null | [] | public interface State {
void spend(Card card, double price);
String getName();
}
| 92 | 0.663043 | 0.663043 | 6 | 14.333333 | 15.195028 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
400b6a471155da7df24487861201bf3d0f935fe6 | 5,119,601,018,073 | 831bd2b13e62678b4057d98c0083e96eab90c69d | /src/main/java/com/cloudmersive/client/model/StringAutomaticThreatDetection.java | cf5efe4c00f9c0511ffe0872f88b1e906a975c6d | [
"Apache-2.0"
] | permissive | Cloudmersive/Cloudmersive.APIClient.Java | https://github.com/Cloudmersive/Cloudmersive.APIClient.Java | af52d5db6484f2bbe6f1ea89952023307c436ccf | 3e8a2705bb77c641fce1f7afe782a583c4956411 | refs/heads/master | 2023-06-16T04:56:47.149000 | 2023-06-03T22:52:39 | 2023-06-03T22:52:39 | 116,770,125 | 14 | 5 | Apache-2.0 | false | 2022-05-20T20:51:05 | 2018-01-09T05:28:25 | 2022-01-02T00:41:53 | 2022-05-20T20:51:03 | 19,566 | 9 | 5 | 7 | Java | false | false | /*
* securityapi
* The security APIs help you detect and block security threats.
*
* OpenAPI spec version: v1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.cloudmersive.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Result of performing an Insecure Deserialization JSON protection operation
*/
@ApiModel(description = "Result of performing an Insecure Deserialization JSON protection operation")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-06-03T15:50:49.465-07:00")
public class StringAutomaticThreatDetection {
@SerializedName("Successful")
private Boolean successful = null;
@SerializedName("CleanResult")
private Boolean cleanResult = null;
@SerializedName("ContainedJsonInsecureDeserializationAttack")
private Boolean containedJsonInsecureDeserializationAttack = null;
@SerializedName("ContainedXssThreat")
private Boolean containedXssThreat = null;
@SerializedName("ContainedXxeThreat")
private Boolean containedXxeThreat = null;
@SerializedName("ContainedSqlInjectionThreat")
private Boolean containedSqlInjectionThreat = null;
@SerializedName("ContainedSsrfThreat")
private Boolean containedSsrfThreat = null;
@SerializedName("IsXML")
private Boolean isXML = null;
@SerializedName("IsJSON")
private Boolean isJSON = null;
@SerializedName("IsURL")
private Boolean isURL = null;
@SerializedName("OriginalInput")
private String originalInput = null;
public StringAutomaticThreatDetection successful(Boolean successful) {
this.successful = successful;
return this;
}
/**
* True if the operation was successful, false otherwise
* @return successful
**/
@ApiModelProperty(value = "True if the operation was successful, false otherwise")
public Boolean isSuccessful() {
return successful;
}
public void setSuccessful(Boolean successful) {
this.successful = successful;
}
public StringAutomaticThreatDetection cleanResult(Boolean cleanResult) {
this.cleanResult = cleanResult;
return this;
}
/**
* Get cleanResult
* @return cleanResult
**/
@ApiModelProperty(value = "")
public Boolean isCleanResult() {
return cleanResult;
}
public void setCleanResult(Boolean cleanResult) {
this.cleanResult = cleanResult;
}
public StringAutomaticThreatDetection containedJsonInsecureDeserializationAttack(Boolean containedJsonInsecureDeserializationAttack) {
this.containedJsonInsecureDeserializationAttack = containedJsonInsecureDeserializationAttack;
return this;
}
/**
* True if the input contained Insecure Deserialization JSON, false otherwise
* @return containedJsonInsecureDeserializationAttack
**/
@ApiModelProperty(value = "True if the input contained Insecure Deserialization JSON, false otherwise")
public Boolean isContainedJsonInsecureDeserializationAttack() {
return containedJsonInsecureDeserializationAttack;
}
public void setContainedJsonInsecureDeserializationAttack(Boolean containedJsonInsecureDeserializationAttack) {
this.containedJsonInsecureDeserializationAttack = containedJsonInsecureDeserializationAttack;
}
public StringAutomaticThreatDetection containedXssThreat(Boolean containedXssThreat) {
this.containedXssThreat = containedXssThreat;
return this;
}
/**
* True if the input contained XSS attack, false otherwise
* @return containedXssThreat
**/
@ApiModelProperty(value = "True if the input contained XSS attack, false otherwise")
public Boolean isContainedXssThreat() {
return containedXssThreat;
}
public void setContainedXssThreat(Boolean containedXssThreat) {
this.containedXssThreat = containedXssThreat;
}
public StringAutomaticThreatDetection containedXxeThreat(Boolean containedXxeThreat) {
this.containedXxeThreat = containedXxeThreat;
return this;
}
/**
* True if the input contained XXE attack, false otherwise
* @return containedXxeThreat
**/
@ApiModelProperty(value = "True if the input contained XXE attack, false otherwise")
public Boolean isContainedXxeThreat() {
return containedXxeThreat;
}
public void setContainedXxeThreat(Boolean containedXxeThreat) {
this.containedXxeThreat = containedXxeThreat;
}
public StringAutomaticThreatDetection containedSqlInjectionThreat(Boolean containedSqlInjectionThreat) {
this.containedSqlInjectionThreat = containedSqlInjectionThreat;
return this;
}
/**
* True if the input contained SQL Injection attack, false otherwise
* @return containedSqlInjectionThreat
**/
@ApiModelProperty(value = "True if the input contained SQL Injection attack, false otherwise")
public Boolean isContainedSqlInjectionThreat() {
return containedSqlInjectionThreat;
}
public void setContainedSqlInjectionThreat(Boolean containedSqlInjectionThreat) {
this.containedSqlInjectionThreat = containedSqlInjectionThreat;
}
public StringAutomaticThreatDetection containedSsrfThreat(Boolean containedSsrfThreat) {
this.containedSsrfThreat = containedSsrfThreat;
return this;
}
/**
* True if the input contained an Server-Side Request Forgery (SSRF) URL attack, false otherwise
* @return containedSsrfThreat
**/
@ApiModelProperty(value = "True if the input contained an Server-Side Request Forgery (SSRF) URL attack, false otherwise")
public Boolean isContainedSsrfThreat() {
return containedSsrfThreat;
}
public void setContainedSsrfThreat(Boolean containedSsrfThreat) {
this.containedSsrfThreat = containedSsrfThreat;
}
public StringAutomaticThreatDetection isXML(Boolean isXML) {
this.isXML = isXML;
return this;
}
/**
* True if the input string is XML, false otherwise
* @return isXML
**/
@ApiModelProperty(value = "True if the input string is XML, false otherwise")
public Boolean isIsXML() {
return isXML;
}
public void setIsXML(Boolean isXML) {
this.isXML = isXML;
}
public StringAutomaticThreatDetection isJSON(Boolean isJSON) {
this.isJSON = isJSON;
return this;
}
/**
* True if the input string is JSON, false otherwise
* @return isJSON
**/
@ApiModelProperty(value = "True if the input string is JSON, false otherwise")
public Boolean isIsJSON() {
return isJSON;
}
public void setIsJSON(Boolean isJSON) {
this.isJSON = isJSON;
}
public StringAutomaticThreatDetection isURL(Boolean isURL) {
this.isURL = isURL;
return this;
}
/**
* True if the input string is a URL, false otherwise
* @return isURL
**/
@ApiModelProperty(value = "True if the input string is a URL, false otherwise")
public Boolean isIsURL() {
return isURL;
}
public void setIsURL(Boolean isURL) {
this.isURL = isURL;
}
public StringAutomaticThreatDetection originalInput(String originalInput) {
this.originalInput = originalInput;
return this;
}
/**
* Original input string
* @return originalInput
**/
@ApiModelProperty(value = "Original input string")
public String getOriginalInput() {
return originalInput;
}
public void setOriginalInput(String originalInput) {
this.originalInput = originalInput;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
StringAutomaticThreatDetection stringAutomaticThreatDetection = (StringAutomaticThreatDetection) o;
return Objects.equals(this.successful, stringAutomaticThreatDetection.successful) &&
Objects.equals(this.cleanResult, stringAutomaticThreatDetection.cleanResult) &&
Objects.equals(this.containedJsonInsecureDeserializationAttack, stringAutomaticThreatDetection.containedJsonInsecureDeserializationAttack) &&
Objects.equals(this.containedXssThreat, stringAutomaticThreatDetection.containedXssThreat) &&
Objects.equals(this.containedXxeThreat, stringAutomaticThreatDetection.containedXxeThreat) &&
Objects.equals(this.containedSqlInjectionThreat, stringAutomaticThreatDetection.containedSqlInjectionThreat) &&
Objects.equals(this.containedSsrfThreat, stringAutomaticThreatDetection.containedSsrfThreat) &&
Objects.equals(this.isXML, stringAutomaticThreatDetection.isXML) &&
Objects.equals(this.isJSON, stringAutomaticThreatDetection.isJSON) &&
Objects.equals(this.isURL, stringAutomaticThreatDetection.isURL) &&
Objects.equals(this.originalInput, stringAutomaticThreatDetection.originalInput);
}
@Override
public int hashCode() {
return Objects.hash(successful, cleanResult, containedJsonInsecureDeserializationAttack, containedXssThreat, containedXxeThreat, containedSqlInjectionThreat, containedSsrfThreat, isXML, isJSON, isURL, originalInput);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringAutomaticThreatDetection {\n");
sb.append(" successful: ").append(toIndentedString(successful)).append("\n");
sb.append(" cleanResult: ").append(toIndentedString(cleanResult)).append("\n");
sb.append(" containedJsonInsecureDeserializationAttack: ").append(toIndentedString(containedJsonInsecureDeserializationAttack)).append("\n");
sb.append(" containedXssThreat: ").append(toIndentedString(containedXssThreat)).append("\n");
sb.append(" containedXxeThreat: ").append(toIndentedString(containedXxeThreat)).append("\n");
sb.append(" containedSqlInjectionThreat: ").append(toIndentedString(containedSqlInjectionThreat)).append("\n");
sb.append(" containedSsrfThreat: ").append(toIndentedString(containedSsrfThreat)).append("\n");
sb.append(" isXML: ").append(toIndentedString(isXML)).append("\n");
sb.append(" isJSON: ").append(toIndentedString(isJSON)).append("\n");
sb.append(" isURL: ").append(toIndentedString(isURL)).append("\n");
sb.append(" originalInput: ").append(toIndentedString(originalInput)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| UTF-8 | Java | 10,898 | java | StringAutomaticThreatDetection.java | Java | [
{
"context": "ger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manu",
"end": 231,
"score": 0.9996705055236816,
"start": 220,
"tag": "USERNAME",
"value": "swagger-api"
}
] | null | [] | /*
* securityapi
* The security APIs help you detect and block security threats.
*
* OpenAPI spec version: v1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.cloudmersive.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Result of performing an Insecure Deserialization JSON protection operation
*/
@ApiModel(description = "Result of performing an Insecure Deserialization JSON protection operation")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-06-03T15:50:49.465-07:00")
public class StringAutomaticThreatDetection {
@SerializedName("Successful")
private Boolean successful = null;
@SerializedName("CleanResult")
private Boolean cleanResult = null;
@SerializedName("ContainedJsonInsecureDeserializationAttack")
private Boolean containedJsonInsecureDeserializationAttack = null;
@SerializedName("ContainedXssThreat")
private Boolean containedXssThreat = null;
@SerializedName("ContainedXxeThreat")
private Boolean containedXxeThreat = null;
@SerializedName("ContainedSqlInjectionThreat")
private Boolean containedSqlInjectionThreat = null;
@SerializedName("ContainedSsrfThreat")
private Boolean containedSsrfThreat = null;
@SerializedName("IsXML")
private Boolean isXML = null;
@SerializedName("IsJSON")
private Boolean isJSON = null;
@SerializedName("IsURL")
private Boolean isURL = null;
@SerializedName("OriginalInput")
private String originalInput = null;
public StringAutomaticThreatDetection successful(Boolean successful) {
this.successful = successful;
return this;
}
/**
* True if the operation was successful, false otherwise
* @return successful
**/
@ApiModelProperty(value = "True if the operation was successful, false otherwise")
public Boolean isSuccessful() {
return successful;
}
public void setSuccessful(Boolean successful) {
this.successful = successful;
}
public StringAutomaticThreatDetection cleanResult(Boolean cleanResult) {
this.cleanResult = cleanResult;
return this;
}
/**
* Get cleanResult
* @return cleanResult
**/
@ApiModelProperty(value = "")
public Boolean isCleanResult() {
return cleanResult;
}
public void setCleanResult(Boolean cleanResult) {
this.cleanResult = cleanResult;
}
public StringAutomaticThreatDetection containedJsonInsecureDeserializationAttack(Boolean containedJsonInsecureDeserializationAttack) {
this.containedJsonInsecureDeserializationAttack = containedJsonInsecureDeserializationAttack;
return this;
}
/**
* True if the input contained Insecure Deserialization JSON, false otherwise
* @return containedJsonInsecureDeserializationAttack
**/
@ApiModelProperty(value = "True if the input contained Insecure Deserialization JSON, false otherwise")
public Boolean isContainedJsonInsecureDeserializationAttack() {
return containedJsonInsecureDeserializationAttack;
}
public void setContainedJsonInsecureDeserializationAttack(Boolean containedJsonInsecureDeserializationAttack) {
this.containedJsonInsecureDeserializationAttack = containedJsonInsecureDeserializationAttack;
}
public StringAutomaticThreatDetection containedXssThreat(Boolean containedXssThreat) {
this.containedXssThreat = containedXssThreat;
return this;
}
/**
* True if the input contained XSS attack, false otherwise
* @return containedXssThreat
**/
@ApiModelProperty(value = "True if the input contained XSS attack, false otherwise")
public Boolean isContainedXssThreat() {
return containedXssThreat;
}
public void setContainedXssThreat(Boolean containedXssThreat) {
this.containedXssThreat = containedXssThreat;
}
public StringAutomaticThreatDetection containedXxeThreat(Boolean containedXxeThreat) {
this.containedXxeThreat = containedXxeThreat;
return this;
}
/**
* True if the input contained XXE attack, false otherwise
* @return containedXxeThreat
**/
@ApiModelProperty(value = "True if the input contained XXE attack, false otherwise")
public Boolean isContainedXxeThreat() {
return containedXxeThreat;
}
public void setContainedXxeThreat(Boolean containedXxeThreat) {
this.containedXxeThreat = containedXxeThreat;
}
public StringAutomaticThreatDetection containedSqlInjectionThreat(Boolean containedSqlInjectionThreat) {
this.containedSqlInjectionThreat = containedSqlInjectionThreat;
return this;
}
/**
* True if the input contained SQL Injection attack, false otherwise
* @return containedSqlInjectionThreat
**/
@ApiModelProperty(value = "True if the input contained SQL Injection attack, false otherwise")
public Boolean isContainedSqlInjectionThreat() {
return containedSqlInjectionThreat;
}
public void setContainedSqlInjectionThreat(Boolean containedSqlInjectionThreat) {
this.containedSqlInjectionThreat = containedSqlInjectionThreat;
}
public StringAutomaticThreatDetection containedSsrfThreat(Boolean containedSsrfThreat) {
this.containedSsrfThreat = containedSsrfThreat;
return this;
}
/**
* True if the input contained an Server-Side Request Forgery (SSRF) URL attack, false otherwise
* @return containedSsrfThreat
**/
@ApiModelProperty(value = "True if the input contained an Server-Side Request Forgery (SSRF) URL attack, false otherwise")
public Boolean isContainedSsrfThreat() {
return containedSsrfThreat;
}
public void setContainedSsrfThreat(Boolean containedSsrfThreat) {
this.containedSsrfThreat = containedSsrfThreat;
}
public StringAutomaticThreatDetection isXML(Boolean isXML) {
this.isXML = isXML;
return this;
}
/**
* True if the input string is XML, false otherwise
* @return isXML
**/
@ApiModelProperty(value = "True if the input string is XML, false otherwise")
public Boolean isIsXML() {
return isXML;
}
public void setIsXML(Boolean isXML) {
this.isXML = isXML;
}
public StringAutomaticThreatDetection isJSON(Boolean isJSON) {
this.isJSON = isJSON;
return this;
}
/**
* True if the input string is JSON, false otherwise
* @return isJSON
**/
@ApiModelProperty(value = "True if the input string is JSON, false otherwise")
public Boolean isIsJSON() {
return isJSON;
}
public void setIsJSON(Boolean isJSON) {
this.isJSON = isJSON;
}
public StringAutomaticThreatDetection isURL(Boolean isURL) {
this.isURL = isURL;
return this;
}
/**
* True if the input string is a URL, false otherwise
* @return isURL
**/
@ApiModelProperty(value = "True if the input string is a URL, false otherwise")
public Boolean isIsURL() {
return isURL;
}
public void setIsURL(Boolean isURL) {
this.isURL = isURL;
}
public StringAutomaticThreatDetection originalInput(String originalInput) {
this.originalInput = originalInput;
return this;
}
/**
* Original input string
* @return originalInput
**/
@ApiModelProperty(value = "Original input string")
public String getOriginalInput() {
return originalInput;
}
public void setOriginalInput(String originalInput) {
this.originalInput = originalInput;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
StringAutomaticThreatDetection stringAutomaticThreatDetection = (StringAutomaticThreatDetection) o;
return Objects.equals(this.successful, stringAutomaticThreatDetection.successful) &&
Objects.equals(this.cleanResult, stringAutomaticThreatDetection.cleanResult) &&
Objects.equals(this.containedJsonInsecureDeserializationAttack, stringAutomaticThreatDetection.containedJsonInsecureDeserializationAttack) &&
Objects.equals(this.containedXssThreat, stringAutomaticThreatDetection.containedXssThreat) &&
Objects.equals(this.containedXxeThreat, stringAutomaticThreatDetection.containedXxeThreat) &&
Objects.equals(this.containedSqlInjectionThreat, stringAutomaticThreatDetection.containedSqlInjectionThreat) &&
Objects.equals(this.containedSsrfThreat, stringAutomaticThreatDetection.containedSsrfThreat) &&
Objects.equals(this.isXML, stringAutomaticThreatDetection.isXML) &&
Objects.equals(this.isJSON, stringAutomaticThreatDetection.isJSON) &&
Objects.equals(this.isURL, stringAutomaticThreatDetection.isURL) &&
Objects.equals(this.originalInput, stringAutomaticThreatDetection.originalInput);
}
@Override
public int hashCode() {
return Objects.hash(successful, cleanResult, containedJsonInsecureDeserializationAttack, containedXssThreat, containedXxeThreat, containedSqlInjectionThreat, containedSsrfThreat, isXML, isJSON, isURL, originalInput);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringAutomaticThreatDetection {\n");
sb.append(" successful: ").append(toIndentedString(successful)).append("\n");
sb.append(" cleanResult: ").append(toIndentedString(cleanResult)).append("\n");
sb.append(" containedJsonInsecureDeserializationAttack: ").append(toIndentedString(containedJsonInsecureDeserializationAttack)).append("\n");
sb.append(" containedXssThreat: ").append(toIndentedString(containedXssThreat)).append("\n");
sb.append(" containedXxeThreat: ").append(toIndentedString(containedXxeThreat)).append("\n");
sb.append(" containedSqlInjectionThreat: ").append(toIndentedString(containedSqlInjectionThreat)).append("\n");
sb.append(" containedSsrfThreat: ").append(toIndentedString(containedSsrfThreat)).append("\n");
sb.append(" isXML: ").append(toIndentedString(isXML)).append("\n");
sb.append(" isJSON: ").append(toIndentedString(isJSON)).append("\n");
sb.append(" isURL: ").append(toIndentedString(isURL)).append("\n");
sb.append(" originalInput: ").append(toIndentedString(originalInput)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 10,898 | 0.748211 | 0.7461 | 324 | 32.632717 | 35.086636 | 220 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.404321 | false | false | 13 |
fabd6e9e5c21a8c2c067ef756ee1cd4ec0412af1 | 27,642,409,573,571 | 5c616756b466ffff96ea6261de70c2e22fa862b4 | /library/src/main/java/com/steve/creact/library/display/CommonDisplayBean.java | 441e3410210f3d756b9012e9d3963a40a5ae8dcc | [
"Apache-2.0"
] | permissive | CysionLiu/PowerfulRecyclerViewAdapter | https://github.com/CysionLiu/PowerfulRecyclerViewAdapter | 948d8fe03095d7a623626b49eb50c0a6856cdd5e | 92455e99c1f5b57b3b685820a314aab96df81b7e | refs/heads/master | 2021-05-31T08:21:20.525000 | 2016-04-29T09:19:26 | 2016-04-29T09:19:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.steve.creact.library.display;
import android.view.ViewGroup;
import com.steve.creact.library.viewholder.BaseRecyclerViewHolder;
/**
* Use for ViewHolders without data or just have static data.
*/
public class CommonDisplayBean extends BaseDisplayBean<BaseRecyclerViewHolder> {
private int layoutId;
public CommonDisplayBean(int layoutId) {
this.layoutId = layoutId;
}
@Override
public BaseRecyclerViewHolder createHolder(ViewGroup parent) {
return new BaseRecyclerViewHolder(getView(parent, layoutId)){
@Override
public void setData(Object data) {
//do nothing
}
};
}
}
| UTF-8 | Java | 691 | java | CommonDisplayBean.java | Java | [] | null | [] | package com.steve.creact.library.display;
import android.view.ViewGroup;
import com.steve.creact.library.viewholder.BaseRecyclerViewHolder;
/**
* Use for ViewHolders without data or just have static data.
*/
public class CommonDisplayBean extends BaseDisplayBean<BaseRecyclerViewHolder> {
private int layoutId;
public CommonDisplayBean(int layoutId) {
this.layoutId = layoutId;
}
@Override
public BaseRecyclerViewHolder createHolder(ViewGroup parent) {
return new BaseRecyclerViewHolder(getView(parent, layoutId)){
@Override
public void setData(Object data) {
//do nothing
}
};
}
}
| 691 | 0.681621 | 0.681621 | 28 | 23.678572 | 25.336386 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 13 |
26a6934218c613163863e9cc4deef834b381c805 | 26,551,487,827,245 | 590c82b4d51c5fdcbd4a6fa5d9d0fabb5143da06 | /app/src/main/java/com/github/gfx/helium/util/AppTracker.java | 950aee3bfebf6ae9a6ca13f11f358acdb2cbf9bf | [
"Apache-2.0",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | vaginessa/Android-Helium | https://github.com/vaginessa/Android-Helium | c7683dbf6a3e969c22f683c60b013ebc759a69fb | 79f47a631b7a19447456a91f8a1c026f100dcdd2 | refs/heads/master | 2020-03-26T18:02:48.781000 | 2017-09-14T05:32:01 | 2017-09-14T05:41:07 | 145,193,499 | 0 | 0 | NOASSERTION | true | 2019-01-18T11:32:36 | 2018-08-18T05:41:08 | 2018-08-18T05:41:10 | 2019-01-18T06:45:52 | 2,718 | 0 | 0 | 1 | HTML | false | null | package com.github.gfx.helium.util;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.github.gfx.helium.BuildConfig;
import android.util.Log;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.inject.Inject;
@ParametersAreNonnullByDefault
public final class AppTracker {
final Tracker tracker;
@Inject
public AppTracker(Tracker tracker) {
this.tracker = tracker;
}
public Tracker getTracker() {
return tracker;
}
public void sendScreenView(String screenName) {
if (BuildConfig.DEBUG) {
Log.d("TrackingUtils", screenName);
}
tracker.setScreenName(screenName);
tracker.send(new HitBuilders.ScreenViewBuilder().build());
}
public void sendEvent(String category, String action) {
if (BuildConfig.DEBUG) {
Log.d("TrackingUtils", category + "/" + action);
}
tracker.send(new HitBuilders.EventBuilder(category, action).build());
}
public void sendTiming(String category, String variable, long timing) {
if (BuildConfig.DEBUG) {
Log.d("TrackingUtils", category + "; timing=" + timing);
}
tracker.send(new HitBuilders.TimingBuilder(category, variable, timing).build());
}
}
| UTF-8 | Java | 1,336 | java | AppTracker.java | Java | [] | null | [] | package com.github.gfx.helium.util;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.github.gfx.helium.BuildConfig;
import android.util.Log;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.inject.Inject;
@ParametersAreNonnullByDefault
public final class AppTracker {
final Tracker tracker;
@Inject
public AppTracker(Tracker tracker) {
this.tracker = tracker;
}
public Tracker getTracker() {
return tracker;
}
public void sendScreenView(String screenName) {
if (BuildConfig.DEBUG) {
Log.d("TrackingUtils", screenName);
}
tracker.setScreenName(screenName);
tracker.send(new HitBuilders.ScreenViewBuilder().build());
}
public void sendEvent(String category, String action) {
if (BuildConfig.DEBUG) {
Log.d("TrackingUtils", category + "/" + action);
}
tracker.send(new HitBuilders.EventBuilder(category, action).build());
}
public void sendTiming(String category, String variable, long timing) {
if (BuildConfig.DEBUG) {
Log.d("TrackingUtils", category + "; timing=" + timing);
}
tracker.send(new HitBuilders.TimingBuilder(category, variable, timing).build());
}
}
| 1,336 | 0.671407 | 0.671407 | 48 | 26.833334 | 24.910116 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false | 13 |
e503a02152b8338c1c8350783a9c2f1bf7ee60d9 | 10,084,583,225,827 | 73f87c1bce873d3332a58c2b1bd4cc1e4ddbccba | /zzapp/zz91-mail/src/main/java/com/zz91/mail/thread/MailSendThread.java | 731ca91fd00c4cef24050933373b0ed94c9c021e | [] | no_license | moutainhigh/workspance | https://github.com/moutainhigh/workspance | 5a5a1f0013411717e9d687c6764330bac5c17687 | 2604d574bb0f0528dfc48f3408832b44fe03a464 | refs/heads/master | 2022-05-22T03:39:04.850000 | 2016-06-28T01:51:30 | 2016-06-28T01:51:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright 2011 ASTO.
* All right reserved.
* Created on 2011-10-13
*/
package com.zz91.mail.thread;
import java.io.IOException;
import java.util.Map;
import com.zz91.mail.domain.MailInfoDomain;
import com.zz91.mail.service.MailInfoService;
import com.zz91.mail.service.MailSendService;
import com.zz91.util.file.FileUtils;
import com.zz91.util.http.HttpUtils;
/**
* 邮件发送线程,将邮件信息提交给邮件服务器
*
* @author kongsj
* @email kongsj@zz91.net
* @date 2011-11-23
*/
public class MailSendThread extends Thread {
private MailInfoDomain mailInfo;
private MailInfoService mailInfoService;
private MailSendService mailSendService;
public final static String SYS_FLAG="asto.mail";
public final static String MAIL_LIST_PROP="file:/usr/tools/config/mail/maillist.properties";
public MailSendThread() {
}
public MailSendThread(MailInfoDomain mailInfo,
MailInfoService mailInfoService, MailSendService mailSendService) {
// super("thread-send-"+mailInfo.getId());
this.mailInfo = mailInfo;
this.mailSendService = mailSendService;
this.mailInfoService = mailInfoService;
}
@Override
public void run() {
String receiver = mailInfo.getReceiver();
String tmp = receiver.substring(receiver.indexOf("@") + 1, receiver
.length());
if(SYS_FLAG.equalsIgnoreCase(tmp)){
try {
Map map=FileUtils.readPropertyFile(MAIL_LIST_PROP, HttpUtils.CHARSET_UTF8);
mailInfo.setReceiver(String.valueOf(map.get(receiver)));
} catch (IOException e) {
}
}
long now = System.currentTimeMillis();
// long start = System.currentTimeMillis();
// 得到计划发送时间
Long planSendTime = MailScanThread.getPlanSendTime(tmp, 2000, now);
while (now < planSendTime) { // 如果还没有到计划发送时间,则不发送邮件
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
now = System.currentTimeMillis();
}
Integer sendStatus = 2;
if(!"mail.zz91.cn".equals(mailInfo.getSendHost())){
sendStatus = mailSendService.doSendMail(mailInfo);
}
mailInfoService.updateComplete(mailInfo.getId(), sendStatus);
// mailInfoService.updateComplete(mailInfo.getId(), 1);
//
// System.out.println("发送邮件:"
// + tmp
// + " 时间:"
// + DateUtil.toString(new Date(now), "HH:mm:ss")
// + " 计划发送时间:"
// + DateUtil.toString(new Date(planSendTime), "yyyy-MM-dd HH:mm:ss")
// + " 等待时间:" + (now - start)
// + "ms");
//
// try {
// Thread.sleep(3000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
}
}
| UTF-8 | Java | 2,595 | java | MailSendThread.java | Java | [
{
"context": "Utils;\n\n/**\n * 邮件发送线程,将邮件信息提交给邮件服务器\n * \n * @author kongsj\n * @email kongsj@zz91.net\n * @date 2011-11-23\n */",
"end": 422,
"score": 0.9997004866600037,
"start": 416,
"tag": "USERNAME",
"value": "kongsj"
},
{
"context": "发送线程,将邮件信息提交给邮件服务器\n * \n * @author kongsj\... | null | [] | /**
* Copyright 2011 ASTO.
* All right reserved.
* Created on 2011-10-13
*/
package com.zz91.mail.thread;
import java.io.IOException;
import java.util.Map;
import com.zz91.mail.domain.MailInfoDomain;
import com.zz91.mail.service.MailInfoService;
import com.zz91.mail.service.MailSendService;
import com.zz91.util.file.FileUtils;
import com.zz91.util.http.HttpUtils;
/**
* 邮件发送线程,将邮件信息提交给邮件服务器
*
* @author kongsj
* @email <EMAIL>
* @date 2011-11-23
*/
public class MailSendThread extends Thread {
private MailInfoDomain mailInfo;
private MailInfoService mailInfoService;
private MailSendService mailSendService;
public final static String SYS_FLAG="asto.mail";
public final static String MAIL_LIST_PROP="file:/usr/tools/config/mail/maillist.properties";
public MailSendThread() {
}
public MailSendThread(MailInfoDomain mailInfo,
MailInfoService mailInfoService, MailSendService mailSendService) {
// super("thread-send-"+mailInfo.getId());
this.mailInfo = mailInfo;
this.mailSendService = mailSendService;
this.mailInfoService = mailInfoService;
}
@Override
public void run() {
String receiver = mailInfo.getReceiver();
String tmp = receiver.substring(receiver.indexOf("@") + 1, receiver
.length());
if(SYS_FLAG.equalsIgnoreCase(tmp)){
try {
Map map=FileUtils.readPropertyFile(MAIL_LIST_PROP, HttpUtils.CHARSET_UTF8);
mailInfo.setReceiver(String.valueOf(map.get(receiver)));
} catch (IOException e) {
}
}
long now = System.currentTimeMillis();
// long start = System.currentTimeMillis();
// 得到计划发送时间
Long planSendTime = MailScanThread.getPlanSendTime(tmp, 2000, now);
while (now < planSendTime) { // 如果还没有到计划发送时间,则不发送邮件
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
now = System.currentTimeMillis();
}
Integer sendStatus = 2;
if(!"mail.zz91.cn".equals(mailInfo.getSendHost())){
sendStatus = mailSendService.doSendMail(mailInfo);
}
mailInfoService.updateComplete(mailInfo.getId(), sendStatus);
// mailInfoService.updateComplete(mailInfo.getId(), 1);
//
// System.out.println("发送邮件:"
// + tmp
// + " 时间:"
// + DateUtil.toString(new Date(now), "HH:mm:ss")
// + " 计划发送时间:"
// + DateUtil.toString(new Date(planSendTime), "yyyy-MM-dd HH:mm:ss")
// + " 等待时间:" + (now - start)
// + "ms");
//
// try {
// Thread.sleep(3000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
}
}
| 2,587 | 0.698741 | 0.677629 | 96 | 24.65625 | 22.279861 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.916667 | false | false | 13 |
e8397f519883890aab03f27644537edb26efaae5 | 21,225,728,395,670 | 47cfede177c120a22dd6dc553c63c8e1643069a9 | /src/LeetCodeSolution/AlgorithmThought/_02_DP/_72_EditDistance/Solution.java | 9a8bfec12b10dfbbbc61619f1b2eeb135af221bf | [] | no_license | dyfloveslife/LeetCodeAndSwordToOffer | https://github.com/dyfloveslife/LeetCodeAndSwordToOffer | 262e7b2ad384c9235afd69f8a22d7b0f20165a30 | 65d648f770f6f5b58007afbf37cc52d4c8bca62d | refs/heads/master | 2023-06-08T16:49:44.941000 | 2023-06-04T11:10:26 | 2023-06-04T11:10:26 | 147,819,855 | 71 | 35 | null | null | null | null | null | null | null | null | null | null | null | null | null | package LeetCodeSolution.AlgorithmThought._02_DP._72_EditDistance;
/*
* 编辑距离
*
* 题目描述:
* 给你两个单词 word1 和 word2,请你计算出将 word1 转换成 word2 所使用的最少操作数 。
* 你可以对一个单词进行如下三种操作:
* 插入一个字符
* 删除一个字符
* 替换一个字符
*
* 思路:
* 1. 总体的思想是:使用两个指针 i、j 分别指向字符串的最后,然后一步一步的往前走,缩小问题的规模;
* 2. 如果 i 和 j 所指的字符相同,为了满足最少的操作次数,则应直接往前移动 i 和 j,不应该对它们所指的字符进行操作;
* 3. 如果 j 走完了 word2,而 i 还没走完 word1,则只能使用删除操作将 word1 缩短为 word2;
* 4. 如果 i 走完了 word1,而 j 还没走完 word2,则只能使用插入操作将 word2 剩下的字符全部插入到 word1 中;
* 5. 整体框架:
* if (word1[i] == word2[j]):
* // 什么都不做,i 和 j 都向前移动
* i--;
* j--;
* else:
* // 三选一
* // 插入
* // 删除
* // 替换
* 6. 定义状态:dp[i][j] 表示返回 word1[0...i] 和 word2[0...j] 的最小编辑距离;
* 7. 如果 word1[i] == word2[j],则返回 dp[i - 1][j - 1],即当前字符对应相等,不需要进行操作,
* 而当前对应的最小编辑距离就是上一个状态的最小编辑距离;
* 8. 如果 word1[i] != word2[j],则需要分为三种情况:
* 8.1) 插入一个字符:直接在 word1[i] 位置插入一个和 word2[j] 一样的字符,此时 word2[j] 就匹配了,然后前移 j,
* 继续和 i 比较,同时操作数加一;
* 8.2) 删除一个字符:直接把 word1[i] 位置的字符删除,前移 i,继续和 j 位置的字符比较,同时操作数加一;
* 8.3) 替换一个字符:直接把 word1[i] 字符替换成 word2[j] 字符,这两个位置就匹配成功了,然后同时前移 i 和 j,
* 同时操作数加一。
*/
public class Solution {
public int minDistance(String word1, String word2) {
int len1 = word1.length();
int len2 = word2.length();
int[][] dp = new int[len1 + 1][len2 + 1];
// 初始化边界
// 先初始化列,因为这里的边界是 len1,表示的是行的范围
for (int i = 1; i <= len1; i++) {
dp[i][0] = i;
}
// 再初始化行,这里的 len2 表示的是列的范围
for (int i = 1; i <= len2; i++) {
dp[0][i] = i;
}
for (int i = 1; i <= len1; i++) {
for (int j = 1; j <= len2; j++) {
if (word1.charAt(i - 1) == word2.charAt(j - 1)) {
dp[i][j] = dp[i - 1][j - 1];
} else {
dp[i][j] = min(
dp[i - 1][j] + 1,
dp[i][j - 1] + 1,
dp[i - 1][j - 1] + 1
);
}
}
}
return dp[len1][len2];
}
public int min(int x, int y, int z) {
return Math.min(Math.min(x, y), z);
}
public static void main(String[] args) {
Solution solution = new Solution();
String word1 = "horse";
String word2 = "ros";
System.out.println(solution.minDistance(word1, word2));
}
}
| UTF-8 | Java | 3,454 | java | Solution.java | Java | [] | null | [] | package LeetCodeSolution.AlgorithmThought._02_DP._72_EditDistance;
/*
* 编辑距离
*
* 题目描述:
* 给你两个单词 word1 和 word2,请你计算出将 word1 转换成 word2 所使用的最少操作数 。
* 你可以对一个单词进行如下三种操作:
* 插入一个字符
* 删除一个字符
* 替换一个字符
*
* 思路:
* 1. 总体的思想是:使用两个指针 i、j 分别指向字符串的最后,然后一步一步的往前走,缩小问题的规模;
* 2. 如果 i 和 j 所指的字符相同,为了满足最少的操作次数,则应直接往前移动 i 和 j,不应该对它们所指的字符进行操作;
* 3. 如果 j 走完了 word2,而 i 还没走完 word1,则只能使用删除操作将 word1 缩短为 word2;
* 4. 如果 i 走完了 word1,而 j 还没走完 word2,则只能使用插入操作将 word2 剩下的字符全部插入到 word1 中;
* 5. 整体框架:
* if (word1[i] == word2[j]):
* // 什么都不做,i 和 j 都向前移动
* i--;
* j--;
* else:
* // 三选一
* // 插入
* // 删除
* // 替换
* 6. 定义状态:dp[i][j] 表示返回 word1[0...i] 和 word2[0...j] 的最小编辑距离;
* 7. 如果 word1[i] == word2[j],则返回 dp[i - 1][j - 1],即当前字符对应相等,不需要进行操作,
* 而当前对应的最小编辑距离就是上一个状态的最小编辑距离;
* 8. 如果 word1[i] != word2[j],则需要分为三种情况:
* 8.1) 插入一个字符:直接在 word1[i] 位置插入一个和 word2[j] 一样的字符,此时 word2[j] 就匹配了,然后前移 j,
* 继续和 i 比较,同时操作数加一;
* 8.2) 删除一个字符:直接把 word1[i] 位置的字符删除,前移 i,继续和 j 位置的字符比较,同时操作数加一;
* 8.3) 替换一个字符:直接把 word1[i] 字符替换成 word2[j] 字符,这两个位置就匹配成功了,然后同时前移 i 和 j,
* 同时操作数加一。
*/
public class Solution {
public int minDistance(String word1, String word2) {
int len1 = word1.length();
int len2 = word2.length();
int[][] dp = new int[len1 + 1][len2 + 1];
// 初始化边界
// 先初始化列,因为这里的边界是 len1,表示的是行的范围
for (int i = 1; i <= len1; i++) {
dp[i][0] = i;
}
// 再初始化行,这里的 len2 表示的是列的范围
for (int i = 1; i <= len2; i++) {
dp[0][i] = i;
}
for (int i = 1; i <= len1; i++) {
for (int j = 1; j <= len2; j++) {
if (word1.charAt(i - 1) == word2.charAt(j - 1)) {
dp[i][j] = dp[i - 1][j - 1];
} else {
dp[i][j] = min(
dp[i - 1][j] + 1,
dp[i][j - 1] + 1,
dp[i - 1][j - 1] + 1
);
}
}
}
return dp[len1][len2];
}
public int min(int x, int y, int z) {
return Math.min(Math.min(x, y), z);
}
public static void main(String[] args) {
Solution solution = new Solution();
String word1 = "horse";
String word2 = "ros";
System.out.println(solution.minDistance(word1, word2));
}
}
| 3,454 | 0.484723 | 0.447977 | 81 | 28.901234 | 21.899097 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.395062 | false | false | 13 |
134b248302c3b2a3debff5d4e73497efbbd131f3 | 13,297,218,767,196 | 67e4f8c4a28052d5fd4ecb7855130d826477a34f | /Java/Assignment_11/src/main/java/com/vti/backend/presentationlayer/package-info.java | c750279e594be4a1eb918945c8ef40ccb2302afe | [] | no_license | Huybamboo/Railway05 | https://github.com/Huybamboo/Railway05 | 317f5a803d479fef3690990b8dbc75c533fdfac5 | a06b6e883ca3aa6dfb1db2955445cee07b754263 | refs/heads/master | 2023-02-06T06:39:33.570000 | 2020-12-19T23:08:53 | 2020-12-19T23:08:53 | 291,733,369 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vti.backend.presentationlayer; | UTF-8 | Java | 42 | java | package-info.java | Java | [] | null | [] | package com.vti.backend.presentationlayer; | 42 | 0.880952 | 0.880952 | 1 | 42 | 0 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 13 |
979e2e29335497245a86a1a62b602b2e1087b0bf | 28,595,892,272,984 | ed196234a0964b14fdb6a774310496778d79d0e3 | /spring-boot-demo-smida/src/main/java/com/xkcoding/smida/rxdemo/statistics/StatisticMetrics.java | b76849be0f1ae27f63c6c9b06eb0c1b2f4e4972f | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | smidaxb/spring-boot-demo | https://github.com/smidaxb/spring-boot-demo | 61d03216fddfb79d61b7ad98aabb65e70e75f906 | b27e4992a3c7157aa9f960b4227ad2142e3e0d3a | refs/heads/master | 2023-09-06T03:21:32.337000 | 2021-10-27T11:11:48 | 2021-10-27T11:11:48 | 286,669,577 | 0 | 0 | MIT | true | 2020-08-11T06:56:17 | 2020-08-11T06:56:16 | 2020-08-11T06:50:49 | 2020-07-15T13:18:49 | 13,600 | 0 | 0 | 0 | null | false | false | package com.xkcoding.smida.rxdemo.statistics;
/**
* @author Created by YangYifan on 2021/4/26.
*/
public interface StatisticMetrics extends HermesEvent{
/**
* 将相同类型的指标数据整合
*/
StatisticMetrics toSumMetrics(StatisticMetrics other);
}
| UTF-8 | Java | 277 | java | StatisticMetrics.java | Java | [
{
"context": "mida.rxdemo.statistics;\n\n/**\n * @author Created by YangYifan on 2021/4/26.\n */\npublic interface StatisticMetri",
"end": 82,
"score": 0.9993813037872314,
"start": 73,
"tag": "NAME",
"value": "YangYifan"
}
] | null | [] | package com.xkcoding.smida.rxdemo.statistics;
/**
* @author Created by YangYifan on 2021/4/26.
*/
public interface StatisticMetrics extends HermesEvent{
/**
* 将相同类型的指标数据整合
*/
StatisticMetrics toSumMetrics(StatisticMetrics other);
}
| 277 | 0.719368 | 0.6917 | 11 | 22 | 22.328131 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 13 |
fc7e2f34d3b022a21ac091cfad6539c8a0c26cde | 33,535,104,661,907 | 84f62df0cb667d403085dfc499d58b2a40a50b22 | /src/Lesson6NetworkingServer.java | 6f70a48c70f2332f042f5e6c07306afdd907fb2b | [] | no_license | tj94109/Lesson6Networking | https://github.com/tj94109/Lesson6Networking | 1c932d6b0a57684c010ee6cfb8673650ccfcce4e | 736d23c9edadad1e8f0d1eb238d764d011ea7db0 | refs/heads/main | 2023-01-13T09:08:23.081000 | 2020-11-17T03:53:19 | 2020-11-17T03:53:19 | 313,500,725 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
public class Lesson6NetworkingServer {
public static void main(String[] args) throws IOException {
String arg = "";
int portNumber = 0;
int i = 0;
while (i < args.length) {
if (args[i].equalsIgnoreCase("--port")) {
portNumber = Integer.parseInt(args[i + 1]);
}
i++;
}
try (ServerSocket s = new ServerSocket(portNumber)) {
System.out.println("Server Running on Port: " + portNumber);
try(Socket socketConnection = s.accept()){
System.out.println("Made Connection");
PrintWriter writer = new PrintWriter(socketConnection.getOutputStream());
writer.print("HTTP/1.1 200\r\n");
writer.print("Content-Type: text/html\r\n\r\n\r\n");
writer.print("<html>\r\n" +
"<head><title>Java Networking</title></head>\r\n" +
"<body>\r\n" +
"<h1>Java Networking</h1>\r\n" +
"</body>\r\n" +
"</html>\r\n");
writer.flush();
System.out.println("Now closing connection");
writer.close();
}
}catch(IOException e){
e.printStackTrace();
}
}
}
| UTF-8 | Java | 1,417 | java | Lesson6NetworkingServer.java | Java | [] | null | [] | import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
public class Lesson6NetworkingServer {
public static void main(String[] args) throws IOException {
String arg = "";
int portNumber = 0;
int i = 0;
while (i < args.length) {
if (args[i].equalsIgnoreCase("--port")) {
portNumber = Integer.parseInt(args[i + 1]);
}
i++;
}
try (ServerSocket s = new ServerSocket(portNumber)) {
System.out.println("Server Running on Port: " + portNumber);
try(Socket socketConnection = s.accept()){
System.out.println("Made Connection");
PrintWriter writer = new PrintWriter(socketConnection.getOutputStream());
writer.print("HTTP/1.1 200\r\n");
writer.print("Content-Type: text/html\r\n\r\n\r\n");
writer.print("<html>\r\n" +
"<head><title>Java Networking</title></head>\r\n" +
"<body>\r\n" +
"<h1>Java Networking</h1>\r\n" +
"</body>\r\n" +
"</html>\r\n");
writer.flush();
System.out.println("Now closing connection");
writer.close();
}
}catch(IOException e){
e.printStackTrace();
}
}
}
| 1,417 | 0.485533 | 0.47777 | 45 | 30.48889 | 24.665426 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 13 |
3af4b17ac47d405846c20ad43ccdbc880d668072 | 33,535,104,658,382 | fec4c1754adce762b5c4b1cba85ad057e0e4744a | /webApp/src/main/java/com/jf/dao/MemberControlCustomMapper.java | 7eac2d79aacbd4fb5d8496e45832144001f7453b | [] | no_license | sengeiou/workspace_xg | https://github.com/sengeiou/workspace_xg | 140b923bd301ff72ca4ae41bc83820123b2a822e | 540a44d550bb33da9980d491d5c3fd0a26e3107d | refs/heads/master | 2022-11-30T05:28:35.447000 | 2020-08-19T02:30:25 | 2020-08-19T02:30:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jf.dao;
import org.springframework.stereotype.Repository;
import com.jf.entity.MemberControlCustom;
@Repository
public interface MemberControlCustomMapper {
int updateLastSignInDateModel(MemberControlCustom custom);
int updateSignBeHelpedDateModel(MemberControlCustom custom);
int updateLastHelpCutPriceDateModel(MemberControlCustom custom);
int updateLastCutPriceDateModel(MemberControlCustom custom);
int updateLastInviteDateModel(MemberControlCustom custom);
}
| UTF-8 | Java | 490 | java | MemberControlCustomMapper.java | Java | [] | null | [] | package com.jf.dao;
import org.springframework.stereotype.Repository;
import com.jf.entity.MemberControlCustom;
@Repository
public interface MemberControlCustomMapper {
int updateLastSignInDateModel(MemberControlCustom custom);
int updateSignBeHelpedDateModel(MemberControlCustom custom);
int updateLastHelpCutPriceDateModel(MemberControlCustom custom);
int updateLastCutPriceDateModel(MemberControlCustom custom);
int updateLastInviteDateModel(MemberControlCustom custom);
}
| 490 | 0.857143 | 0.857143 | 20 | 23.5 | 26.537708 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65 | false | false | 13 |
54c0ef8e3a1331b920c5c0c203574836edb3231c | 27,187,143,000,433 | 8f600447ff0902e8bb4041e74e15f079b8975924 | /team_vv/src/test/java/java2/application_target_list/core/junittests/services/target/ChangeTargetDescriptionServiceTest.java | cdf8e0811cf16a8e4909086256af74c4a8bd2cbd | [] | no_license | olegs-volaks/java2_thursday_online_2020_autumn | https://github.com/olegs-volaks/java2_thursday_online_2020_autumn | befdadb84c9a4413b06a0db459572ca84136cd9c | cf1b9d65cd4174e9fc7ea8585408913be5c580fe | refs/heads/master | 2023-04-07T20:05:30.228000 | 2021-04-17T18:08:07 | 2021-04-17T18:08:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package java2.application_target_list.core.junittests.services.target;
import java2.application_target_list.core.database.jpa.JpaTargetRepository;
import java2.application_target_list.core.requests.target.ChangeTargetDescriptionRequest;
import java2.application_target_list.core.responses.target.ChangeTargetDescriptionResponse;
import java2.application_target_list.core.responses.CoreError;
import java2.application_target_list.core.services.target.ChangeTargetDescriptionService;
import java2.application_target_list.core.validators.target.ChangeTargetDescriptionValidator;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
@RunWith(MockitoJUnitRunner.class)
public class ChangeTargetDescriptionServiceTest {
private List<CoreError> errors;
@Mock
private JpaTargetRepository jpaTargetRepository;
@Mock
private ChangeTargetDescriptionValidator validator;
@InjectMocks
ChangeTargetDescriptionService service;
@Before
public void setup() {
errors = new ArrayList<>();
}
@Test
public void shouldChangeTargetDescription() {
Mockito.when(jpaTargetRepository.existsById(1L)).thenReturn(true);
Mockito.when(jpaTargetRepository.changeTargetDescription(1L, "new description")).thenReturn(1);
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(1L, "new description");
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertFalse(response.hasErrors());
}
@Test
public void invalidChangeTargetDescriptionRequest_v1() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(1L, "new description");
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 1);
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "no target with that ID");
}
@Test
public void invalidChangeTargetDescriptionRequest_v2() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(null, "new description");
errors.add(new CoreError("Target ID;","must not be empty!"));
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 2);
Assert.assertEquals(response.getErrorList().get(1).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(1).getMessage(), "no target with that ID");
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "must not be empty!");
}
@Test
public void invalidChangeTargetDescriptionRequest_v3() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(-2L, "new description");
errors.add(new CoreError("Target ID;","must not be negative!"));
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 2);
Assert.assertEquals(response.getErrorList().get(1).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(1).getMessage(), "no target with that ID");
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "must not be negative!");
}
@Test
public void invalidChangeTargetDescriptionRequest_v4() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(-2L, null);
errors.add(new CoreError("Target ID;","must not be negative!"));
errors.add(new CoreError("Target new description","must not be empty!"));
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 3);
Assert.assertEquals(response.getErrorList().get(2).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(2).getMessage(), "no target with that ID");
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "must not be negative!");
Assert.assertEquals(response.getErrorList().get(1).getField(), "Target new description");
Assert.assertEquals(response.getErrorList().get(1).getMessage(), "must not be empty!");
}
@Test
public void invalidChangeTargetDescriptionRequest_v5() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(2L, null);
errors.add(new CoreError("Target new description","must not be empty!"));
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 2);
Assert.assertEquals(response.getErrorList().get(1).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(1).getMessage(), "no target with that ID");
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target new description");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "must not be empty!");
}
} | UTF-8 | Java | 6,198 | java | ChangeTargetDescriptionServiceTest.java | Java | [] | null | [] | package java2.application_target_list.core.junittests.services.target;
import java2.application_target_list.core.database.jpa.JpaTargetRepository;
import java2.application_target_list.core.requests.target.ChangeTargetDescriptionRequest;
import java2.application_target_list.core.responses.target.ChangeTargetDescriptionResponse;
import java2.application_target_list.core.responses.CoreError;
import java2.application_target_list.core.services.target.ChangeTargetDescriptionService;
import java2.application_target_list.core.validators.target.ChangeTargetDescriptionValidator;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
@RunWith(MockitoJUnitRunner.class)
public class ChangeTargetDescriptionServiceTest {
private List<CoreError> errors;
@Mock
private JpaTargetRepository jpaTargetRepository;
@Mock
private ChangeTargetDescriptionValidator validator;
@InjectMocks
ChangeTargetDescriptionService service;
@Before
public void setup() {
errors = new ArrayList<>();
}
@Test
public void shouldChangeTargetDescription() {
Mockito.when(jpaTargetRepository.existsById(1L)).thenReturn(true);
Mockito.when(jpaTargetRepository.changeTargetDescription(1L, "new description")).thenReturn(1);
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(1L, "new description");
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertFalse(response.hasErrors());
}
@Test
public void invalidChangeTargetDescriptionRequest_v1() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(1L, "new description");
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 1);
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "no target with that ID");
}
@Test
public void invalidChangeTargetDescriptionRequest_v2() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(null, "new description");
errors.add(new CoreError("Target ID;","must not be empty!"));
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 2);
Assert.assertEquals(response.getErrorList().get(1).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(1).getMessage(), "no target with that ID");
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "must not be empty!");
}
@Test
public void invalidChangeTargetDescriptionRequest_v3() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(-2L, "new description");
errors.add(new CoreError("Target ID;","must not be negative!"));
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 2);
Assert.assertEquals(response.getErrorList().get(1).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(1).getMessage(), "no target with that ID");
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "must not be negative!");
}
@Test
public void invalidChangeTargetDescriptionRequest_v4() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(-2L, null);
errors.add(new CoreError("Target ID;","must not be negative!"));
errors.add(new CoreError("Target new description","must not be empty!"));
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 3);
Assert.assertEquals(response.getErrorList().get(2).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(2).getMessage(), "no target with that ID");
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "must not be negative!");
Assert.assertEquals(response.getErrorList().get(1).getField(), "Target new description");
Assert.assertEquals(response.getErrorList().get(1).getMessage(), "must not be empty!");
}
@Test
public void invalidChangeTargetDescriptionRequest_v5() {
ChangeTargetDescriptionRequest request = new ChangeTargetDescriptionRequest(2L, null);
errors.add(new CoreError("Target new description","must not be empty!"));
Mockito.when(validator.validate(request)).thenReturn(errors);
ChangeTargetDescriptionResponse response = service.execute(request);
Assert.assertTrue(response.hasErrors());
Assert.assertEquals(response.getErrorList().size(), 2);
Assert.assertEquals(response.getErrorList().get(1).getField(), "Target ID;");
Assert.assertEquals(response.getErrorList().get(1).getMessage(), "no target with that ID");
Assert.assertEquals(response.getErrorList().get(0).getField(), "Target new description");
Assert.assertEquals(response.getErrorList().get(0).getMessage(), "must not be empty!");
}
} | 6,198 | 0.73201 | 0.72475 | 114 | 53.377193 | 34.918549 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.096491 | false | false | 13 |
7827afdac8bc1ca0d322184f0ca8707f5365e177 | 27,187,143,001,088 | 146d522e812219fa4d825bed97ef7c35c641d38e | /erta-main/erta-common/src/main/java/erta/common/config/AppConfigUtil.java | 13692a8db3e6fe3b6e691ed33549ae7feda42185 | [] | no_license | luke202001/EventsRealTimeAnalysis | https://github.com/luke202001/EventsRealTimeAnalysis | 7c9f570f0066f121547536a08b6461893b712d40 | 7f4ccadcd835b00320e6bba616fe97f29d3a8514 | refs/heads/master | 2020-06-30T10:36:52.011000 | 2019-07-29T13:15:45 | 2019-07-29T13:15:45 | 200,803,165 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package erta.common.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.client.RestTemplate;
@Configuration
public class AppConfigUtil implements EnvironmentAware {
@Autowired
public ApplicationContext appCtx;
private Environment environment;
public AppConfigUtil() {
}
// @ConfigurationProperties
// @Bean(autowireCandidate = true, name = "springEnvironmentREf")
// @Autowired
// public Properties getProperties(@Autowired ApplicationContext appCtx) {
//
// final SortedMap<String, String> sortedMap = new TreeMap<>();
//
// Environment env = appCtx.getEnvironment();
//
// return new Properties();
// }
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
public String getProperty(String key) {
return this.environment.getProperty(key);
}
public String getProperty(String key, String defaultValue) {
return this.environment.getProperty(key, defaultValue);
}
public <T> Object getProperty(String key, Class<T> targetType) {
return this.environment.getProperty(key, targetType);
}
public boolean containsProperty(String key) {
return this.environment.containsProperty(key);
}
public String getServicesWFActivitiesCSV(String processorContext, String processorName) {
String wfActivitiesCSVPropBaseKey = processorContext + ".workflows.tasks";
String wfActivitiesCSVPropKey = wfActivitiesCSVPropBaseKey + "." + processorName;
if (!this.environment.containsProperty(wfActivitiesCSVPropKey)) {
wfActivitiesCSVPropKey = wfActivitiesCSVPropBaseKey;
}
return this.environment.getProperty(wfActivitiesCSVPropKey);
}
public String getUi2ServicesDelegateRestUrl(String processorContext, String processName) {
String ui2ServicesRestUrlPropKey = processorContext + "." + processName + ".ui2services.delegate.resturl";
if (this.environment.containsProperty(ui2ServicesRestUrlPropKey)) {
return this.environment.getProperty(ui2ServicesRestUrlPropKey);
}
ui2ServicesRestUrlPropKey = processorContext + ".*.ui2services.delegate.resturl";
if (this.environment.containsProperty(ui2ServicesRestUrlPropKey)) {
return this.environment.getProperty(ui2ServicesRestUrlPropKey) + "/" + processName;
}
return null;
}
@Bean
public RestTemplate createRestTemplate() {
return new RestTemplate();
}
}
| UTF-8 | Java | 2,629 | java | AppConfigUtil.java | Java | [] | null | [] | package erta.common.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.client.RestTemplate;
@Configuration
public class AppConfigUtil implements EnvironmentAware {
@Autowired
public ApplicationContext appCtx;
private Environment environment;
public AppConfigUtil() {
}
// @ConfigurationProperties
// @Bean(autowireCandidate = true, name = "springEnvironmentREf")
// @Autowired
// public Properties getProperties(@Autowired ApplicationContext appCtx) {
//
// final SortedMap<String, String> sortedMap = new TreeMap<>();
//
// Environment env = appCtx.getEnvironment();
//
// return new Properties();
// }
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
public String getProperty(String key) {
return this.environment.getProperty(key);
}
public String getProperty(String key, String defaultValue) {
return this.environment.getProperty(key, defaultValue);
}
public <T> Object getProperty(String key, Class<T> targetType) {
return this.environment.getProperty(key, targetType);
}
public boolean containsProperty(String key) {
return this.environment.containsProperty(key);
}
public String getServicesWFActivitiesCSV(String processorContext, String processorName) {
String wfActivitiesCSVPropBaseKey = processorContext + ".workflows.tasks";
String wfActivitiesCSVPropKey = wfActivitiesCSVPropBaseKey + "." + processorName;
if (!this.environment.containsProperty(wfActivitiesCSVPropKey)) {
wfActivitiesCSVPropKey = wfActivitiesCSVPropBaseKey;
}
return this.environment.getProperty(wfActivitiesCSVPropKey);
}
public String getUi2ServicesDelegateRestUrl(String processorContext, String processName) {
String ui2ServicesRestUrlPropKey = processorContext + "." + processName + ".ui2services.delegate.resturl";
if (this.environment.containsProperty(ui2ServicesRestUrlPropKey)) {
return this.environment.getProperty(ui2ServicesRestUrlPropKey);
}
ui2ServicesRestUrlPropKey = processorContext + ".*.ui2services.delegate.resturl";
if (this.environment.containsProperty(ui2ServicesRestUrlPropKey)) {
return this.environment.getProperty(ui2ServicesRestUrlPropKey) + "/" + processName;
}
return null;
}
@Bean
public RestTemplate createRestTemplate() {
return new RestTemplate();
}
}
| 2,629 | 0.789274 | 0.78585 | 88 | 28.875 | 30.381594 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.306818 | false | false | 13 |
6c1b2419b4a15fb0ceb6f97006813f5f01478330 | 15,934,328,696,936 | f9158612e4b8dca6d2ca6dfde53168d1fa52b72b | /src/main/java/org/transactiontool/model/Node.java | 564ba32e1e538167b3897883a3fc490591348347 | [] | no_license | WisedomChainGroup/java-transactiontool | https://github.com/WisedomChainGroup/java-transactiontool | 244bc064c2521dc3434697087359ded898b6d8f1 | 08cfe1fc873d18517341ee97f332fa01406cfce6 | refs/heads/master | 2022-10-21T07:57:03.524000 | 2020-06-15T06:39:21 | 2020-06-15T06:39:21 | 255,527,645 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.transactiontool.model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class Node {
public String ip;
public String port;
public Node(String ip, String port) {
this.ip = ip;
this.port = port;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
}
| UTF-8 | Java | 574 | java | Node.java | Java | [] | null | [] | package org.transactiontool.model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class Node {
public String ip;
public String port;
public Node(String ip, String port) {
this.ip = ip;
this.port = port;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
}
| 574 | 0.616725 | 0.616725 | 32 | 16.9375 | 16.190155 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 13 |
1b22b5f041c3dc036f75796aa9159e0d2d78919c | 13,408,887,917,405 | 9c5c8a0778d4929afa9864ecc9685711435d243c | /Java2/src/pk30/stream/ArrayStream.java | 42267b4ddcc3bf74c36265b04bdecf6976974149 | [] | no_license | Huchu0623/JavaStudy | https://github.com/Huchu0623/JavaStudy | 09741af3b8e365b6a7a744355680d169e207b2aa | b9c1a195185245962071be58c7cfaf3e84dcbce7 | refs/heads/master | 2022-11-25T13:37:56.883000 | 2020-07-13T11:19:17 | 2020-07-13T11:19:17 | 276,329,981 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pk30.stream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
public class ArrayStream {
public static void main(String[] args) {
int[] arr = {1,2,3,4,5};
Arrays.stream(arr).forEach(n->System.out.println(n));
int sum = Arrays.stream(arr).sum();
System.out.println("arr의 합계: " + sum);
System.out.println("-----------------");
//객체이름 : list
List<Integer> list = new ArrayList<Integer>();
list.add(1);
list.add(2);
list.add(3);
list.add(4);
list.add(5);
Stream<Integer> stream = list.stream();
int sum2 = list.stream().mapToInt(n->n.intValue()).sum();
System.out.println("ArrayList의 합계 : " + sum2);
}
}
| UHC | Java | 781 | java | ArrayStream.java | Java | [] | null | [] | package pk30.stream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
public class ArrayStream {
public static void main(String[] args) {
int[] arr = {1,2,3,4,5};
Arrays.stream(arr).forEach(n->System.out.println(n));
int sum = Arrays.stream(arr).sum();
System.out.println("arr의 합계: " + sum);
System.out.println("-----------------");
//객체이름 : list
List<Integer> list = new ArrayList<Integer>();
list.add(1);
list.add(2);
list.add(3);
list.add(4);
list.add(5);
Stream<Integer> stream = list.stream();
int sum2 = list.stream().mapToInt(n->n.intValue()).sum();
System.out.println("ArrayList의 합계 : " + sum2);
}
}
| 781 | 0.595269 | 0.576873 | 36 | 19.138889 | 18.075693 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.916667 | false | false | 13 |
3e3fc0c42c10a2fb0742e825eeae37e191d5bd35 | 7,533,372,656,433 | a3bcf1401e4a5a8ac3d8317a1acab8fe22b58557 | /src/com/spring/chapter2/idol/instrument/Piano.java | 54db2a61042cf0b8a925c3f222a71afce4d5cf6b | [] | no_license | mengmen116/spring | https://github.com/mengmen116/spring | 6103f915fd86339155488869c0ecd8036a6cc99d | dc1cd725abd52867d3b327f1fd06d2d0ea8bb107 | refs/heads/master | 2021-01-15T10:41:22.050000 | 2014-05-12T12:23:44 | 2014-05-12T12:23:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.spring.chapter2.idol.instrument;
import com.spring.chapter2.Instrument;
import com.spring.chapter2.idol.StringedInstrument;
@StringedInstrument
public class Piano implements Instrument{
public Piano(){}
@Override
public void play() {
// TODO Auto-generated method stub
System.out.println("piano is playing.");
}
}
| UTF-8 | Java | 340 | java | Piano.java | Java | [] | null | [] | package com.spring.chapter2.idol.instrument;
import com.spring.chapter2.Instrument;
import com.spring.chapter2.idol.StringedInstrument;
@StringedInstrument
public class Piano implements Instrument{
public Piano(){}
@Override
public void play() {
// TODO Auto-generated method stub
System.out.println("piano is playing.");
}
}
| 340 | 0.764706 | 0.755882 | 17 | 19 | 18.442278 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.764706 | false | false | 13 |
c4fe8dd965ac5afceb5bd0c124a2d51f3c944bc4 | 31,181,462,591,569 | 929696149b1441827ef683ef0eb44a290ae65bd7 | /hope-dependencies/hope-core/src/main/java/org/hopeframework/core/exception/ExceptionHandler.java | 4956a2a3b6c120d01ec87847fbd8271e443a923c | [] | no_license | hejunling/hopeFramework | https://github.com/hejunling/hopeFramework | bac232fb78b20237d4baf1cfb2cdd9732a995cfa | 0156a38d6fcf5fdac9baf2a0aa0b476a598c1c73 | refs/heads/master | 2020-12-02T07:55:46.210000 | 2017-07-10T08:35:34 | 2017-07-10T08:35:34 | 96,747,539 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.hopeframework.core.exception;
import java.text.MessageFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.hopeframework.core.cache.BasicDataDao;
import org.hopeframework.core.cache.SystemBasicData;
import org.hopeframework.core.constant.ResponseConst;
import org.hopeframework.core.error.Errors;
import org.hopeframework.core.response.RespBody;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 异常处理拦截类
*
* @author hechuan
*
* @created 2017年4月10日
*
* @version hopeframework-1.0.0
*
* @since 1.0.0
*/
@ControllerAdvice
public class ExceptionHandler {
/** 日志 */
private static Logger log = LoggerFactory.getLogger(ExceptionHandler.class);
@Autowired
private BasicDataDao basicDataDao;
/**
* 处理参数校验异常
*
* @param request
* 请求体
* @param response
* 回复体
* @param handler
* 发生异常的类
* @param ex
* 具体异常
* @return 处理结果
*/
@ResponseBody
@org.springframework.web.bind.annotation.ExceptionHandler(value = ParamterValidException.class)
public RespBody<Errors> resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
ParamterValidException ex) {
RespBody<Errors> result = new RespBody<Errors>(ex.getErrors());
int code = ex.getCode();
SystemBasicData data = basicDataDao.getBusiness(String.valueOf(code));
String msg = "";
if (null != data && !StringUtils.isEmpty(data.getModule())) {
msg = data.getConfValue();
}
result.getInfo().setCode(code);
result.getInfo().setMsg(msg);
log.error("参数校验异常:result ={},", result.getContent().toString());
return result;
}
/**
* 业务处理异常
*
* @param request
* @param response
* @param handler
* @param ex
* @return
*/
@ResponseBody
@org.springframework.web.bind.annotation.ExceptionHandler(value = HopeException.class)
public RespBody<String> resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
Exception ex) {
// 请求响应的格式(xml/json)
RespBody<String> out = new RespBody<String>(null);
int code = ResponseConst.SYSTEM_EXCEPTION;
Object[] params = {};
String msg = "";
if (null != ex && ex instanceof HopeException) {
code = ((HopeException) ex).getCode();
params = ((HopeException) ex).getParams();
SystemBasicData data = basicDataDao.getBusiness(String.valueOf(code));
if (null != data && !StringUtils.isEmpty(data.getModule())) {
msg = MessageFormat.format(data.getConfValue(), params);
}
log.error("业务异常:code={},msg={}", code, msg);
} else {
SystemBasicData data = basicDataDao.getBusiness(code + "");
msg = MessageFormat.format(data.getConfValue(), params);
log.error("系统异常");
}
response.setHeader("code", String.valueOf(code));
out.getInfo().setCode(code);
out.getInfo().setMsg(msg);
log.error("异常信息:", ex);
return out;
}
}
| UTF-8 | Java | 3,401 | java | ExceptionHandler.java | Java | [
{
"context": ".ResponseBody;\r\n\r\n/**\r\n * 异常处理拦截类\r\n * \r\n * @author hechuan\r\n *\r\n * @created 2017年4月10日\r\n *\r\n * @version hope",
"end": 771,
"score": 0.9964892268180847,
"start": 764,
"tag": "USERNAME",
"value": "hechuan"
}
] | null | [] | package org.hopeframework.core.exception;
import java.text.MessageFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.hopeframework.core.cache.BasicDataDao;
import org.hopeframework.core.cache.SystemBasicData;
import org.hopeframework.core.constant.ResponseConst;
import org.hopeframework.core.error.Errors;
import org.hopeframework.core.response.RespBody;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 异常处理拦截类
*
* @author hechuan
*
* @created 2017年4月10日
*
* @version hopeframework-1.0.0
*
* @since 1.0.0
*/
@ControllerAdvice
public class ExceptionHandler {
/** 日志 */
private static Logger log = LoggerFactory.getLogger(ExceptionHandler.class);
@Autowired
private BasicDataDao basicDataDao;
/**
* 处理参数校验异常
*
* @param request
* 请求体
* @param response
* 回复体
* @param handler
* 发生异常的类
* @param ex
* 具体异常
* @return 处理结果
*/
@ResponseBody
@org.springframework.web.bind.annotation.ExceptionHandler(value = ParamterValidException.class)
public RespBody<Errors> resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
ParamterValidException ex) {
RespBody<Errors> result = new RespBody<Errors>(ex.getErrors());
int code = ex.getCode();
SystemBasicData data = basicDataDao.getBusiness(String.valueOf(code));
String msg = "";
if (null != data && !StringUtils.isEmpty(data.getModule())) {
msg = data.getConfValue();
}
result.getInfo().setCode(code);
result.getInfo().setMsg(msg);
log.error("参数校验异常:result ={},", result.getContent().toString());
return result;
}
/**
* 业务处理异常
*
* @param request
* @param response
* @param handler
* @param ex
* @return
*/
@ResponseBody
@org.springframework.web.bind.annotation.ExceptionHandler(value = HopeException.class)
public RespBody<String> resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
Exception ex) {
// 请求响应的格式(xml/json)
RespBody<String> out = new RespBody<String>(null);
int code = ResponseConst.SYSTEM_EXCEPTION;
Object[] params = {};
String msg = "";
if (null != ex && ex instanceof HopeException) {
code = ((HopeException) ex).getCode();
params = ((HopeException) ex).getParams();
SystemBasicData data = basicDataDao.getBusiness(String.valueOf(code));
if (null != data && !StringUtils.isEmpty(data.getModule())) {
msg = MessageFormat.format(data.getConfValue(), params);
}
log.error("业务异常:code={},msg={}", code, msg);
} else {
SystemBasicData data = basicDataDao.getBusiness(code + "");
msg = MessageFormat.format(data.getConfValue(), params);
log.error("系统异常");
}
response.setHeader("code", String.valueOf(code));
out.getInfo().setCode(code);
out.getInfo().setMsg(msg);
log.error("异常信息:", ex);
return out;
}
}
| 3,401 | 0.690323 | 0.685407 | 112 | 27.0625 | 25.757551 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.589286 | false | false | 13 |
5f5a7ed7c41232d1827562b8330492a0437ecd7e | 206,158,491,567 | bbfd8dccc9bafe9231cc5df2ca8cd75b94769a01 | /deitel/src/br/com/deitel/cap/three/GradeBook4Test.java | e2fd01ea722b87735a9d92620fb532276c401432 | [] | no_license | bonejah/Java | https://github.com/bonejah/Java | 39189731c0e99226d03720f2e23c6a418c6fc8c3 | 2de44d1341b7eef741670acf92e65ecf2ea1d5fe | refs/heads/master | 2021-01-21T11:57:56.227000 | 2020-06-22T12:42:08 | 2020-06-22T12:42:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.deitel.cap.three;
public class GradeBook4Test {
public static void main(String[] args) {
GradeBook4 gradeBook1 = new GradeBook4("Ruby on Rails");
GradeBook4 gradeBook2 = new GradeBook4("Python");
System.out.printf(" gradebook1 course name is: %s\n", gradeBook1.getCourseName());
System.out.printf(" gradebook2 course name is: %s\n", gradeBook2.getCourseName());
}
}
| UTF-8 | Java | 395 | java | GradeBook4Test.java | Java | [] | null | [] | package br.com.deitel.cap.three;
public class GradeBook4Test {
public static void main(String[] args) {
GradeBook4 gradeBook1 = new GradeBook4("Ruby on Rails");
GradeBook4 gradeBook2 = new GradeBook4("Python");
System.out.printf(" gradebook1 course name is: %s\n", gradeBook1.getCourseName());
System.out.printf(" gradebook2 course name is: %s\n", gradeBook2.getCourseName());
}
}
| 395 | 0.729114 | 0.701266 | 11 | 34.909092 | 30.491295 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.727273 | false | false | 13 |
a6281bfe4b0a43f4d5cfdf31135955da9c1c1180 | 6,236,292,535,319 | 3d7e86013ff4d91a948946c114b84e7301823c8b | /concurrent-study/src/main/java/com/xuyong/study/queue/TestQueue.java | b636cdd2fb7f37f51aec3771759878ceb5864117 | [] | no_license | xuyongisgoop/all-study | https://github.com/xuyongisgoop/all-study | c481e70ba727776343a4ba3c272759a0ad096bfb | 8bc5f1b14af5c2fb37c7d87c49bb331083c759f2 | refs/heads/master | 2022-12-17T18:27:22.879000 | 2022-11-16T08:29:14 | 2022-11-16T08:29:14 | 111,499,199 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xuyong.study.queue;
public class TestQueue {
}
| UTF-8 | Java | 61 | java | TestQueue.java | Java | [] | null | [] | package com.xuyong.study.queue;
public class TestQueue {
}
| 61 | 0.754098 | 0.754098 | 5 | 11.2 | 13.496666 | 31 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 13 |
aedbfc37f0b14e26fbead11307c38632ea5f71a2 | 13,039,520,733,739 | 2199dd4d95169875c3e9c8641e4bcba82c860b1e | /DB_Project_dev3/src/biz/MatchBIZ.java | c8bf13e36933d8b44a54debe90c846cfb15c5f2f | [] | no_license | BohanHsu/MyEclipse | https://github.com/BohanHsu/MyEclipse | 0af92a95f07986ea9a66ab37c9e72ed787b6a8be | 2242342358066ed9f987993b6b3f988166a23461 | refs/heads/master | 2021-01-10T18:42:20.731000 | 2014-03-14T03:52:33 | 2014-03-14T03:52:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package biz;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import dao.BaseHibernateDAO;
import dao.CityDAO;
import dao.ClubDAO;
import dao.LeagueDAO;
import dao.MatchDAO;
import dao.PlayerDAO;
import dao.PlayingDAO;
import dao.RoundDAO;
import dao.SeasonDAO;
import entity.Club;
import entity.League;
import entity.Match;
import entity.Round;
import entity.Season;
public class MatchBIZ {
private MatchDAO matchDAO = null;
private ClubDAO clubDAO = null;
private CityDAO cityDAO = null;
private LeagueDAO leagueDAO = null;
private SeasonDAO seasonDAO = null;
private PlayingDAO playingdDao = null;
private PlayerDAO playerDAO = null;
private RoundDAO roundDAO = null;
public MatchBIZ(MatchDAO matchDAO, ClubDAO clubDAO, CityDAO cityDAO,
LeagueDAO leagueDAO, SeasonDAO seasonDAO, PlayingDAO playingdDao,
PlayerDAO playerDAO, RoundDAO roundDAO) {
super();
this.matchDAO = matchDAO;
this.clubDAO = clubDAO;
this.cityDAO = cityDAO;
this.leagueDAO = leagueDAO;
this.seasonDAO = seasonDAO;
this.playingdDao = playingdDao;
this.playerDAO = playerDAO;
this.roundDAO = roundDAO;
}
public Match findMatchById(Integer id) throws Exception{
Match match = matchDAO.findById(id);
if(match == null){
throw new Exception("match not found : (id="+id+")");
}
return match;
}
public List<Match> findMatchByLeagueAndSeason(String leagueName,
Integer seasonStartYear) {
List<Match> resultList = new ArrayList<Match>();
String hql = "from entity.Match as m where m.league.name =? and m.season.startyear =?";
Session session = matchDAO.getSession();
Query query = session.createQuery(hql);
query.setString(0, leagueName);
query.setInteger(1, seasonStartYear);
List<Object> resultObjs = query.list();
for (Object object : resultObjs) {
resultList.add((Match) object);
}
return resultList;
}
public Match findMatchByLeagueAndSeasonAndHomeAndVisitTeam(
String leagueName, Integer seasonStartYear, Integer homeId,
Integer visitId) {
List<Match> resultList = findMatchByLeagueAndSeason(leagueName,
seasonStartYear);
for (Match match : resultList) {
if (match.getClubByHomeTeamId().getId().equals(homeId)) {
if (match.getClubByVisitTeamId().getId().equals(visitId)) {
return match;
}
}
}
return null;
}
public List<Match> findMatchByHomeTeam(Integer team_Id) throws Exception {
List<Match> resultList = new ArrayList<Match>();
ClubBIZ clubBIZ = new ClubBIZ(this.clubDAO, this.cityDAO);
Club club = clubBIZ.findClubById(team_Id);
List resultObjs = matchDAO.findByProperty("clubByHomeTeamId", club);
for (Object object : resultObjs) {
resultList.add((Match) object);
}
return resultList;
}
public List<Match> findMatchByVisitTeam(Integer team_Id) throws Exception {
List<Match> resultList = new ArrayList<Match>();
ClubBIZ clubBIZ = new ClubBIZ(this.clubDAO, this.cityDAO);
Club club = clubBIZ.findClubById(team_Id);
List resultObjs = matchDAO.findByProperty("clubByVisitTeamId", club);
for (Object object : resultObjs) {
resultList.add((Match) object);
}
return resultList;
}
public void addMatch(String leagueName, Integer seasonStartYear,
Integer homeTeamId, Integer visitTeamId, Integer roundNumber, Date date, String stadium,
Integer homeScore, Integer visitScore, List<Integer> playerIds)
throws Exception {
Session session = this.matchDAO.getSession();
Transaction tx = session.beginTransaction();
tx.begin();
League league = new LeagueBIZ(this.leagueDAO)
.findLeagueByName(leagueName);
Season season = new SeasonBIZ(this.seasonDAO)
.findSeasonByStartYear(seasonStartYear);
Club homeTeam = new ClubBIZ(clubDAO, cityDAO).findClubById(homeTeamId);
Club visitTeam = new ClubBIZ(clubDAO, cityDAO)
.findClubById(visitTeamId);
Round round = new RoundBIZ(roundDAO ).findRoundByRound(roundNumber);
Match newMatch = new Match(league, homeTeam, round, visitTeam, season, date, stadium, homeScore, visitScore, null);
this.matchDAO.save(newMatch);
tx.commit();
session.flush();
session.close();
}
public List<Match> findMatchsByLeagueAndSeasonAndRound(String leagueName,
Integer seasonStartYear, Integer roundNumber) throws Exception{
Round round = new RoundBIZ(roundDAO).findRoundByRound(roundNumber);
Integer requestRoundId = round.getId();
ArrayList<Match> resultList = new ArrayList<Match>();
List<Match> list = findMatchByLeagueAndSeason(leagueName, seasonStartYear);
for (Match match : list) {
if (requestRoundId.equals(match.getRound().getId())){
resultList.add(match);
}
}
return resultList;
}
public List<Match> getAllMatches(){
return this.matchDAO.findAll();
}
}
| UTF-8 | Java | 4,835 | java | MatchBIZ.java | Java | [] | null | [] | package biz;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import dao.BaseHibernateDAO;
import dao.CityDAO;
import dao.ClubDAO;
import dao.LeagueDAO;
import dao.MatchDAO;
import dao.PlayerDAO;
import dao.PlayingDAO;
import dao.RoundDAO;
import dao.SeasonDAO;
import entity.Club;
import entity.League;
import entity.Match;
import entity.Round;
import entity.Season;
public class MatchBIZ {
private MatchDAO matchDAO = null;
private ClubDAO clubDAO = null;
private CityDAO cityDAO = null;
private LeagueDAO leagueDAO = null;
private SeasonDAO seasonDAO = null;
private PlayingDAO playingdDao = null;
private PlayerDAO playerDAO = null;
private RoundDAO roundDAO = null;
public MatchBIZ(MatchDAO matchDAO, ClubDAO clubDAO, CityDAO cityDAO,
LeagueDAO leagueDAO, SeasonDAO seasonDAO, PlayingDAO playingdDao,
PlayerDAO playerDAO, RoundDAO roundDAO) {
super();
this.matchDAO = matchDAO;
this.clubDAO = clubDAO;
this.cityDAO = cityDAO;
this.leagueDAO = leagueDAO;
this.seasonDAO = seasonDAO;
this.playingdDao = playingdDao;
this.playerDAO = playerDAO;
this.roundDAO = roundDAO;
}
public Match findMatchById(Integer id) throws Exception{
Match match = matchDAO.findById(id);
if(match == null){
throw new Exception("match not found : (id="+id+")");
}
return match;
}
public List<Match> findMatchByLeagueAndSeason(String leagueName,
Integer seasonStartYear) {
List<Match> resultList = new ArrayList<Match>();
String hql = "from entity.Match as m where m.league.name =? and m.season.startyear =?";
Session session = matchDAO.getSession();
Query query = session.createQuery(hql);
query.setString(0, leagueName);
query.setInteger(1, seasonStartYear);
List<Object> resultObjs = query.list();
for (Object object : resultObjs) {
resultList.add((Match) object);
}
return resultList;
}
public Match findMatchByLeagueAndSeasonAndHomeAndVisitTeam(
String leagueName, Integer seasonStartYear, Integer homeId,
Integer visitId) {
List<Match> resultList = findMatchByLeagueAndSeason(leagueName,
seasonStartYear);
for (Match match : resultList) {
if (match.getClubByHomeTeamId().getId().equals(homeId)) {
if (match.getClubByVisitTeamId().getId().equals(visitId)) {
return match;
}
}
}
return null;
}
public List<Match> findMatchByHomeTeam(Integer team_Id) throws Exception {
List<Match> resultList = new ArrayList<Match>();
ClubBIZ clubBIZ = new ClubBIZ(this.clubDAO, this.cityDAO);
Club club = clubBIZ.findClubById(team_Id);
List resultObjs = matchDAO.findByProperty("clubByHomeTeamId", club);
for (Object object : resultObjs) {
resultList.add((Match) object);
}
return resultList;
}
public List<Match> findMatchByVisitTeam(Integer team_Id) throws Exception {
List<Match> resultList = new ArrayList<Match>();
ClubBIZ clubBIZ = new ClubBIZ(this.clubDAO, this.cityDAO);
Club club = clubBIZ.findClubById(team_Id);
List resultObjs = matchDAO.findByProperty("clubByVisitTeamId", club);
for (Object object : resultObjs) {
resultList.add((Match) object);
}
return resultList;
}
public void addMatch(String leagueName, Integer seasonStartYear,
Integer homeTeamId, Integer visitTeamId, Integer roundNumber, Date date, String stadium,
Integer homeScore, Integer visitScore, List<Integer> playerIds)
throws Exception {
Session session = this.matchDAO.getSession();
Transaction tx = session.beginTransaction();
tx.begin();
League league = new LeagueBIZ(this.leagueDAO)
.findLeagueByName(leagueName);
Season season = new SeasonBIZ(this.seasonDAO)
.findSeasonByStartYear(seasonStartYear);
Club homeTeam = new ClubBIZ(clubDAO, cityDAO).findClubById(homeTeamId);
Club visitTeam = new ClubBIZ(clubDAO, cityDAO)
.findClubById(visitTeamId);
Round round = new RoundBIZ(roundDAO ).findRoundByRound(roundNumber);
Match newMatch = new Match(league, homeTeam, round, visitTeam, season, date, stadium, homeScore, visitScore, null);
this.matchDAO.save(newMatch);
tx.commit();
session.flush();
session.close();
}
public List<Match> findMatchsByLeagueAndSeasonAndRound(String leagueName,
Integer seasonStartYear, Integer roundNumber) throws Exception{
Round round = new RoundBIZ(roundDAO).findRoundByRound(roundNumber);
Integer requestRoundId = round.getId();
ArrayList<Match> resultList = new ArrayList<Match>();
List<Match> list = findMatchByLeagueAndSeason(leagueName, seasonStartYear);
for (Match match : list) {
if (requestRoundId.equals(match.getRound().getId())){
resultList.add(match);
}
}
return resultList;
}
public List<Match> getAllMatches(){
return this.matchDAO.findAll();
}
}
| 4,835 | 0.742916 | 0.742503 | 162 | 28.845678 | 24.142727 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.327161 | false | false | 13 |
036167805f77147ec3052929188843d5b7d4a615 | 31,241,592,158,376 | 21cfd98dbe0e09944b7f20a39b5e20568e3f480b | /EjemploAlmacenamientoExterno/src/com/diplomadourp/almacenamientoexterno/MainActivity.java | d231af65dc961c5dc866500862c8b870173cc228 | [] | no_license | ricardochavezt/diplomado-moviles-urp | https://github.com/ricardochavezt/diplomado-moviles-urp | ff66f25958935e98650c4411a679189a6bf63ba4 | 218899ecc6c5a66f8b58d0fdfbafa22d182bd6f7 | refs/heads/master | 2021-01-13T01:45:41.872000 | 2015-07-24T06:45:34 | 2015-07-24T06:45:34 | 22,903,322 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.diplomadourp.almacenamientoexterno;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity implements OnClickListener {
Button btnExportar;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnExportar = (Button) findViewById(R.id.btnExportar);
btnExportar.setOnClickListener(this);
}
@Override
public void onClick(View view) {
String estado = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(estado)) {
Toast.makeText(this,
"Memoria externa disponible como solo lectura",
Toast.LENGTH_SHORT).show();
return;
}
if (!Environment.MEDIA_MOUNTED.equals(estado)) {
Toast.makeText(this,
"Memoria externa no disponible",
Toast.LENGTH_SHORT).show();
return;
}
exportarIcono();
}
private void exportarIcono() {
File directorioAlbum = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File archivoIcono = new File(directorioAlbum, "icono.png");
InputStream in = getResources().openRawResource(R.drawable.ic_launcher);
OutputStream out = null;
try {
out = new FileOutputStream(archivoIcono);
byte[] dataIconoApp = new byte[in.available()];
in.read(dataIconoApp);
out.write(dataIconoApp);
Toast.makeText(this, "Se cre— la imagen en la memoria externa",
Toast.LENGTH_SHORT).show();
} catch (IOException e) {
Log.w("AlmacenamientoExterno", "No se pudo crear el archivo", e);
Toast.makeText(this,
"No se pudo crear el archivo de imagen: " + e.getLocalizedMessage(),
Toast.LENGTH_SHORT).show();
} finally {
try {
in.close();
if (out != null) {
out.close();
}
} catch (IOException e) {
Log.w("AlmacenamientoExterno", "Error al cerrar archivo", e);
}
}
}
}
| WINDOWS-1252 | Java | 2,268 | java | MainActivity.java | Java | [] | null | [] | package com.diplomadourp.almacenamientoexterno;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity implements OnClickListener {
Button btnExportar;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnExportar = (Button) findViewById(R.id.btnExportar);
btnExportar.setOnClickListener(this);
}
@Override
public void onClick(View view) {
String estado = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(estado)) {
Toast.makeText(this,
"Memoria externa disponible como solo lectura",
Toast.LENGTH_SHORT).show();
return;
}
if (!Environment.MEDIA_MOUNTED.equals(estado)) {
Toast.makeText(this,
"Memoria externa no disponible",
Toast.LENGTH_SHORT).show();
return;
}
exportarIcono();
}
private void exportarIcono() {
File directorioAlbum = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File archivoIcono = new File(directorioAlbum, "icono.png");
InputStream in = getResources().openRawResource(R.drawable.ic_launcher);
OutputStream out = null;
try {
out = new FileOutputStream(archivoIcono);
byte[] dataIconoApp = new byte[in.available()];
in.read(dataIconoApp);
out.write(dataIconoApp);
Toast.makeText(this, "Se cre— la imagen en la memoria externa",
Toast.LENGTH_SHORT).show();
} catch (IOException e) {
Log.w("AlmacenamientoExterno", "No se pudo crear el archivo", e);
Toast.makeText(this,
"No se pudo crear el archivo de imagen: " + e.getLocalizedMessage(),
Toast.LENGTH_SHORT).show();
} finally {
try {
in.close();
if (out != null) {
out.close();
}
} catch (IOException e) {
Log.w("AlmacenamientoExterno", "Error al cerrar archivo", e);
}
}
}
}
| 2,268 | 0.726831 | 0.726831 | 78 | 28.051283 | 20.779612 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.628205 | false | false | 13 |
2f29bc39666346c75cba073d9795e5c3129b4302 | 31,301,721,659,292 | 9eeb3093893b0243068ba06dce43d9a345d5bd58 | /app/src/main/java/com/example/cw/fumesmanage/MainPage/MainListview/DetailActivity/Monthly/MonthAdapter.java | db3efdba4e6400c995c7efadc214e3ea8ab01851 | [] | no_license | xiaoshidefeng/Fumes | https://github.com/xiaoshidefeng/Fumes | 1306edf972443ed8558a9d239f8c5f0166f15041 | a1c12de8335e0e8510dfc09a7c42e78a249d4433 | refs/heads/master | 2021-01-22T22:23:53.134000 | 2018-03-08T12:18:58 | 2018-03-08T12:18:58 | 85,536,355 | 2 | 0 | null | false | 2017-03-29T15:36:41 | 2017-03-20T04:49:36 | 2017-03-20T04:50:01 | 2017-03-29T15:36:41 | 2,283 | 0 | 0 | 0 | Java | null | null | package com.example.cw.fumesmanage.MainPage.MainListview.DetailActivity.Monthly;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.cw.fumesmanage.R;
import java.util.List;
/**
* Created by cw on 2017/3/30.
*/
public class MonthAdapter extends BaseAdapter {
private List<MonthListBean> mList;
private ViewHolder viewHolder = null;
private LayoutInflater mInflater;
public MonthAdapter(Context context, List<MonthListBean> mList) {
this.mList = mList;
this.mInflater = mInflater.from(context);
}
@Override
public int getCount() {
return mList.size();
}
@Override
public Object getItem(int i) {
return mList.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
viewHolder = null;
if(view == null){
viewHolder = new ViewHolder();
view = mInflater.inflate(R.layout.detail_fg_month_listview_item_layout,null);
viewHolder.time = (TextView)view.findViewById(R.id.id_TVListItemMonthDay);
viewHolder.maxn = (TextView)view.findViewById(R.id.id_TVMaxValue);
viewHolder.minn = (TextView)view.findViewById(R.id.id_TVMinValue);
//viewHolder.rl = (RelativeLayout)view.findViewById(R.id.id_RLmainListView);
view.setTag(viewHolder);
}else {
viewHolder = (ViewHolder)view.getTag();
}
final MonthListBean bean = mList.get(i);
viewHolder.time.setText(bean.time);
viewHolder.maxn.setText(bean.maxn+"mg/m³");
viewHolder.minn.setText(bean.minn+"mg/m³");
if (bean.maxn > 1.8){
viewHolder.maxn.setTextColor(Color.RED);
}else {
viewHolder.maxn.setTextColor(Color.rgb(0,153,0));
}
if (bean.minn > 1.8){
viewHolder.minn.setTextColor(Color.RED);
}else {
viewHolder.minn.setTextColor(Color.rgb(0,153,0));
}
return view;
}
class ViewHolder{
public TextView time;
public TextView maxn;
public TextView minn;
//public RelativeLayout rl;
}
}
| UTF-8 | Java | 2,426 | java | MonthAdapter.java | Java | [
{
"context": "nage.R;\n\nimport java.util.List;\n\n/**\n * Created by cw on 2017/3/30.\n */\n\npublic class MonthAdapter exte",
"end": 388,
"score": 0.9986627697944641,
"start": 386,
"tag": "USERNAME",
"value": "cw"
}
] | null | [] | package com.example.cw.fumesmanage.MainPage.MainListview.DetailActivity.Monthly;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.cw.fumesmanage.R;
import java.util.List;
/**
* Created by cw on 2017/3/30.
*/
public class MonthAdapter extends BaseAdapter {
private List<MonthListBean> mList;
private ViewHolder viewHolder = null;
private LayoutInflater mInflater;
public MonthAdapter(Context context, List<MonthListBean> mList) {
this.mList = mList;
this.mInflater = mInflater.from(context);
}
@Override
public int getCount() {
return mList.size();
}
@Override
public Object getItem(int i) {
return mList.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
viewHolder = null;
if(view == null){
viewHolder = new ViewHolder();
view = mInflater.inflate(R.layout.detail_fg_month_listview_item_layout,null);
viewHolder.time = (TextView)view.findViewById(R.id.id_TVListItemMonthDay);
viewHolder.maxn = (TextView)view.findViewById(R.id.id_TVMaxValue);
viewHolder.minn = (TextView)view.findViewById(R.id.id_TVMinValue);
//viewHolder.rl = (RelativeLayout)view.findViewById(R.id.id_RLmainListView);
view.setTag(viewHolder);
}else {
viewHolder = (ViewHolder)view.getTag();
}
final MonthListBean bean = mList.get(i);
viewHolder.time.setText(bean.time);
viewHolder.maxn.setText(bean.maxn+"mg/m³");
viewHolder.minn.setText(bean.minn+"mg/m³");
if (bean.maxn > 1.8){
viewHolder.maxn.setTextColor(Color.RED);
}else {
viewHolder.maxn.setTextColor(Color.rgb(0,153,0));
}
if (bean.minn > 1.8){
viewHolder.minn.setTextColor(Color.RED);
}else {
viewHolder.minn.setTextColor(Color.rgb(0,153,0));
}
return view;
}
class ViewHolder{
public TextView time;
public TextView maxn;
public TextView minn;
//public RelativeLayout rl;
}
}
| 2,426 | 0.632838 | 0.62335 | 100 | 23.24 | 24.045008 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.48 | false | false | 13 |
f832122081dbed0dda7bd612827afb54fdb2b039 | 18,167,711,664,759 | 17667bc519a6cb80a3f29f5dce5c38cd4e3506d1 | /Ch00_Exam/src/test_solution/MemberExample.java | 0ec4a424303d5a32dfed819d1f0516dd210f38cb | [] | no_license | Shin-JS/jsjavaex | https://github.com/Shin-JS/jsjavaex | 80270cf939aa9ff62ad68248304a2f4fcc08219c | 17904a9b4e141b892261cc03c72c9512a4b832ea | refs/heads/master | 2021-05-07T21:50:49.378000 | 2017-12-08T07:58:14 | 2017-12-08T07:58:14 | 109,063,429 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test_solution;
import java.util.Scanner;
/***
* 회원가입,
* 로그인 처리
* id체크 id가 다르면 NoMemerException();
* 회원가입 처리
* password다르면 NoMatchPassword();
* 패스워드 5회 입력 까지 성공 못하면 자동 종료 System.exit(0);
* 둘다 맞으면 로그인성공 메세지 출력
*
*/
public class MemberExample {
static Member[] members = new Member[10];
static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
boolean run = true;
while(run) {
try {
System.out.println("-----------------------");
System.out.println("1.회원가입|2.로그인|3.종료 ");
System.out.println("-----------------------");
System.out.print("선택>");
int selectNo = scanner.nextInt();
if(selectNo ==1) {
subscribe();
}else if(selectNo==2) {
login();
}else if(selectNo==3) {
run=true;
}
}catch(Exception e) {
System.out.println("다시하세요");
}
}//while문 종료
System.out.println("종료");
}
private static void login() {
System.out.println("--------------로그인----------------");
System.out.print("아이디를 입력하세요>");
String id = scanner.next();
Member member=null;
int cnt=1;//오류횟수 카운트 변수
try {
member = findMember(id);//회원등록 여부 확인
while(true) {
try {
System.out.print("비밀번호를 입력하세요>");
String password = scanner.next();
if(findPassword(member,password))break;//id와 패스워드가 맞으면 반복문 종료
}catch(NoMatchPaswordException n) {
if(cnt>=5) {
System.out.println("5회 이상 오류로 종료합니다.");
System.exit(0);//강제 종료
}
System.out.println(cnt+"회 입력 오류 다시 입력하세요");
cnt++;//오류 카운트
}
}
System.out.println("로그인 환영합니다.");
System.exit(0);//종료
} catch (NoMemberException e) {
System.out.println("id가 존재하지않습니다.\n 회원가입하시겠습니까?");
char c = scanner.next().charAt(0);
if(c=='y'||c=='Y')
subscribe();//회원가입
else
{
System.out.println("종료합니다");
System.exit(0);//종료
}
}
}
//회원가입
private static void subscribe() {
System.out.print("아이디를 입력하세요>");
String id = scanner.next();
System.out.print("비밀번호를 입력하세요>");
String password = scanner.next();
System.out.print("이름을 입력하세요>");
String name = scanner.next();
for(int i=0;i<members.length;i++) {
if(members[i]==null) {
members[i] = new Member(id,password,name);
break;
}
}
System.out.println("회원가입 완료");
}
//회원 여부 확인
private static Member findMember(String id) throws NoMemberException{
Member member=null;
for(int i=0;i<members.length;i++) {
if(members[i]!=null) {
if(members[i].getId().equals(id)) {
member = members[i];
break;
}
}
}
if(member==null) {
throw new NoMemberException();
}
return member;
}
//패스워드 확인
private static boolean findPassword(Member member,String password) throws NoMatchPaswordException{
boolean isTrue=false;
if(member.getPassword().equals(password))
isTrue=true;
else
throw new NoMatchPaswordException();
return isTrue;
}
} | UTF-8 | Java | 3,374 | java | MemberExample.java | Java | [] | null | [] | package test_solution;
import java.util.Scanner;
/***
* 회원가입,
* 로그인 처리
* id체크 id가 다르면 NoMemerException();
* 회원가입 처리
* password다르면 NoMatchPassword();
* 패스워드 5회 입력 까지 성공 못하면 자동 종료 System.exit(0);
* 둘다 맞으면 로그인성공 메세지 출력
*
*/
public class MemberExample {
static Member[] members = new Member[10];
static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
boolean run = true;
while(run) {
try {
System.out.println("-----------------------");
System.out.println("1.회원가입|2.로그인|3.종료 ");
System.out.println("-----------------------");
System.out.print("선택>");
int selectNo = scanner.nextInt();
if(selectNo ==1) {
subscribe();
}else if(selectNo==2) {
login();
}else if(selectNo==3) {
run=true;
}
}catch(Exception e) {
System.out.println("다시하세요");
}
}//while문 종료
System.out.println("종료");
}
private static void login() {
System.out.println("--------------로그인----------------");
System.out.print("아이디를 입력하세요>");
String id = scanner.next();
Member member=null;
int cnt=1;//오류횟수 카운트 변수
try {
member = findMember(id);//회원등록 여부 확인
while(true) {
try {
System.out.print("비밀번호를 입력하세요>");
String password = scanner.next();
if(findPassword(member,password))break;//id와 패스워드가 맞으면 반복문 종료
}catch(NoMatchPaswordException n) {
if(cnt>=5) {
System.out.println("5회 이상 오류로 종료합니다.");
System.exit(0);//강제 종료
}
System.out.println(cnt+"회 입력 오류 다시 입력하세요");
cnt++;//오류 카운트
}
}
System.out.println("로그인 환영합니다.");
System.exit(0);//종료
} catch (NoMemberException e) {
System.out.println("id가 존재하지않습니다.\n 회원가입하시겠습니까?");
char c = scanner.next().charAt(0);
if(c=='y'||c=='Y')
subscribe();//회원가입
else
{
System.out.println("종료합니다");
System.exit(0);//종료
}
}
}
//회원가입
private static void subscribe() {
System.out.print("아이디를 입력하세요>");
String id = scanner.next();
System.out.print("비밀번호를 입력하세요>");
String password = scanner.next();
System.out.print("이름을 입력하세요>");
String name = scanner.next();
for(int i=0;i<members.length;i++) {
if(members[i]==null) {
members[i] = new Member(id,password,name);
break;
}
}
System.out.println("회원가입 완료");
}
//회원 여부 확인
private static Member findMember(String id) throws NoMemberException{
Member member=null;
for(int i=0;i<members.length;i++) {
if(members[i]!=null) {
if(members[i].getId().equals(id)) {
member = members[i];
break;
}
}
}
if(member==null) {
throw new NoMemberException();
}
return member;
}
//패스워드 확인
private static boolean findPassword(Member member,String password) throws NoMatchPaswordException{
boolean isTrue=false;
if(member.getPassword().equals(password))
isTrue=true;
else
throw new NoMatchPaswordException();
return isTrue;
}
} | 3,374 | 0.607317 | 0.600697 | 116 | 23.75 | 17.213604 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.043103 | false | false | 13 |
f1e4853ceffc77bc44bbbc85831a12de913d1b7c | 29,025,389,029,023 | 6ce88bd885aa6aff6bd4750013aa8fe7b0fc17e3 | /app/src/main/java/com/example/bhavik/smarter/SQLiteDB/DBStructure.java | aab32b9383f7e38d5e092e0ac53f49859cc4ef0a | [] | no_license | bhavikchauhan93/SmartER | https://github.com/bhavikchauhan93/SmartER | 3668b34ad6170a239f6505d4c27c1ce3486a4897 | 4195d1a586b5f5987f8da346299a1976946bdde9 | refs/heads/master | 2020-03-14T01:59:13.260000 | 2018-04-30T01:46:43 | 2018-04-30T01:46:43 | 131,389,558 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.bhavik.smarter.SQLiteDB;
import android.provider.BaseColumns;
public class DBStructure {
// Class to store the schema of the table
public static abstract class tableEntry implements BaseColumns {
public static final String TABLE_NAME = "eUsage";
public static final String COLUMN_ID = "usageId";
public static final String COLUMN_DATE = "usageDate";
public static final String COLUMN_HOUR = "usageHour";
public static final String COLUMN_FRIDGE = "fridgeUse";
public static final String COLUMN_AIRCON = "airConUse";
public static final String COLUMN_WASHINGMACHINE = "washingMachine";
public static final String COLUMN_TEMPERATURE = "temperature";
}
}
| UTF-8 | Java | 751 | java | DBStructure.java | Java | [] | null | [] | package com.example.bhavik.smarter.SQLiteDB;
import android.provider.BaseColumns;
public class DBStructure {
// Class to store the schema of the table
public static abstract class tableEntry implements BaseColumns {
public static final String TABLE_NAME = "eUsage";
public static final String COLUMN_ID = "usageId";
public static final String COLUMN_DATE = "usageDate";
public static final String COLUMN_HOUR = "usageHour";
public static final String COLUMN_FRIDGE = "fridgeUse";
public static final String COLUMN_AIRCON = "airConUse";
public static final String COLUMN_WASHINGMACHINE = "washingMachine";
public static final String COLUMN_TEMPERATURE = "temperature";
}
}
| 751 | 0.712384 | 0.712384 | 18 | 40.722221 | 27.169847 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 13 |
ac8c4d506ccec5ea67284fd3da05b4d39d5a091a | 34,316,788,695,676 | 3c0bd69e44c9759076388661715166d21e2f4a67 | /Java/tutorials/JavaEE/JDBC/tutorialspoint/ex01_sample/src/main/java/ua/mega/streaming/jdbc/sample/FirstExample.java | d3003bc3db20e5875ed3e0039f9182dd2a79b8fe | [] | no_license | megadethov/shildt | https://github.com/megadethov/shildt | 959e102da8a0325b01a3d4e246d32b135d410d8d | 7c828b964836f6a3ee763e4a25357d217a739752 | refs/heads/master | 2020-09-17T22:15:31.819000 | 2018-09-25T19:27:44 | 2018-09-25T19:27:44 | 67,035,362 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ua.mega.streaming.jdbc.sample;
import java.sql.*;
import java.util.Properties;
import static java.awt.SystemColor.info;
public class FirstExample {
// JDBC driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost/emp";
// Database credentials
static final String USER = "root";
static final String PASS = "root";
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
try {
//STEP 2: Register JDBC driver
Class.forName(JDBC_DRIVER);
//STEP 3: Open a conn
System.out.println("Connection to DB ...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
//STEP 3: Open a conn - Properties
/* Properties credentials = new Properties();
credentials.put("user", USER);
credentials.put("password", PASS);
conn = DriverManager.getConnection(DB_URL, credentials);*/
//STEP 4: Execute a query
System.out.println("Creating stmt...");
stmt = conn.createStatement();
String sql = "SELECT id, first, last, age FROM Employees";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while (rs.next()) {
int id = rs.getInt("id");
int age = rs.getInt("age");
String first = rs.getString("first");
String last = rs.getString("last");
//Display values
System.out.print("ID: " + id);
System.out.print(", Age: " + age);
System.out.print(", First: " + first);
System.out.println(", Last: " + last);
}
//STEP 6: Clean-up environment
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null) {
stmt.close();
}
} catch (SQLException se2) {
//NOP
}
try {
if (conn != null) {
conn.close();
}
} catch (SQLException se3) {
se3.printStackTrace();
}
System.out.println("Goodbye!");
} // end finally
} // end main
}
| UTF-8 | Java | 2,662 | java | FirstExample.java | Java | [
{
"context": "abase credentials\n static final String USER = \"root\";\n static final String PASS = \"root\";\n\n pub",
"end": 393,
"score": 0.6641457080841064,
"start": 389,
"tag": "USERNAME",
"value": "root"
},
{
"context": "ng USER = \"root\";\n static final String PAS... | null | [] | package ua.mega.streaming.jdbc.sample;
import java.sql.*;
import java.util.Properties;
import static java.awt.SystemColor.info;
public class FirstExample {
// JDBC driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost/emp";
// Database credentials
static final String USER = "root";
static final String PASS = "<PASSWORD>";
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
try {
//STEP 2: Register JDBC driver
Class.forName(JDBC_DRIVER);
//STEP 3: Open a conn
System.out.println("Connection to DB ...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
//STEP 3: Open a conn - Properties
/* Properties credentials = new Properties();
credentials.put("user", USER);
credentials.put("password", <PASSWORD>);
conn = DriverManager.getConnection(DB_URL, credentials);*/
//STEP 4: Execute a query
System.out.println("Creating stmt...");
stmt = conn.createStatement();
String sql = "SELECT id, first, last, age FROM Employees";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while (rs.next()) {
int id = rs.getInt("id");
int age = rs.getInt("age");
String first = rs.getString("first");
String last = rs.getString("last");
//Display values
System.out.print("ID: " + id);
System.out.print(", Age: " + age);
System.out.print(", First: " + first);
System.out.println(", Last: " + last);
}
//STEP 6: Clean-up environment
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null) {
stmt.close();
}
} catch (SQLException se2) {
//NOP
}
try {
if (conn != null) {
conn.close();
}
} catch (SQLException se3) {
se3.printStackTrace();
}
System.out.println("Goodbye!");
} // end finally
} // end main
}
| 2,674 | 0.506011 | 0.50263 | 83 | 31.072289 | 19.337076 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.554217 | false | false | 13 |
80b0b6d103e1aa5356570f573df4610b00a41b5e | 19,155,554,175,080 | d4fdfb5deb66c95e64bfa97f9a378bea0929faac | /Zuul_New/src/zuul1/CommandWord.java | 24b813f9b5f55af19da0d727ef681298cda75648 | [] | no_license | AlvinPech/Proyecto_Game | https://github.com/AlvinPech/Proyecto_Game | 1b225b00a87ad674777ebd055af81a1568cea11c | b31c6d26a6c45841dc9c49be36cd49f14d3d4136 | refs/heads/main | 2023-02-25T02:29:10.444000 | 2021-02-09T01:59:07 | 2021-02-09T01:59:07 | 334,331,191 | 0 | 0 | null | false | 2021-02-09T01:59:08 | 2021-01-30T04:55:56 | 2021-02-08T04:16:37 | 2021-02-09T01:59:07 | 123 | 0 | 0 | 0 | Java | false | false |
package zuul1;
/*
* @author lizandro reyes
*/
public enum CommandWord {
GO("go"),HELP("help"), STRANGEWORD("?"),EXIT("exit");
private String textCommand;
CommandWord(String textCommand){
this.textCommand = textCommand;
}
public String toString(){
return textCommand ;
}
}
| UTF-8 | Java | 331 | java | CommandWord.java | Java | [
{
"context": "\npackage zuul1;\n\n/*\n * @author lizandro reyes\n */\npublic enum CommandWord {\n \n GO(\"go\"),H",
"end": 45,
"score": 0.9997916221618652,
"start": 31,
"tag": "NAME",
"value": "lizandro reyes"
}
] | null | [] |
package zuul1;
/*
* @author <NAME>
*/
public enum CommandWord {
GO("go"),HELP("help"), STRANGEWORD("?"),EXIT("exit");
private String textCommand;
CommandWord(String textCommand){
this.textCommand = textCommand;
}
public String toString(){
return textCommand ;
}
}
| 323 | 0.598187 | 0.595166 | 20 | 15.5 | 16.62077 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 13 |
1770c1737c7b938c015e965c20efbc768f400230 | 14,620,068,713,819 | 1fc33baa2c317c91bd401f1175164e3824ef0d2b | /core/src/main/java/me/rocketwash/client/data/dto/LoginResult.java | 2817a836f4b49c3eef6abcb770b81f738a923377 | [] | no_license | fedka27/rw-core-lient | https://github.com/fedka27/rw-core-lient | 4c10b7a5238863f110faf1d79d621a8ebc48f9ad | f7096bf009cc0aebae8f76816635de217348a2d0 | refs/heads/master | 2020-04-03T21:26:02.177000 | 2018-11-06T12:58:22 | 2018-11-06T12:58:22 | 155,574,416 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.rocketwash.client.data.dto;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import me.rocketwash.client.data.dto.sign_in.LoginData;
@Deprecated
public class LoginResult implements Serializable {
@SerializedName("status")
private String status;
@SerializedName("data")
private LoginData data;
public LoginData getData() {
return data;
}
public String getStatus() {
return status;
}
public String toString() {
String s;
s = "status = " + status;
s = s + "\ndata = " + (data == null ? "null" : data.toString());
return s;
}
}
| UTF-8 | Java | 662 | java | LoginResult.java | Java | [] | null | [] | package me.rocketwash.client.data.dto;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import me.rocketwash.client.data.dto.sign_in.LoginData;
@Deprecated
public class LoginResult implements Serializable {
@SerializedName("status")
private String status;
@SerializedName("data")
private LoginData data;
public LoginData getData() {
return data;
}
public String getStatus() {
return status;
}
public String toString() {
String s;
s = "status = " + status;
s = s + "\ndata = " + (data == null ? "null" : data.toString());
return s;
}
}
| 662 | 0.634441 | 0.634441 | 31 | 20.354839 | 19.00857 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.387097 | false | false | 13 |
30195e9644a06708a7c7164746e26da5df785e98 | 11,768,210,420,421 | 618226961ddb3ffd5638c240ba8fec10a25989f3 | /paiza/java入門編2/【補講】税込み金額を計算する.java | d4f1ce37c303de64480f2704533aa645c463c721 | [] | no_license | KenInoue1911/NewJava | https://github.com/KenInoue1911/NewJava | 731612c9458103096ffcb2ad536be7e13b3c39c5 | 871afa13dc602cb708c16cc26cf5657c99b62bac | refs/heads/main | 2023-06-26T22:24:41.100000 | 2021-07-31T09:55:04 | 2021-07-31T09:55:04 | 388,092,186 | 0 | 0 | null | false | 2021-07-29T11:37:06 | 2021-07-21T11:18:10 | 2021-07-24T12:02:15 | 2021-07-29T11:37:05 | 17 | 0 | 0 | 0 | Java | false | false | public class Main {
public static void main(String[] args) {
int price = 128;
int weight = 300;
int amount = (int)(price / 100.0 * weight);
System.out.println("100グラム"+price+"円の肉"+weight+"グラム"+amount+"円です。");
}
}
| UTF-8 | Java | 267 | java | 【補講】税込み金額を計算する.java | Java | [] | null | [] | public class Main {
public static void main(String[] args) {
int price = 128;
int weight = 300;
int amount = (int)(price / 100.0 * weight);
System.out.println("100グラム"+price+"円の肉"+weight+"グラム"+amount+"円です。");
}
}
| 267 | 0.593361 | 0.539419 | 8 | 28.125 | 22.474638 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
5f294412b94b667f035cc461d79d5fa0245bcb18 | 5,196,910,467,364 | d19dc7e85ccddd789add06e741e8e0865fce9a76 | /javaweb/day12/src/JsoupDemo03.java | ed2e3007b184b2bd7750a89d9b9d291f3432be95 | [] | no_license | sjtuwyf/java-basic-code | https://github.com/sjtuwyf/java-basic-code | 6cd7b812cf1e221077c551368b3260ea6d2c9ae2 | 51047c659f66099937e095597c7e71cf726f1ff0 | refs/heads/main | 2023-03-31T13:32:59.573000 | 2021-04-04T04:07:41 | 2021-04-04T04:07:41 | 342,221,770 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.File;
import java.io.IOException;
import java.net.URL;
public class JsoupDemo03 {
public static void main(String[] args) throws IOException {
String path = JsoupDemo03.class.getClassLoader().getResource("student.xml").getPath();
Document document = Jsoup.parse(new File(path), "utf-8");
Elements elements = document.getElementsByTag("student");
String number = elements.get(0).attr("number");
System.out.println(number);
String text = elements.get(1).text();
System.out.println(text);
}
}
| UTF-8 | Java | 670 | java | JsoupDemo03.java | Java | [] | null | [] | import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.File;
import java.io.IOException;
import java.net.URL;
public class JsoupDemo03 {
public static void main(String[] args) throws IOException {
String path = JsoupDemo03.class.getClassLoader().getResource("student.xml").getPath();
Document document = Jsoup.parse(new File(path), "utf-8");
Elements elements = document.getElementsByTag("student");
String number = elements.get(0).attr("number");
System.out.println(number);
String text = elements.get(1).text();
System.out.println(text);
}
}
| 670 | 0.680597 | 0.670149 | 28 | 22.928572 | 25.892536 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
7a239f9c6d90fd964e4b5f60e607a41d49d492f2 | 10,539,849,788,989 | cc17de01d85d11cbaee3ed3091bfc4c99e468540 | /Javaground/src/revisePac/anagram.java | d984a2b0d57fda689dcfda0aaf330c7564661ff8 | [] | no_license | Dharamiyer/autojava | https://github.com/Dharamiyer/autojava | b75d9036534bb4374b93d2e660a079b38bac224f | f9e84f4e17415680ce637eec4b241ee07412a039 | refs/heads/master | 2021-01-11T09:55:51.854000 | 2017-03-07T16:40:39 | 2017-03-07T16:40:39 | 77,921,530 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package revisePac;
import java.util.Arrays;
public class anagram {
public static boolean isAnagram(String s1, String s2){
s1 = s1.replaceAll("\\s", "");
s2 = s2.replaceAll("\\s", "");
char[] c1 = s1.toLowerCase().toCharArray();
char[] c2 = s2.toLowerCase().toCharArray();
Arrays.sort(c1);
Arrays.sort(c2);
return Arrays.equals(c1, c2);
}
public static boolean isAnagramStringComparison(String s1, String s2){
s1 = s1.replaceAll("\\s", "");
s2 = s2.replaceAll("\\s", "");
char[] c1 = s1.toCharArray();
if(s1.length() != s2.length())
return false;
else{
for(char c : c1){
int index = s2.indexOf(c);
if(index != -1){
s2 = s2.substring(0,index)+s2.substring(index+1,s2.length());
}
else
return false;
}
return true;
}
}
public static void main(String[] args){
System.out.println(anagram.isAnagram("keep", "peek"));
System.out.println(anagram.isAnagram("Dormitory", "Dirty room"));
System.out.println(anagram.isAnagramStringComparison("keep", "peek"));
System.out.println(anagram.isAnagramStringComparison("Dormitory", "Dirty room"));
System.out.println(anagram.isAnagramStringComparison("Dormitory", "Dirty roam"));
}
}
| UTF-8 | Java | 1,312 | java | anagram.java | Java | [] | null | [] | package revisePac;
import java.util.Arrays;
public class anagram {
public static boolean isAnagram(String s1, String s2){
s1 = s1.replaceAll("\\s", "");
s2 = s2.replaceAll("\\s", "");
char[] c1 = s1.toLowerCase().toCharArray();
char[] c2 = s2.toLowerCase().toCharArray();
Arrays.sort(c1);
Arrays.sort(c2);
return Arrays.equals(c1, c2);
}
public static boolean isAnagramStringComparison(String s1, String s2){
s1 = s1.replaceAll("\\s", "");
s2 = s2.replaceAll("\\s", "");
char[] c1 = s1.toCharArray();
if(s1.length() != s2.length())
return false;
else{
for(char c : c1){
int index = s2.indexOf(c);
if(index != -1){
s2 = s2.substring(0,index)+s2.substring(index+1,s2.length());
}
else
return false;
}
return true;
}
}
public static void main(String[] args){
System.out.println(anagram.isAnagram("keep", "peek"));
System.out.println(anagram.isAnagram("Dormitory", "Dirty room"));
System.out.println(anagram.isAnagramStringComparison("keep", "peek"));
System.out.println(anagram.isAnagramStringComparison("Dormitory", "Dirty room"));
System.out.println(anagram.isAnagramStringComparison("Dormitory", "Dirty roam"));
}
}
| 1,312 | 0.601372 | 0.576219 | 45 | 28.155556 | 24.740391 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.555556 | false | false | 13 |
dcd9b763c16b5c745e0c06b53f2a4c7f44bb0470 | 32,813,550,183,375 | 46e810caa943ebae4606f067b6278025d6e03b40 | /III_LV_Strings/Strings.java | ce990933de2c55508d53e64e7cec2ae173410d01 | [
"MIT"
] | permissive | AleksandarLilic/Concurrent_Java | https://github.com/AleksandarLilic/Concurrent_Java | 163692b49afd7c11d32164dcce0c68ce36f5a4a7 | fdfab918ae005a39e0d360a97ec32e9e70784484 | refs/heads/master | 2021-07-20T17:14:07.071000 | 2021-01-06T06:36:41 | 2021-01-06T06:36:41 | 231,875,680 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class Strings
{
static boolean palindrome(String t)
{
StringBuffer s = new StringBuffer(t);
s.reverse();
String s1 = new String (s);
boolean test = false;
test = s1.equalsIgnoreCase(t);
return test;
}
public static void main(String[] args)
{
Scanner scan1 = new Scanner(System.in);
System.out.println("Word to test: ");
String s = scan1.next();
System.out.println("Input word is: " + s);
boolean test = palindrome(s);
System.out.println("Word is palindrome: " + test);
}
}
| UTF-8 | Java | 544 | java | Strings.java | Java | [] | null | [] | import java.util.Scanner;
public class Strings
{
static boolean palindrome(String t)
{
StringBuffer s = new StringBuffer(t);
s.reverse();
String s1 = new String (s);
boolean test = false;
test = s1.equalsIgnoreCase(t);
return test;
}
public static void main(String[] args)
{
Scanner scan1 = new Scanner(System.in);
System.out.println("Word to test: ");
String s = scan1.next();
System.out.println("Input word is: " + s);
boolean test = palindrome(s);
System.out.println("Word is palindrome: " + test);
}
}
| 544 | 0.663603 | 0.65625 | 24 | 21.666666 | 16.699966 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 13 |
b1403f179c4233d39d14c4d3670e88d1e754ff1e | 21,303,037,833,660 | bd9a16908527b000ff3c6a4351139a5f7951172e | /src/main/java/ec/edu/ucuenca/analizer/service/RunTestServiceImpl.java | 3a186da148ffb039e8f845528f6192a21085dd0d | [] | no_license | fernandobac03/GeoSPARQLAnalizer | https://github.com/fernandobac03/GeoSPARQLAnalizer | 5478cc0b2a8acaf636ef880aa27f0358e49f3bb5 | 6f9c6536dfb345c7f922ba1ec1849e83f2c90831 | refs/heads/master | 2021-01-20T22:24:22.995000 | 2016-06-15T21:23:33 | 2016-06-15T21:23:33 | 61,241,802 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ec.edu.ucuenca.analizer.service;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import ec.edu.ucuenca.analizer.api.RunTestService;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.security.CodeSource;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.IOUtils;
/**
*
* @author Fernando Baculima Geo Linked Data Ecuador linkeddata.ec
* geo.linkeddata.ec Universidad de Cuenca Departamento de Ciencias de la
* Computacion Cuenca - Ecuador
*
*/
public class RunTestServiceImpl implements RunTestService {
@Override
public String runMainTest(String endpoint, String queryFile, String folderToTest) {
StringBuilder prefixes = new StringBuilder();
prefixes.append(" PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> ");
/**
* Getting list of files
*/
try {
String query = "";
query = IOUtils.toString(this.getClass().getResourceAsStream("/" + folderToTest + "/" + queryFile), "UTF-8");
QueryExecution execution = null;
try {
long start = System.currentTimeMillis();
long end = start + 5 * 1000; // 60 seconds * 1000 ms/sec
while ((System.currentTimeMillis() < end) || execution == null) {
execution = QueryExecutionFactory.sparqlService(endpoint, query);
if (execution != null) {
break;
}
}
if (execution == null) {
System.out.println(" Time Exceeded, No results obtained ");
} else {
int allRetrieveResources = 0;
ResultSet queryResult = execution.execSelect();
while (queryResult.hasNext()) {
QuerySolution solution = queryResult.next();
String uri = solution.get("resource").toString();
allRetrieveResources++;
}
System.out.println(" Recovered resources from " + allRetrieveResources);
execution.close();
}
} catch (Exception e) {
System.out.println(" No results obtained");
} finally {
}
return "";
} catch (IOException ex) {
Logger.getLogger(RunTestServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return "";
}
}
| UTF-8 | Java | 2,950 | java | RunTestServiceImpl.java | Java | [
{
"context": " org.apache.commons.io.IOUtils;\n\n/**\n *\n * @author Fernando Baculima Geo Linked Data Ecuador linkeddata.ec\n * geo.link",
"end": 758,
"score": 0.999882161617279,
"start": 741,
"tag": "NAME",
"value": "Fernando Baculima"
}
] | 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 ec.edu.ucuenca.analizer.service;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import ec.edu.ucuenca.analizer.api.RunTestService;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.security.CodeSource;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.IOUtils;
/**
*
* @author <NAME> Geo Linked Data Ecuador linkeddata.ec
* geo.linkeddata.ec Universidad de Cuenca Departamento de Ciencias de la
* Computacion Cuenca - Ecuador
*
*/
public class RunTestServiceImpl implements RunTestService {
@Override
public String runMainTest(String endpoint, String queryFile, String folderToTest) {
StringBuilder prefixes = new StringBuilder();
prefixes.append(" PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> ");
/**
* Getting list of files
*/
try {
String query = "";
query = IOUtils.toString(this.getClass().getResourceAsStream("/" + folderToTest + "/" + queryFile), "UTF-8");
QueryExecution execution = null;
try {
long start = System.currentTimeMillis();
long end = start + 5 * 1000; // 60 seconds * 1000 ms/sec
while ((System.currentTimeMillis() < end) || execution == null) {
execution = QueryExecutionFactory.sparqlService(endpoint, query);
if (execution != null) {
break;
}
}
if (execution == null) {
System.out.println(" Time Exceeded, No results obtained ");
} else {
int allRetrieveResources = 0;
ResultSet queryResult = execution.execSelect();
while (queryResult.hasNext()) {
QuerySolution solution = queryResult.next();
String uri = solution.get("resource").toString();
allRetrieveResources++;
}
System.out.println(" Recovered resources from " + allRetrieveResources);
execution.close();
}
} catch (Exception e) {
System.out.println(" No results obtained");
} finally {
}
return "";
} catch (IOException ex) {
Logger.getLogger(RunTestServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return "";
}
}
| 2,939 | 0.584068 | 0.577288 | 84 | 34.119049 | 28.382341 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 13 |
0245da006aa36933acf80795532336dc9f304c22 | 29,033,978,953,681 | 861ac35ddcf83662eb519bb62a774bcf0eed37ba | /스쳐가는월급.java | 0a12154920fc44b3238115e493660315768923a6 | [] | no_license | Kangyong0527/passorfail | https://github.com/Kangyong0527/passorfail | ddea0f50ef1734d3fa6f48a20db12aef52bdf64e | abfea1659cbcaf3686708418a56f84be8cca6de8 | refs/heads/main | 2023-04-20T07:07:53.551000 | 2021-04-30T07:32:24 | 2021-04-30T07:32:24 | 358,812,336 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package 월급분배기;
import javax.swing.JFrame;
public class 스쳐가는월급 extends JFrame {
public 스쳐가는월급()
{
super("스쳐가는 월급");
setSize(400,300);
setVisible(true);
}
public static void main(String[] args) {
스쳐가는월급 f = new 스쳐가는월급();
f.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
| UHC | Java | 383 | java | 스쳐가는월급.java | Java | [] | null | [] | package 월급분배기;
import javax.swing.JFrame;
public class 스쳐가는월급 extends JFrame {
public 스쳐가는월급()
{
super("스쳐가는 월급");
setSize(400,300);
setVisible(true);
}
public static void main(String[] args) {
스쳐가는월급 f = new 스쳐가는월급();
f.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
| 383 | 0.626198 | 0.607029 | 21 | 12.904762 | 14.431793 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.238095 | false | false | 13 |
d33592bcbcd77f98da09048d5f8aa89ed653ce26 | 31,104,153,199,532 | 412cb998cf3151bfcffe14eacc6ae7763c788151 | /app/src/main/java/com/example/hotelqualitifinalproject/model/Accommodation.java | 73c325683831402cd324e7aad8e0b965bdb2a732 | [] | no_license | ClaraJaborandy/HotelQualitiFinalProject | https://github.com/ClaraJaborandy/HotelQualitiFinalProject | 56a6195d93a76dacd275f9cafbb4421cb729d6e3 | 7110dee19837aab7388a149c23b9cd5a54452285 | refs/heads/master | 2023-02-04T10:15:24.409000 | 2020-12-24T02:22:53 | 2020-12-24T02:22:53 | 315,076,223 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.hotelqualitifinalproject.model;
import java.util.List;
public class Accommodation {
private Long id;
private String startDay;
private String endDay;
private Double valueReservation;
private Guest guest;
private Hotel hotel;
public Hotel getHotel() {
return hotel;
}
public void setHotel(Hotel hotel) {
this.hotel = hotel;
}
public Guest getGuest() {
return guest;
}
public void setGuest(Guest guest) {
this.guest = guest;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getStartDay() {
return startDay;
}
public void setStartDay(String startDay) {
this.startDay = startDay;
}
public String getEndDay() {
return endDay;
}
public void setEndDay(String endDay) {
this.endDay = endDay;
}
public double getValueReservation() {
return valueReservation;
}
public void setValueReservation(double valueReservation) {
this.valueReservation = valueReservation;
}
// ver
@Override
public String toString() {
return "Accommodation [id=" + id + ", startDay=" + startDay + ", endDay=" + endDay + ", valueReservation="
+ valueReservation + "]";
}
}
| UTF-8 | Java | 1,376 | java | Accommodation.java | Java | [] | null | [] | package com.example.hotelqualitifinalproject.model;
import java.util.List;
public class Accommodation {
private Long id;
private String startDay;
private String endDay;
private Double valueReservation;
private Guest guest;
private Hotel hotel;
public Hotel getHotel() {
return hotel;
}
public void setHotel(Hotel hotel) {
this.hotel = hotel;
}
public Guest getGuest() {
return guest;
}
public void setGuest(Guest guest) {
this.guest = guest;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getStartDay() {
return startDay;
}
public void setStartDay(String startDay) {
this.startDay = startDay;
}
public String getEndDay() {
return endDay;
}
public void setEndDay(String endDay) {
this.endDay = endDay;
}
public double getValueReservation() {
return valueReservation;
}
public void setValueReservation(double valueReservation) {
this.valueReservation = valueReservation;
}
// ver
@Override
public String toString() {
return "Accommodation [id=" + id + ", startDay=" + startDay + ", endDay=" + endDay + ", valueReservation="
+ valueReservation + "]";
}
}
| 1,376 | 0.600291 | 0.600291 | 70 | 18.642857 | 19.773024 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.342857 | false | false | 13 |
754812f3d0e16d014725a034ccc0721f79413642 | 31,104,153,197,831 | a47d9c3036a54aa1e027390699a50fcb2605091b | /app/src/main/java/nyc/c4q/hw8androidquiz/Quiz.java | 43c345f7d30a6c3cf24f1b31731251b3bf712ed3 | [] | no_license | mbryantramirez/hw9quiz | https://github.com/mbryantramirez/hw9quiz | a6663a01a5797f686986bc4d5e9991b7ee487dae | fc0475d9b3b3fc598463f076dccd7aad9396b32f | refs/heads/master | 2021-08-16T02:52:04.271000 | 2017-11-18T22:44:12 | 2017-11-18T22:44:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package nyc.c4q.hw8androidquiz;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
/**
* Created by c4q on 11/14/17.
*/
public class Quiz {
String title;
Drawable image;
public Quiz(String title, Drawable image) {
this.title = title;
this.image = image;
}
public String getTitle() {
return title;
}
public Drawable getImage() {
return image;
}
}
| UTF-8 | Java | 452 | java | Quiz.java | Java | [
{
"context": "oid.graphics.drawable.Drawable;\n\n/**\n * Created by c4q on 11/14/17.\n */\n\npublic class Quiz {\n String ",
"end": 140,
"score": 0.999610185623169,
"start": 137,
"tag": "USERNAME",
"value": "c4q"
}
] | null | [] | package nyc.c4q.hw8androidquiz;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
/**
* Created by c4q on 11/14/17.
*/
public class Quiz {
String title;
Drawable image;
public Quiz(String title, Drawable image) {
this.title = title;
this.image = image;
}
public String getTitle() {
return title;
}
public Drawable getImage() {
return image;
}
}
| 452 | 0.632743 | 0.612832 | 26 | 16.384615 | 15.069268 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 13 |
594cba324b96e8b8c871ac7544f51c7990411021 | 1,872,605,742,747 | 4551dc48911ba4e7662e80dd9271f60ffa7d7fb3 | /RMS/src/com/ixora/rms/ui/dataviewboard/DataViewBoardComponent.java | 880de43e2be458c07879d289cf31f5c5fdb228d6 | [] | no_license | vmmelnikov/ixora-rms | https://github.com/vmmelnikov/ixora-rms | 856dec0c2538b2a84f731ebef315abf46076a859 | 85cd658b44bc5952214c51d16c571b83e02c6c71 | refs/heads/master | 2021-01-17T23:38:25.864000 | 2011-11-10T09:06:26 | 2011-11-10T09:06:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* 14-Feb-2006
*/
package com.ixora.rms.ui.dataviewboard;
/**
* This is the parent component for all data view boards.
* @author Daniel Moraru
*/
public interface DataViewBoardComponent {
public static final String NAME = "boards";
}
| UTF-8 | Java | 256 | java | DataViewBoardComponent.java | Java | [
{
"context": "nt component for all data view boards.\r\n * @author Daniel Moraru\r\n */\r\npublic interface DataViewBoardComponent {\r\n",
"end": 157,
"score": 0.9992106556892395,
"start": 144,
"tag": "NAME",
"value": "Daniel Moraru"
}
] | null | [] | /**
* 14-Feb-2006
*/
package com.ixora.rms.ui.dataviewboard;
/**
* This is the parent component for all data view boards.
* @author <NAME>
*/
public interface DataViewBoardComponent {
public static final String NAME = "boards";
}
| 249 | 0.679688 | 0.65625 | 12 | 19.333334 | 19.813015 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 13 |
287464e0a6693afdd8f825d003fdacafa4ba4d19 | 22,892,175,735,381 | 5185fbaf3885793c757ef08df93868eea9e8b309 | /src/src/parser/ParticipantParser.java | c8a0b3fec1160075505c9ff6122aefe4920fee42 | [] | no_license | tusharvjoshi/jeasyuml | https://github.com/tusharvjoshi/jeasyuml | 741f455175585cbb40cfb9d5bc2785492ccffd46 | b7540db6fa9bb1f78d2d907e166bf0e862710821 | refs/heads/master | 2021-01-22T07:32:39.883000 | 2008-08-18T08:39:03 | 2008-08-18T08:39:03 | 32,112,068 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package parser;
import java.util.ArrayList;
import parser.event.IParticipantParserListener;
/**
*
* @author kamlesh paunikar
*/
public class ParticipantParser implements IParser {
public static final String keyWord = "participant";
private String branchName;
private ArrayList<IParticipantParserListener> participantParserListenerrList = new ArrayList<IParticipantParserListener>();
public void addParticipantParserListener(IParticipantParserListener participantParserListener) {
participantParserListenerrList.add(participantParserListener);
}
public void removeParticipantParserListener(IParticipantParserListener participantParserListener) {
participantParserListenerrList.remove(participantParserListener);
}
public void parse(String lineToParse) {
String delims = "[ ->: ]+";
String[] tokens = lineToParse.split(delims);
if (tokens.length == 2) {
branchName = tokens[1];
if (tokens[0].equals(keyWord)) {
System.out.println(" participant is found Draw" + branchName);
} else {
System.out.println("participan is not found Draw");
}
} else {
//throw new Exception("Syntax Error");
}
}
}
| UTF-8 | Java | 1,386 | java | ParticipantParser.java | Java | [
{
"context": ".IParticipantParserListener;\n\n\n/**\n * \n * @author kamlesh paunikar\n */\npublic class ParticipantParser implements IPa",
"end": 231,
"score": 0.9997782111167908,
"start": 215,
"tag": "NAME",
"value": "kamlesh paunikar"
},
{
"context": "rser {\n\n public static ... | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package parser;
import java.util.ArrayList;
import parser.event.IParticipantParserListener;
/**
*
* @author <NAME>
*/
public class ParticipantParser implements IParser {
public static final String keyWord = "participant";
private String branchName;
private ArrayList<IParticipantParserListener> participantParserListenerrList = new ArrayList<IParticipantParserListener>();
public void addParticipantParserListener(IParticipantParserListener participantParserListener) {
participantParserListenerrList.add(participantParserListener);
}
public void removeParticipantParserListener(IParticipantParserListener participantParserListener) {
participantParserListenerrList.remove(participantParserListener);
}
public void parse(String lineToParse) {
String delims = "[ ->: ]+";
String[] tokens = lineToParse.split(delims);
if (tokens.length == 2) {
branchName = tokens[1];
if (tokens[0].equals(keyWord)) {
System.out.println(" participant is found Draw" + branchName);
} else {
System.out.println("participan is not found Draw");
}
} else {
//throw new Exception("Syntax Error");
}
}
}
| 1,376 | 0.681097 | 0.678932 | 44 | 30.5 | 31.929255 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 13 |
cddbfcfebc499961f55f3dc1ea35dab3c602bee9 | 22,892,175,738,386 | a42ff5d56853b627f6f39d80da9848eed186adcb | /FindAllAnagramsInAString/Solution.java | ed25e74ba2c6107b99438ed7e6cb9da6372faeda | [
"MIT"
] | permissive | hawkphantomnet/leetcode | https://github.com/hawkphantomnet/leetcode | e46b8baf5e9ecf550b49678576803db8e31bc5c0 | be565b7120f069b3c9b1cc5dba051151db65933c | refs/heads/master | 2021-01-23T18:44:33.102000 | 2018-09-23T15:52:05 | 2018-09-23T15:52:05 | 40,332,717 | 6 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Solution {
private boolean compare(int[] sCnt, int[] pCnt) {
for (int i = 0; i < pCnt.length; i++) {
if (sCnt[i] != pCnt[i]) return false;
}
return true;
}
public List<Integer> findAnagrams(String s, String p) {
int sLen = s.length();
int pLen = p.length();
List<Integer> res = new ArrayList<Integer>();
if (sLen < pLen) return res;
int[] pCnt = new int[26];
int[] sCnt = new int[26];
for (int i = 0; i < pLen; i++) {
pCnt[p.charAt(i) - 'a']++;
}
for (int i = 0; i < pLen; i++) {
sCnt[s.charAt(i) - 'a']++;
}
if (true == compare(sCnt, pCnt)) {
res.add(0);
}
for (int i = pLen; i < sLen; i++) {
sCnt[s.charAt(i - pLen) - 'a']--;
sCnt[s.charAt(i) - 'a']++;
if (true == compare(sCnt, pCnt)) {
res.add(i - pLen + 1);
}
}
return res;
}
} | UTF-8 | Java | 1,022 | java | Solution.java | Java | [] | null | [] | public class Solution {
private boolean compare(int[] sCnt, int[] pCnt) {
for (int i = 0; i < pCnt.length; i++) {
if (sCnt[i] != pCnt[i]) return false;
}
return true;
}
public List<Integer> findAnagrams(String s, String p) {
int sLen = s.length();
int pLen = p.length();
List<Integer> res = new ArrayList<Integer>();
if (sLen < pLen) return res;
int[] pCnt = new int[26];
int[] sCnt = new int[26];
for (int i = 0; i < pLen; i++) {
pCnt[p.charAt(i) - 'a']++;
}
for (int i = 0; i < pLen; i++) {
sCnt[s.charAt(i) - 'a']++;
}
if (true == compare(sCnt, pCnt)) {
res.add(0);
}
for (int i = pLen; i < sLen; i++) {
sCnt[s.charAt(i - pLen) - 'a']--;
sCnt[s.charAt(i) - 'a']++;
if (true == compare(sCnt, pCnt)) {
res.add(i - pLen + 1);
}
}
return res;
}
} | 1,022 | 0.421722 | 0.412916 | 34 | 29.088236 | 16.631592 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.794118 | false | false | 13 |
378494d0e14c37cceca6eddbd8023c522cc3d2c7 | 25,769,803,828,829 | 377e5e05fb9c6c8ed90ad9980565c00605f2542b | /bin/ext-integration/profile/yprofilecommons/src/com/hybris/yprofile/services/DefaultProfileConfigurationService.java | 6ed4cf3759c7595fcd8b7f24fe417873611c92f2 | [] | no_license | automaticinfotech/HybrisProject | https://github.com/automaticinfotech/HybrisProject | c22b13db7863e1e80ccc29774f43e5c32e41e519 | fc12e2890c569e45b97974d2f20a8cbe92b6d97f | refs/heads/master | 2021-07-20T18:41:04.727000 | 2017-10-30T13:24:11 | 2017-10-30T13:24:11 | 108,957,448 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*/
package com.hybris.yprofile.services;
import de.hybris.platform.yaasconfiguration.model.YaasApplicationModel;
import de.hybris.platform.yaasconfiguration.service.YaasConfigurationService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Required;
import java.util.Optional;
import static java.util.Optional.ofNullable;
import static org.apache.commons.lang.StringUtils.isBlank;
public class DefaultProfileConfigurationService implements ProfileConfigurationService {
private final String appId;
private YaasApplicationModel yaasConfig;
private YaasConfigurationService yaasConfigurationService;
public DefaultProfileConfigurationService(String appId) {
this.appId = appId;
}
@Override
public boolean isYaaSConfigurationPresent(){
return (getYaasConfig() != null);
}
@Override
public String getYaaSTenant(){
if (isYaaSConfigurationPresent() && getYaasConfig().getYaasProject() != null) {
return getYaasConfig().getYaasProject().getIdentifier();
}
return StringUtils.EMPTY;
}
@Override
public String getBaseSiteId(){
if (isYaaSConfigurationPresent() && getYaasConfig().getYaasProject() != null) {
return getYaasConfig().getYaasProject().getBaseSite().getUid();
}
return StringUtils.EMPTY;
}
@Override
public String getApplicationId(){
if (isBlank(appId) && isYaaSConfigurationPresent()) {
return getYaasConfig().getIdentifier();
}
return appId;
}
protected YaasApplicationModel getYaasConfig() {
if (yaasConfig == null){
Optional<YaasApplicationModel> model = getYaasApplicationModel();
if (model.isPresent()) {
yaasConfig = model.get();
}
}
return yaasConfig;
}
protected Optional<YaasApplicationModel> getYaasApplicationModel()
{
if (isBlank(appId))
{
return getYaasConfigurationService().takeFirstModel();
}
return ofNullable(getYaasConfigurationService().getYaasApplicationForId(appId));
}
public YaasConfigurationService getYaasConfigurationService() {
return yaasConfigurationService;
}
@Required
public void setYaasConfigurationService(YaasConfigurationService yaasConfigurationService) {
this.yaasConfigurationService = yaasConfigurationService;
}
}
| UTF-8 | Java | 2,872 | java | DefaultProfileConfigurationService.java | Java | [] | null | [] | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*/
package com.hybris.yprofile.services;
import de.hybris.platform.yaasconfiguration.model.YaasApplicationModel;
import de.hybris.platform.yaasconfiguration.service.YaasConfigurationService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Required;
import java.util.Optional;
import static java.util.Optional.ofNullable;
import static org.apache.commons.lang.StringUtils.isBlank;
public class DefaultProfileConfigurationService implements ProfileConfigurationService {
private final String appId;
private YaasApplicationModel yaasConfig;
private YaasConfigurationService yaasConfigurationService;
public DefaultProfileConfigurationService(String appId) {
this.appId = appId;
}
@Override
public boolean isYaaSConfigurationPresent(){
return (getYaasConfig() != null);
}
@Override
public String getYaaSTenant(){
if (isYaaSConfigurationPresent() && getYaasConfig().getYaasProject() != null) {
return getYaasConfig().getYaasProject().getIdentifier();
}
return StringUtils.EMPTY;
}
@Override
public String getBaseSiteId(){
if (isYaaSConfigurationPresent() && getYaasConfig().getYaasProject() != null) {
return getYaasConfig().getYaasProject().getBaseSite().getUid();
}
return StringUtils.EMPTY;
}
@Override
public String getApplicationId(){
if (isBlank(appId) && isYaaSConfigurationPresent()) {
return getYaasConfig().getIdentifier();
}
return appId;
}
protected YaasApplicationModel getYaasConfig() {
if (yaasConfig == null){
Optional<YaasApplicationModel> model = getYaasApplicationModel();
if (model.isPresent()) {
yaasConfig = model.get();
}
}
return yaasConfig;
}
protected Optional<YaasApplicationModel> getYaasApplicationModel()
{
if (isBlank(appId))
{
return getYaasConfigurationService().takeFirstModel();
}
return ofNullable(getYaasConfigurationService().getYaasApplicationForId(appId));
}
public YaasConfigurationService getYaasConfigurationService() {
return yaasConfigurationService;
}
@Required
public void setYaasConfigurationService(YaasConfigurationService yaasConfigurationService) {
this.yaasConfigurationService = yaasConfigurationService;
}
}
| 2,872 | 0.699164 | 0.696379 | 97 | 28.608248 | 28.629362 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.268041 | false | false | 13 |
94a8ab6930f5d644fe0d5286ce8954007d342d5c | 979,252,602,994 | 65f05007c719622d34cc6b01ea20d1f1f53214e7 | /src/main/java/cn/fyg/qt/application/RecvlogService.java | d27ada8acc4587e732fe8a476f712f8a926c81cf | [] | no_license | jarod-chan/qt | https://github.com/jarod-chan/qt | edae0475aa43d449eb08e87b2f5b2757ce40ef2b | 059f0c7cd8b0127f4045c22f128b74cd6dec14aa | refs/heads/master | 2016-09-05T11:53:22.523000 | 2013-02-04T06:32:46 | 2013-02-04T06:32:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.fyg.qt.application;
import cn.fyg.qt.domain.model.recvlog.Recvlog;
public interface RecvlogService {
Recvlog create(Long qtid,Long centerId,Long prizeKey,Long prizeId);
Recvlog save(Recvlog recvlog);
Recvlog findByPirzeKey(Long prizeKey);
}
| UTF-8 | Java | 274 | java | RecvlogService.java | Java | [] | null | [] | package cn.fyg.qt.application;
import cn.fyg.qt.domain.model.recvlog.Recvlog;
public interface RecvlogService {
Recvlog create(Long qtid,Long centerId,Long prizeKey,Long prizeId);
Recvlog save(Recvlog recvlog);
Recvlog findByPirzeKey(Long prizeKey);
}
| 274 | 0.751825 | 0.751825 | 12 | 20.833334 | 22.371237 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.083333 | false | false | 13 |
a12df9eb2fef9237f1e8dfce43343be09c5652ef | 22,290,880,320,890 | 09aff01dfb4e43e71d45e19b26ac0bce1dc3cd23 | /src/main/java/lk/ijse/dep/dao/custom/CustomerDAO.java | 614ca256125b1f88664e19b3e6308c0e359e4f55 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | skspyapa/Pos-Jpa-Spring-DataAccess-Data-JPA | https://github.com/skspyapa/Pos-Jpa-Spring-DataAccess-Data-JPA | 9190caf5dff3bc4f52e18545ebf14167122714bb | a9a67b26d790dc55156099023e622983644afaca | refs/heads/master | 2022-06-27T05:50:55.621000 | 2019-06-04T23:33:01 | 2019-06-04T23:33:01 | 190,185,549 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lk.ijse.dep.dao.custom;
import lk.ijse.dep.entity.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface CustomerDAO extends JpaRepository<Customer,String> {
@Query(value = "SELECT c.id from Customer c ORDER BY c.id DESC limit 1",nativeQuery = true)
String getTopCustomerId() throws Exception;
@Query(value = "select * from Customer c where c.name LIKE :#{#name +'%'} AND c.address LIKE :#{#address + '%'} ORDER By c.id DESC ",nativeQuery = true)
List<Customer> customQuery(@Param("name") String name,@Param("address") String address) throws Exception;
}
| UTF-8 | Java | 737 | java | CustomerDAO.java | Java | [] | null | [] | package lk.ijse.dep.dao.custom;
import lk.ijse.dep.entity.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface CustomerDAO extends JpaRepository<Customer,String> {
@Query(value = "SELECT c.id from Customer c ORDER BY c.id DESC limit 1",nativeQuery = true)
String getTopCustomerId() throws Exception;
@Query(value = "select * from Customer c where c.name LIKE :#{#name +'%'} AND c.address LIKE :#{#address + '%'} ORDER By c.id DESC ",nativeQuery = true)
List<Customer> customQuery(@Param("name") String name,@Param("address") String address) throws Exception;
}
| 737 | 0.765265 | 0.763908 | 18 | 39.944443 | 42.707626 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 13 |
ea3eda0dc6f3c77d57b145982f278ee81b250457 | 14,345,190,833,920 | ddb39a99f2278a141e847656173890df6a778642 | /lab3/SkipSum/SkipSumTest.java | 6f6b0e8585b862df0a7c4b5a468e2b556edc46e0 | [] | no_license | Sterling317/CPT204 | https://github.com/Sterling317/CPT204 | 30fe23643e643bd2d80bb9da5ae4e965d51f83c8 | 4020a5defce5b2a7aaf9781d1595045dd78ed9d8 | refs/heads/main | 2023-05-14T14:44:53.029000 | 2021-06-08T01:26:04 | 2021-06-08T01:26:04 | 366,455,630 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lab3.SkipSum;
public class SkipSumTest {
}
| UTF-8 | Java | 68 | java | SkipSumTest.java | Java | [] | null | [] | package lab3.SkipSum;
public class SkipSumTest {
}
| 68 | 0.588235 | 0.573529 | 7 | 7.714286 | 10.137826 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 13 |
1229a3092cae623362079512d15da994fa04888c | 7,687,991,516,888 | a83e86e32fac696f211529ace7c04c95973f2585 | /webapp/src/main/java/de/fh/albsig/milazzdo/web/package-info.java | 53c4178a703c2a142bb9bd17b19b34199bcc2e33 | [
"MIT"
] | permissive | m3yco/Weatherfrog | https://github.com/m3yco/Weatherfrog | e8c6b321d8124ff6c100f7974da61506ac762650 | 33465660a66c701006cb60218422ee0b2cb75c35 | refs/heads/master | 2020-04-08T02:43:08.064000 | 2018-11-26T13:31:10 | 2018-11-26T13:31:10 | 157,704,558 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* @author milazzdo
*
*/
package de.fh.albsig.milazzdo.web;
| UTF-8 | Java | 66 | java | package-info.java | Java | [
{
"context": "/**\n * @author milazzdo\n *\n */\npackage de.fh.albsig.milazzdo.web;\n",
"end": 23,
"score": 0.9958181977272034,
"start": 15,
"tag": "USERNAME",
"value": "milazzdo"
}
] | null | [] | /**
* @author milazzdo
*
*/
package de.fh.albsig.milazzdo.web;
| 66 | 0.636364 | 0.636364 | 5 | 12.2 | 12.607934 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 13 |
89e418994e2c183d0ace519028bb721bd1dee5cf | 2,164,663,576,027 | 158f7b23bbd85c612da6cd42d372a6dd84d7d2c3 | /src/main/java/jp/hf/commons/dbutil/HfNamedParameterJdbcTemplate.java | 4f8b055c00a67293ca6469141adf5c3ccc322325 | [] | no_license | d2luu/training_java | https://github.com/d2luu/training_java | 5c578916fb1a2e54e33657abb75566c25dd57d10 | aef363981cec34d6d0f1f53527c82e36ce4bbc16 | refs/heads/master | 2021-08-31T02:30:59.389000 | 2017-12-20T01:56:28 | 2017-12-20T07:02:10 | 110,952,955 | 0 | 0 | null | false | 2017-12-20T03:06:12 | 2017-11-16T09:44:15 | 2017-12-19T10:23:14 | 2017-12-20T03:06:12 | 65 | 0 | 0 | 0 | Java | false | null | package jp.hf.commons.dbutil;
import javax.sql.DataSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
public class HfNamedParameterJdbcTemplate extends NamedParameterJdbcTemplate {
public HfNamedParameterJdbcTemplate(DataSource dataSource) {
super(dataSource);
}
}
| UTF-8 | Java | 319 | java | HfNamedParameterJdbcTemplate.java | Java | [] | null | [] | package jp.hf.commons.dbutil;
import javax.sql.DataSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
public class HfNamedParameterJdbcTemplate extends NamedParameterJdbcTemplate {
public HfNamedParameterJdbcTemplate(DataSource dataSource) {
super(dataSource);
}
}
| 319 | 0.805643 | 0.805643 | 13 | 23.538462 | 28.995001 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 13 |
7cd472f8e8adfd2247433b26cdb711a99238a508 | 17,334,488,065,533 | 1eb8fcc1e029f4d0d530987ad9253255b3cae330 | /java/SmallTests/Class16_18c_s19049.java | c49564605583a57ac4dd067c60371308585ca862 | [] | no_license | lukaskup/collage | https://github.com/lukaskup/collage | 0a764dece1296443e03ecf7dc45df3b23f0e3bd4 | 0c971f2720eaff1e610c0c2589e67e7fa2fd8102 | refs/heads/master | 2020-04-08T12:19:13.168000 | 2019-06-22T06:00:34 | 2019-06-22T06:00:34 | 159,342,383 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* @author s19049
* @group 18c
* @blockchainHash 42bc4fd79496183420262473712b1cde5dca7724b0f615e3ece77df23bf0a5a6
*/
public class Class16_18c_s19049 {
public static void main(String[] args) {
int amountOfHorcruxes = 8;
Voldemort youKnowWho = new Voldemort(amountOfHorcruxes);
String name = "Harry";
String familyName = "Potter";
RegularPerson harry = youKnowWho.killLily(name, familyName);
Dumbledore albus = new Dumbledore();
Wizard harryWizard = albus.youAreWizard(harry);
while (youKnowWho.isAlive()) {
harryWizard.destroyHorcruxOf(youKnowWho);
harryWizard.tryToDefeat(youKnowWho); // Success, if Voldemort has no Horcruxes
}
System.out.println("Happy ending");
}
}
// tip: start here
class Voldemort{
int amountOfHorcruxes;
Voldemort(int amountOfHorcruxes){
this.amountOfHorcruxes = amountOfHorcruxes;
}
RegularPerson killLily(String name, String familyName){
System.out.println("Roses are red, violets are blue, lily is dead, so my soul too :,C :,C :,C :,C");
return new RegularPerson(name, familyName);
}
boolean isAlive(){
if(amountOfHorcruxes != 0)
return true;
else
return false;
}
}
class RegularPerson{
String name;
String familyName;
RegularPerson(String name, String familyName){
this.name = name;
this.familyName = familyName;
}
}
class Dumbledore{
Wizard youAreWizard(RegularPerson person){
return new Wizard(person);
}
}
class Wizard{
RegularPerson person;
Wizard(RegularPerson person){
this.person = person;
}
void destroyHorcruxOf(Voldemort enemy){
enemy.amountOfHorcruxes -= 1;
}
void tryToDefeat(Voldemort enemy){
if(enemy.amountOfHorcruxes == 0){
System.out.println("Success");
}else{
System.out.println("Just destroyed one Horcruxes but he's still alive");
}
}
} | UTF-8 | Java | 2,059 | java | Class16_18c_s19049.java | Java | [
{
"context": "\n/**\n* @author s19049\n* @group 18c\n* @blockchainHash 42bc4fd79496183420",
"end": 21,
"score": 0.9995622038841248,
"start": 15,
"tag": "USERNAME",
"value": "s19049"
},
{
"context": "emort(amountOfHorcruxes);\n\n String name = \"Harry\";\n String familyN... | null | [] |
/**
* @author s19049
* @group 18c
* @blockchainHash 42bc4fd79496183420262473712b1cde5dca7724b0f615e3ece77df23bf0a5a6
*/
public class Class16_18c_s19049 {
public static void main(String[] args) {
int amountOfHorcruxes = 8;
Voldemort youKnowWho = new Voldemort(amountOfHorcruxes);
String name = "Harry";
String familyName = "Potter";
RegularPerson harry = youKnowWho.killLily(name, familyName);
Dumbledore albus = new Dumbledore();
Wizard harryWizard = albus.youAreWizard(harry);
while (youKnowWho.isAlive()) {
harryWizard.destroyHorcruxOf(youKnowWho);
harryWizard.tryToDefeat(youKnowWho); // Success, if Voldemort has no Horcruxes
}
System.out.println("Happy ending");
}
}
// tip: start here
class Voldemort{
int amountOfHorcruxes;
Voldemort(int amountOfHorcruxes){
this.amountOfHorcruxes = amountOfHorcruxes;
}
RegularPerson killLily(String name, String familyName){
System.out.println("Roses are red, violets are blue, lily is dead, so my soul too :,C :,C :,C :,C");
return new RegularPerson(name, familyName);
}
boolean isAlive(){
if(amountOfHorcruxes != 0)
return true;
else
return false;
}
}
class RegularPerson{
String name;
String familyName;
RegularPerson(String name, String familyName){
this.name = name;
this.familyName = familyName;
}
}
class Dumbledore{
Wizard youAreWizard(RegularPerson person){
return new Wizard(person);
}
}
class Wizard{
RegularPerson person;
Wizard(RegularPerson person){
this.person = person;
}
void destroyHorcruxOf(Voldemort enemy){
enemy.amountOfHorcruxes -= 1;
}
void tryToDefeat(Voldemort enemy){
if(enemy.amountOfHorcruxes == 0){
System.out.println("Success");
}else{
System.out.println("Just destroyed one Horcruxes but he's still alive");
}
}
} | 2,059 | 0.634774 | 0.605148 | 86 | 22.94186 | 24.087223 | 108 | false | false | 0 | 0 | 0 | 0 | 65 | 0.031569 | 0.44186 | false | false | 13 |
90e6514c411213bea40bfc560c6079cd4cd7465d | 34,780,645,171,791 | 4ce0e7c0195852da1ca1a5eae2053a6e87ad4fa3 | /src/execption/numberexcp.java | fc571d2a6d529957fd4d9589d344be68421f1feb | [] | no_license | Vishram761988/June-A-Basic-Pgms | https://github.com/Vishram761988/June-A-Basic-Pgms | e9f06fb191ce368abe865992f472fef84bf846ef | 0485fd54836443fd64eb45790845a4d170892d38 | refs/heads/master | 2020-07-31T15:16:22.469000 | 2019-09-24T16:33:45 | 2019-09-24T16:33:45 | 210,650,236 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package execption;
public class numberexcp {
public static void main(String[] args) {
try
{
//sagar is not number
int num=Integer.parseInt("sagar");
System.out.println(num);
}
catch(NumberFormatException e)
{
//e.printStackTrace();
System.out.println("Number Format Exception Handle");
}
}
}
| UTF-8 | Java | 352 | java | numberexcp.java | Java | [] | null | [] | package execption;
public class numberexcp {
public static void main(String[] args) {
try
{
//sagar is not number
int num=Integer.parseInt("sagar");
System.out.println(num);
}
catch(NumberFormatException e)
{
//e.printStackTrace();
System.out.println("Number Format Exception Handle");
}
}
}
| 352 | 0.616477 | 0.616477 | 20 | 15.6 | 16.460255 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 13 |
2df032f1741d8f47e07ba97f40e647c9997888e3 | 34,265,249,117,026 | 485c044409cb387890aef46b36e3d19160bfa646 | /src/main/java/com/hfkj/iotplatform/service/commandDelivery/InvokeDeviceServicesRequestBody.java | 6197ec4eab932737df3b361e795771c62261cf98 | [] | no_license | YDHCUI/hfkjWisdomCanteen | https://github.com/YDHCUI/hfkjWisdomCanteen | c50a98a783c4632af0391740ef6d3702c5c0a934 | de843b0f939c9b9558055829841d5e4477b47648 | refs/heads/master | 2020-08-26T15:48:47.416000 | 2019-04-08T10:38:58 | 2019-04-08T10:38:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hfkj.iotplatform.service.commandDelivery;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.hfkj.iotplatform.service.RequestBody;
public class InvokeDeviceServicesRequestBody extends RequestBody {
private Object body;
private CommandNA2CloudHeader header;
public Object getBody() {
return body;
}
public void setBody(Object body) {
this.body = body;
}
public CommandNA2CloudHeader getHeader() {
return header;
}
public void setHeader(CommandNA2CloudHeader header) {
this.header = header;
}
}
| UTF-8 | Java | 603 | java | InvokeDeviceServicesRequestBody.java | Java | [] | null | [] | package com.hfkj.iotplatform.service.commandDelivery;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.hfkj.iotplatform.service.RequestBody;
public class InvokeDeviceServicesRequestBody extends RequestBody {
private Object body;
private CommandNA2CloudHeader header;
public Object getBody() {
return body;
}
public void setBody(Object body) {
this.body = body;
}
public CommandNA2CloudHeader getHeader() {
return header;
}
public void setHeader(CommandNA2CloudHeader header) {
this.header = header;
}
}
| 603 | 0.704809 | 0.699834 | 29 | 19.793104 | 21.547668 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.310345 | false | false | 13 |
566c2baa07abae97da27764d6d98f7e6481e81c1 | 34,265,249,117,805 | fc998050f56ba1621d9035fcc3f94df5d252f8cf | /PizzaPatternAbstractMethod/PizzaPatternAbstractMethod/src/tn/iit/glid2/pizza/CheesePizza.java | 5bcc5260ed2da02e141e9dd08c559306a34be883 | [] | no_license | ghassenSghaier/ExercicesDesignPatterns | https://github.com/ghassenSghaier/ExercicesDesignPatterns | 46879b7c73ff0c2258fea9059afbd97738414abc | d2d49a18887bfbc99b346bcfab2538d2614b6129 | refs/heads/main | 2023-01-01T02:14:26.690000 | 2020-10-25T16:50:49 | 2020-10-25T16:50:49 | 307,132,786 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tn.iit.glid2.pizza;
import tn.iit.glid2.factory.*;
import tn.iit.glid2.ingredients.*;
public class CheesePizza extends Pizza{
public CheesePizza(PizzaIngredientFactory ingredientfactory) {
super(ingredientfactory);
}
public void prepare(){
System.out.println("Préparons " + name);
dough = ingredientfactory.createDough();
sauce = ingredientfactory.createSauce();
cheese = ingredientfactory.createCheese();
}
}
| ISO-8859-2 | Java | 440 | java | CheesePizza.java | Java | [] | null | [] | package tn.iit.glid2.pizza;
import tn.iit.glid2.factory.*;
import tn.iit.glid2.ingredients.*;
public class CheesePizza extends Pizza{
public CheesePizza(PizzaIngredientFactory ingredientfactory) {
super(ingredientfactory);
}
public void prepare(){
System.out.println("Préparons " + name);
dough = ingredientfactory.createDough();
sauce = ingredientfactory.createSauce();
cheese = ingredientfactory.createCheese();
}
}
| 440 | 0.753986 | 0.747153 | 18 | 23.388889 | 19.621811 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.388889 | false | false | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.