blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5c166d51e5b9d4a984644713f05d50a89e936580 | 58c23f6d66d08ef81c89d24f642f24f09704ec48 | /csas-framework/audit-impl/src/main/java/com/hoomsun/csas/audit/server/impl/PreAuditServerImpl.java | 804c175883a55d2728f3c367e32e281a1900ea2a | [] | no_license | ybak/casc-framework | 5ed651901eb4357e807d3c3d3440ed26c1848d56 | b76e68dd53cf26ce6302db545afd572a38aac3e3 | refs/heads/master | 2021-03-24T01:11:12.632781 | 2018-05-16T06:49:09 | 2018-05-16T06:49:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,513 | java | /**
* Copyright www.hoomsun.com 红上金融信息服务(上海)有限公司
*/
package com.hoomsun.csas.audit.server.impl;
import java.io.File;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.activiti.engine.HistoryService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.impl.TaskServiceImpl;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hoomsun.common.model.Json;
import com.hoomsun.common.model.Pager;
import com.hoomsun.common.util.DateUtil;
import com.hoomsun.common.util.JumpTaskCmd;
import com.hoomsun.common.util.PrimaryKeyUtil;
import com.hoomsun.common.util.UploadPathUtil;
import com.hoomsun.core.dao.SysEmployeeMapper;
import com.hoomsun.core.enums.AnnexType;
import com.hoomsun.csas.audit.dao.BPMNMapper;
import com.hoomsun.csas.audit.dao.PhoneVerifyMapper;
import com.hoomsun.csas.audit.dao.PreAuditMapper;
import com.hoomsun.csas.audit.exception.AuditException;
import com.hoomsun.csas.audit.model.PhoneVerify;
import com.hoomsun.csas.audit.model.PreAudit;
import com.hoomsun.csas.audit.model.vo.UserApplyVO;
import com.hoomsun.csas.audit.server.inter.PreAuditServerI;
import com.hoomsun.csas.audit.util.ActivitiUtils;
import com.hoomsun.csas.sales.api.model.Annex;
import com.hoomsun.csas.sales.api.model.CreditCard;
import com.hoomsun.csas.sales.api.model.UserChsi;
import com.hoomsun.csas.sales.api.model.UserCis;
import com.hoomsun.csas.sales.api.model.UserHouseFund;
import com.hoomsun.csas.sales.api.model.UserPbccre;
import com.hoomsun.csas.sales.api.model.UserSocialsecurity;
import com.hoomsun.csas.sales.api.model.UserTaoBaoAddress;
import com.hoomsun.csas.sales.api.model.UserTaobao;
import com.hoomsun.csas.sales.api.model.vo.CreditVo;
import com.hoomsun.csas.sales.api.model.vo.FinancialVo;
import com.hoomsun.csas.sales.api.model.vo.OtherVo;
import com.hoomsun.csas.sales.api.model.vo.RollBackInfoVo;
import com.hoomsun.csas.sales.dao.AnnexMapper;
import com.hoomsun.csas.sales.dao.CreditCardMapper;
import com.hoomsun.csas.sales.dao.UserApplyMapper;
import com.hoomsun.csas.sales.dao.UserChsiMapper;
import com.hoomsun.csas.sales.dao.UserCisMapper;
import com.hoomsun.csas.sales.dao.UserHouseFundMapper;
import com.hoomsun.csas.sales.dao.UserPbccreMapper;
import com.hoomsun.csas.sales.dao.UserSocialsecurityMapper;
import com.hoomsun.csas.sales.dao.UserTaoBaoAddressMapper;
import com.hoomsun.csas.sales.dao.UserTaobaoMapper;
/**
* 作者:ywzou <br>
* 创建时间:2017年12月4日 <br>
* 描述:初审审核的业务实现
*/
@Service("preAuditServer")
public class PreAuditServerImpl implements PreAuditServerI {
private final static Logger log = LoggerFactory.getLogger(PreAuditServerImpl.class);
@Autowired
private PreAuditMapper preAuditMapper;
@Autowired
private TaskService taskService;
@Autowired
private HistoryService historyService;
@Autowired
private UserCisMapper userCisMapper;
@Autowired
private UserTaobaoMapper userTaobaoMapper;
@Autowired
private AnnexMapper annexMapper;// 上传表
@Autowired
private UploadPathUtil uploadPathUtil;
@Autowired
private UserTaoBaoAddressMapper userTaobaoAddrMapper;
@Autowired
private UserChsiMapper userChsiMapper;
@Autowired
private UserPbccreMapper userPbccreMapper;
@Autowired
private UserHouseFundMapper userHouseFundMapper;
@Autowired
private UserSocialsecurityMapper userSocialsecurityMapper;
@Autowired
private CreditCardMapper creditCardMapper;
@Autowired
private PhoneVerifyMapper phoneVerifyMapper;
@Autowired
private UserApplyMapper userApplyMapper;
@Autowired
private BPMNMapper bpmnMapper;
@Autowired
private SysEmployeeMapper sysEmployeeMapper;// 员工表
// 列表
@Override
public Pager<UserApplyVO> findPager(Integer page, Integer rows, String custName, String idNumber, String loanId, String empId, String nodeStatus, String node, String deptId) {
if (StringUtils.isBlank(empId) || StringUtils.isBlank(deptId)) {
throw new AuditException("无法获取你的登录信息,请尝试重新登录!");
}
Map<String, Object> param = new HashMap<String, Object>();
// List<Group> groups =
// identityService.createGroupQuery().groupMember(empId).list();
//
// boolean isGroup = false;
// for (Group group : groups) {
// if ("PRE_AUDIT_GROUP".equalsIgnoreCase(group.getId())) {
// isGroup = true;
// break;
// }
// }
//
// if (!isGroup) {
// throw new AuditException("您没有权限操作!不是该审批组人员!");
// }
// 验证当前登录人是不是部门负责人
String mgrId = sysEmployeeMapper.findDeptManager(deptId);
Integer isMgr = 0;//
if (empId.equals(mgrId)) {// 是部门的负责人
isMgr = 1;
}
if (page == null || rows == null) {
page = 1;
}
if (rows == null) {
rows = 10;
}
rows = rows > 100 ? 100 : rows;
if (!StringUtils.isBlank(node)) {
param.put("node", node);// 默认未审核的信息
}
param.put("empId", empId);
param.put("isMgr", isMgr);
param.put("deptId", deptId);
param.put("pageIndex", page);
param.put("pageSize", rows);
if (!StringUtils.isBlank(custName)) {
param.put("custName", "%" + custName + "%");
}
if (!StringUtils.isBlank(idNumber)) {
param.put("idNumber", idNumber);
}
// [{'id':'0','text':'待签收'},{'id':'1','text':'待审核'},{'id':'2','text':'已审核'},{'id':'3','text':'全部'}]
if (!StringUtils.isBlank(nodeStatus)) {
param.put("nodeStatus", nodeStatus);
} else {
param.put("nodeStatus", 1);// 待审核
}
if (!StringUtils.isBlank(loanId)) {
param.put("loanId", loanId);
}
List<UserApplyVO> userApplyVOs = preAuditMapper.findPager(param);
Integer total = preAuditMapper.findPreAuditCount(param);
return new Pager<>(userApplyVOs, total);
}
// 签收任务
@Override
public Json claimTask(String applyId, String empId) {
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskDefinitionKey("preAudit").singleResult();
if (task == null) {
return new Json(false, "不能处理,任务在其他节点!");
}
String assignee = task.getAssignee();
if (!StringUtils.isBlank(assignee)) {//
if (assignee.equals(empId)) {
return new Json(true, "任务已签收成功!");
} else {
return new Json(false, "不能处理,任务已被他人签收!");
}
} else {
if (ActivitiUtils.getClaimTaskSign(bpmnMapper, empId)) {
taskService.claim(task.getId(), empId);
} else {
return new Json(false, "不能签收,请先处理完手中的任务!");
}
}
return new Json(true, "任务签收成功!");
}
// 处理任务 提交
@Override
public Json completeTask(String applyId, String empId) {
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskDefinitionKey("preAudit").taskAssignee(empId).singleResult();
if (task == null) {
return new Json(false, "不能处理,任务在其他节点!");
}
taskService.complete(task.getId());
String processId = task.getProcessInstanceId();
preAuditMapper.updatePreStatus(applyId, task.getId(), processId, 1);
// 修改申请主表状态
List<Task> tasks = taskService.createTaskQuery().processInstanceBusinessKey(applyId).processInstanceId(processId).list();
String precessStatus = "";
String precessStatusVal = "";
boolean isFirst = true;
for (Task tk : tasks) {
if (isFirst) {
precessStatus = tk.getTaskDefinitionKey();
precessStatusVal = tk.getName();
isFirst = false;
} else {
precessStatus = precessStatus + "," + tk.getTaskDefinitionKey();
precessStatusVal = precessStatusVal + "," + tk.getName();
}
}
userApplyMapper.updateProcessInstance(applyId, processId, precessStatus, precessStatusVal);
return new Json(true, "处理成功!");
}
// 退回
@Override
public Json rollbackTask(String applyId, String empId) {
if (StringUtils.isBlank(applyId)) {
return new Json(false, "参数有误!");
}
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskDefinitionKey("preAudit").singleResult();
if (null == task) {
return new Json(false, "不能撤销!任务已不在当前节点!");
}
JumpTaskCmd cmd = new JumpTaskCmd(task, "addData", JumpTaskCmd.ROLLBACK);
TaskServiceImpl taskServiceImpl = (TaskServiceImpl) taskService;
taskServiceImpl.getCommandExecutor().execute(cmd);
return new Json(true, "退回成功!");
}
// 撤回
@Override
public Json withdrawTask(String applyId, String empId) {
if (StringUtils.isBlank(applyId)) {
return new Json(false, "参数有误!");
}
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskDefinitionKey("finalAudit").singleResult();
if (null == task) {
return new Json(false, "不能撤销!任务已不在终审节点!");
}
String assignee = task.getAssignee();
if (!StringUtils.isBlank(assignee)) {
return new Json(false, "任务已被签收,不能撤回!!!");
}
JumpTaskCmd cmd = new JumpTaskCmd(task, "preAudit", JumpTaskCmd.WITHDRAW);
TaskServiceImpl taskServiceImpl = (TaskServiceImpl) taskService;
taskServiceImpl.getCommandExecutor().execute(cmd);
String processId = task.getProcessInstanceId();
// 修改申请主表状态
List<Task> tasks = taskService.createTaskQuery().processInstanceBusinessKey(applyId).processInstanceId(processId).list();
String precessStatus = "";
String precessStatusVal = "";
boolean isFirst = true;
for (Task tk : tasks) {
if (isFirst) {
precessStatus = tk.getTaskDefinitionKey();
precessStatusVal = tk.getName();
isFirst = false;
} else {
precessStatus = precessStatus + "," + tk.getTaskDefinitionKey();
precessStatusVal = precessStatusVal + "," + tk.getName();
}
}
userApplyMapper.updateProcessInstance(applyId, processId, precessStatus, precessStatusVal);
return new Json(true, "撤销成功!");
}
@Override
public Json claimTask(String loginEmp, String toEmpId, String applyId) {
if (StringUtils.isBlank(applyId)) {
throw new AuditException("参数异常!applyId is null!");
}
if (StringUtils.isBlank(toEmpId)) {
throw new AuditException("参数异常!toEmpId is null!");
}
if (StringUtils.isBlank(loginEmp)) {
throw new AuditException("参数异常!loginEmp is null!");
}
if (loginEmp.equals(toEmpId)) {
return new Json(false, "任务已经在您的节点!无需转办!");
}
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskDefinitionKey("preAudit").singleResult();
if (task == null) {
return new Json(false, "不能处理,任务在其他节点!");
}
taskService.claim(task.getId(), toEmpId);
return new Json(true, "任务转办成功!");
}
@Override
public Json savePreAudit(PreAudit audit, String loginEmp) {
if (audit == null || StringUtils.isBlank(loginEmp)) {
return new Json(false, "参数异常!");
}
String applyId = audit.getApplyId();
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskDefinitionKey("preAudit").singleResult();
if (null == task) {
return new Json(false, "不能处理!任务已不在当前节点!");
}
// 首先判断审核数据时候已经存在
String taskId = task.getId();
String processId = task.getProcessInstanceId();
audit.setHandleTime(DateUtil.getSqlDate());
audit.setApplyId(applyId);
audit.setTaskId(taskId);
audit.setProcInstId(task.getProcessInstanceId());
PreAudit preInfo = preAuditMapper.selectIdByProcess(applyId, taskId);
if (preInfo != null) {// 修改
preInfo.setEmpId(audit.getEmpId());
preInfo.setEmpName(audit.getEmpName());
preInfo.setInnerRemark(audit.getInnerRemark());
preInfo.setRemark(audit.getRemark());
preInfo.setTaskId(taskId);
preInfo.setProcInstId(processId);
preInfo.setCreditRemark(audit.getCreditRemark());
preInfo.setFinanceRemark(audit.getFinanceRemark());
preInfo.setOtherRemark(audit.getOtherRemark());
preInfo.setHandleOption(audit.getHandleOption());
preInfo.setHandleOptionval(audit.getHandleOptionval());
preInfo.setProductId(audit.getProductId());
preInfo.setProductName(audit.getProductName());
preInfo.setApplyId(applyId);
preInfo.setHandleTime(DateUtil.getSqlDate());
preInfo.setHandleMoney(audit.getHandleMoney());
preAuditMapper.updateByPrimaryKeySelective(preInfo);
} else {
audit.setPreId(PrimaryKeyUtil.getPrimaryKey());
preAuditMapper.insertSelective(audit);
}
Integer option = audit.getHandleOption();
// String proAlias = userApplyMapper.selectProNameByApplyId(applyId);
Map<String, Object> var = new HashMap<String, Object>();
switch (option) {
case 0:// 拒贷(拒贷跳到终审)
// JumpTaskCmd cmd = new JumpTaskCmd(task, "endEvent",
// JumpTaskCmd.REJECT);
// TaskServiceImpl taskServiceImpl = (TaskServiceImpl) taskService;
// taskServiceImpl.getCommandExecutor().execute(cmd);
var.put("presupp", 0);
taskService.complete(task.getId(), var);
// noticeServer.sendMsg(applyId,"您提交的"+ proAlias + "申请未通过初审审核,原因:" +
// audit.getInnerRemark(),1);
break;
case 1:// 客户放弃
JumpTaskCmd cmd = new JumpTaskCmd(task, "endEvent", JumpTaskCmd.WAIVER);
TaskServiceImpl taskServiceImpl = (TaskServiceImpl) taskService;
taskServiceImpl.getCommandExecutor().execute(cmd);
break;
case 2:// 退回 质检复核
// cmd = new JumpTaskCmd(task, "qcCheck", JumpTaskCmd.ROLLBACK);
// taskServiceImpl = (TaskServiceImpl) taskService;
// taskServiceImpl.getCommandExecutor().execute(cmd);
// break;
var.put("presupp", 1);
var.put("goto", "preaudit");
taskService.complete(task.getId(), var);
break;
case 3:// 补充资料
var.put("presupp", 1);
var.put("goto", "preaudit");
taskService.complete(task.getId(), var);
// noticeServer.sendMsg(applyId,"您提交的"+ proAlias +
// "申请资料不全,请及时前往门店补充资料",1);
break;
case 4:// 通过
var.put("presupp", 0);
taskService.complete(task.getId(), var);
// noticeServer.sendMsg(applyId,"您提交的"+ proAlias +
// "申请已通过信审的初步审核,请等待信审部门终审",1);
break;
default:
break;
}
List<Task> tasks = taskService.createTaskQuery().processInstanceBusinessKey(applyId).processInstanceId(processId).list();
String precessStatus = "";
String precessStatusVal = "";
if (tasks != null && tasks.size() > 0) {
boolean isFirst = true;
for (Task tk : tasks) {
if (isFirst) {
precessStatus = tk.getTaskDefinitionKey();
precessStatusVal = tk.getName();
isFirst = false;
} else {
precessStatus = precessStatus + "," + tk.getTaskDefinitionKey();
precessStatusVal = precessStatusVal + "," + tk.getName();
}
}
} else {
switch (option) {
case 0:// 拒贷
precessStatus = option == 1 ? JumpTaskCmd.REJECT : "error";
precessStatusVal = option == 1 ? "拒贷" : "未知";
break;
case 1:// 客户放弃
precessStatus = option == 1 ? JumpTaskCmd.WAIVER : "error";
precessStatusVal = option == 1 ? "客户放弃" : "未知";
break;
default:
precessStatus = "error";
precessStatusVal = "未知";
break;
}
}
userApplyMapper.updateProcessInstance(applyId, processId, precessStatus, precessStatusVal);
return new Json(true, "保存成功!");
}
@Override
public Json saveCredit(CreditVo creditVo, String loginEmp) {
if (creditVo == null || creditVo.getPbccre() == null || StringUtils.isBlank(loginEmp)) {
throw new AuditException("参数异常!params is null !");
}
String applyId = creditVo.getPbccre().getApplyId();
if (StringUtils.isBlank(applyId)) {
throw new AuditException("参数异常!applyId is null !");
}
UserPbccre pbccre = creditVo.getPbccre();
if (pbccre != null) {
// 征信数据 首先查看是否有征信 若无则添加 有则修改
Integer result = userPbccreMapper.checkByApplyId(applyId);
pbccre.setApplyId(applyId);
if (result > 0) {
userPbccreMapper.updateByPrimaryKeySelective(pbccre);
} else {
pbccre.setCrId(PrimaryKeyUtil.getPrimaryKey());
userPbccreMapper.insertSelective(pbccre);
}
}
// 上海资信
UserCis userCis = creditVo.getUserCis();
if (userCis != null) {
Integer result = userCisMapper.checkByApplyId(applyId);
userCis.setApplyId(applyId);
if (result > 0) {
userCisMapper.updateByPrimaryKeySelective(userCis);
} else {
userCis.setCisId(PrimaryKeyUtil.getPrimaryKey());
userCisMapper.insertSelective(userCis);
}
}
return new Json(true, "征信数据保存成功!");
}
@Override
public Json savePbccre(CreditVo creditVo, String loginEmp) {
if (creditVo == null || creditVo.getPbccre() == null || StringUtils.isBlank(loginEmp)) {
throw new AuditException("参数异常!params is null !");
}
String applyId = creditVo.getPbccre().getApplyId();
if (StringUtils.isBlank(applyId)) {
throw new AuditException("参数异常!applyId is null !");
}
UserPbccre pbccre = creditVo.getPbccre();
if (pbccre != null) {
// 征信数据 首先查看是否有征信 若无则添加 有则修改
Integer result = userPbccreMapper.checkByApplyId(applyId);
pbccre.setApplyId(applyId);
if (result > 0) {
userPbccreMapper.updateByPrimaryKeySelective(pbccre);
} else {
pbccre.setCrId(PrimaryKeyUtil.getPrimaryKey());
userPbccreMapper.insertSelective(pbccre);
}
}
return new Json(true, "征信数据保存成功!");
}
@Override
public Json saveCis(CreditVo creditVo, String loginEmp) {
if (creditVo == null || creditVo.getPbccre() == null || StringUtils.isBlank(loginEmp)) {
throw new AuditException("参数异常!params is null !");
}
String applyId = creditVo.getPbccre().getApplyId();
if (StringUtils.isBlank(applyId)) {
throw new AuditException("参数异常!applyId is null !");
}
// 上海资信
UserCis userCis = creditVo.getUserCis();
if (userCis != null) {
Integer result = userCisMapper.checkByApplyId(applyId);
userCis.setApplyId(applyId);
if (result > 0) {
userCisMapper.updateByPrimaryKeySelective(userCis);
} else {
userCis.setCisId(PrimaryKeyUtil.getPrimaryKey());
userCisMapper.insertSelective(userCis);
}
}
return new Json(true, "征信数据保存成功!");
}
// 财务数据
@Override
public Json saveFinancial(FinancialVo financialVo, String applyId, String loginEmp) {
if (financialVo == null || StringUtils.isBlank(loginEmp) || StringUtils.isBlank(applyId)) {
throw new AuditException("参数异常!params is null !");
}
// 信用卡账单
List<CreditCard> creditCards = financialVo.getCreditCards();
if (creditCards != null && creditCards.size() > 0) {
// Integer result = creditCardBillsMapper.checkByApplyId(applyId);
creditCardMapper.deleteByApplyId(applyId);
for (CreditCard cc : creditCards) {
cc.setCcId(PrimaryKeyUtil.getPrimaryKey());
cc.setApplyId(applyId);
creditCardMapper.insertSelective(cc);
}
}
return new Json(true, "数据保存成功!");
}
// 保存电核信息
@Override
public Json saveTelAudit(PhoneVerify telAudit, String applyId, String loginEmp) {
if (telAudit == null || StringUtils.isBlank(loginEmp) || StringUtils.isBlank(applyId)) {
throw new AuditException("参数异常!params is null !");
}
String pvId = telAudit.getPvId();
if (StringUtils.isBlank(pvId)) {
telAudit.setPvId(PrimaryKeyUtil.getPrimaryKey());
phoneVerifyMapper.insertSelective(telAudit);
} else {
phoneVerifyMapper.updateByPrimaryKeySelective(telAudit);
}
return new Json(true, "保存成功!");
}
@Override
public Json saveOthor(OtherVo otherVo, String applyId, String loginEmp) {
if (otherVo == null || StringUtils.isBlank(loginEmp) || StringUtils.isBlank(applyId)) {
throw new AuditException("参数异常!params is null !");
}
// 学历
UserChsi chsi = otherVo.getUserChsi();
if (chsi != null) {
Integer result = userChsiMapper.checkByApplyId(applyId);
if (result > 0) {
userChsiMapper.updateByPrimaryKey(chsi);
} else {
chsi.setChsiId(PrimaryKeyUtil.getPrimaryKey());
chsi.setApplyId(applyId);
userChsiMapper.insertSelective(chsi);
}
}
// 公积金
UserHouseFund houseFund = otherVo.getHouseFund();
if (houseFund != null) {
Integer result = userHouseFundMapper.checkByApplyId(applyId);
if (result > 0) {
userHouseFundMapper.updateByPrimaryKey(houseFund);
} else {
houseFund.setHfId(PrimaryKeyUtil.getPrimaryKey());
houseFund.setApplyId(applyId);
userHouseFundMapper.insertSelective(houseFund);
}
}
// 社保
UserSocialsecurity socialsecurity = otherVo.getSocialsecurity();
if (socialsecurity != null) {
Integer result = userSocialsecurityMapper.checkByApplyId(applyId);
if (result > 0) {
userSocialsecurityMapper.updateByPrimaryKey(socialsecurity);
} else {
socialsecurity.setSiId(PrimaryKeyUtil.getPrimaryKey());
socialsecurity.setApplyId(applyId);
userSocialsecurityMapper.insertSelective(socialsecurity);
}
}
// 淘宝
UserTaobao taobao = otherVo.getTaobao();
if (socialsecurity != null) {
Integer result = userTaobaoMapper.checkByApplyId(applyId);
String tbId = taobao.getTbId();
if (result > 0 && StringUtils.isNotBlank(tbId)) {
userTaobaoMapper.updateByPrimaryKey(taobao);
userTaobaoAddrMapper.deleteByFKId(tbId);
} else {
tbId = PrimaryKeyUtil.getPrimaryKey();
taobao.setTbId(tbId);
taobao.setApplyId(applyId);
userTaobaoMapper.insertSelective(taobao);
}
List<UserTaoBaoAddress> addresses = taobao.getAddresses();
if (null != addresses && addresses.size() > 0) {
for (UserTaoBaoAddress address : addresses) {
address.setTbAddressId(PrimaryKeyUtil.getPrimaryKey());
address.setTbFkid(tbId);
userTaobaoAddrMapper.insertSelective(address);
}
}
}
return new Json(true, "保存成功!");
}
// 验证签收
@Override
public Json checkClaim(String applyId, String empId) {
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskDefinitionKey("preAudit").singleResult();
if (null == task) {
return new Json(false, "不能处理!任务已不在当前节点!");
}
String assignee = task.getAssignee();
if (StringUtils.isBlank(assignee)) {// 没有签收 签收任务
if (ActivitiUtils.getClaimTaskSign(bpmnMapper, empId)) {
taskService.claim(task.getId(), empId);
return new Json(true, "签收成功!");
} else {
return new Json(false, "不能签收,请先处理完手中的任务!");
}
} else {
if (assignee.equals(empId)) {// 相同的人处理
return new Json(true, "你已经签收成功!");
} else {
return new Json(false, "任务已经被他人签收!");
}
}
}
// 历史任务
@Override
public List<HistoricTaskInstance> findAuditHistory(String applyId) {
List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().processInstanceBusinessKey(applyId).orderByTaskCreateTime().asc().list();
return historicTaskInstances;
}
@Override
public PreAudit finByApplyId(String applyId) {
return preAuditMapper.findByApplyId(applyId);
}
@Override
public PreAudit selectByEcxxess(String applyId) {
return preAuditMapper.findByApplyId(applyId);
}
@Override
public Json upload(MultipartFile file, String applyId, String loginEmp, String loginName, String context) {
if (null == file || file.isEmpty() || StringUtils.isBlank(applyId)) {
return new Json(false, "上传失败,参数不能为空!");
}
String fileName = file.getOriginalFilename();
if (StringUtils.isBlank(fileName)) {
return new Json(false, "上传失败,参数不能为空!");
}
String fileType = fileName.substring(fileName.lastIndexOf("."));
if (!StringUtils.isBlank(fileType) && (!".jpg".equalsIgnoreCase(fileType) && !".png".equalsIgnoreCase(fileType) && !".gif".equalsIgnoreCase(fileType) && !".bmp".equalsIgnoreCase(fileType) && !".jpeg".equalsIgnoreCase(fileType))) {
return new Json(false, "图片格式不正确");
}
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskAssignee(loginEmp).singleResult();
Timestamp currentTime = DateUtil.getTimestamp();
Annex annex = new Annex();
String id = PrimaryKeyUtil.getPrimaryKey();
annex.setAnxId(id);
annex.setActNode(task.getTaskDefinitionKey());
annex.setApplyId(applyId);
annex.setEmpId(loginEmp);
annex.setFileSize(file.getSize());
annex.setCreateDate(currentTime);
annex.setFileType(fileType);
annex.setFileName(fileName);
annex.setPreViewHost(context);
annex.setApplyTypeId(AnnexType.ANNEX_AUDIT.getType());
annex.setApplyTypeVal(AnnexType.ANNEX_AUDIT.getName());
File savefile = new File(uploadPathUtil.saveAudit() + File.separator + applyId);
if (!savefile.exists()) {
savefile.mkdirs();
}
String saveName = UUID.randomUUID().toString().replace("-", "") + fileType;// 时间戳
annex.setSaveName(saveName);
// 文件保存路径
String savePath = savefile.getAbsolutePath() + File.separator + saveName;
// 映射地址
String preView = uploadPathUtil.auditUrl() + "/" + applyId + "/" + saveName;
// 转存文件
try {
file.transferTo(new File(savePath));
annex.setSavePath(savePath);
annex.setPreView(preView);
annexMapper.insertSelective(annex);
JSONObject obj = new JSONObject();
obj.put("preView", preView);
obj.put("uid", id);
return new Json(true, "保存成功!", obj);
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return new Json(false, "上传失败!");
}
@Override
public Json deleteAnnex(String id) {
int result = annexMapper.deleteByPrimaryKey(id);
if (result > 0) {
return new Json(true, "附件删除成功!");
} else {
return new Json(false, "附件删除失败!");
}
}
@Override
public List<Annex> findByapplyIdAndAnnexType(String applyId, Integer anxType) {
if (StringUtils.isBlank(applyId)) {
return null;
}
return annexMapper.findByApplyIdImgType(applyId, anxType);
}
@Override
public List<RollBackInfoVo> findPreRollBackHis(String applyId) {
return preAuditMapper.selectRollBackInfo(applyId);
}
@Override
public Json saveAuditInfo(PreAudit audit, String loginEmp) {
if (audit == null || StringUtils.isBlank(loginEmp)) {
return new Json(false, "参数异常!");
}
String applyId = audit.getApplyId();
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskDefinitionKey("preAudit").singleResult();
if (null == task) {
return new Json(false, "不能处理!任务已不在当前节点!");
}
// 首先判断审核数据时候已经存在
String taskId = task.getId();
audit.setHandleTime(DateUtil.getSqlDate());
audit.setApplyId(applyId);
audit.setTaskId(taskId);
audit.setProcInstId(task.getProcessInstanceId());
int result = 0;
PreAudit preInfo = preAuditMapper.selectIdByProcess(applyId, taskId);
if (preInfo != null) {// 修改
preInfo.setEmpId(audit.getEmpId());
preInfo.setEmpName(audit.getEmpName());
preInfo.setInnerRemark(audit.getInnerRemark());
preInfo.setRemark(audit.getRemark());
preInfo.setTaskId(taskId);
preInfo.setProcInstId(task.getProcessInstanceId());
preInfo.setCreditRemark(audit.getCreditRemark());
preInfo.setFinanceRemark(audit.getFinanceRemark());
preInfo.setOtherRemark(audit.getOtherRemark());
preInfo.setHandleOption(audit.getHandleOption());
preInfo.setHandleOptionval(audit.getHandleOptionval());
preInfo.setProductId(audit.getProductId());
preInfo.setProductName(audit.getProductName());
preInfo.setApplyId(applyId);
preInfo.setHandleTime(DateUtil.getSqlDate());
preInfo.setHandleMoney(audit.getHandleMoney());
result += preAuditMapper.updateByPrimaryKeySelective(preInfo);
} else {
audit.setPreId(PrimaryKeyUtil.getPrimaryKey());
result += preAuditMapper.insertSelective(audit);
}
if (result > 0) {
return new Json(true, "保存草稿成功!");
} else {
return new Json(true, "保存草稿失败!");
}
}
@Override
public Json multiUpload(MultipartFile[] files, String applyId, String loginEmp, String loginName, String context) {
if (files == null || files.length < 1) {
return new Json(false, "参数有误");
}
JSONArray result = new JSONArray();
for (MultipartFile file : files) {
if (null == file || file.isEmpty() || StringUtils.isBlank(applyId)) {
return new Json(false, "上传失败,参数不能为空!");
}
String fileName = file.getOriginalFilename();
if (StringUtils.isBlank(fileName)) {
return new Json(false, "上传失败,参数不能为空!");
}
String fileType = fileName.substring(fileName.lastIndexOf("."));
if (!StringUtils.isBlank(fileType)
&& (!".jpg".equalsIgnoreCase(fileType) && !".png".equalsIgnoreCase(fileType) && !".gif".equalsIgnoreCase(fileType) && !".bmp".equalsIgnoreCase(fileType) && !".jpeg".equalsIgnoreCase(fileType))) {
return new Json(false, "图片格式不正确");
}
Task task = taskService.createTaskQuery().processInstanceBusinessKey(applyId).taskAssignee(loginEmp).singleResult();
Timestamp currentTime = DateUtil.getTimestamp();
Annex annex = new Annex();
String id = PrimaryKeyUtil.getPrimaryKey();
annex.setAnxId(id);
annex.setActNode(task.getTaskDefinitionKey());
annex.setApplyId(applyId);
annex.setEmpId(loginEmp);
annex.setFileSize(file.getSize());
annex.setCreateDate(currentTime);
annex.setFileType(fileType);
annex.setFileName(fileName);
annex.setPreViewHost(context);
annex.setApplyTypeId(AnnexType.ANNEX_AUDIT.getType());
annex.setApplyTypeVal(AnnexType.ANNEX_AUDIT.getName());
File savefile = new File(uploadPathUtil.saveContract() + File.separator + applyId);
if (!savefile.exists()) {
savefile.mkdirs();
}
String saveName = UUID.randomUUID().toString().replace("-", "") + fileType;// 时间戳
annex.setSaveName(saveName);
// 文件保存路径
String savePath = savefile.getAbsolutePath() + File.separator + saveName;
// 映射地址
String preView = uploadPathUtil.contractUrl() + "/" + applyId + "/" + saveName;
// 转存文件
try {
file.transferTo(new File(savePath));
annex.setSavePath(savePath);
annex.setPreView(preView);
annexMapper.insertSelective(annex);
JSONObject obj = new JSONObject();
obj.put("preView", preView);
obj.put("anxId", id);
obj.put("saveName", saveName);
obj.put("oldName", fileName);
result.add(obj);
} catch (IllegalStateException e) {
e.printStackTrace();
log.error("【协议拟制 文件上传异常 批量上传】", e);
} catch (IOException e) {
e.printStackTrace();
log.error("【协议拟制 文件上传异常 批量上传】", e);
}
}
return new Json(true, "保存成功!", result);
}
}
| [
"[email protected]"
] | |
29f566e04275fa210a1882fbe7d5c92b6f0c46f6 | 64beb8e2ef523fb4914986d190a063cc3e7945b8 | /src/main/java/com/kuliza/mmtraverl/model/GoogleStatusCode.java | ec7f231b3eb441e0881736fd11fd6d88c115cc44 | [] | no_license | nagenra432/MMTravel | b134dcfce3e4083003965868c33b382a717e0651 | a6ebf2245e8cfb3c160f95e3ceac050ee852b26f | refs/heads/master | 2020-07-19T19:09:36.207742 | 2019-09-06T06:14:12 | 2019-09-06T06:14:12 | 206,498,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.kuliza.mmtraverl.model;
public enum GoogleStatusCode {
NOT_FOUND("NOT_FOUND"),ZERO_RESULTS("ZERO_RESULTS"),MAX_ROUTE_LENGTH_EXCEEDED("MAX_ROUTE_LENGTH_EXCEEDED"),OK("OK");
private String levelStatusCode;
private GoogleStatusCode(String levelStatusCode) {
this.levelStatusCode = levelStatusCode;
}
public String getLevelStatusCode() {
return levelStatusCode;
}
}
| [
"[email protected]"
] | |
1ff41ae6529e0a1698957a982e66cfe10ebec4be | ce4fda0d22266b4867fda559a8a208e0545070b9 | /src/main/java/com/mystudycanada/shreehari/API/AddExamRequest.java | ed7bb1796c5cc3a5e3b827ba047458768707c87d | [] | no_license | kevalderivedweb/ShriHari | 6942b5b43bc5c8c8105f4cc5302de3be929e5568 | 04c8fcf4707d302e4b7de0e85dea9bca15fdd0a2 | refs/heads/master | 2023-04-09T10:46:34.130335 | 2021-04-16T06:37:37 | 2021-04-16T06:37:37 | 358,273,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | java | package com.mystudycanada.shreehari.API;
import com.android.volley.AuthFailureError;
import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
/**
* Created by kshitij on 12/17/17.
*/
public class AddExamRequest extends StringRequest {
private Map<String, String> parameters;
public AddExamRequest(String mock_test_name, String mock_test_date,String mock_test_time,String speaking_topic,String essay,String branch_id,String coaching_id,String batch_id, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.POST, ServerUtils.BASE_URL+"add-exam", listener, errorListener);
parameters = new HashMap<>();
parameters.put("mock_test_name", mock_test_name);
parameters.put("mock_test_date", mock_test_date);
parameters.put("mock_test_time", mock_test_time);
parameters.put("speaking_topic", speaking_topic);
parameters.put("essay", essay);
parameters.put("branch_id", branch_id);
parameters.put("standard_id", coaching_id);
parameters.put("batch_id", batch_id);
}
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return parameters;
}
}
| [
"nimish@125"
] | nimish@125 |
24775342114d5b34d2b6fbe1b2fa4e1d4e053db1 | 57dfe1c4a72524df158493f2f975c1757ef8f472 | /src/com/gtn/dto/DplReasonDto.java | 4c8a01a9668f3cded41287c234c7b5f278d1f1c6 | [] | no_license | nive1980/gtn | 0cde8cfe7570d7eae58f680851f1f5de5a689042 | 5ed4631eeb14e55995a1897c959264eb9b6dff98 | refs/heads/master | 2022-12-23T08:56:58.230001 | 2022-12-16T05:28:41 | 2022-12-16T05:28:41 | 110,862,005 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,618 | java | package com.gtn.dto;
import java.util.Date;
public class DplReasonDto {
private String reasonCode;
/**
* Attribute reason.
*/
private String reason;
/**
* Attribute denyOverride.
*/
private String denyOverride;
/**
* Attribute createdOn.
*/
private Date createdOn;
/**
* Attribute createdBy.
*/
private String createdBy;
/**
* Attribute modifiedOn.
*/
private Date modifiedOn;
/**
* Attribute modifiedBy.
*/
private String modifiedBy;
/**
* Attribute active.
*/
private String active;
public String getReasonCode() {
return reasonCode;
}
public void setReasonCode(String reasonCode) {
this.reasonCode = reasonCode;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getDenyOverride() {
return denyOverride;
}
public void setDenyOverride(String denyOverride) {
this.denyOverride = denyOverride;
}
public Date getCreatedOn() {
return createdOn;
}
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getModifiedOn() {
return modifiedOn;
}
public void setModifiedOn(Date modifiedOn) {
this.modifiedOn = modifiedOn;
}
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
public String getActive() {
return active;
}
public void setActive(String active) {
this.active = active;
}
}
| [
"[email protected]"
] | |
07788e01543a3e090aacf9e58146f43c9a4a5f43 | aef7c2366ff266b79081c6d75f9be76dc2562707 | /product-display-jdbc/src/com/simplilearn/workshop/ProductDetails.java | 8aa5576114e1a27815ef5a56ebb2f9d44cc0c300 | [] | no_license | vinodhmahendra/pg-web-developers | b0bb17f8ff762d634b6452c512fc55c7a0880f56 | 8d5c163d3f95991a297820cccc1f36da9b63457c | refs/heads/master | 2023-02-19T00:30:45.831935 | 2021-01-24T14:38:43 | 2021-01-24T14:38:43 | 328,432,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,266 | java | package com.simplilearn.workshop;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.simplilearn.workshop.util.DatabaseConnection;
public class ProductDetails extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String INSERT_QUERY = "INSERT INTO eproduct(NAME,PRICE) value ('mac pro',150000)";
private static final String SELECT_QUERY = "SELECT * FROM eproduct";
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
try {
PrintWriter out = response.getWriter();
out.println("<html> <body>");
out.println("<h1>Simplilearn Product Display Info</h1>");
out.println("<hr size='5' color='blue' />");
InputStream inputStream = getServletContext().getResourceAsStream(
"/WEB-INF/application.properties");
Properties properties = new Properties();
properties.load(inputStream);
// obtain a connection object
DatabaseConnection connection = new DatabaseConnection(
properties.getProperty("url"),
properties.getProperty("user"),
properties.getProperty("password"));
// obtain a Statement Object
Statement statement = connection.getConnection().createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
statement.executeUpdate(INSERT_QUERY);
ResultSet resultSet = statement.executeQuery(SELECT_QUERY);
while (resultSet.next()){
out.println(resultSet.getInt("ID") + " ," + resultSet.getString("NAME") + "<br/>");
}
resultSet.close();
statement.close();
out.println("</html> </body>");
connection.closeConnection();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| [
"[email protected]"
] | |
1a90c3d54071f6b583928e9f58dc117816c9e161 | 981df8aa31bf62db3b9b4e34b5833f95ef4bd590 | /xworker_javafx/src/main/java/xworker/javafx/design/DesignerListener.java | 48ecfff3231df61c69414edb681430379f668fe9 | [
"Apache-2.0"
] | permissive | x-meta/xworker | 638c7cd935f0a55d81f57e330185fbde9dce9319 | 430fba081a78b5d3871669bf6fcb1e952ad258b2 | refs/heads/master | 2022-12-22T11:44:10.363983 | 2021-10-15T00:57:10 | 2021-10-15T01:00:24 | 217,432,322 | 1 | 0 | Apache-2.0 | 2022-12-12T23:21:16 | 2019-10-25T02:13:51 | Java | UTF-8 | Java | false | false | 795 | java | package xworker.javafx.design;
import javafx.event.EventHandler;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
public class DesignerListener implements EventHandler<MouseEvent> {
@Override
public void handle(MouseEvent event) {
if(event.getButton() == MouseButton.MIDDLE && event.isControlDown()){
Object source = event.getSource();
if(source instanceof TableView){
TableView<?> tableView = (TableView<?>) source;
for(TableColumn<?,?> column : tableView.getColumns()){
System.out.println(column.getText() + ", width=" + column.getWidth());
}
}
}
}
}
| [
"[email protected]"
] | |
89690bbe4136b9d0a58a4a21b3ad36074fd5ac75 | 2cb9760aed7cc08535cf47e883fe3319773d7efc | /src/main/java/com/gamasoft/eopi/cap17_DynamicProgramming/ShortestSum.java | 0530228438641c90172a1bc759e55d160db7100b | [] | no_license | uberto/eopi | 4bdd0e4e29e5886245d84a7afe8588381f001d04 | 953dfd4feff2bf98f4ae3f2e233febd619944d0d | refs/heads/master | 2021-01-13T09:02:43.532323 | 2017-01-07T23:21:26 | 2017-01-07T23:21:26 | 72,373,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package com.gamasoft.eopi.cap17_DynamicProgramming;
/**
* Created by uberto on 20/11/16.
*/
public class ShortestSum {
public static int find(int[] seq, int sum) {
int currTot = 0;
int best = 0;
for (int v: seq){
best++;
currTot += v;
if (currTot >= sum)
break;
}
if (currTot < sum)
return 0;
currTot -= seq[0];
for (int i = best; i < seq.length; i++) {
currTot += seq[i] - seq[i - best + 1];
while (currTot >= sum){
best--;
currTot -= seq[i - best + 1];
}
if (best == 1)
break;
}
return best;
}
}
| [
"[email protected]"
] | |
c6717084d2dec4ddf690fc7509214e6e17f95d23 | e9d2c8b583e2537b7b7bc92879872ed5189bed53 | /app/src/main/java/com/tech/hami/cardview/domain.java | cdef482c82e61feb285b2938e3295d36e66dc0d3 | [] | no_license | hamitech44/EarnMoneyApp | c3140ede332eacdea0d9e57c1ddd596fb2e88ad0 | 1f8af187690c5e89315e041bd77c91575c2793f5 | refs/heads/master | 2020-11-24T13:41:22.923130 | 2019-12-15T11:31:54 | 2019-12-15T11:31:54 | 228,173,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package com.tech.hami.cardview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class domain extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_domain);
}
}
| [
"[email protected]"
] | |
ddc500aba04667e42f1001efec3c6f5b1ee0973c | c0913642081978f48d17467aa5d477de8b6b803d | /android/src/main/java/com/nerdyfactory/notification/NLService.java | a94d45677a92af12bc09db3d044fd6eb000e232c | [
"Apache-2.0"
] | permissive | gildo/react-native-notification-listener | 5e41dd5d8cc2c1049338e00c7616e6d9290d2be4 | 411be1c7e83fa3774d754f1531435a03b62f1be9 | refs/heads/master | 2021-01-13T13:45:50.656849 | 2016-11-19T04:07:30 | 2016-11-19T04:07:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,610 | java | package com.nerdyfactory.notification;
import android.os.Handler;
import android.os.Looper;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.WritableNativeMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
public class NLService extends NotificationListenerService {
private static final String TAG = "NLService";
private void handleNotification(ReactApplicationContext context, StatusBarNotification sbn) {
WritableNativeMap params = new WritableNativeMap();
params.putString("packageName", sbn.getPackageName());
params.putString("tickerText", sbn.getNotification().tickerText.toString());
context
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("notificationReceived", params);
}
@Override
public void onNotificationPosted(final StatusBarNotification sbn) {
Log.d(TAG, "Notification received: "+sbn.getPackageName()+":"+sbn.getNotification().tickerText);
//Following code is from https://github.com/zo0r/react-native-push-notification
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
ReactInstanceManager mReactInstanceManager = ((ReactApplication) getApplication()).getReactNativeHost().getReactInstanceManager();
ReactContext context = mReactInstanceManager.getCurrentReactContext();
if (context != null) {
handleNotification((ReactApplicationContext) context, sbn);
} else {
mReactInstanceManager.addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() {
public void onReactContextInitialized(ReactContext context) {
handleNotification((ReactApplicationContext) context, sbn);
}
});
if (!mReactInstanceManager.hasStartedCreatingInitialContext()) {
mReactInstanceManager.createReactContextInBackground();
}
}
}
});
}
@Override
public void onNotificationRemoved(StatusBarNotification sbn) {
}
} | [
"[email protected]"
] | |
bfbd612c6e180e861425fad1358ddd7537f0fb57 | 90688659d5493e7ec2e71c258601e1f2f00d5a9b | /Katalabaino/src/splitters/SampleLabelSplitter.java | 9bfbe2949bdce3089e4f2051a251f92d17cff43a | [] | no_license | jmagnotti/katalabaino | bd9c5dc59938ded06a6afc7969d27f4d3377f435 | 507eec39925fccb68186bfebe37a9a40c953ac40 | refs/heads/master | 2021-01-24T06:41:23.779521 | 2014-08-08T19:20:39 | 2014-08-08T19:20:39 | 32,994,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package splitters;
import core.MultiClassRule;
import core.Splitter;
import core.trial.Trial;
class SampleLabelRule extends MultiClassRule {
@Override
public String getClassMembership(Trial trial) {
return trial.sampleStimuli.firstElement().label + ".";
}
}
public class SampleLabelSplitter extends Splitter {
public SampleLabelSplitter() {
super(new SampleLabelRule());
}
}
| [
"john.magnotti@0cdcdda5-9da0-63a2-563e-abc94933a68b"
] | john.magnotti@0cdcdda5-9da0-63a2-563e-abc94933a68b |
89c66abef00b1b8b3af4cfd9cee1db4486800355 | 03d760560372a5a356a5d20eac9fd726844be2f0 | /src/main/java/com/strut/CartDetails.java | 61218e0aa25cf35e16288f30f841e58ca32e3579 | [] | no_license | basnet97/SpringBoot | 9b15284b25ce82b42e70da63020df6be542a2e9c | 65948f7f6ec02cb8a8f0c3bb9392a9045e015c04 | refs/heads/master | 2022-12-02T14:01:27.939708 | 2020-08-13T22:54:50 | 2020-08-13T22:54:50 | 286,634,901 | 0 | 1 | null | 2020-08-13T21:07:51 | 2020-08-11T03:20:04 | Java | UTF-8 | Java | false | false | 419 | java | package com.strut;
import java.util.ArrayList;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
@Scope("session")
public class CartDetails {
boolean isLoggedIn;
ArrayList<String> items = new ArrayList<String>();
public void add(String prod) {
items.add(prod);
System.out.println("total items in the cart");
System.out.println(items);
}
}
| [
"[email protected]"
] | |
d170bd9ba8d2c6954bc9fa40e70f894921345c88 | 188a0e2324adfa191b067946bf4dee6758969487 | /src/main/java/no/swati/lanesoknad/LanesoknadApplication.java | 78ad86fcf3f465405a9c18af0765c5e963a387d1 | [] | no_license | SwatCodes/Lanesoknad | f0125cdf53523105d6f3028034573b2a04fc9c81 | 1d95227047864d70a7e404e53357611a836d9c00 | refs/heads/master | 2023-02-23T03:45:17.850225 | 2021-01-18T15:43:51 | 2021-01-18T15:43:51 | 330,464,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package no.swati.lanesoknad;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class LanesoknadApplication {
public static void main(String[] args) {
SpringApplication.run(LanesoknadApplication.class, args);
}
}
| [
"[email protected]"
] | |
d24162441f76a642ccbb14f4f115392e96579ff2 | 9e7ba96543bb5fa83866cec2643b930b988d47a8 | /访问者模式/src/main/Node.java | d12eb565ae7c1c532f5ab28b2781361ded5a6fc1 | [] | no_license | PengSun90/DesignMode | aa83b6177eee53cae55bde69201d6e08fe551394 | 42311e8d012a48bf1c26bc2423b8724a0d328a95 | refs/heads/master | 2021-01-17T20:39:25.931858 | 2016-06-30T12:42:39 | 2016-06-30T12:42:39 | 62,307,811 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package main;
public abstract class Node {
/**
* 接受操作
*/
public abstract void accept(Visitor visitor);
} | [
"[email protected]"
] | |
a7333ecd7b84bb15a177fd332245ea7a9f3a9de4 | b4d05807a7c985d9e66727faa3345e82507a2fa5 | /Factorial.java | 19772fc8145f7f4fc5992a34e5feee6218ba6c96 | [] | no_license | vaughnsten/Java-Beginner | 9b29ef98847ecc2ff5ec5d9fd96f949b2d965cc6 | 726b24d081c5f763feb9bb2d4cf8fb13219624e6 | refs/heads/master | 2020-04-26T16:58:05.074912 | 2019-04-02T14:28:36 | 2019-04-02T14:28:36 | 173,697,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package Hello;
public class Factorial {
int fact(int n) {
int result;
if(n==1) return 1;
result = fact(n - 1) * n;
return result;
}
}
| [
"[email protected]"
] | |
8ed59d671a61f6dcf3a88d8e507f19a88fb61aa4 | 84880c8aa7e465c08c426fdb9a61b7848231696f | /jwt/src/main/java/com/murali/jwt/core/JwtUserDetailsService.java | 8cb671377415129c64718fbb393ef2881df1b156 | [] | no_license | murali198/springboot-auth | 354cafb9df1815e58d6a658123b3dd7d5c67ba6e | b8fe37bea01159dc310864bdc4e1933a2bd4126f | refs/heads/master | 2023-06-22T16:48:33.498941 | 2019-07-26T11:48:40 | 2019-07-26T11:48:40 | 198,639,345 | 0 | 0 | null | 2023-06-20T18:31:57 | 2019-07-24T13:18:03 | Java | UTF-8 | Java | false | false | 1,070 | java | package com.murali.jwt.core;
import com.murali.jwt.repo.AppUserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
@Component
@Primary
public class JwtUserDetailsService implements UserDetailsService {
@Autowired
private AppUserRepository repository;
@Override
public UserDetails loadUserByUsername(String user) throws UsernameNotFoundException {
return repository.findByUser(user)
.map( usr -> {
return new User(usr.getUser(), usr.getPassword(), new ArrayList<>());
})
.orElseThrow(() -> new UsernameNotFoundException("Invalid User!!"));
}
}
| [
"[email protected]"
] | |
b582a938a1fb0dbe1799bc95a566a25859aa00a5 | 4e2f16f2904d75e55cce1b2cef54acf79aa21280 | /gradle-core/src/main/java/com/android/build/gradle/tasks/ShaderCompile.java | cc736afc0cfa1a3e49e171667afc0b17152958de | [
"Apache-2.0"
] | permissive | yuweiguocn/build-system | 0e49a836728614efd30e9bae8c7e92b0d8371f2e | bc4c85f7b25770caa4c565176b8f92e1cdd9cf70 | refs/heads/master | 2020-09-21T16:20:14.670290 | 2019-11-29T12:07:13 | 2019-11-29T12:07:13 | 224,846,645 | 13 | 5 | null | null | null | null | UTF-8 | Java | false | false | 6,827 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.build.gradle.tasks;
import static com.android.build.gradle.internal.scope.InternalArtifactType.MERGED_SHADERS;
import com.android.annotations.NonNull;
import com.android.build.api.artifact.BuildableArtifact;
import com.android.build.gradle.internal.api.artifact.BuildableArtifactUtil;
import com.android.build.gradle.internal.core.GradleVariantConfiguration;
import com.android.build.gradle.internal.scope.InternalArtifactType;
import com.android.build.gradle.internal.scope.VariantScope;
import com.android.build.gradle.internal.tasks.AndroidBuilderTask;
import com.android.build.gradle.internal.tasks.Workers;
import com.android.build.gradle.internal.tasks.factory.VariantTaskCreationAction;
import com.android.builder.internal.compiler.ShaderProcessor;
import com.android.ide.common.process.LoggedProcessOutputHandler;
import com.android.ide.common.workers.WorkerExecutorFacade;
import com.android.utils.FileUtils;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.util.PatternSet;
import org.gradle.workers.WorkerExecutor;
/** Task to compile Shaders */
@CacheableTask
public class ShaderCompile extends AndroidBuilderTask {
private static final PatternSet PATTERN_SET = new PatternSet()
.include("**/*." + ShaderProcessor.EXT_VERT)
.include("**/*." + ShaderProcessor.EXT_TESC)
.include("**/*." + ShaderProcessor.EXT_TESE)
.include("**/*." + ShaderProcessor.EXT_GEOM)
.include("**/*." + ShaderProcessor.EXT_FRAG)
.include("**/*." + ShaderProcessor.EXT_COMP);
// ----- PUBLIC TASK API -----
// ----- PRIVATE TASK API -----
private File outputDir;
private final WorkerExecutorFacade workers;
@Inject
public ShaderCompile(WorkerExecutor workerExecutor) {
this.workers = Workers.INSTANCE.getWorker(workerExecutor);
}
@Input
public String getBuildToolsVersion() {
return getBuildTools().getRevision().toString();
}
private BuildableArtifact sourceDir;
@InputFiles
public BuildableArtifact getSourceDir() {
return sourceDir;
}
@NonNull
private List<String> defaultArgs = ImmutableList.of();
private Map<String, List<String>> scopedArgs = ImmutableMap.of();
private File ndkLocation;
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
public FileTree getSourceFiles() {
File sourceDirFile = BuildableArtifactUtil.singleFile(sourceDir);
FileTree src = null;
if (sourceDirFile.isDirectory()) {
src = getProject().files(sourceDirFile).getAsFileTree().matching(PATTERN_SET);
}
return src == null ? getProject().files().getAsFileTree() : src;
}
@TaskAction
protected void compileShaders() throws IOException {
// this is full run, clean the previous output
File destinationDir = getOutputDir();
FileUtils.cleanOutputDir(destinationDir);
try {
getBuilder()
.compileAllShaderFiles(
BuildableArtifactUtil.singleFile(sourceDir),
getOutputDir(),
defaultArgs,
scopedArgs,
ndkLocation,
new LoggedProcessOutputHandler(getILogger()),
workers);
workers.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@OutputDirectory
public File getOutputDir() {
return outputDir;
}
public void setOutputDir(File sourceOutputDir) {
this.outputDir = sourceOutputDir;
}
@NonNull
@Input
public List<String> getDefaultArgs() {
return defaultArgs;
}
public void setDefaultArgs(@NonNull List<String> defaultArgs) {
this.defaultArgs = ImmutableList.copyOf(defaultArgs);
}
@NonNull
@Input
public Map<String, List<String>> getScopedArgs() {
return scopedArgs;
}
public void setScopedArgs(@NonNull Map<String, List<String>> scopedArgs) {
this.scopedArgs = ImmutableMap.copyOf(scopedArgs);
}
public static class CreationAction extends VariantTaskCreationAction<ShaderCompile> {
private File outputDir;
public CreationAction(@NonNull VariantScope scope) {
super(scope);
}
@Override
@NonNull
public String getName() {
return getVariantScope().getTaskName("compile", "Shaders");
}
@Override
@NonNull
public Class<ShaderCompile> getType() {
return ShaderCompile.class;
}
@Override
public void preConfigure(@NonNull String taskName) {
super.preConfigure(taskName);
outputDir =
getVariantScope()
.getArtifacts()
.appendArtifact(InternalArtifactType.SHADER_ASSETS, taskName, "out");
}
@Override
public void configure(@NonNull ShaderCompile task) {
super.configure(task);
VariantScope scope = getVariantScope();
final GradleVariantConfiguration variantConfiguration = scope.getVariantConfiguration();
task.ndkLocation = scope.getGlobalScope().getNdkHandler().getNdkDirectory();
task.sourceDir = scope.getArtifacts().getFinalArtifactFiles(MERGED_SHADERS);
task.setOutputDir(outputDir);
task.setDefaultArgs(variantConfiguration.getDefautGlslcArgs());
task.setScopedArgs(variantConfiguration.getScopedGlslcArgs());
}
}
}
| [
"[email protected]"
] | |
accf423fe3d656cef764a1f5fcd0b8487aa8ac15 | 5f8e09e37ce6418fd7e423ac275b816d18707f53 | /lab_1/_code/step9/mps/languages/ArduinoML/source_gen/ArduinoML/editor/Condition_SubstituteMenu.java | 664257c134f09d334eec0eaaaf1fb18424d14540 | [] | no_license | Pantoofle/sec-labs | 2e689d8fdbce6c99bffadd3685f3880b05130380 | 97272fb76bd4c8d33d0c53f7db810b7a8c95f2a3 | refs/heads/master | 2020-04-01T01:37:18.727376 | 2018-12-22T00:45:12 | 2018-12-22T00:45:12 | 152,746,032 | 0 | 0 | null | 2018-10-12T12:18:32 | 2018-10-12T12:18:31 | null | UTF-8 | Java | false | false | 4,363 | java | package ArduinoML.editor;
/*Generated by MPS */
import jetbrains.mps.nodeEditor.menus.substitute.SubstituteMenuBase;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import jetbrains.mps.lang.editor.menus.MenuPart;
import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuItem;
import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuContext;
import java.util.ArrayList;
import jetbrains.mps.lang.editor.menus.substitute.ConstraintsFilteringSubstituteMenuPartDecorator;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.editor.menus.EditorMenuDescriptorBase;
import jetbrains.mps.smodel.SNodePointer;
import jetbrains.mps.lang.editor.menus.substitute.ReferenceScopeSubstituteMenuPart;
import jetbrains.mps.lang.editor.menus.ConceptMenusPart;
import java.util.Collection;
import jetbrains.mps.smodel.ConceptDescendantsCache;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuLookup;
import jetbrains.mps.smodel.language.LanguageRegistry;
public class Condition_SubstituteMenu extends SubstituteMenuBase {
@NotNull
@Override
protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts(final SubstituteMenuContext _context) {
List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> result = new ArrayList<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>();
result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new Condition_SubstituteMenu.SMP_ReferenceScope_ivmgla_a(), MetaAdapterFactory.getConcept(0x6d84bad7eb044249L, 0x8d80c9157947c3f2L, 0x558f584187c478ebL, "ArduinoML.structure.Condition")));
result.add(new Condition_SubstituteMenu.SMP_Subconcepts_ivmgla_b());
return result;
}
@NotNull
@Override
public List<SubstituteMenuItem> createMenuItems(@NotNull SubstituteMenuContext context) {
context.getEditorMenuTrace().pushTraceInfo();
context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase("default substitute menu for Condition. Generated from implicit smart reference attribute.", new SNodePointer("r:95dc3936-047b-4df0-883d-ba757a2402dd(ArduinoML.structure)", "6165243453367417067")));
try {
return super.createMenuItems(context);
} finally {
context.getEditorMenuTrace().popTraceInfo();
}
}
public class SMP_ReferenceScope_ivmgla_a extends ReferenceScopeSubstituteMenuPart {
public SMP_ReferenceScope_ivmgla_a() {
super(MetaAdapterFactory.getConcept(0x6d84bad7eb044249L, 0x8d80c9157947c3f2L, 0x558f584187c478ebL, "ArduinoML.structure.Condition"), MetaAdapterFactory.getReferenceLink(0x6d84bad7eb044249L, 0x8d80c9157947c3f2L, 0x558f584187c478ebL, 0x558f584187c4ef55L, "reader"));
}
@NotNull
@Override
public List<SubstituteMenuItem> createItems(SubstituteMenuContext context) {
context.getEditorMenuTrace().pushTraceInfo();
context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase("reference scope substitute menu part", null));
try {
return super.createItems(context);
} finally {
context.getEditorMenuTrace().popTraceInfo();
}
}
}
public class SMP_Subconcepts_ivmgla_b extends ConceptMenusPart<SubstituteMenuItem, SubstituteMenuContext> {
protected Collection getConcepts(final SubstituteMenuContext _context) {
return ConceptDescendantsCache.getInstance().getDirectDescendants(MetaAdapterFactory.getConcept(0x6d84bad7eb044249L, 0x8d80c9157947c3f2L, 0x558f584187c478ebL, "ArduinoML.structure.Condition"));
}
@NotNull
@Override
public List<SubstituteMenuItem> createItems(SubstituteMenuContext context) {
context.getEditorMenuTrace().pushTraceInfo();
context.getEditorMenuTrace().setDescriptor(new EditorMenuDescriptorBase("include menus for all the direct subconcepts of " + "Condition", null));
try {
return super.createItems(context);
} finally {
context.getEditorMenuTrace().popTraceInfo();
}
}
@Override
protected Collection<SubstituteMenuItem> createItemsForConcept(SubstituteMenuContext context, SAbstractConcept concept) {
return context.createItems(new DefaultSubstituteMenuLookup(LanguageRegistry.getInstance(context.getEditorContext().getRepository()), concept));
}
}
}
| [
"[email protected]"
] | |
90cee2b7a75f76b9be0324c3f2792202ae6000b6 | e4f0a932b9598f737de523a58166fa8f63ec205d | /FreeCRMtest/src/test/java/com/crm/qa/testcases/LoginPageTest.java | 717485a7c47b1e26f6a9796bdb2c47b151604973 | [] | no_license | harshal2806/automationrepository | 977ef3d15de802bf7c75d2ccc5cca3f6bdbfef70 | 7cc437de721eaf37d8dbdd783c7177b14eddb3f1 | refs/heads/master | 2022-07-24T11:48:58.947385 | 2019-12-06T17:22:40 | 2019-12-06T17:22:40 | 199,118,645 | 0 | 0 | null | 2022-06-29T17:49:34 | 2019-07-27T05:08:26 | HTML | UTF-8 | Java | false | false | 1,035 | java | package com.crm.qa.testcases;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.crm.qa.base.TestBase;
import com.crm.qa.page.HomePage;
import com.crm.qa.page.LoginPage;
public class LoginPageTest extends TestBase {
LoginPage loginPage;
HomePage homepage;
public LoginPageTest() {
super();
}
@BeforeMethod
public void setup()
{
initialization();
loginPage=new LoginPage();
}
@Test
public void validateLoginPageTest()
{
String Title=loginPage.validateLoginPageTitle();
Assert.assertEquals(Title, "<title>Free CRM #1 cloud software for any business large or small");
}
@Test
public void CRMlogoTest() {
boolean flag=loginPage.validateCRMimage();
Assert.assertTrue(flag);
}
@Test
public void loginTest() {
homepage=loginPage.login(prop.getProperty("username"),"password");
}
@AfterMethod
public void tearDown()
{
driver.quit();
}
}
| [
"[email protected]"
] | |
bd4de87b0c8fd81902d90098ec695808abdb861b | c64805fe0a8ebe30e19ffafe1dd94efb7c1de366 | /main/java/com/ihm/customer/dao/CustomerAppointmentDAO.java | 37dbefd74d678f95e5df2d01d3ea4275a33399cc | [] | no_license | SrinuT/new | 83f1d4a65ef87f4d4176f78081acfa3cd6bc9606 | 86d3e5b871daa6711c76364d0cfafd04b19b0199 | refs/heads/master | 2021-01-10T15:45:19.979817 | 2015-05-26T13:37:49 | 2015-05-26T13:37:49 | 36,298,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package com.ihm.customer.dao;
import org.springframework.stereotype.Repository;
import com.ihm.customer.entites.SlrAppointmentBookings;
/**
* @author SARDAR WAQAS AHMED
* @email [email protected]
* @since 23-Jan-2015
* @version 1.0
*/
@Repository
public interface CustomerAppointmentDAO extends GenericDAO<SlrAppointmentBookings, Integer> {
}
| [
"[email protected]"
] | |
bc40c4b10dd702324a0e92b5e3d7c6c330237746 | 6846419001a1823542048ea67cc4fce015fed7de | /src/algdat/GenericSorting.java | d6b961c8aec8bee6392cae47e30f7ff1b7893ab4 | [] | no_license | HenkBonna/AlgDat2020 | fc1f0c3630057cef2c6e61914e924ebb3878d031 | 7869af8ad577a8d5dd9ab34ad3e1425a4ca10169 | refs/heads/master | 2023-01-13T05:30:34.244624 | 2020-11-12T12:40:33 | 2020-11-12T12:40:33 | 289,725,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,199 | java | package algdat;
import java.util.ArrayList;
import java.util.Arrays;
public class GenericSorting {
public static class Person implements Comparable<Person> {
String firstName;
String lastName;
Person(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public int compareTo(Person other) {
/*
if (thislastName < other.lastName){
return -1;
}
else if (this.lastName == other.lastName){
return 0;
}
else {
return 1;
}
*/
int lastCompare = this.lastName.compareTo(other.lastName);
if (lastCompare == 0) {
return this.firstName.compareTo(other.firstName);
} else {
return lastCompare;
}
}
public String toString(){
return firstName + " " + lastName;
}
}
public static void main(String[] args) {
Integer[] a = {1, 8, 9, 18, 98, 3, 2, 9};
Character[] b = {'A', 'C', 'K', 'Z', 'L', 'Y', 'M'};
String[] c = {"ASF", "Kari", "poteter", "lammelår", "eple", "Petter"};
Person[] d = {new Person("Petter", "Pettersen"), new Person("Kari", "Pettersen"), new Person("Nils", "Abrahamsen"), new Person("Tor", "Toresen")};
int personMaxIndex = max(d, 0, d.length);
System.out.println("Siste person, leksikografisk er " + d[personMaxIndex]);
System.out.println("Sorterte opersnore");
System.out.println("Før: " + Arrays.toString(d));
sort(d);
System.out.println("Etter: " + Arrays.toString(d));
}
static
<T extends Comparable<? super T>>
void sort(T[] values){
// Loops over every entry except last
for (int i = 0; i < values.length - 1; ++i){
// Find largest element in interval (i, a.length)
int maxIndex = max(values, i, values.length);
// switch largest element to pos i
T temp = values[i];
values[i] = values[maxIndex];
values[maxIndex] = temp;
// continue
}
}
static
<T extends Comparable<? super T>>
int max(T[] values, int begin, int end) {
T current_max = values[begin];
int current_index = begin;
for (int i = 1; i < end; ++i) {
//if(values[i] > current_max){
if (values[i].compareTo(current_max) > 0) {
current_max = values[i];
current_index = i;
}
}
return current_index;
}
} | [
"[email protected]"
] | |
4f5f247bd331409d584b3a9bc2747f2108570b00 | 461ef2b44b5bbba4f60fec2ff482d37409ece084 | /week_13/day_3/lab_and_homework_whisky_tracker/5_lab_and_homework_solution/WhiskyTracker/src/main/java/com/codeclan/example/WhiskyTracker/controllers/WhiskyController.java | 333249b2593a035af9e32cf920c01de82f310a60 | [] | no_license | krismac/course_notes | 28f6826c276647a0d3170bbe3cc6b986dceface8 | 4ad516161f7ed1ef2b821b66e7a13aac0a58d873 | refs/heads/master | 2023-01-29T23:08:03.611653 | 2021-09-09T14:03:52 | 2021-09-09T14:03:52 | 163,969,266 | 2 | 3 | null | 2023-01-25T11:46:53 | 2019-01-03T12:19:13 | Java | UTF-8 | Java | false | false | 1,495 | java | package com.codeclan.example.WhiskyTracker.controllers;
import com.codeclan.example.WhiskyTracker.models.Distillery;
import com.codeclan.example.WhiskyTracker.models.Whisky;
import com.codeclan.example.WhiskyTracker.repositories.DistilleryRepository.DistilleryRepository;
import com.codeclan.example.WhiskyTracker.repositories.WhiskyRepository.WhiskyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(value = "/whiskies")
public class WhiskyController {
@Autowired
WhiskyRepository whiskyRepository;
@Autowired
DistilleryRepository distilleryRepository;
@GetMapping(value = "/year/{year}")
public List<Whisky> getAllWhiskiesForYear(@PathVariable int year){
return whiskyRepository.getAllWhiskiesForYear(year);
}
@GetMapping(value = "/age/{age}/distilleries")
public List<Distillery> getDistilleriesForWhiskiesAged(@PathVariable int age){
return distilleryRepository.getDistilleriesForWhiskiesAged(age);
}
@GetMapping(value = "/region/{region}")
public List<Whisky> getAllWhiskiesFromRegion(@PathVariable String region){
return whiskyRepository.getAllWhiskiesFromRegion(region);
}
}
| [
"[email protected]"
] | |
2a7413c32209c2d6cd223ad63cc3dcc6a9b79aa5 | 4a4ffbdd3bf645b65928c2575aada1403381e801 | /src/com/emitrom/easygwt/wf/client/column/core/ColumnPanelInterface.java | 82e1f7aed96430e720f8921c0bf111a632774752 | [] | no_license | gpicron/easy-gwt | b1b423b849a7acdfc79ffc5a6db4b602faf0e046 | 4eea13edc1eed80552cc046263f2bd07f4bbcec1 | refs/heads/master | 2021-01-10T10:52:08.431176 | 2011-12-16T20:17:40 | 2011-12-16T20:17:40 | 47,193,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,117 | java | /*******************************************************************************
* This file is part of EasyGWT
*
* Copyright (c) 2010 Emitrom LLC
* All rights reserved.
*
* EasyGWT 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/
******************************************************************************/
package com.emitrom.easygwt.wf.client.column.core;
/**
* Column Panel's Marker interface
*
* @author Alfredo Quiroga-Villamil
*
*/
public interface ColumnPanelInterface {
}
| [
"[email protected]"
] | |
a477e5f39ca0e8c14e7c12f46c39eea470973c16 | 44764396365e23150b2d6e36c5c51556d615b9e6 | /Thread/src/testthread/MyTimerTask.java | ba41587d75d31cf3501a55de438d6d6b9ea07b04 | [] | no_license | obujeaud/testGitEclipse | b09fd548d12e8852c195a5af18b9933c47aaff0b | 06dd2eb981255f9138b287d152158d31ed96c9e2 | refs/heads/master | 2020-04-05T11:23:37.686079 | 2018-11-09T09:11:58 | 2018-11-09T09:11:58 | 156,833,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package testthread;
import java.util.Date;
import java.util.TimerTask;
public class MyTimerTask {
static TimerTask makeTimer() {
TimerTask tt = new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println(new Date());
}
};
return tt;
}
} | [
"[email protected]"
] | |
2bcbb4ed13c8f4b5cbada6653f3e90fb0406c251 | a9469adda77c7833452629e2b6560d4d52e6d59e | /HibernateORM4.3.8Debug/hibernateSrc/org/hibernate/event/internal/DefaultSaveEventListener.java | 6e77a5176095b07a0d057cdc3b2231c0cbaad2e9 | [] | no_license | brunoalbrito/javacodedemo | 882cee2afe742e51354ca6fd60fc3546d481244c | 840e84c252967e63022197116d170b3090927591 | refs/heads/master | 2020-04-22T17:50:36.975840 | 2017-06-30T11:11:47 | 2017-06-30T11:11:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,741 | java | /*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.event.internal;
import java.io.Serializable;
import org.hibernate.Hibernate;
import org.hibernate.PersistentObjectException;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.event.spi.SaveOrUpdateEvent;
/**
* An event handler for save() events
* @author Gavin King
*/
public class DefaultSaveEventListener extends DefaultSaveOrUpdateEventListener {
protected Serializable performSaveOrUpdate(SaveOrUpdateEvent event) {
// this implementation is supposed to tolerate incorrect unsaved-value
// mappings, for the purpose of backward-compatibility
// org.hibernate.engine.internal.StatefulPersistenceContext.getEntry( event.getEntity() );
EntityEntry entry = event.getSession().getPersistenceContext().getEntry( event.getEntity() );
if ( entry!=null && entry.getStatus() != Status.DELETED ) {
return entityIsPersistent(event);
}
else {
return entityIsTransient(event);// !!!! 调用父类的方法
}
}
protected Serializable saveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) {
if ( event.getRequestedId() == null ) {
return super.saveWithGeneratedOrRequestedId(event); // !!!
}
else {
return saveWithRequestedId(
event.getEntity(),
event.getRequestedId(),
event.getEntityName(),
null,
event.getSession()
);
}
}
protected boolean reassociateIfUninitializedProxy(Object object, SessionImplementor source) {
if ( !Hibernate.isInitialized(object) ) {
throw new PersistentObjectException("uninitialized proxy passed to save()");
}
else {
return false;
}
}
}
| [
"[email protected]"
] | |
a9af2302be30c519a5312352c3af0a19b34b1ebc | 304b6bface21575e95a3e92207253124a07f2535 | /Week-1/AssignmentAug24/src/com/telstra/assignments/Bank.java | 1bbd54c4eb64f2ac5ab8b163915934bc5942cd74 | [] | no_license | SrikanthGadde/MaGE-JavaFS | 955d5473b36fe425b5511c7456cde1e80c5d1f8d | e24d7edbb2e83acc3dfe661fd6869587fa979f8e | refs/heads/master | 2022-12-16T16:05:54.868489 | 2020-09-12T08:50:50 | 2020-09-12T08:50:50 | 292,359,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,249 | java | package com.telstra.assignments;
import java.util.Scanner;
import java.util.ArrayList;
public class Bank {
public static void main(String[] args) {
int lastAccountNumber = 0;
boolean active = true;
Scanner sc = new Scanner(System.in);
ArrayList<User> users = new ArrayList<User>();
while (active) {
System.out.println("Enter 1 for creating a new account, 2 for accessing an existing account: ");
int num = sc.nextInt();
Boolean session = true;
if (num == 1) {
while(session) {
User u = new User(lastAccountNumber++);
users.add(u);
System.out.println("Account created! "+u.toString());
System.out.println("Enter 1 for operating on this account, 2 for terminating session: ");
int nums = sc.nextInt();
Boolean operating = true;
if (nums==1) {
while (operating) {
System.out.println("Enter 1 for withdrawing, 2 for depositing, 3 for account details");
int numu = sc.nextInt();
if(numu==1) {
System.out.println("Enter amount being withdrawn: ");
int num1 = sc.nextInt();
u.Withdraw(num1);
System.out.println(u);
}
else if(numu == 2) {
System.out.println("Enter amount being deposited: ");
int num2 = sc.nextInt();
u.Deposit(num2);
System.out.println(u);
}
else if (numu ==3) {
System.out.println(u);
}
else {
System.out.println("Invalid input");
}
System.out.println("Do you want to continue operating on this account? (1 for yes)");
int numc = sc.nextInt();
if (numc == 1) {
continue;
}
else {
operating = false;
session = false;
}
}
}
else {
System.out.println("Session terminated");
session = false;
}
}
}
else if (num == 2) { //existing account
System.out.println("Enter account number: ");
int acc = sc.nextInt();
Boolean flag = false;
for (User i: users) {
if (i.equals(acc)) {
flag = true;
System.out.println("Account found.");
Boolean operating = true;
while (operating) {
System.out.println("Enter 1 for withdrawing, 2 for depositing, 3 for account details");
int numu= sc.nextInt();
if(numu==1) {
System.out.println("Enter amount being withdrawn: ");
int num1 = sc.nextInt();
i.Withdraw(num1);
System.out.println(i);
}
else if(numu == 2) {
System.out.println("Enter amount being deposited: ");
int num2 = sc.nextInt();
i.Deposit(num2);
System.out.println(i);
}
else if (numu ==3) {
System.out.println(i);
}
else {
System.out.println("Invalid input");
}
System.out.println("Do you want to continue operating on this account? (1 for yes)");
int numc = sc.nextInt();
if (numc == 1) {
continue;
}
else {
operating = false;
}
}
break;
}
else {
continue;
}
}
if (flag==false)
System.out.println("Account not found.");
}
else {
System.out.println("Closed");
active = false;
}
}
}
}
| [
"[email protected]"
] | |
53cc8342a298f9302a0f22668204d6687c9d9ac7 | 9b9ad157a33248a092ef0ee43eb10c54290daede | /src/main/java/com/studyTable/student/Admin.java | 733725c05a4b3c40b6866805fa8d43ffdde36c90 | [] | no_license | MyTestStudyTable/shayog | 72981c0ed6e12c4c0a3687089ef15a0ce6a90f67 | e7737d4a2df542ad9fac4a5dd88940bb54a051e7 | refs/heads/master | 2022-12-22T04:14:28.956483 | 2020-04-02T17:29:48 | 2020-04-02T17:29:48 | 164,010,913 | 0 | 1 | null | 2022-12-16T02:13:34 | 2019-01-03T18:52:08 | JavaScript | UTF-8 | Java | false | false | 623 | java | package com.studyTable.student;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.validator.constraints.NotEmpty;
@Entity
@Table(name ="admin_tbl")
public class Admin {
@Id
private int adminId;
@NotEmpty
private String password;
public int getadminId() {
return adminId;
}
public void setadminId(int adminId) {
this.adminId = adminId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
] | |
02030b8a42a76a61c0ece8da6cfabc8083cebc50 | efcfa657c87f3e6af14bd1b480a9577ee4d9560e | /src/main/java/com/ekito/teleinfo/domain/LocalWeather.java | 4b1fd590383c6a42dae1a7db64785266e5046885 | [] | no_license | designreuse/teleinfo | 6ed2ebaa013b47de00716a5a2580f777942e7e93 | ab05c048e024949bd534e2fa31c7da394d0da13d | refs/heads/master | 2021-04-27T06:04:57.080287 | 2014-12-29T12:56:39 | 2014-12-29T12:56:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,090 | java | package com.ekito.teleinfo.domain;
import java.util.Date;
import org.springframework.data.annotation.Id;
public class LocalWeather {
@Id
private String id;
private Double temp;
private Date sunrise;
private Date sunset;
private Integer cloud;
private Date date;
private String location;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Double getTemp() {
return temp;
}
public void setTemp(Double temp) {
this.temp = temp;
}
public Date getSunrise() {
return sunrise;
}
public void setSunrise(Date sunrise) {
this.sunrise = sunrise;
}
public Date getSunset() {
return sunset;
}
public void setSunset(Date sunset) {
this.sunset = sunset;
}
public Integer getCloud() {
return cloud;
}
public void setCloud(Integer cloud) {
this.cloud = cloud;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
}
| [
"[email protected]"
] | |
f2700818ceea675aff44e46f84141fea7d993ddd | 024d21ae0dcfa20345cf0a33f1c1b4f3d8f75d1e | /packages/SystemUI/src/com/android/systemui/aokp/RingVibSilentToggle.java | 8dd55ff5059bdca014951b0a1ae5d0ec93cfdbed | [
"Apache-2.0",
"LicenseRef-scancode-unicode"
] | permissive | Root-Box/frameworks_base | 2b8e3b086587ec75fd0cd0a4b36b9444f5bbe411 | 956b4ef4d5cf1c92fd0ff64ff856259e8db41fa3 | refs/heads/jb-mr1 | 2020-04-06T03:54:00.428090 | 2013-07-30T01:40:08 | 2013-07-30T01:44:29 | 5,918,063 | 1 | 2 | null | 2013-08-29T07:48:54 | 2012-09-23T00:04:49 | Java | UTF-8 | Java | false | false | 2,057 | java | /*
* Copyright 2011 AOKP by Mike Wilson - Zaphod-Beeblebrox
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.aokp;
import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.media.ToneGenerator;
import android.os.Bundle;
import android.os.Vibrator;
import android.provider.Settings;
/*
* Toggle Ring/Vibrate/Silent
*/
public class RingVibSilentToggle extends Activity {
public RingVibSilentToggle() {
super();
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if(am != null){
if(am.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
Vibrator vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
if(vib != null){
vib.vibrate(50);
}
}else if(am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
}else{
am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, (int)(ToneGenerator.MAX_VOLUME * 0.85));
if(tg != null){
tg.startTone(ToneGenerator.TONE_PROP_BEEP);
}
}
}
finish();
}
}
| [
"[email protected]"
] | |
4f7d16e39ab5d219f9d7923e5bbed1d02a3d3b28 | 75854ca2172f1dcd26c057f8d0798a56f8cb9c1b | /common-redis/src/test/java/com/sb/stu/test/type/string/StringRedisTemplateTest.java | 9bfccb8fd69b2dd0cc6f738688fa69056e08fb1a | [] | no_license | chendongxia/spring-boot-common-modules | 7dfb838efb9695ee4bb3b0e2d783dfadda59ef4d | 892facb3960023343446caf098a2c59f7789e2b4 | refs/heads/master | 2020-04-28T08:27:21.993268 | 2019-02-14T14:49:43 | 2019-02-14T14:49:43 | 175,127,177 | 1 | 0 | null | 2019-03-12T03:19:43 | 2019-03-12T03:19:23 | Java | UTF-8 | Java | false | false | 983 | java | package com.sb.stu.test.type.string;
import com.sb.stu.common.BaseApplicationTest;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
public class StringRedisTemplateTest extends BaseApplicationTest {
private static Logger logger = LoggerFactory.getLogger(StringRedisTemplateTest.class);
private @Autowired StringRedisTemplate stringTemplate;
@Test
public void testStringRedisTemplate() throws Exception {
// 保存字符串
stringTemplate.opsForValue().set("strTest", "222");
ValueOperations<String, String> valOpt = stringTemplate.opsForValue();
String val = valOpt.get("strTest");
Assert.assertEquals("222", val);
logger.info("strTest.val={}", val);
}
}
| [
"[email protected]"
] | |
04bc2686451fbba8e3b25e2fc98b2d94aa91836a | 902aa161d33b839f39e951e03fc4714ee9c31e95 | /src/jmh/java/io/reactivex/rxjava3/xmapz/ObservableConcatMapCompletablePerf.java | ca6174a006e6ff5307bb314bb2930f6f08e5116b | [
"Apache-2.0"
] | permissive | mayank-gokarna/JaVARx | 56e61c560183f2d91a70683404ea14c3daec7fff | 98cae38cb581f4a18448e793329b684a8ee4181b | refs/heads/3.x | 2023-02-17T15:11:37.725014 | 2021-01-17T10:41:30 | 2021-01-17T10:41:30 | 261,213,720 | 6 | 2 | Apache-2.0 | 2021-01-17T10:41:31 | 2020-05-04T14:56:32 | Java | UTF-8 | Java | false | false | 2,760 | java | /**
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
package io.reactivex.rxjava3.xmapz;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.functions.Function;
@BenchmarkMode(Mode.Throughput)
@Warmup(iterations = 5)
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class ObservableConcatMapCompletablePerf {
@Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
public int count;
Observable<Integer> observableConvert;
Completable observableDedicated;
Observable<Integer> observablePlain;
@Setup
public void setup() {
Integer[] sourceArray = new Integer[count];
Arrays.fill(sourceArray, 777);
Observable<Integer> source = Observable.fromArray(sourceArray);
observablePlain = source.concatMap(new Function<Integer, Observable<? extends Integer>>() {
@Override
public Observable<? extends Integer> apply(Integer v) {
return Observable.empty();
}
});
observableConvert = source.concatMap(new Function<Integer, Observable<? extends Integer>>() {
@Override
public Observable<? extends Integer> apply(Integer v) {
return Completable.complete().toObservable();
}
});
observableDedicated = source.concatMapCompletable(new Function<Integer, Completable>() {
@Override
public Completable apply(Integer v) {
return Completable.complete();
}
});
}
@Benchmark
public Object observablePlain(Blackhole bh) {
return observablePlain.subscribeWith(new PerfConsumer(bh));
}
@Benchmark
public Object observableConvert(Blackhole bh) {
return observableConvert.subscribeWith(new PerfConsumer(bh));
}
@Benchmark
public Object observableDedicated(Blackhole bh) {
return observableDedicated.subscribeWith(new PerfConsumer(bh));
}
}
| [
"[email protected]"
] | |
c7794f4cc2db02c3ab5aca7d93416f3fe8bf4603 | d577f066627703130e70c60374d1b65f31072b43 | /Render/BiomeFXRenderer.java | 0f120aaa4c08282b612372937d8267c61ecd8c03 | [] | no_license | lrivera25/ChromatiCraft | bef7960c1d81af29883a5d909cac8b652e38aac1 | 42842ad41ea3f8b2663f9dc19cb0b8983f64545e | refs/heads/master | 2021-03-24T05:35:43.135925 | 2020-03-14T20:50:10 | 2020-03-14T20:50:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,707 | java | /*******************************************************************************
* @author Reika Kalseki
*
* Copyright 2017
*
* All rights reserved.
* Distribution of the software in any form is only allowed with
* explicit, prior permission from the owner.
******************************************************************************/
package Reika.ChromatiCraft.Render;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumSkyBlock;
import net.minecraftforge.client.MinecraftForgeClient;
import Reika.ChromatiCraft.ChromatiCraft;
import Reika.ChromatiCraft.Auxiliary.ChromaFX;
import Reika.ChromatiCraft.Registry.ExtraChromaIDs;
import Reika.DragonAPI.Instantiable.Rendering.ColorBlendList;
import Reika.DragonAPI.Libraries.IO.ReikaColorAPI;
import Reika.DragonAPI.Libraries.IO.ReikaRenderHelper;
import Reika.DragonAPI.Libraries.IO.ReikaTextureHelper;
import Reika.DragonAPI.Libraries.Java.ReikaGLHelper.BlendMode;
import Reika.DragonAPI.Libraries.Java.ReikaRandomHelper;
public class BiomeFXRenderer {
public static final BiomeFXRenderer instance = new BiomeFXRenderer();
private static final int RAIN_RADIUS = 48;
private static final int POINT_COUNT = 28;
private static final HashMap<Integer, ColorReference> colorMapA = new HashMap();
private static final HashMap<Integer, ColorReference> colorMapB = new HashMap();
static {
colorMapA.put(ExtraChromaIDs.RAINBOWFOREST.getValue(), new SolidColorReference(0x22aaff));
colorMapB.put(ExtraChromaIDs.RAINBOWFOREST.getValue(), new SolidColorReference(0x0060ff));
colorMapA.put(ExtraChromaIDs.ENDERFOREST.getValue(), new SolidColorReference(0xa060ff));
colorMapB.put(ExtraChromaIDs.ENDERFOREST.getValue(), new SolidColorReference(0xffaaff));
colorMapA.put(ExtraChromaIDs.LUMINOUSCLIFFS.getValue(), new ColorBlendReference(new ColorBlendList(5, ChromaFX.getChromaColorTiles())));
colorMapB.put(ExtraChromaIDs.LUMINOUSCLIFFS.getValue(), colorMapA.get(ExtraChromaIDs.LUMINOUSCLIFFS.getValue()));
}
private int biomeRainColor = 0x000000;
private ArrayList<RainPoint> points = new ArrayList();
private BiomeFXRenderer() {
}
public void render() {
if (MinecraftForgeClient.getRenderPass() != 1)
return;
float f = ReikaRenderHelper.getPartialTickTime();
EntityPlayer ep = Minecraft.getMinecraft().thePlayer;
double x = ep.posX+(ep.posX-ep.lastTickPosX)*f;
double y = ep.posY+(ep.posY-ep.lastTickPosY)*f;
double z = ep.posZ+(ep.posZ-ep.lastTickPosZ)*f;
int px = MathHelper.floor_double(x);
int py = MathHelper.floor_double(y);
int pz = MathHelper.floor_double(z);
int b = ep.worldObj.getBiomeGenForCoords(px, pz).biomeID;
ColorReference c1 = colorMapA.get(b);
if (c1 != null && ep.worldObj.getSavedLightValue(EnumSkyBlock.Sky, px, py, pz) > 5) {
ColorReference c2 = colorMapB.get(b);
long tick = ep.worldObj.getTotalWorldTime();
int c = 0xff000000 | (c1 == c2 ? c1.getColor(tick) : ReikaColorAPI.mixColors(c1.getColor(tick), c2.getColor(tick), (float)(0.5+0.5*Math.sin(System.currentTimeMillis()/1500D))));
biomeRainColor = ReikaColorAPI.mixColors(c, biomeRainColor, 0.05F);
}
else {
biomeRainColor = ReikaColorAPI.mixColors(0x00000000, biomeRainColor, 0.025F);
}
if (biomeRainColor == 0)
return;
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glEnable(GL11.GL_BLEND);
//GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_ALPHA_TEST);
BlendMode.ADDITIVEDARK.apply();
GL11.glDisable(GL11.GL_LIGHTING);
ReikaRenderHelper.disableEntityLighting();
GL11.glDepthMask(false);
GL11.glTranslated(-RenderManager.renderPosX, -RenderManager.renderPosY, -RenderManager.renderPosZ);
ReikaTextureHelper.bindTexture(ChromatiCraft.class, "Textures/biomeFX2.png");
Tessellator v5 = Tessellator.instance;
Iterator<RainPoint> it = points.iterator();
while (it.hasNext()) {
RainPoint p = it.next();
if (p.tick(ep))
it.remove();
}
while (points.size() < POINT_COUNT) {
this.generateNewPoint(ep);
}
v5.startDrawingQuads();
for (RainPoint p : points) {
int c = biomeRainColor;
float al = p.getAlpha();
if (al < 1)
c = ReikaColorAPI.getColorWithBrightnessMultiplier(c, al);
v5.setColorOpaque_I(c);
double u = (System.currentTimeMillis()/(int)(50*p.animationSpeed))%64/64D;
double du = u+1/64D;
double rx = p.posX;
double rz = p.posZ;
int n = 6;
double da = 360D/n;
double r = p.radius;
double h = p.height;
int ty = ep.worldObj.getTopSolidOrLiquidBlock(px, pz);
double my = Math.max(ty-8, ep.posY-64);
my = Math.max(my, ep.worldObj.getPrecipitationHeight(MathHelper.floor_double(rx), MathHelper.floor_double(rz)));
for (double ry = my; ry <= ep.posY+64; ry += h*2) {
for (double a = 0; a <= 360; a += da) {
double ang1 = Math.toRadians(a);
double dx1 = rx+r*Math.cos(ang1);
double dz1 = rz+r*Math.sin(ang1);
double ang2 = Math.toRadians(a+da);
double dx2 = rx+r*Math.cos(ang2);
double dz2 = rz+r*Math.sin(ang2);
v5.addVertexWithUV(dx1, ry+h, dz1, u, 0);
v5.addVertexWithUV(dx2, ry+h, dz2, du, 0);
v5.addVertexWithUV(dx2, ry-h, dz2, du, 1);
v5.addVertexWithUV(dx1, ry-h, dz1, u, 1);
}
}
}
v5.draw();
ReikaRenderHelper.enableEntityLighting();
BlendMode.DEFAULT.apply();
GL11.glPopAttrib();
GL11.glPopMatrix();
}
private void generateNewPoint(EntityPlayer ep) {
double dx = ReikaRandomHelper.getRandomPlusMinus(ep.posX, RAIN_RADIUS);
double dz = ReikaRandomHelper.getRandomPlusMinus(ep.posZ, RAIN_RADIUS);
Random r = ep.worldObj.rand;
RainPoint p = new RainPoint(dx, dz, 40+r.nextInt(440), 0.0625+0.0625*r.nextDouble(), ReikaRandomHelper.getRandomPlusMinus(9, 3), 0.5F+r.nextFloat()*1.5F);
points.add(p);
}
private static abstract class ColorReference {
protected abstract int getColor(long tick);
}
private static class ColorBlendReference extends ColorReference {
private final ColorBlendList list;
private ColorBlendReference(ColorBlendList c) {
list = c;
}
@Override
protected int getColor(long tick) {
return list.getColor(tick);
}
}
private static class SolidColorReference extends ColorReference {
private final int color;
private SolidColorReference(int c) {
color = c;
}
@Override
protected int getColor(long tick) {
return color;
}
}
private static class RainPoint {
private static final int FADE_IN = 10;
private static final int FADE_OUT = 20;
private final int lifespan;
private int age;
private final float animationSpeed;
private final double radius;
private final double height;
private final double posX;
private final double posZ;
private RainPoint(double x, double z, int l, double r, double h, float sp) {
posX = x;
posZ = z;
lifespan = l;
radius = r;
height = h;
animationSpeed = sp;
}
private boolean tick(EntityPlayer ep) {
double dx = ep.posX-posX;
double dz = ep.posZ-posZ;
double dd = dx*dx+dz*dz;
if (dd >= RAIN_RADIUS*RAIN_RADIUS) {
age += lifespan/8;
}
else {
age++;
}
return age >= lifespan;
}
private float getAlpha() {
if (age < FADE_IN) {
return (float)age/FADE_IN;
}
else if (age > lifespan-FADE_OUT) {
int rem = lifespan-age;
return (float)rem/FADE_OUT;
}
else {
return 1;
}
}
}
}
| [
"[email protected]"
] | |
aa4194fe42330e4168d2af8c3707127d5bc5eb9a | 2b6e3a34ec277f72a5da125afecfe3f4a61419f5 | /Ruyicai_168/v3.6.2/src/com/ruyicai/activity/buy/jc/explain/zq/ExplainListActivity.java | ece5bcb667263c6647adb0cfa872869b0a44650a | [] | no_license | surport/Android | 03d538fe8484b0ff0a83b8b0b2499ad14592c64b | afc2668728379caeb504c9b769011f2ba1e27d25 | refs/heads/master | 2020-04-02T10:29:40.438348 | 2013-12-18T09:55:42 | 2013-12-18T09:55:42 | 15,285,717 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 18,543 | java | package com.ruyicai.activity.buy.jc.explain.zq;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.palmdream.RuyicaiAndroid168.R;
import com.ruyicai.activity.buy.jc.JcMainView.Info;
import com.ruyicai.activity.buy.jc.explain.zq.AsiaActivity.JcInfoAdapter;
import com.ruyicai.activity.buy.jc.explain.zq.AsiaActivity.JcInfoAdapter.ViewHolder;
import com.ruyicai.activity.buy.jc.explain.zq.BaseListActivity.ExplainInfo;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
/**
* 分析的界面
*
* @author Administrator
*
*/
public class ExplainListActivity extends BaseListActivity {
private String[] titleStrs = {"联赛排名","主队近期战绩(近10场)","客队近期战绩(近10场)","主队未来5场赛事","客队未来5场赛事","历史交锋"};
private String[] keys = {"rankings","homePreSchedules","guestPreSchedules","homeAfterSchedules","guestAfterSchedules","preClashSchedules"};
protected boolean isLq = false;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setLQ();
initList();
}
public void setLQ(){
this.isLq = false;
}
public JSONArray getJsonArray(String value){
JSONArray json = null;
try {
json = JcExplainActivity.jsonObject.getJSONObject("result").getJSONArray(value);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return json;
}
public void initList(){
JSONObject json = JcExplainActivity.jsonObject;
if(json != null){
listMain = (ListView) findViewById(R.id.buy_jc_main_listview);
adapter = new JcInfoAdapter(context,initExplainInfo());
listMain.setAdapter(adapter);
}
}
protected List initExplainInfo(){
List listInfos = new ArrayList<List>();
for(int i=0;i<6;i++){
List listInfo = getHTerm10Info(getJsonArray(keys[i]),titleStrs[i]);
listInfos.add(listInfo);
}
return listInfos;
}
/**
* 主队近期战绩
* @param jsonArray
* @return
*/
protected List getHTerm10Info(JSONArray jsonArray,String title){
List listInfo = new ArrayList<ExplainInfo>();
for(int i=0;i<jsonArray.length();i++){
ExplainInfo info = new ExplainInfo();
info.setTitleName(title);
try {
JSONObject json = jsonArray.getJSONObject(i);
info.setMatchTime(json.getString("matchTime"));
info.setHomeTeam(json.getString("homeTeam"));
info.setGuestTeam(json.getString("guestTeam"));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try{
JSONObject json = jsonArray.getJSONObject(i);
info.setMatchTime(json.getString("matchTime"));
info.setHomeTeam(json.getString("homeTeam"));
info.setGuestTeam(json.getString("guestTeam"));
info.setScore(json.getString("score"));
}catch(JSONException e){
e.printStackTrace();
}
try{
JSONObject json = jsonArray.getJSONObject(i);
info.setRanking(json.getString("ranking"));
info.setTeamName(json.getString("teamName"));
info.setWin(json.getString("win"));
info.setLose(json.getString("lose"));
info.setGoalDifference(json.getString("goalDifference"));
info.setIntegral(json.getString("integral"));
info.setMatchCount(json.getString("matchCount"));
if(!isLq){
info.setStandoff(json.getString("standoff"));
}
}catch(JSONException e){
e.printStackTrace();
}
try{
JSONObject json = jsonArray.getJSONObject(i);
info.setMatchTime(json.getString("matchTime"));
info.setHomeTeam(json.getString("homeTeam"));
info.setGuestTeam(json.getString("guestTeam"));
info.setScore(json.getString("score"));
info.setSclassName(json.getString("sclassName"));
info.setResult(json.getString("result"));
if(!isLq){
info.setGoals(json.getString("goals"));
info.setHalfResult(json.getString("halfResult"));
info.setHalfScore(json.getString("halfScore"));
}
}catch(JSONException e){
e.printStackTrace();
}
listInfo.add(info);
}
return listInfo;
}
/**
* 竞彩的适配器
*/
public class JcInfoAdapter extends BaseAdapter {
private LayoutInflater mInflater; // 扩充主列表布局
private List<List> mList;
public JcInfoAdapter(Context context, List<List> list) {
mInflater = LayoutInflater.from(context);
mList = list;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mList.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return mList.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
int index;
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
index = position;
final ArrayList<ExplainInfo> list = (ArrayList<ExplainInfo>) mList.get(position);
convertView = mInflater.inflate(R.layout.buy_jc_main_view_list_item,null);
final ViewHolder holder = new ViewHolder();
holder.btn = (Button) convertView.findViewById(R.id.buy_jc_main_view_list_item_btn);
holder.layout = (LinearLayout) convertView.findViewById(R.id.buy_jc_main_view_list_item_linearLayout);
holder.btn.setBackgroundResource(R.drawable.buy_jc_btn_close);
if(list.size() == 0){
// holder.btn.setVisibility(Button.GONE);
holder.btn.setText(titleStrs[position]);
holder.btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(context,titleStrs[position]+"没有数据" , Toast.LENGTH_SHORT).show();
}
});
}else{
isOpen(list, holder);
holder.btn.setText(titleStrs[position]);
holder.btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
list.get(0).isOpen = !list.get(0).isOpen;
isOpen(list, holder);
}
});
holder.layout.addView(addLayout(null,true,position));
for(ExplainInfo info:list){
holder.layout.addView(addLayout(info,false,position));
}
}
if(isLq&&position==0){
holder.btn.setVisibility(View.GONE);
}
return convertView;
}
private void isOpen(final ArrayList<ExplainInfo> list, final ViewHolder holder) {
if(list.get(0).isOpen){
holder.layout.setVisibility(LinearLayout.VISIBLE);
holder.btn.setBackgroundResource(R.drawable.buy_jc_btn_open);
}else{
holder.layout.setVisibility(LinearLayout.GONE);
holder.btn.setBackgroundResource(R.drawable.buy_jc_btn_close);
}
}
private View addLayout(final ExplainInfo info,boolean isTop,int index) {
View view = null;
if(index==0){
view = createRank(info,isTop);
}else if(index == 1||index == 2){
view = createTerm10(info,isTop);
}else if(index == 3||index == 4){
view = createTerm5(info,isTop);
}else if(index == 5){
view = createHistory(info,isTop);
}
return view;
}
}
private View createRank(ExplainInfo info,boolean isTop){
View convertView = null;
ViewHolder holder = null;
if(convertView==null){
LayoutInflater mInflater = LayoutInflater.from(context);
convertView = mInflater.inflate(R.layout.explain_list_team_rank,null);
holder = new ViewHolder();
holder.oneText = (TextView) convertView.findViewById(R.id.explain_list_item_text_one);
holder.twoText = (TextView) convertView.findViewById(R.id.explain_list_item_text_two);
holder.teamText = (TextView) convertView.findViewById(R.id.explain_list_item_text_team);
holder.threeText = (TextView) convertView.findViewById(R.id.explain_list_item_text_three);
holder.fourText = (TextView) convertView.findViewById(R.id.explain_list_item_text_four);
holder.fiveText = (TextView) convertView.findViewById(R.id.explain_list_item_text_five);
holder.sixText = (TextView) convertView.findViewById(R.id.explain_list_item_text_six);
holder.sevenText = (TextView) convertView.findViewById(R.id.explain_list_item_text_seven);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
if(isTop){
convertView.setBackgroundColor(context.getResources().getColor(R.color.jc_explain_list_bg));
if(isLq){
holder.fourText.setVisibility(View.GONE);
}
}else{
if(isLq){
holder.fourText.setVisibility(View.GONE);
}else{
holder.fourText.setText(info.getStandoff());
}
holder.oneText.setText(info.getRanking());
holder.twoText.setText(info.getTeamName());
holder.teamText.setText(info.getMatchCount());
holder.threeText.setText(info.getWin());
holder.fiveText.setText(info.getLose());
holder.sixText.setText(info.getGoalDifference());
holder.sevenText.setText(info.getIntegral());
}
return convertView;
}
private View createTerm10(ExplainInfo info,boolean isTop){
View convertView = null;
ViewHolder holder = null;
if(convertView==null){
LayoutInflater mInflater = LayoutInflater.from(context);
convertView = mInflater.inflate(R.layout.explain_term10_list_item,null);
holder = new ViewHolder();
holder.oneText = (TextView) convertView.findViewById(R.id.explain_list_item_text_one);
holder.twoText = (TextView) convertView.findViewById(R.id.explain_list_item_text_two);
holder.threeText = (TextView) convertView.findViewById(R.id.explain_list_item_text_three);
holder.fourText = (TextView) convertView.findViewById(R.id.explain_list_item_text_four);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
if(isTop){
convertView.setBackgroundColor(context.getResources().getColor(R.color.jc_explain_list_bg));
}else{
holder.oneText.setText(info.getMatchTime());
holder.twoText.setText(info.getHomeTeam());
holder.threeText.setText(info.getScore());
holder.fourText.setText(info.getGuestTeam());
}
return convertView;
}
private View createTerm5(ExplainInfo info,boolean isTop){
View convertView = null;
ViewHolder holder = null;
if(convertView==null){
LayoutInflater mInflater = LayoutInflater.from(context);
convertView = mInflater.inflate(R.layout.explain_term5_list_item,null);
holder = new ViewHolder();
holder.oneText = (TextView) convertView.findViewById(R.id.explain_list_item_text_one);
holder.twoText = (TextView) convertView.findViewById(R.id.explain_list_item_text_two);
holder.threeText = (TextView) convertView.findViewById(R.id.explain_list_item_text_three);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
if(isTop){
convertView.setBackgroundColor(context.getResources().getColor(R.color.jc_explain_list_bg));
}else{
holder.oneText.setText(info.getMatchTime());
holder.twoText.setText(info.getHomeTeam());
holder.threeText.setText(info.getGuestTeam());
}
return convertView;
}
private View createHistory(ExplainInfo info,boolean isTop){
View convertView = null;
ViewHolder holder = null;
if(convertView==null){
LayoutInflater mInflater = LayoutInflater.from(context);
convertView = mInflater.inflate(R.layout.explain_history_list_item,null);
holder = new ViewHolder();
holder.oneText_1 = (TextView) convertView.findViewById(R.id.explain_history_one_1);
holder.oneText_2 = (TextView) convertView.findViewById(R.id.explain_history_one_2);
holder.twoText_1 = (TextView) convertView.findViewById(R.id.explain_history_two_1);
holder.twoText_2 = (TextView) convertView.findViewById(R.id.explain_history_two_2);
holder.twoText_3 = (TextView) convertView.findViewById(R.id.explain_history_two_3);
holder.threeText_1 = (TextView) convertView.findViewById(R.id.explain_history_three_1);
holder.threeText_2 = (TextView) convertView.findViewById(R.id.explain_history_three_2);
holder.threeText_3 = (TextView) convertView.findViewById(R.id.explain_history_three_3);
holder.fourText_1 = (TextView) convertView.findViewById(R.id.explain_history_four_1);
holder.fourText_2 = (TextView) convertView.findViewById(R.id.explain_history_four_2);
holder.fourText_3 = (TextView) convertView.findViewById(R.id.explain_history_four_3);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
if(isTop){
convertView.setBackgroundColor(context.getResources().getColor(R.color.jc_explain_list_bg));
if(isLq){
holder.twoText_3.setVisibility(View.GONE);
holder.threeText_3.setVisibility(View.GONE);
holder.fourText_2.setVisibility(View.GONE);
holder.threeText_2.setText("比分");
holder.fourText_3.setText("赛果");
}
}else{
holder.oneText_1.setText(info.getSclassName());
holder.oneText_2.setText(info.getMatchTime());
holder.twoText_1.setText(info.getHomeTeam());
holder.twoText_2.setText(info.getGuestTeam());
if(isLq){
holder.twoText_3.setVisibility(View.GONE);
holder.threeText_3.setVisibility(View.GONE);
holder.fourText_2.setVisibility(View.GONE);
holder.threeText_2.setText(info.getScore());
holder.fourText_3.setText(info.getResult());
}else{
holder.twoText_3.setText(info.getScore());
holder.threeText_1.setText("");
holder.threeText_2.setText(info.getHalfScore());
holder.threeText_3.setText(info.getScore());
holder.fourText_1.setText("");
holder.fourText_2.setText(info.getResult());
holder.fourText_3.setText("");
}
}
return convertView;
}
public class ViewHolder {
Button btn;
LinearLayout layout;
TextView teamText;
TextView oneText;
TextView twoText;
TextView threeText;
TextView fourText;
TextView fiveText;
TextView sixText;
TextView sevenText;
public TextView oneText_1;
public TextView oneText_2;
public TextView twoText_1;
public TextView twoText_2;
public TextView twoText_3;
public TextView threeText_1;
public TextView threeText_2;
public TextView threeText_3;
public TextView fourText_1;
public TextView fourText_2;
public TextView fourText_3;
}
public class ExplainInfo{
private String titleName;
private String matchTime;//"2011-10-12",
private String homeTeam;//"大阪樱花"
private String guestTeam;//"北海道大学",
private String score;//"6:0"
private String ranking;//"1",
private String teamName;//"清水鼓动",
private String win;//"0",
private String standoff;//"0",
private String lose;//"0",
private String goalDifference;//"0",
private String integral;//"0"
private String sclassName;//"日本职业联赛J1",
private String halfResult;//"负",
private String result;//"胜",
private String goals;//"5"
private String halfScore;
private String matchCount;
public String getMatchCount() {
return matchCount;
}
public void setMatchCount(String matchCount) {
this.matchCount = matchCount;
}
public ExplainInfo(){
}
public String getHalfScore() {
return halfScore;
}
public void setHalfScore(String halfScore) {
this.halfScore = halfScore;
}
public String getSclassName() {
return sclassName;
}
public void setSclassName(String sclassName) {
this.sclassName = sclassName;
}
public String getHalfResult() {
return halfResult;
}
public void setHalfResult(String halfResult) {
this.halfResult = halfResult;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getGoals() {
return goals;
}
public void setGoals(String goals) {
this.goals = goals;
}
public String getRanking() {
return ranking;
}
public void setRanking(String ranking) {
this.ranking = ranking;
}
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) {
this.teamName = teamName;
}
public String getWin() {
return win;
}
public void setWin(String win) {
this.win = win;
}
public String getStandoff() {
return standoff;
}
public void setStandoff(String standoff) {
this.standoff = standoff;
}
public String getLose() {
return lose;
}
public void setLose(String lose) {
this.lose = lose;
}
public String getGoalDifference() {
return goalDifference;
}
public void setGoalDifference(String goalDifference) {
this.goalDifference = goalDifference;
}
public String getIntegral() {
return integral;
}
public void setIntegral(String integral) {
this.integral = integral;
}
public String getMatchTime() {
return matchTime;
}
public void setMatchTime(String matchTime) {
this.matchTime = matchTime;
}
public String getHomeTeam() {
return homeTeam;
}
public void setHomeTeam(String homeTeam) {
this.homeTeam = homeTeam;
}
public String getGuestTeam() {
return guestTeam;
}
public void setGuestTeam(String guestTeam) {
this.guestTeam = guestTeam;
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score;
}
public boolean isOpen = false;
public String getTitleName() {
return titleName;
}
public void setTitleName(String titleName) {
this.titleName = titleName;
}
public boolean isOpen() {
return isOpen;
}
public void setOpen(boolean isOpen) {
this.isOpen = isOpen;
}
}
}
| [
"[email protected]"
] | |
e621e4acae65fcfffcd19db5d4ecf495e00833a4 | 2510f363cffd5fac824123c359c874b2cdc56656 | /microservicio/infraestructura/src/main/java/com/ceiba/comercio/adaptador/dao/DaoComercioMysql.java | 83049372e75c26a21318825dc62c9fefbc6c1454 | [
"Apache-2.0"
] | permissive | srdejo/adn-ceiba | 165f62917d0639b7b84a07209ccd96a978923767 | 446864686f1e04a9e5a16e2ab88b43dce5de630d | refs/heads/master | 2023-06-12T02:04:11.679316 | 2021-07-09T20:06:43 | 2021-07-09T20:06:43 | 380,218,051 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 977 | java | package com.ceiba.comercio.adaptador.dao;
import com.ceiba.comercio.modelo.dto.DtoComercio;
import com.ceiba.comercio.puerto.dao.DaoComercio;
import com.ceiba.infraestructura.jdbc.CustomNamedParameterJdbcTemplate;
import com.ceiba.infraestructura.jdbc.sqlstatement.SqlStatement;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class DaoComercioMysql implements DaoComercio {
private final CustomNamedParameterJdbcTemplate customNamedParameterJdbcTemplate;
@SqlStatement(namespace = "comercio", value = "listar")
private static String sqlListar;
public DaoComercioMysql(CustomNamedParameterJdbcTemplate customNamedParameterJdbcTemplate) {
this.customNamedParameterJdbcTemplate = customNamedParameterJdbcTemplate;
}
@Override
public List<DtoComercio> listar() {
return this.customNamedParameterJdbcTemplate.getNamedParameterJdbcTemplate().query(sqlListar, new MapeoComercio());
}
}
| [
"[email protected]"
] | |
70df1f17b015f74760411e3a4902df4afdf3488d | 4926295bce48c28a8fd1fb908d6410b717809b4e | /LAB DA5/CustomException.java | 8d6eaab1e3f9df0ebcb3c2ff81193a3700a0390a | [] | no_license | Vibhukumar10/java-lab-DAs | 889f2f78c091111264ccd3046a4c9ef10965e168 | a911d715ce77dbffe2fd074ef06f33fc4280d3e9 | refs/heads/main | 2023-05-31T18:25:03.241878 | 2021-06-07T11:58:49 | 2021-06-07T11:58:49 | 371,345,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | public class CustomException extends Exception{
String str1;
public CustomException(String str2)
{
str1=str2;
}
public String toString()
{
return (str1) ;
}
}
| [
"[email protected]"
] | |
55d3cd23e83a58684beb2b2b5d54700dd5ebe640 | 8eb8558fa198c59e93de076a4da516ef1b14b72d | /src/main/java/com/ed/criptos/avalanche/testing/client/SentAVAPOST.java | 5f182e09c1adeae2ecd4290782ac2e87c4ceb892 | [] | no_license | Naraku86/Avalanche-Flash-Test | 6098e74e116314eec8c1c74f9ff526d380a9f263 | 7b070574562fa5a9422a6a1d653fb93d53542bd1 | refs/heads/master | 2023-04-27T02:05:55.965708 | 2020-07-27T19:14:25 | 2020-07-27T19:14:25 | 282,329,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,288 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ed.criptos.avalanche.testing.client;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import org.json.JSONObject;
/**
*
* @author Edgar
*/
public class SentAVAPOST {
private final String URL;
private final HttpClient httpClient = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_2)
.build();
public SentAVAPOST(String URL) {
this.URL = URL;
}
public JSONObject getPOSResponce(String request_path, JSONObject jsono) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.POST(HttpRequest.BodyPublishers.ofString(jsono.toString()))
//.uri(URI.create("http://ed.ava.node:9650/ext/bc/X"))
.uri(URI.create(URL + request_path))
.header("Content-Type", "application/json")
.build();
return new JSONObject(httpClient.send(request, HttpResponse.BodyHandlers.ofString()).body());
}
}
| [
"Edgar@Edgar-LAP"
] | Edgar@Edgar-LAP |
3751e5a3c4d1a202bdfa3666cf555fdc1516e029 | dd52fad49c285bf6d759b35f24ad466a6aaa67a7 | /PTN_Server(2015)/src/com/nms/drive/analysis/datablock/status/AnalysisVPWSStatus.java | ef0e5fb0d2cf09c8b458d6299043e37820d3260b | [] | no_license | pengchong1989/sheb_serice | a5c46113f822342dfe98c5c232b5df21cb1ac6b6 | 3ce6550e8eb39f38871b4481af2987f238a368da | refs/heads/master | 2021-08-30T05:52:24.235809 | 2017-12-16T08:47:06 | 2017-12-16T08:47:06 | 114,067,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,764 | java | package com.nms.drive.analysis.datablock.status;
import java.util.ArrayList;
import java.util.List;
import com.nms.drive.analysis.datablock.AnalysisBase;
import com.nms.drive.analysis.xmltool.AnalysisCommandByDriveXml;
import com.nms.drive.analysis.xmltool.bean.DriveAttribute;
import com.nms.drive.analysis.xmltool.bean.DriveRoot;
import com.nms.drive.service.bean.status.VpwsStatusObject;
import com.nms.drive.service.impl.CoderUtils;
public class AnalysisVPWSStatus extends AnalysisBase{
/**
* 命令转对象
* @param commands
* @param configXml
* @return
* @throws Exception
*/
public List<VpwsStatusObject> analysisCommandsToPortConfigObject(byte[] commands ,String configXml) throws Exception{
List<VpwsStatusObject> vpwsStatusList = new ArrayList<VpwsStatusObject>();
int number = commands[24]*256+CoderUtils.bytesToInt(commands[25]);
for (int i = 0; i < number; i++) {
VpwsStatusObject vpwsStatus = new VpwsStatusObject();
StringBuffer buffer1 = new StringBuffer();
StringBuffer buffer2 = new StringBuffer();
byte[] a = new byte[75];
System.arraycopy(commands, 26+a.length*i, a, 0, a.length);
AnalysisCommandByDriveXml analysisCommandByDriveXml = new AnalysisCommandByDriveXml();
analysisCommandByDriveXml.setCommands(a);
DriveRoot driveRoot_config = analysisCommandByDriveXml.analysisDriveAttrbute(configXml);
for (int j = 0; j < driveRoot_config.getDriveAttributeList().size(); j++) {
DriveAttribute driveattribute = driveRoot_config.getDriveAttributeList().get(j);
driveattributeToObject(driveattribute, vpwsStatus,buffer1,buffer2);
}
vpwsStatusList.add(vpwsStatus);
}
return vpwsStatusList;
}
public void driveattributeToObject(DriveAttribute driveattribute,VpwsStatusObject vpwsStatus,StringBuffer buffer1,StringBuffer buffer2){
if("VPWS ID".equals(driveattribute.getDescription())){
vpwsStatus.setVpwsID(Integer.parseInt(driveattribute.getValue()));
}else if("流ID".equals(driveattribute.getDescription())){
vpwsStatus.setBufferID(Integer.parseInt(driveattribute.getValue()));
}else if("UNI".equals(driveattribute.getDescription())){
vpwsStatus.setUniPortid(Integer.parseInt(driveattribute.getValue()));
}else if("业务匹配类型".equals(driveattribute.getDescription())){
vpwsStatus.setVpwsType(driveattribute.getValue());
}else if("第一匹配值(1)".equals(driveattribute.getDescription())){
buffer1.append(driveattribute.getValue()+",");
}else if("第一匹配值(2)".equals(driveattribute.getDescription())){
buffer1.append(driveattribute.getValue()+",");
}else if("第一匹配值(3)".equals(driveattribute.getDescription())){
buffer1.append(driveattribute.getValue()+",");
}else if("第一匹配值(4)".equals(driveattribute.getDescription())){
buffer1.append(driveattribute.getValue()+",");
}else if("第一匹配值(5)".equals(driveattribute.getDescription())){
buffer1.append(driveattribute.getValue()+",");
}else if("第一匹配值(6)".equals(driveattribute.getDescription())){
buffer1.append(driveattribute.getValue());
vpwsStatus.setVpwsValue1(buffer1.toString());
}else if("第二匹配值(1)".equals(driveattribute.getDescription())){
buffer2.append(driveattribute.getValue()+",");
}else if("第二匹配值(2)".equals(driveattribute.getDescription())){
buffer2.append(driveattribute.getValue()+",");
}else if("第二匹配值(3)".equals(driveattribute.getDescription())){
buffer2.append(driveattribute.getValue()+",");
}else if("第二匹配值(4)".equals(driveattribute.getDescription())){
buffer2.append(driveattribute.getValue()+",");
}else if("第二匹配值(5)".equals(driveattribute.getDescription())){
buffer2.append(driveattribute.getValue()+",");
}else if("第二匹配值(6)".equals(driveattribute.getDescription())){
buffer2.append(driveattribute.getValue());
vpwsStatus.setVpwsValue2(buffer2.toString());
}else if("NNI".equals(driveattribute.getDescription())){
vpwsStatus.setNniPortid(Integer.parseInt(driveattribute.getValue()));
}else if("出TUNNEL标签".equals(driveattribute.getDescription())){
vpwsStatus.setOutTunnelLable(Integer.parseInt(driveattribute.getValue()));
}else if("出PW标签".equals(driveattribute.getDescription())){
vpwsStatus.setOutPwLable(Integer.parseInt(driveattribute.getValue()));
}else if("入TUNNEL标签".equals(driveattribute.getDescription())){
vpwsStatus.setInTunnelLable(Integer.parseInt(driveattribute.getValue()));
}else if("入PW标签".equals(driveattribute.getDescription())){
vpwsStatus.setInPwlable(Integer.parseInt(driveattribute.getValue()));
}else if("PW ID".equals(driveattribute.getDescription())){
vpwsStatus.setPwId(Integer.parseInt(driveattribute.getValue()));
}
}
}
| [
"[email protected]"
] | |
1f2720ea36446c3795d511ca864322d8f87ad21d | b08eb5b1b71c91f653151fbcf655d68bffd63caa | /src/com/xjtu/servlet/LoginServlet.java | 67f6606c47e5e16e732c7a568bbb867da45162ea | [] | no_license | hanmeina/listenertest | e0c3c01fb7bc1d22bc1cccb87d6216b03e3185e9 | d55ec99ccfc31bd0cbf04aaa49157cd7d4efffa2 | refs/heads/master | 2021-01-19T22:49:29.958557 | 2017-03-03T09:23:28 | 2017-03-03T09:23:28 | 83,780,849 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 823 | java | package com.xjtu.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class LoginServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String username = request.getParameter("username");
if(username!=null && username.trim().length()>0){
HttpSession session = request.getSession();
//将用户名绑定到HttpSession中,事件触发
session.setAttribute("username",username);
response.sendRedirect(request.getContextPath()+"/welcome.jsp");
}
}
}
| [
"[email protected]"
] | |
c39e44a44e1a0cece573a064ee95fa94454eaf5d | 255a66c4c646908ebc3ae0ea515ff5ba77f2e908 | /JavaSource/confia/servicios/basicos/ServicioSubagenteRamo.java | f8c395d4ef877ffed1f61ed38d214feeed5a67c2 | [] | no_license | eddiesosa81/Broken | f8257997cd8b81fe8ec31bb35801e8cf3cd7487e | 707bf771447b5b4a4e6f92b97d5c5fd028b06fa1 | refs/heads/master | 2023-06-07T01:51:36.925616 | 2021-07-06T16:31:15 | 2021-07-06T16:31:15 | 291,845,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,251 | java | package confia.servicios.basicos;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import confia.entidades.basicos.SubagenteRamo;
import confia.procedures.ConectarBase;
@Stateless
public class ServicioSubagenteRamo {
@PersistenceContext
private EntityManager em;
@SuppressWarnings("unchecked")
public List<SubagenteRamo> listaSubagenteRamo(String codRamo) {
String sql = "select * from subagenteRamo_tbl where cd_ramo = "+codRamo;
System.out.println("SQL -->"+sql);
try {
Query query = em.createNativeQuery(sql, SubagenteRamo.class);
return query.getResultList();
} catch (Exception ex) {
return null;
}
}
public SubagenteRamo consultaSubagenteRamo(Integer codSuba, Integer codRamo) {
String sql = "select * from subagenteRamo_tbl where cd_ramo = "+codRamo
+" and cd_subagente = "+codSuba;
System.out.println("SQL -->"+sql);
try {
Query query = em.createNativeQuery(sql, SubagenteRamo.class);
return (SubagenteRamo) query.getSingleResult();
} catch (Exception ex) {
return null;
}
}
public int codigoMaxSubagenteRamo() {
Connection conn;
String sql;
String resultado = "0";
try {
conn = ConectarBase.getOracleConnection();
sql = "select nvl(max(cd_subagenteramo),1) as cd_subagenteramo from subagenteRamo_tbl";
PreparedStatement a = conn.prepareStatement(sql);
ResultSet res = a.executeQuery();
if (res.next()) {
resultado = res.getString("cd_subagenteramo");
}
res.close();
a.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
resultado = "0";
}
return Integer.parseInt(resultado);
}
public Integer insertarSubagenteRamo(SubagenteRamo obj) {
try {
em.persist(obj);
} catch (Exception e) {
return 0;
}
return 1;
}
public void actualizaSubagenteRamo(SubagenteRamo obj) {
em.merge(obj);
}
public void eliminaSubagenteRamo(SubagenteRamo obj) {
em.remove(em.merge(obj));
}
}
| [
"[email protected]"
] | |
406d2f72362bf6111ea7aa46345ff7a55f50b4f1 | 145ceb746d5b2371b7b3606af5dce43767e2845d | /src/nyc/c4q/tashsmit/TestC.java | 813c110276e59f6a4d6b38cea97cf00069ccdc69 | [] | no_license | tashsmit/access-code-java-strings | 6ca5a5d8b59c94f335208649a888a2c7f3dee70f | d3c9b23f26b411492ca6ff3cac55dff609bb7883 | refs/heads/master | 2021-01-20T15:27:33.331271 | 2015-03-06T03:07:57 | 2015-03-06T03:07:57 | 31,513,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,142 | java | package nyc.c4q.tashsmit;
/**
* Created by c4q-tashasmith on 3/1/15.
*/
public class TestC {
public static void main(String[] args)
{
/*A comment, this is so you can read your program later.
Anything after the // is ignored by Java.*/
System.out.println( "My letter" ); // and the comment after is ignored.
/*You can also use a comment to "disable" or comment out a piece of code:
System.out.println("This won't run.");*/
System.out.println( "|----------------------------|" );
System.out.println( "| :::::|" );
System.out.println( "| ::::|" );
System.out.println( "| ::|" );
System.out.println( "| Tasha Smith |" );
System.out.println( "| 620 Thwaites Place |" );
System.out.println( "| Bronx, NY 10467 |" );
System.out.println( "|----------------------------|" );
System.out.println( "This is a string with \"double quotes\" in it");
System.out.println( "Twinkle twinkle little\n" +
"little star" );
System.out.println( "How I wonder what \n\n\nYouuu Areeee" );
System.out.println( "TTTTT SSS " );
System.out.println( " T S " );
System.out.println( " T S " );
System.out.println( " T SSS " );
System.out.println( " T S" );
System.out.println( " T S S" );
System.out.println( " T SSS " );
System.out.println("System.out.println(\"Hello, world!\");");
System.out.println(42);
System.out.println("42");
System.out.println(42.0);
System.out.println(42.0000);
System.out.println("42.0000");
System.out.println(41.99999999999999999);
System.out.println("41.9999999999");
System.out.println(10 + 30);
System.out.println("70" + "1");
System.out.println("10" + 30);
System.out.println(30 + "10");
System.out.println("temperature " + (9.0*(-4)/5 + 32) + "\u0277");
}
}
| [
"[email protected]"
] | |
6c86185e03657509b039c1d35730a8c6b84e3464 | f3e54160dad33d9b71bfc3bdde7b8b4b0b2befc5 | /src/Itemshop/Itemshop.java | a153879b81fcc406e5ff67eeeec847e30bebd502 | [] | no_license | Glamdo/TowerDefend | 05a4ee1fd58cccc4ecbb81e3fecd36b47fd5bb51 | 1dd7624b764735c064dce6cb8520fd5048aca0d5 | refs/heads/master | 2021-01-19T22:48:23.464239 | 2017-04-07T08:42:14 | 2017-04-07T08:42:14 | 83,780,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | /**
*
*/
package Itemshop;
/**
* @author Miles
*
*/
public class Itemshop {
private int kaufpreis;
private int verkaufspreis;
}
| [
"[email protected]"
] | |
c3c682984ed2f956c2c3e433f41d36403b74882b | 409bb653b430ee65b59e9a1804881008136a4400 | /app/src/main/java/com/zrb/houserental/activity/MainTestJava.java | 9bfb9114510c9914f3596cc1b69735676878bc15 | [] | no_license | zrbaihld/Houserental | 274bc4a55611687e79f217c3fa2644cd324c71d8 | 2a1181a9037c9f45f59f3e2195e3812f6a3b92b2 | refs/heads/master | 2021-01-18T17:27:12.572662 | 2017-06-09T14:20:43 | 2017-06-09T14:20:43 | 86,802,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,546 | java | package com.zrb.houserental.activity;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* Created by Administrator on 2017/5/2.
*/
public class MainTestJava {
private static int[] ints = {1, 5, 4, 8, 6, 3, 9, 7, 4, 8, 2, 9, 3};
public static void main(String[] strings) {
List<test> tests = new ArrayList<>();
for (int i = 0; i < ints.length; i++) {
test test = new test();
test.setDays(ints[i]);
test.setName("test" + i);
tests.add(test);
}
Collections.sort(tests, new Comparator<test>() {
@Override
public int compare(test floorEntity, test t1) {
if (floorEntity.getDays() > t1.getDays())
return 1;
else if (floorEntity.getDays() == t1.getDays())
return 0;
else
return -1;
}
});
for (test test : tests) {
System.out.println("test.getName() " + test.getName() + "test.getDays() " + test.getDays());
}
}
private static class test {
private int days;
private String name;
public int getDays() {
return days;
}
public void setDays(int days) {
this.days = days;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}
| [
"[email protected]"
] | |
c1a6004716c21660b0eb56eb7ff1ce761282de46 | 758fc6253dff7906afdb38078920d718eb0144d2 | /Shop_/src/main/java/ru/kpfu/itis/controller/admin/UserController.java | d75088c442e56efbb2a3d2efcabb03bc16f279f8 | [] | no_license | Leithbragan/Shop_with_admin_app | c8639e58991b75207fb00bbacf0c01fa82c68efa | e0c9c4fa8b3436fe4765eff0d6c721a0da239cf6 | refs/heads/master | 2021-01-23T12:46:35.511749 | 2017-06-02T20:31:58 | 2017-06-02T20:32:04 | 93,199,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,750 | java | package ru.kpfu.itis.controller.admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import ru.kpfu.itis.form.UserModifyForm;
import ru.kpfu.itis.form.collateralForms.UserForm;
import ru.kpfu.itis.model.Order;
import ru.kpfu.itis.model.ProductInOrder;
import ru.kpfu.itis.model.Token;
import ru.kpfu.itis.model.User;
import ru.kpfu.itis.model.enums.UserRole;
import ru.kpfu.itis.repository.TokenRepository;
import ru.kpfu.itis.service.OrderService;
import ru.kpfu.itis.service.ProductInOrderService;
import ru.kpfu.itis.service.UserService;
import java.util.List;
@Controller
@RequestMapping(value = "admin/user")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private OrderService orderService;
@Autowired
private ProductInOrderService productInOrderService;
@Autowired
private TokenRepository tokenRepository;
@RequestMapping(value = "/all", method = RequestMethod.GET)
public String all_users(Model model) {
model.addAttribute("user_modify_form", new UserForm());
model.addAttribute("users", userService.getAll());
return "all_users_page";
}
@RequestMapping(value = "/all", method = RequestMethod.POST)
public String all_users(@ModelAttribute("user_modify_form") UserForm form) {
User user = userService.getById(form.getUser_id());
UserRole userRole = UserRole.valueOf(form.getRole());
UserModifyForm modifyUserForm = new UserModifyForm();
modifyUserForm.setUser(user);
modifyUserForm.setRole(userRole);
modifyUserForm.setIs_confirm(form.getIs_confirm());
userService.modifyUser(modifyUserForm);
return "redirect:/admin/user/all";
}
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public String delete(@RequestParam(value = "id", required = true) Long id, Model model) {
User user = userService.getById(id);
Token token = tokenRepository.findOneByUser(user);
tokenRepository.delete(token);
List<Order> orders = orderService.getByUser(user);
List<ProductInOrder> productInOrders = productInOrderService.getAllByOrderIn(orders);
productInOrderService.delete(productInOrders);
orderService.delete(orders);
userService.delete(user);
model.addAttribute("id", id);
return "redirect:/admin/user/all";
}
}
| [
"[email protected]"
] | |
de22aa2dda0130ff8a274a64ae60c32b24848965 | 715abcf0884235049ad2f772f7b56ed95ff19a17 | /src/ThisIsSecondBAO/MyIaO.java | b0035476d63c20e93ec3eeebe757fa7c8e9ade61 | [] | no_license | prescalamity/myJavaLearningProject | 404035596042a0a33b44baec4f18125112f38acb | 3bfb0c3ad669b7c49a743bc080ce0097acad06d1 | refs/heads/master | 2022-04-14T05:28:03.803625 | 2020-04-10T13:33:49 | 2020-04-10T13:33:49 | 254,641,556 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,903 | java | package ThisIsSecondBAO;
import java.io.*;
import java.util.*;
/**
* Learning I/O stream
*/
public class MyIaO
{
/**
* @for 用于测试 文件字节流 输入输出,且该流主要用于传输非字符数据,如整形,对象等
*
* @throws IOException
*/
public static void fileStream_Byte() throws IOException
{
String filePath="C:\\Users\\LiuYuan\\Desktop\\JavaTest_IO_a";
int testInt_a=1;
int testInt_b=100;
int testInt_c=500; // 00000000 00000000 00000001 11110100
int testInt_d=511; // 00000000 00000000 00000001 11111111
int testInt_e=1023; // 00000000 00000000 00000011 11111111
//文件 字节流 读写以 字节 为单位,可以
System.out.println("文件 字节流 读写以 字节 为单位 ");
FileOutputStream fout =new FileOutputStream(filePath); // FileOutputStream
fout.write(testInt_a);
fout.write(testInt_b);
fout.write(testInt_c); //只存最低8位(1个字节)
fout.write(testInt_d); //只存最低8位(1个字节)
fout.write(testInt_e);
fout.write(-1);
fout.close();
FileInputStream fin =new FileInputStream(filePath); //字节流 输入,FileInputStream
int i;
while((i=fin.read())!=-1)
{
System.out.println(" "+i);
}
fin.close();
//从字节流中读取4字节为一个int整数
System.out.println("从字节流中读取4字节为一个int整数 ");
FileOutputStream fOut =new FileOutputStream(filePath);
fOut.write(-1>>>24);
fOut.write(-1>>>16);
fOut.write(-1>>>8);
fOut.write(-1);
fOut.close();
int counter=0;
FileInputStream fIn=new FileInputStream(filePath);
while((i=fIn.read())!=-1) //值读取一个字节,当字节流结束时返回-1
{
counter++;
System.out.println("运行次数:"+counter);
int tmp;
for(int j=0;j<3&&(tmp=fIn.read())!=-1;j++) //读取剩余三字节,读完一字节后再读下一个字节
{
i=i<<8|tmp; //左移8位,再加入低位1字节
}
System.out.println(i+" ");
}
fIn.close();
//数据字节流
System.out.println("数据字节流");
fout =new FileOutputStream(filePath);
DataOutputStream dOut=new DataOutputStream(fout); // 写 入一个整数,传入FileOutputStream对象
dOut.writeInt(testInt_e);
dOut.close();
fin =new FileInputStream(filePath);
DataInputStream dIn=new DataInputStream(fin); // 读 取一个整数,传入FileInputStream对象
int dInt=dIn.readInt();
System.out.println(dInt);
dIn.close();
//对象字节流
}
/**
* @for 用于测试 文件字符流 输入输出,且该流 ‘仅’ 用于传输字符数据
* @throws IOException
*/
public static void fileStream_R_W() throws IOException
{
String filePath="C:\\Users\\LiuYuan\\Desktop\\JavaTest_IO_b.txt";
String testStr="Java'IO test.";
byte[] buff=new byte[]{};
buff=testStr.getBytes(); //将 字符串 转换成 字符数组
FileWriter fWriter=new FileWriter(filePath);
fWriter.write(testStr+"\r\n");
fWriter.write("This is second line!"+"\r\n");
fWriter.write("中文测试!"+"\r\n");
fWriter.close();
FileReader fReader = new FileReader(filePath); //创建 指定 文件读取流,读写以 字符 为单位
BufferedReader bReader=new BufferedReader(fReader); //创建 输入流 缓冲区,可按行读取
String text=bReader.readLine()+"\r\n"; //流 结束时返回 null
text+=bReader.readLine()+"\r\n";
text+=bReader.readLine();
bReader.close();
fReader.close();
System.out.println("变量的字节长度:"+text.getBytes().length);
System.out.println(text);
}
/**
* @for 测试 系统 输入输出流,及从键盘获得数据
* @throws IOException
*/
public static void systemIaO() throws IOException
{
char cText;
String sText;
int iText;
float fText;
// System.out.println("please input a float number:");
// cText=System.in.read();
// System.out.println(cText);
// System.out.println("利用 BufferedReader实现从键盘读入字符串");
// System.out.println("please input string:");
// BufferedReader bReader = new BufferedReader (new InputStreamReader(System.in));
// sText=bReader.readLine();
// bReader.close();
// System.out.println(sText);
System.out.println("利用 Scanner 类实现从键盘读入数据");
System.out.println("please input string, int, float:");
Scanner inKeyboard=new Scanner(System.in); //使用Scanner类定义对象
//cText=inKeyboard.next();
sText=inKeyboard.nextLine();
iText=inKeyboard.nextInt();
fText=inKeyboard.nextFloat();
inKeyboard.close();
System.out.println("你输入的数据为:");
System.out.println(sText+"\r\n"+iText+"\r\n"+fText);
}
/**
* @for 用于测试 对文件进行相关操作,如查找,复制,修改
*/
public static void systemFile()
{
}
}
| [
"[email protected]"
] | |
8b42f35a2c66a8ffc36c9c5f60858cbf9b492b54 | ff6217e6dd989a646a82a949382f214c15341e7d | /config/config-api/src/main/java/com/thoughtworks/go/config/Deny.java | b878a1535969d2bf5853df10bf06e87592633a13 | [
"Apache-2.0"
] | permissive | JefferyLan/gocd | cf2e97d17b6f2c536775fb3223411f68ca7c0c62 | f9389ea1bd6911acb58c12f9087f9d1667c69d06 | refs/heads/master | 2020-05-09T12:54:47.221719 | 2019-04-12T05:40:51 | 2019-04-12T05:40:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 858 | java | /*
* Copyright 2019 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thoughtworks.go.config;
@ConfigTag("deny")
public class Deny extends AbstractDirective {
public Deny() {
super();
}
public Deny(String action, String type, String resource) {
super(action, type, resource);
}
} | [
"[email protected]"
] | |
3e9ff2206b16067fc54e7218b09929dd32c1b976 | e1d2daef67e5fd1b26604edb83aa1f387424f586 | /src/app/app/cq/hmq/service/bedroomallot/BedroomAllotService.java | 6f4ae705df90d859b2c2e00bec17d5bfe8e898c7 | [] | no_license | 404904728/yx | bcaf7cadcd8cdf78bbbfff4103b4cdb734d2e87d | 4cfafdec65bdc637d1b5e3ecd2363c50ae545cc0 | refs/heads/master | 2016-09-09T17:26:19.730069 | 2015-02-03T00:51:51 | 2015-02-03T00:51:51 | 30,217,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,806 | java | /**
* Limit
*
*/
package app.cq.hmq.service.bedroomallot;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.plaf.ListUI;
import org.apache.commons.collections.ListUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.servlet.ModelAndView;
import common.cq.hmq.pojo.Org;
import app.cq.hmq.pojo.bedroomallot.BedroomAllot;
import app.cq.hmq.pojo.entrancehandle.EntranceHandle;
import core.cq.hmq.dao.PageList;
import core.cq.hmq.model.AjaxMsg;
import core.cq.hmq.model.EasyData;
import core.cq.hmq.model.PageModel;
import core.cq.hmq.service.BaseService;
import core.cq.hmq.util.tools.StringUtil;
/**
* @author Administrator
*
*/
@Service
public class BedroomAllotService extends BaseService {
/**
*
*@title
*@author Limit
*@date 2014-6-20 下午4:56:23
*@version 1.0
*@Description 查询男生寝室信息
*
*@param id
* @param gender
*@return
*
*
*/
public List<Map<String, Object>> queryTreeValue(Long id) {
List<Map<String,Object>> resultList = null;
Map<String,Object> resultMap = null;
System.out.println(id);
String querySql = " from BedroomAllot where ";
resultList = new ArrayList<Map<String,Object>>();
if(id == 1){
querySql += " type = ? and gender = 1 and userStatus = 0";
List<BedroomAllot> find = dao.find(querySql, Integer.parseInt(String.valueOf(id)));
if(find.isEmpty()){
return null;
}else{
for (int i = 0; i < find.size(); i++) {
BedroomAllot allot = find.get(i);
resultMap = new HashMap<String,Object>();
resultMap.put("id", allot.getId() + ",1,1");
resultMap.put("text", allot.getName());
resultMap.put("state", "closed");
resultMap.put("iconCls", "icon-lou-small");
resultList.add(resultMap);
}
return resultList;
}
}else{
querySql += " gender = 1 and parent.id = ? and userStatus = 0";
List<BedroomAllot> find = dao.find(querySql, id);
if(find.isEmpty()){
return null;
}else{
for (int i = 0; i < find.size(); i++) {
BedroomAllot allot = find.get(i);
resultMap = new HashMap<String,Object>();
if(allot.getType() == 2){
resultMap.put("id", allot.getId() + ",2,1");
resultMap.put("text", allot.getName());
resultMap.put("state", "closed");
resultMap.put("iconCls", "icon-lou-small");
resultList.add(resultMap);
}else if(allot.getType() == 3){
resultMap.put("id", allot.getId() + ",3,1");
if(allot.getAlreadyLive() != 0){
resultMap.put("text", allot.getName()+"(可住"+allot.getLiveSum()+"人,已住"+ allot.getAlreadyLive() +"人)");
}else{
resultMap.put("text", allot.getName()+"(可住"+allot.getLiveSum()+"人)");
}
resultMap.put("state", "open");
resultMap.put("iconCls", "icon-lou-small");
resultList.add(resultMap);
}
}
return resultList;
}
}
}
/**
*
*@title
*@author Limit
*@date 2014-6-20 下午4:56:23
*@version 1.0
*@Description 查询女生寝室信息
*
*@param id
*@return
*
*
*/
public List<Map<String, Object>> queryTreeValueToWomen(Long id) {
List<Map<String,Object>> resultList = null;
Map<String,Object> resultMap = null;
System.out.println(id);
String querySql = " from BedroomAllot where ";
resultList = new ArrayList<Map<String,Object>>();
if(id == 0){
querySql += " type = ? and gender = 0 and userStatus = 0";
List<BedroomAllot> find = dao.find(querySql, 1);
if(find.isEmpty()){
return null;
}else{
for (int i = 0; i < find.size(); i++) {
BedroomAllot allot = find.get(i);
resultMap = new HashMap<String,Object>();
resultMap.put("id", allot.getId() + ",1,0");
resultMap.put("text", allot.getName());
resultMap.put("state", "closed");
resultMap.put("iconCls", "icon-lou-small");
resultList.add(resultMap);
}
return resultList;
}
}else{
querySql += " gender = 0 and parent.id = ? and userStatus = 0";
List<BedroomAllot> find = dao.find(querySql, id);
if(find.isEmpty()){
return null;
}else{
for (int i = 0; i < find.size(); i++) {
BedroomAllot allot = find.get(i);
resultMap = new HashMap<String,Object>();
if(allot.getType() == 2){
resultMap.put("id", allot.getId() + ",2,0");
resultMap.put("text", allot.getName());
resultMap.put("state", "closed");
resultMap.put("iconCls", "icon-lou-small");
resultList.add(resultMap);
}else if(allot.getType() == 3){
resultMap.put("id", allot.getId() + ",3,0");
if(allot.getAlreadyLive() != 0){
resultMap.put("text", allot.getName()+"(可住"+allot.getLiveSum()+"人,已住"+ allot.getAlreadyLive() +"人)");
}else{
resultMap.put("text", allot.getName()+"(可住"+allot.getLiveSum()+"人)");
}
resultMap.put("state", "open");
resultMap.put("iconCls", "icon-lou-small");
resultList.add(resultMap);
}
}
return resultList;
}
}
}
/**
*
*@title
*@author Limit
*@date 2014-6-20 下午4:56:23
*@version 1.0
*@Description 查询单一寝室信息寝室信息
*
*@param id
*@return
*
*
*/
public Map<String, Object> queryRoomInfo(Long id) {
Map<String, Object> map = null;
if(null == id || StringUtil.isEmpty(id)){
map = new HashMap<String, Object>();
map.put("flg", 2);
return map;
}
BedroomAllot allot = dao.findOne(BedroomAllot.class, "id", id);
if(null != allot){
map = new HashMap<String, Object>();
map.put("flg", 1);
map.put("data", allot);
return map;
}
map = new HashMap<String, Object>();
map.put("flg", 2);
return map;
}
/**
*
*@title
*@author Limit
*@date 2014-6-23 下午3:28:01
*@version 1.0
*@Description
*
*@param model
* @param classid
* @param sex
*@param regist
*@param startTime
*@param endTime
*@return
*
*
*/
public EasyData<EntranceHandle> finddata(PageModel model, Long classid, int sex) {
System.out.println(classid);
EasyData<EntranceHandle> data = new EasyData<EntranceHandle>();
PageList<EntranceHandle> pagelis = null;
StringBuffer sb = new StringBuffer(" where 1=1 and isPay = 1 and isFenBan = 1");
sb.append("and org = " + classid);
sb.append("and sex = " + sex);
sb.append("and isFenQS = 0");
sb.append(" order by createTime,stage desc");
pagelis = page(model, "from " + EntranceHandle.class.getName()
+ sb.toString());
if(pagelis.size() == 0){
return data;
}
return new EasyData<EntranceHandle>(pagelis);
}
/**
*
*@title
*@author Limit
*@date 2014-6-25 下午2:15:10
*@version 1.0
*@Description 查询阶段下的年级
*
*@param id
*@return
*
*
*/
public List<Map<String, Object>> findGrand(Long id) {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = null;
if(null == id || StringUtil.isEmpty(id)){
return list;
}
List<Org> list2 = dao.find(Org.class, "parent.id", id);
if(list2.isEmpty()){
return list;
}
map = new HashMap<String, Object>();
map.put("id", "");
map.put("text", "--请选择--");
list.add(map);
for (Org org : list2) {
map = new HashMap<String, Object>();
map.put("id", org.getId());
map.put("text", org.getName());
list.add(map);
}
return list;
}
/**
*
*@title
*@author Limit
*@date 2014-6-25 下午2:15:10
*@version 1.0
*@Description 查询阶段数据
*
*@param id
*@return
*
*
*/
public List<Map<String, Object>> initJieDuan() {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = null;
List<Org> list2 = dao.find(Org.class, "parent.id", 14L);
if(list2.isEmpty()){
return list;
}
map = new HashMap<String, Object>();
map.put("id", "");
map.put("text", "--请选择--");
list.add(map);
for (Org org : list2) {
map = new HashMap<String, Object>();
map.put("id", org.getId());
map.put("text", org.getName());
list.add(map);
}
return list;
}
/**
*
*@title
*@author Limit
*@date 2014-6-25 下午4:48:15
*@version 1.0
*@Description 保存分配的寝室信息
*
*@param roomId
*@param roomAlreadytLive
*@param stuIds
*@return
*
*
*/
@Transactional
public AjaxMsg saveBedRoomInfo(Long roomId, int roomAlreadytLive,
String stuIds) {
AjaxMsg msg = new AjaxMsg();
if(StringUtil.isEmpty(roomId) || StringUtil.isEmpty(stuIds)){
msg.setType(2);
return msg;
}
BedroomAllot bedroomAllot = dao.findOne(BedroomAllot.class, "id", roomId);
if(null == bedroomAllot){
msg.setType(2);
return msg;
}
if(bedroomAllot.getLiveSum() < (roomAlreadytLive + stuIds.split(",").length)){
msg.setType(2);
return msg;
}
String stuId = " where t.id in ( ";
String[] split = stuIds.split(",");
for (int i = 0; i < split.length; i++) {
if(i == (split.length - 1)){
stuId += Long.parseLong(split[i]);
}else{
stuId += Long.parseLong(split[i]) + ",";
}
}
stuId += " )";
String updateSql = "update EntranceHandle t set t.isFenQS = 1,t.dormitory = " + roomId + stuId;
dao.excute(updateSql);
bedroomAllot.setAlreadyLive(bedroomAllot.getAlreadyLive() + split.length);
dao.update(bedroomAllot);
msg.setType(1);
msg.setMsg(bedroomAllot.getLiveSum() + "," + bedroomAllot.getAlreadyLive() + "," + bedroomAllot.getGender() + "," + bedroomAllot.getName());
return msg;
}
/**
*
*@title
*@author Limit
*@date 2014-7-1 上午11:44:09
*@version 1.0
*@Description 自动保存分配的寝室信息
*
*@param roomId
*@param roomtype
*@param classId
*@param gender
*@return
*
*
*/
public AjaxMsg autoSaveBedRoomInfo(Long roomId, int roomtype, Long classId,
int gender) {
AjaxMsg msg = new AjaxMsg();
msg.setType(2);
msg.setMsg("数据异常,请联系管理员");
if(StringUtil.isEmpty(classId)){
msg.setMsg("没有选择班级信息");
return msg;
}
String stuSql = "select en.id_f from entrancehandle_t en where en.org_f = "+ classId +" and en.isfenqs_f = 0 and en.sex_f = " + gender;
List list = dao.getHelperDao().find(stuSql);
if(list == null || list.size() == 0){
msg.setMsg("班级下没有学生信息");
return msg;
}
StringBuffer sb = new StringBuffer("select bed.id_f,bed.alreadylive_f,bed.livesum_f from bedroomallot_t bed where bed.stuid_f is not null ");
sb.append(" and bed.type_f = 3 and bed.livesum_f - bed.alreadylive_f > 0 and bed.gender_f = " + gender);
if(roomtype == 1){
sb.append(" and bed.parent_f in (select bed.id_f from bedroomallot_t bed where bed.type_f = 2 and bed.parent_f = "+ roomId +") ");
}
if(roomtype == 2){
sb.append(" and bed.parent_f = " + roomId);
}
if(roomtype == 3){
sb.append("and bed.id_f = " + roomId);
}
sb.append(" order by bed.stuid_f asc ");
String saveAutoBedRoom = saveAutoBedRoom(sb.toString(),list);
if("succ".equals(saveAutoBedRoom)){
msg.setType(1);
msg.setMsg("分配完成");
return msg;
}else if("2".equals(saveAutoBedRoom)){
msg.setMsg("学生数据异常,请联系管理员");
return msg;
}else if("3".equals(saveAutoBedRoom)){
msg.setMsg("您选择分配寝室的楼,楼层,或者房间床位已经全部分配完成,无法在继续分配,请您重新选择其他寝室进行分配");
return msg;
}
return msg;
}
/**
*
*@title
*@author Limit
*@date 2014-7-1 下午3:21:26
*@version 1.0
*@Description
*
*@param sql
*@param list
*@return
*
*
*/
@Transactional
public String saveAutoBedRoom(String sql,List list){
List roomList = dao.getHelperDao().find(sql);
if(list.size() == 0){
return "1";
}else if(roomList.size() == 0){
return "3";
}
else{
Object[] object = (Object[]) roomList.get(0);
int alreadyLive = Integer.parseInt(object[1].toString());
//当前一间寝室能住的人数
int num = Integer.parseInt(object[2].toString()) - alreadyLive;
int cycleNum = 0;
if(num > list.size()){
cycleNum = list.size();
}else if(num <= list.size()){
cycleNum = num;
}
String updateStuIdSql = " where t.id in ( ";
for (int i = 0; i < cycleNum; i++) {
Object object2 = list.get(i);
if(i == (cycleNum - 1)){
updateStuIdSql += Long.parseLong(object2.toString()) + ")";
}else{
updateStuIdSql += Long.parseLong(object2.toString()) + ",";
}
alreadyLive = alreadyLive + 1;
}
String updateStuSql = "update EntranceHandle t set t.isFenQS = 1,t.dormitory = " + Long.parseLong(object[0].toString()) + updateStuIdSql;
String updateBedRoomSql = "update BedroomAllot b set b.alreadyLive = " + alreadyLive + " where b.id = " + Long.parseLong(object[0].toString());
dao.excute(updateStuSql);
dao.excute(updateBedRoomSql);
for (int i = 0; i < cycleNum; i++) {
list.remove(0);
}
if(list.size() == 0){
return "succ";
}
return saveAutoBedRoom(sql,list);
}
}
/**
*
*@title
*@author Limit
*@date 2014-7-2 下午5:12:28
*@version 1.0
*@Description 查询已经分完寝室的学生信息
*
*@param model
*@param regist
*@return
*
*
*/
@SuppressWarnings("unchecked")
public EasyData<Map<String,Object>> queryStudentbed(PageModel model, EntranceHandle regist) {
EasyData<Map<String,Object>> data = new EasyData<Map<String,Object>>();
//PageList<Map<String,Object>> pagelis = null;
StringBuffer sb = new StringBuffer("select stu.name_f,stu.guardian_f,stu.examcardno_f," +
"stu.tel_f,bed.name_f as bname,bed.stuid_f,stu.id_f, stu.sex_f," +
"bed.id_f as bid from entrancehandle_t stu,bedroomallot_t bed " +
"where stu.dormitory_f = bed.id_f and stu.isfenqs_f = 1");
if(null != regist){
if(!StringUtil.isEmpty(regist.getExamCardNo()) || !StringUtil.isEmpty(regist.getName())){
//准考证号
if(!StringUtil.isEmpty(regist.getExamCardNo())){
sb.append(" and stu.examcardno_f like '%" + regist.getExamCardNo() + "%' ");
}
//姓名
if(!StringUtil.isEmpty(regist.getName())){
sb.append(" and stu.name_f like '%" + regist.getName() + "%' ");
}
}else{
if(!StringUtil.isEmpty(regist.getSex()) || !StringUtil.isEmpty(regist.getDormitory())){
//性别
if(!StringUtil.isEmpty(regist.getSex())){
sb.append(" and bed.gender_f = " + regist.getSex());
}
//寝室号
if(!StringUtil.isEmpty(regist.getDormitory())){
sb.append(" and bed.stuid_f ='" + String.valueOf(regist.getDormitory())+"' ");
}
}
}
//拟读年级
if(!StringUtil.isEmpty(regist.getOrg())){
sb.append(" and stu.org_f = " + regist.getOrg());
}
sb.append(" order by stu.sex_f ");
}
// pagelis = page(model, "from " + EntranceHandle.class.getName()
// + sb.toString());
PageList page = dao.getHelperDao().page(model.getPage(), model.getRows(), sb.toString());
List list = page.getList();
if(list.size() == 0){
return data;
}
List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>();
Map<String,Object> map = null;
for (int i = 0; i < list.size(); i++) {
Object[] object = (Object[]) list.get(i);
map = new HashMap<String,Object>();
if(!StringUtil.isEmpty(object[0].toString())){
map.put("stuName", object[0].toString());
}
if(!StringUtil.isEmpty(object[1].toString())){
map.put("guardian", object[1].toString());
}
if(!StringUtil.isEmpty(object[2].toString())){
map.put("examcardno", object[2].toString());
}
if(!StringUtil.isEmpty(object[3].toString())){
map.put("tel", object[3].toString());
}
if(!StringUtil.isEmpty(object[4].toString())){
map.put("bedName", object[4].toString());
}
if(!StringUtil.isEmpty(object[5].toString())){
map.put("bedCode", object[5].toString());
}
if(!StringUtil.isEmpty(object[7].toString())){
map.put("sex", object[7].toString());
}
if(!StringUtil.isEmpty(object[6].toString())){
map.put("id", object[6].toString());
}
if(!StringUtil.isEmpty(object[8].toString())){
map.put("bedid", object[8].toString());
}
resultList.add(map);
}
page.setResult(resultList);
return new EasyData<Map<String,Object>>(page);
}
/**
*
*@title
*@author Limit
*@date 2014-7-3 下午2:41:08
*@version 1.0
*@Description 修改学生寝室
*
*@param sex
*@param stuId
*@param roomId
*@return
*
*
*/
public ModelAndView updateBedRoom(Integer sex, Long stuId, Long roomId) {
if(StringUtil.isEmpty(sex) || StringUtil.isEmpty(stuId) || StringUtil.isEmpty(roomId)){
return null;
}
ModelAndView mav = new ModelAndView("/app/bedroomallot/bedroomupdate");
// 民族查询
//mav.addObject("nations", enumerationService.findnation());
EntranceHandle handle = dao.findOne(EntranceHandle.class, "id", stuId);
BedroomAllot bedroomAllot = dao.findOne(BedroomAllot.class, "id", roomId);
handle.setIdCardNo(bedroomAllot.getParent().getParent().getName() + "-" + bedroomAllot.getParent().getName() + "-" + bedroomAllot.getName());
mav.addObject("eh", handle);
mav.addObject("oldroom", roomId);
return mav;
}
/**
*
*@title
*@author Limit
*@date 2014-7-3 下午3:16:50
*@version 1.0
*@Description 修改寝室页面初始化寝室楼信息
*
*@param sex
* @param roomType,Long roomId
*@return
*
*
*/
public List<Map<String, Object>> initbedRoom(Integer sex, int roomType,Long roomId) {
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
Map<String, Object> map = null;
if(1 == roomType){
String querySql = "from BedroomAllot t where t.type = 1 and t.gender = ?";
List bedList = dao.find(querySql, sex);
if(bedList.size() == 0){
return null;
}
map = new HashMap<String, Object>();
map.put("id", "");
map.put("text", "--请选择--");
resultList.add(map);
for (int i = 0; i < bedList.size(); i++) {
BedroomAllot object = (BedroomAllot) bedList.get(i);
map = new HashMap<String, Object>();
map.put("id", object.getId());
map.put("text", object.getName());
resultList.add(map);
}
return resultList;
}else if(2 == roomType){
map = new HashMap<String, Object>();
map.put("id", "");
map.put("text", "--请选择--");
resultList.add(map);
if(StringUtil.isEmpty(roomId)){
return resultList;
}
String querySql = "from BedroomAllot t where t.type = 2 and t.parent.id = ?";
List bedList = dao.find(querySql, roomId);
if(bedList.size() == 0){
return resultList;
}
for (int i = 0; i < bedList.size(); i++) {
BedroomAllot object = (BedroomAllot) bedList.get(i);
map = new HashMap<String, Object>();
map.put("id", object.getId());
map.put("text", object.getName());
resultList.add(map);
}
return resultList;
}else{
map = new HashMap<String, Object>();
map.put("id", "");
map.put("text", "--请选择--");
resultList.add(map);
if(StringUtil.isEmpty(roomId)){
return resultList;
}
String querySql = "from BedroomAllot t where t.type = 3 and t.parent.id = ?";
List bedList = dao.find(querySql, roomId);
if(bedList.size() == 0){
return resultList;
}
for (int i = 0; i < bedList.size(); i++) {
BedroomAllot object = (BedroomAllot) bedList.get(i);
map = new HashMap<String, Object>();
map.put("id", object.getId());
map.put("text", object.getName() + "(可以住"+ object.getLiveSum() +"人,已住"+ object.getAlreadyLive() +"人)");
resultList.add(map);
}
return resultList;
}
}
/**
*
*@title
*@author Limit
*@date 2014-7-4 下午3:39:41
*@version 1.0
*@Description 保存修改寝室页面修改的寝室信息
*
*@param stuId
*@param bedNo
*@param oldRoom
*@return
*
*
*/
@Transactional
public AjaxMsg updateBedRoomTo(Long stuId, Long bedNo, Long oldRoom) {
AjaxMsg msg = new AjaxMsg();
if(StringUtil.isEmpty(bedNo)){
msg.setMsg("请选择对应的寝室房间");
return msg;
}
EntranceHandle handle = dao.findOne(EntranceHandle.class, "id", stuId);
BedroomAllot newallot = dao.findOne(BedroomAllot.class, "id", bedNo);
BedroomAllot oldallot = dao.findOne(BedroomAllot.class, "id", oldRoom);
if(null == handle || null == newallot){
msg.setMsg("数据异常,请联系管理员");
return msg;
}
if(newallot.getLiveSum() - newallot.getAlreadyLive() <= 0){
msg.setMsg("该间寝室已经注满,请选择其他寝室入住");
return msg;
}
handle.setDormitory(newallot.getId());
newallot.setAlreadyLive(newallot.getAlreadyLive() + 1);
oldallot.setAlreadyLive(oldallot.getAlreadyLive() - 1);
dao.update(handle);
dao.update(newallot);
dao.update(oldallot);
msg.setMsg("修改成功");
return msg;
}
}
| [
"[email protected]"
] | |
f11c0663de6c0e4815c8dc00b7ab0dc15cd188f3 | f91c611a8b4c7d9d8d3e7f7b599d8369495cf797 | /lss-rmi-server/src/main/java/com/lss/demo/rmi/rpc/ProcessorHandler.java | 9a65822c98f1496979292255bc74e1cfae5cfd89 | [] | no_license | firegoods/gupao | 0e20acf17eb83cd7bc48927a28ee0fe837570247 | 09dace5b3a9642877a58e906b3c02db8312863ed | refs/heads/master | 2020-04-11T02:52:48.152374 | 2018-06-24T07:10:32 | 2018-06-24T07:10:32 | 124,322,731 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,624 | java | package com.lss.demo.rmi.rpc;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.Socket;
import java.util.Map;
/**
* 腾讯课堂搜索 咕泡学院
* 加群获取视频:608583947
* 风骚的Michael 老师
*
* 处理socket请求
*/
public class ProcessorHandler implements Runnable{
private Socket socket;
private Map<String, Object> handleMap; //服务端发布的服务
public ProcessorHandler(Socket socket, Map<String,Object> handleMap) {
this.socket = socket;
this.handleMap = handleMap;
}
public void run() {
//处理请求
ObjectInputStream inputStream=null;
try {
//获取客户端的输入流
inputStream=new ObjectInputStream(socket.getInputStream());
//反序列化远程传输的对象RpcRequest
RpcRequest request=(RpcRequest) inputStream.readObject();
Object result=invoke(request); //通过反射去调用本地的方法
//通过输出流讲结果输出给客户端
ObjectOutputStream outputStream=new ObjectOutputStream(socket.getOutputStream());
outputStream.writeObject(result);
outputStream.flush();
inputStream.close();
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}finally {
if(inputStream!=null){
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private Object invoke(RpcRequest request) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
//一下均为反射操作,目的是通过反射调用服务
Object[] args=request.getParameters();
Class<?>[] types=new Class[args.length];
for(int i=0;i<args.length;i++){
types[i]=args[i].getClass();
}
String serviceName = request.getClassName();
String version = request.getVersion();
if(null!=version&&!version.equals("")){
serviceName = serviceName+"-"+version;
}
//从handleMap中,根据客户端请求的地址,去拿响应的服务,通过发射发起调用
Object service = handleMap.get(serviceName);
Method method=service.getClass().getMethod(request.getMethodName(),types);
return method.invoke(service,args);
}
}
| [
"[email protected]"
] | |
b249cda1132d64e070bca92922c1b2cb398f79c9 | 79f8d4363426be41870c30a2c10449cf2aeb33f5 | /国学/data/d1.java | 7334eade53e7d5455ee58d890ab81a42fdf25e7a | [] | no_license | crazyandroidcoder/books | ab5fc9de9a72cfa4c792134e17102327a49ed5b6 | b3af4cb064e51ae99411089e3f84a15ce6710a9d | refs/heads/master | 2021-01-12T12:29:34.915300 | 2019-11-15T01:59:33 | 2019-11-15T01:59:33 | 72,492,326 | 2 | 0 | null | 2016-11-01T01:22:34 | 2016-11-01T01:22:33 | null | GB18030 | Java | false | false | 18,686 | java | /**
* @(#)d1.java 8.0.1 2011-4-16
*
* Copyright 2004-2011 mymmsc.org (MyMMSC), Inc. All rights reserved.
* MyMMSC PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package org.mymmsc.guoxue.dlr.data;
import org.mymmsc.guoxue.base.*;
/**
* 大六壬720课-1
*
* @author WangFeng(mail:[email protected], mobile:13911113230)
* @version 8.0.1 2011-4-16
* @since mymmsc-guoxue-base 8.0.1
*/
public class d1 extends KeEntry{
public d1() {
set(4, new LiuReKe("乙丑日第一局 干上辰", "课体:伏吟,稼穑,斩关。", "课义:木克九土,生阴生虎,伤食病胃,贪财祸阻。", "解曰:日干一木而课传九土,身极弱而财极重,贪财有祸,此之谓矣。贪多则伤,且生太阴白虎之金,转而克我,病讼之祸,岂能免乎。伏吟诸神各归本家,天地如一,伏而未发之象,稼穑有艰难之意。占得此者,名为鲸鲵归涧,凡事逼迫不由己出。若遇雷神,方能变化。斩关之课,不能安居。惟利隐身避难,暗中不顺,多见更改,或有中止。", "断曰:此卦财多身弱,力不堪财,亦恐因财起祸。若得本命行年有生助之神,或冬春木旺,乃可无虞。诸事皆急于前而缓于后,劳而无功,成而不久。惟忧疑患难,却能解散也。", "天时:亢旱无雨。家宅:有强梁之妻,把持门户,招事生非。求财:财多反财亏。婚姻:不吉,女亦凶恶。疾病:胃满腹胀,身体黄肿,医药不效。胎产:女胎难养。出行:不能安居,却有阻滞。行人:羊刃临身,恐有刑伤,且恐勾留。出兵:昼将吉,夜将不利。坟墓:防有破坏。", "毕法云:首尾相见始终宜,全财病体难担荷,用破身心无所归。课经云:乙日用起见天罡,地上辰昏同此方,像里争端须预备,或于失脱见乖张。"));
set(3, new LiuReKe("乙丑日第二局 干上卯", "课体:重审,退茹,龙德,励德。", "课义:彼此无礼,丁禄难倚,凡占凶甚,婚姻为美。", "解曰:子卯相刑,谓之无礼。今卯禄乘丁,而被刑于子,乌足恃也。中末空亡,惟解忧释患则可,岂有利于常占乎。子乘太常而合于丑,谓之牛女相会,故占婚姻则吉也。夜占则帘幕临干支上,凡占帘幕官者,不喜空,不喜墓,不喜克,而空亡尤甚,使试官略不视其文卷。又朱雀所乘之神若克帘幕,其文必不能贴合主司之意。干上卯辰相害,支上子丑相合,有自己煎熬,他人逸乐之象。", "断曰:此卦旺禄临身,止宜守旧。自有财禄,妄动则变为罗网,祸且不测。当静以镇之,正以持之,不出户庭,乃为良善。", "天时:有雨不大。家宅:防盗贼,屋少人多,奴仆不得力。胎产:女胎,见红不妨。疾病:手足拘挛,久病有碍。遗失:在宅内北方可获。出行:旱路平安,水路恐防有盗。行人:思归未至。求财:止得本分之财,求之宜早。功名:未遇。见贵:在家可谒。出兵:彼此相持,彼兵自乱,但恐有劫营暗通者,谨防之。", "毕法云:旺禄临身徒妄作。指南:戌将加亥,占鸦鸣。游都贼符临干支,右见驿马、元武,左见劫煞贼符。主有贼八九人,自东北来劫邻人衣物,渡河而去。子发用,故来自东北。子加丑,为八九之数,勾陈遥克元武,五日后必获。"));
set(2, new LiuReKe("乙丑日第三局 干上寅", "课体:重审,间传,时遁。", "课义:虎墓辛随,行人病归,名还魂格,迤逦生之。", "解曰:凡三传入墓,行人必至。今墓上乘虎,所以病归也。亥乃空亡作用,得末传未土生酉,中传酉金生亥,迤逦相生,故曰还魂。然亥属空亡,终究无力,虽生犹不生也。末传财爻,遁为辛鬼,而乘白虎,求财者岂能免于祸乎,谋事有始无终,见美不美。夜占有失脱。末传未加酉上乘虎,占物主茶叶。此课乃三旬空亡。", "断曰:此卦五行潜于湮没之地,四时入于衰败之乡,闭塞不通,暗昧不明。占者身见孤独,别离乡井,虚耗财物,有自立门户之象。惟僧道相宜,余人则否。", "天时:密云不雨,阴晴未判。家宅:人旺宅衰,尊长有碍。疾病:肾家虚损,新病解禳,久病则危。考试:文字蒙晦。求财:急于取利,须防祸患。仕宦:马空禄绝,不利差遣。胎产:怀妊有病,婢妾之孕。出行:旱路平安,水路防盗。行人:驿马空,行人未至。出兵:宜止而不行,勿为所诈。", "毕法云:三传递生人荐举,有始无终生值墓;干乘墓虎有伏尸,贵人坐狱难干贵。时遁诗云:时不利兮遁闷之,亥酉未兮报君知;君子待时方可吉,小人病患且防危。"));
set(1, new LiuReKe("乙丑日第四局 干上丑", "课体:稼穑,赘婿,励德,游子,三丘,五墓。", "课义:循环周布,昼夜辛墓,处此危疑,自来相顾。", "解曰:三传不出四课,为循环格。凡事萦纡,不能直遂。课传纯财,嫌财太盛。毕法所云:传财太旺反财亏也。末传墓神乘虎,又遁辛鬼,可课危疑至矣。未为日干之墓,而日干自去临于未,受未之墓,日干又能克未,所谓自来相顾也。支为干之财,上门而利于干,故占者最宜坐守此利。若贪而多取,必有祸矣。所当安于义命,乃为元吉。", "断曰;鬼墓加干。墓者,五行潜伏湮没之地,四时虚绝衰败之乡,闭塞不通,暗昧不明。凡占者若有鬼墓加临,必有潜谋暗算,背地侵扰之者。占在病讼,尤为大忌。必三传年命,幸遇冲散,方可免难。", "天时:久晴难雨。家宅:虽有田园,反为所累,尊长有悔。功名:财旺生官,恐有丁艰。疾病:大约脾肾之病,惟宜减食节孟,静以养之。胎产:是男喜,防有病。求财:虚而不实。出行:鬼墓临身,出门不吉。遗失:当在土中。捕获:夜占贼在西北方姑贤家。出兵:暗中有损,谍报军情,不可轻信。", "毕法云:人宅坐墓甘招晦,全财病体难担荷,宾主不投刑在上。照胆秘诀云:辰阴刑辰罡处孟,定招卑幼惊惶横。夜占戌作朱雀加支,宅中斗斛最多。"));
set(0, new LiuReKe("乙丑日第五局 干上子", "课体:从革,乙奇。", "课义:外勾里连,虽被熬煎,众金生水,昼贵同全。", "解曰:丑往加于巳,遂成金局伤干,是家中之人外勾里连以酿祸也。幸全金生起子水,而昼贵三传天将,俱来育身,是始虽煎熬,尚赖昼贵人之力,窃其金气,用以解祸。三传递生,以生干上之神而生干。则子之一字,乃全体化煞生身之神,所谓引鬼为生者也。乙干克丑支为财,而支上乘鬼,求财者不免自惊危中取之。干上子,支上酉,谓之首尾相见。", "断曰:课名从革,先天后革。凡事多有阻滞,有气则革而增进,无气则革而退失。四课发传,又名蓦越,有意外之忧喜。", "天时:有雨恐连绵。家宅:宅主健旺,宅母有病;四月占,尤有刑克。功名:官文两旺,前程万里。求谋:革故从新,渐人佳境。婚姻:女贪男家,能主家政。胎产:胎安难产。疾病:咳嗽劳伤之症,十月占之大凶。官讼:始怨终德,终成和好。遗失:是婢女窃去。捕获:贼党甚多,急难捕捉。出兵:大获全胜,彼必自来投诚。", "毕法云:众鬼虽彰全不畏,贵虽在狱宜临干,一旬周遍始终宜,帘幕贵人高甲第,合中犯煞蜜中砒。指南:二月亥将加卯占会试,传将递生,格合周遍,且干支交车生合,主文思滔滔。又朱雀遁丙乘旺,主文词华丽,高中无疑。"));
set(11, new LiuReKe("乙丑日第六局 干上亥", "课体:知一,斫轮,四绝,察微。", "课义:生虚鬼实,仕宦占吉,夜因神愿,禄动危失。", "解曰:亥水空而申官实,是隆虚名,受实害也。卦得斫轮,仕宦最宜,武职占之,尤有威权也。夜贵乘鬼,临干支上,病者宜祈祷神祇,了还香愿,方得痊吉。卯为日之禄神,既被申克,昼占乘元,则为闭口;夜占乘虎,又逢丁神,其动如此,病者岂不危乎。昼占帘幕临干支上,占考试者,当有同里之人,或系祖辈尊行,暗中摸索,有水乳之投。", "断曰:生我不生,禄我不禄。求官见贵,虽有喜悦之象,不过深情厚貌而已,难用其力也。密云不雨,凡百占者,皆宜知机而退,守正待时,自有不期然而然之妙。", "天时:有风,微雨。家宅:尊长有灾,防损小口,宅母当权,土木兴工。仕宦:任所不远,恐不能久任。功名:昼占可望中式,但恐未必正榜。求财:只宜得本分之财,不能大旺。婚姻:夜占主贵介之女,人亦端好,但不能助夫益子。疾病:胃口不开,肺家亦有病,急还家堂旧愿,医人不得力,秋防加病。胎产:虽是男胎,恐是虚喜。出行:宜于水路,利见贵人。行人:马空未至。行师:不宜躁动,为主者胜。遗失:在门内寻。捕获:四月占之,即见擒获。", "毕法云:避难逃生须弃旧,闭口凡占莫测机,鬼乘天乙乃神祇。玉成歌云:日鬼加临辰两课,必然官吏到门庭。"));
set(10, new LiuReKe("乙丑日第七局 干上戌", "课体:反吟,稼穑,斩关,关格。", "课义:日墓临支,宅有伏尸,三传俱陷,妻丧财遗。", "解曰:支乘墓虎,则有伏尸。今未为乙之墓,虽临干支,而昼夜贵神,并未乘虎。然亦以伏尸同论者,虎异而墓同也。三传往来俱陷于空,而皆属于妻财,则占妻者必有鼓盆之患,占财者必有致寇之凶,谓之妻丧财遗,不亦宜乎。朱雀主文章,陷空无气,必然抄袭旧文,不明题旨。春秋占诸事获吉。丑加未,夜将乘青龙,主有雨。", "断曰:反吟之卦,孤神无依,事多反覆,百凡疑滞。三传皆财神往来,必有因财而起争端者。斩关发用,有逃亡避难之象。传见孤辰,有别离乡井之象。", "天时:乍晴乍雨。家宅:人口不安,宅东有女入墓作祟。婚姻:昼占女子甚秀美,即恐有破败之者。胎产:应得女胎,生亦易育。考试:文字空虚,不贴书意。求财:主有争斗。疾病:口舌起病,不思饮食,即好亦防翻覆。出行:水路可行,恐中道而返。行人:近者即至。遗失:在旧地寻觅。捕获:逃去已远。出兵:须别寻良策,庶可建功。", "毕法云:全财病体难担荷,来去俱空岂动移。玉成歌云:反吟占事休言定,往复双双两事因,常占须主身摇动,不动人情有怨心。"));
set(9, new LiuReKe("乙丑日第八局 干上酉", "课体:重审,励德,天狱。", "课义:凶里藏利,迤逦而至,昼传夹克,寅全死气。", "解曰:酉来克乙,可谓凶矣。得支上午火克之,遂迤逦至末,皆为财也。但三传昼占皆系夹克,则财已无气,而费用百出,争竞多端,岂能安享而无事乎。干上克初,初克中,中克末,为求财大获。酉为日鬼,午火克制酉金,所谓制鬼之位乃良医也。占病当有本家亲人医治,占灾亦有人解救,占讼亦有人辨雪。酉为明鬼,午遁庚为暗鬼。干酉支午,又为四胜煞。凡占皆有自逞其能,邀功见美之意。", "断曰:此课三传全受夹克,凡事不能由己,忍耐为佳。", "天时:水升火降,当有雨。家宅:主有火烛血光之灾,阴私口舌之事。求财:必主大获,耗费亦重。婚姻:干支俱乘桃花咸池,不成为妙。胎产:是双生,一男一女。出行:正九月不利远行。行人:传墓为来,行人远至。捕亡:易获。遗失:在木柜上寻。出兵:多在中途止息,大宜防夜。", "毕法云:宾主不投刑在上,制鬼之位乃良医。古鉴:八月卯将加戌占脱保正。此名官鬼缠身,初传功曹,身已入官,焉能得脱。乙见酉官,螣蛇缠绕,必被勒认。初传天空,不认即当入狱。中传天后,认即无事。末传勾陈,子未相穿,断然难脱,脱亦复作。支上午作太阴,与我关说,却为他人作内鬼也。"));
set(8, new LiuReKe("乙丑日第九局 干上申", "课体:重审,狡童,从革。", "课义:俗庶难任,病讼俱兴,守官宜卜,俸倍职升。", "解曰:纯金克身,末传乘虎,庶民遇之,岂能免于病讼。若夜占乃贵德临身,能除一切凶咎。官爻重叠,而催官又临宅上,仕宦得此,知必能升俸增秩矣。金局并来伤干,昼占凶不可遏。若用夜贵,则初传酉金上被蛇克,下被巳伤,又被中传丑土来墓,末传巳火来克,则酉金全然无力。酉加巳为胎坐长生,大宜占孕,不利占产。又丑加酉为腹胎格,来人值此,必占妻孕。缘丑为腹,酉胎在腹内也。", "断曰:从革之课,革故鼎新,事主冗杂不一,动摇不定。凡占诸事,皆迟疑不进之象。", "天时:风雨兼至。家宅:有阴私暗昧之事,当以礼自防为吉。婚姻:女益男家,然合中有刑,不免妨害。胎产:男喜,难产。官讼:牵连众人,秋占可虑。疾病:患不一症,肝经受伤,难治。出行:不宜远行,陆路遇贵。行人:得利即至。捕亡:可获。遗失:家中二女窃去。出兵:大宜斟酌。", "毕法云:贵虽坐狱宜临干,鬼乘天乙乃神祇,后合占婚岂用媒,众鬼虽彰全不畏,制鬼之位乃良医,传墓入墓分憎爱。中黄经云:日辰衰木见真金,三传无火却成迍。"));
set(7, new LiuReKe("乙丑日第十局 干上未", "课体:重审,斩关,富贵,丘墓,阴不备。", "课义:支干乘墓,如处云雾,磨罗而归,妻财共聚。", "解曰:墓覆干支,人宅昏滞,夜占未蛇更凶。乙畏未墓,归干支上,辰遁为戊,而丑中有癸,戊与癸合,则妻财聚矣。干上虽作日财,却遁旬中干鬼。谓之财遁鬼格,必因财致祸,因食丧身,因妻致讼。春丑、夏辰、秋未、冬戌为关神。秋占此课,乃干墓作关神发用,人口有灾。昼贵地盘旬首,上神乘武,亦为闭口卦。", "断曰:三传俱财,财多反不如意。中间见阻,却喜相冲,冲散凶事,大宜解释忧疑。然中末传空,百事逢之,到底归于散漫。", "天时:昼占雨,夜占晴。家宅:人宅不能光明,却藏秀气;妻妾欢宁,儿孙诗礼。仕宦:昼占可望升迁,夜占迟滞。求财:须要循分守义。婚姻:可以出赘。疾病:主吐逆惊伤,或气冲而食不化,医在西南方,延之可治。出行:必有阻滞。行人:立至。胎产:男胎,立产。出兵:始虽相持,终归和好。", "毕法云:干支乘墓各昏迷,全财病体难担荷,干墓并关人宅废;宾主不投刑在上。指南:二月亥将加申,占起复进京。曰:干支乘墓,时未亨通。干神归支,利静不利动。中末空亡,半途而返。青龙居干发用,今年却当起官。年上酉为印信,阴神见贵生日,必补尚宝(按:官名)之职。"));
set(6, new LiuReKe("乙丑日第十一局 干上午", "课体:重审,间传,龙德,涉三渊。", "课义:脱空昼迎,禄作元丁,干官贵怒,凶吉无成。", "解曰:午乘天空,脱干之气,而能制初传之申鬼,亦一救神也。卯禄乘丁,昼占作武,恐因禄动而耗费也。夜贵坐克,日贵入狱,干贵者不逢其喜而逢其怒也。中末皆空,则吉凶两不成矣。禄临支上,谓之权摄不正。凡占不自尊贵,受屈于人,或遥授职禄,或受宅上之禄,或将本身之禄,替于儿孙,六乙日皆同。未加巳为两蛇夹墓,占病必有积块,占讼必被囚禁,占事必见凶祸。干上脱气乘空,名脱空格。凡占无中生有,全无实际,所谓脱上逢脱防虚诈也。", "断曰:此卦事多隔手,有不能退,不能遂之象。", "天时:主晴。家宅:夜占得贤妻,生好子,昼占多虚耗,防失脱。婚姻:女贪男家,亦可入赘,夜占女美。疾病:医人得力,虽危无害。胎产:男喜,八月占即生。行人:寅午日来。仕宦:可作佐贰。出行:宜从水路。遗失:财神空,恐难寻。捕亡:昼占往北方,夜占往南方。出兵:劳而无功。", "毕法云:权摄不正禄临支,两贵受克难干贵;鬼乘天乙乃神祇,人宅皆死各衰羸。涉三渊诗云:孟动不动涉三渊,申戌子兮在日前;进退艰难还万状,虽然对面隔层天。"));
set(5, new LiuReKe("乙丑日第十二局 干上巳", "课体:元首,进茹,罗网,夹定格。", "课义:支干拱传,惟喜春占,疑凶凶有,向后灾潜。", "解曰:干乙支丑,夹拱寅卯辰在内,会而为木,克身克宅,凶诚不免也。春则贪其生旺,不为害矣。若一休囚,便出而为灾,故疑其凶,凶未始不有也,但潜伏而向后乃发耳。所谓“旺相相生灾未发,死囚刑克便灾临”者是也。冬春占又为三阳课,天乙左行,阳气顺也,一、日辰在天乙前,阳气伸也,二、用神旺相,阳气进也,三、占此者凡事吉庆。", "断曰:联茹而进,顺时而动,吉无不利矣。春占正当交泰之时,依门傍户,可显功名,亦防有兄弟牵连之祸。", "天时:先雨后晴。家宅:主不聚财,且防孝服。胎产:女胎易产,颇亦伶俐。婚姻:女家多有口舌欺诳。疾病:棺椁煞见,占病大凶。干谒:且宜止息,不利正五九月。求财:劫财重重,不能生聚。捕获:恐被伤。遗失:恐夹带在人身上。出兵:申严号令,须防间谍。", "毕法云:所谋多拙遭罗网,彼此猜忌害相随。通神集云:起日离辰,不出家庭(谓四课三传,皆寅卯辰巳午也)。玉成歌云:三传带合须干谒,类就其干众所占(如甲乙日见寅卯入传也)。括囊赋云:内出外而己求,阳人阴而被索。"));
}
};
| [
"[email protected]"
] | |
deac0a6a0e52d759fd3d191b59aa9c61046f584d | d005b3764c85d9dc8a8af83b623b01e2c57564c8 | /Test.java | 7cfabc5fbe9f39bacf1ffb7fd7f96c22fcc50eec | [] | no_license | sushilshah/learnJava | 04fd3fb694f1d034a0583c0bfe518c07b0c8cbd3 | bbdb3fb9bcbd7a920f73901bc4b0279d84bde09c | refs/heads/master | 2020-03-28T19:37:20.775359 | 2013-06-13T05:20:03 | 2013-06-13T05:20:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | public class Test{
public static void main(String [] args){
int a = 1000;
for(int i = 0;i <= 100; i++){
/* System.out.println(i + " " + i % 10 + " " + i % 100); */
/* System.out.println();
System.out.println(i % 100); */
/* if (i % 10 == 1 && i % 100 == 11){
System.out.println(i + "th Hello");
}
if (i % 10 == 2 && i % 100 == 12){
System.out.println(i + "th Hello");
}
if (i % 10 == 3 && i % 100 == 1){
System.out.println(i + "th Hello");
}
if(i % 10 == 1 && i % 100 != 11){
System.out.println(i + "st Hello");
}
if (i % 10 == 2 && i % 100 != 12){
System.out.println(i + "nd Hello");
}
if (i % 10 == 3 && i % 100 != 1){
System.out.println(i + "rd Hello");
} */
if (int >= 11 && int <= 13) {
System.out.print(i + "th Hello");
}
else {
if(i % 10 == 1){ System.out.print(i + "st Hello"); }
if(i % 10 == 2){ System.out.print(i + "nd Hello"); }
if(i % 10 == 3){ System.out.print(i + "rd Hello"); }
if(i % 10 > 3){ System.out.print(i + "st Hello"); }
}
}
}
}
} | [
"[email protected]"
] | |
0c9e4ea2c4e25643a94731cb842fdd560768de6b | 00b6c0e59234827fe37b2c3ad2662ef3bcfebed4 | /app/src/main/java/dawizards/eatting/ui/activity/DustbinFoodActivity.java | 2b32fae70ba7b19d998ceef5a647bd96d792d8e1 | [] | no_license | qw243211462/Eatting | ad0adaff2bce6da6983e416ed29902dd0ef51c09 | 72d9f6b648003edb5c88d009ffc9e4d066604b90 | refs/heads/master | 2020-12-24T11:09:30.650486 | 2016-10-09T15:43:55 | 2016-10-09T15:43:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,033 | java | package dawizards.eatting.ui.activity;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.RadioButton;
import com.afollestad.materialdialogs.MaterialDialog;
import com.annimon.stream.Stream;
import com.litesuits.orm.LiteOrm;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.UpdateListener;
import dawizards.eatting.R;
import dawizards.eatting.bean.Food;
import dawizards.eatting.bean.FoodDB;
import dawizards.eatting.manager.RxBus;
import dawizards.eatting.ui.adapter.FoodAdapter;
import dawizards.eatting.ui.adapter.event.LayoutState;
import dawizards.eatting.ui.base.ScrollActivity;
import dawizards.eatting.util.CollectionUtil;
import dawizards.eatting.util.IntentUtil;
public class DustbinFoodActivity extends ScrollActivity {
@Bind(R.id.rootView)
View mRootView;
private static final String TAG = "DustbinFoodActivity";
private FoodAdapter mAdapter;
private Menu mMenu;
private List<Food> mSelected = new ArrayList<>();
private boolean edit = false;
private static LiteOrm mLiteOrm;
@Override
protected int layoutId() {
return R.layout.activity_dustbin_food;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAdapter = new FoodAdapter(this);
mAdapter.setLoadState(LayoutState.GONE);
mAdapter.setOnItemClickListener(R.id.food_select, new SelectListener());
mAdapter.setOnItemClickListener(R.id.food_layout, (view, data) -> {
if (!edit)
IntentUtil.goToOtherActivity(DustbinFoodActivity.this, ItemFoodActivity.class, "itemFood", data);
});
/*
* Load data from custom database.
*/
if (mLiteOrm == null) {
mLiteOrm = LiteOrm.newSingleInstance(this, "eatting.db");
mLiteOrm.setDebugged(true);
}
List<FoodDB> list = mLiteOrm.query(FoodDB.class);
Log.i(TAG, list.size() + " ");
showContent(CollectionUtil.convert(list));
}
@Override
public boolean canRefresh() {
return false;
}
@Override
public void onRefreshDelayed() {
}
@Override
public void onLoadMore(int toToLoadPage) {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_select_food, menu);
mMenu = menu;
return true;
}
/**
* When toolbar set menu.If too;bar can response the home button,MUST set it here.
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.edit:
/*
* Enter Edit Model.
*/
if (!edit) {
enterEdit();
}
/*
* Enter Upload Model.
*/
else {
upload();
}
break;
case android.R.id.home:
onBackPressed();
break;
}
return true;
}
private void upload() {
if (mSelected.size() == 0) {
Snackbar.make(mRootView, "您好像没有进行选择哦", Snackbar.LENGTH_SHORT);
return;
}
new MaterialDialog.Builder(this)
.content("您选择了" + mSelected.size() + "进行更新?")
.positiveText("确定")
.negativeText("取消")
.onPositive((dialog, which) -> Stream.of(mSelected).forEach(item -> {
item.release();
item.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (e != null) {
Log.e(TAG, e.getMessage());
} else {
Log.i(TAG, "Success Upload");
RxBus.getDefault().post(item, RxBus.EVENT_ADD);
}
}
});
}))
.show();
}
@Override
public void onBackPressed() {
if (edit) {
exitEdit();
} else {
super.onBackPressed();
}
}
private void enterEdit() {
edit = true;
mAdapter.enterEdit();
mRecyclerView.setAdapter(mAdapter);
updateMenu();
}
private void exitEdit() {
edit = false;
mAdapter.exitEdit();
mRecyclerView.setAdapter(mAdapter);
updateMenu();
}
/**
* Or we can use onPrepareOptionsMenu that call before we click the menuItem.
*/
private void updateMenu() {
MenuItem item = mMenu.findItem(R.id.edit);
if (edit) {
item.setTitle("上传");
} else {
item.setTitle("编辑");
}
}
/**
* Show view by given data.
*/
private void showContent(List<Food> data) {
mAdapter.fill(data);
mRecyclerView.setAdapter(mAdapter);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
return super.onPrepareOptionsMenu(menu);
}
private class SelectListener implements dawizards.eatting.ui.adapter.event.OnItemClickListener<Food> {
// Todo : Cannot cancle select.
@Override
public void onItemClick(View view, Food data) {
RadioButton mButton = (RadioButton) view;
if (!mButton.isChecked()) {
mButton.setChecked(false);
mSelected.remove(data);
} else {
mButton.setChecked(true);
mSelected.add(data);
}
}
}
}
| [
"[email protected]"
] | |
43c05db1494b16a512afe09ab0955700a2866dcb | 446a56b68c88df8057e85f424dbac90896f05602 | /support/cas-server-support-pac4j-webflow/src/test/java/org/apereo/cas/web/flow/DelegatedClientIdentityProviderConfigurationGroovyPostProcessorTests.java | 97df862bc43b286102e31c847b365f5a61c11a95 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | apereo/cas | c29deb0224c52997cbfcae0073a4eb65ebf41205 | 5dc06b010aa7fd1b854aa1ae683d1ab284c09367 | refs/heads/master | 2023-09-01T06:46:11.062065 | 2023-09-01T01:17:22 | 2023-09-01T01:17:22 | 2,352,744 | 9,879 | 3,935 | Apache-2.0 | 2023-09-14T14:06:17 | 2011-09-09T01:36:42 | Java | UTF-8 | Java | false | false | 2,994 | java | package org.apereo.cas.web.flow;
import org.apereo.cas.configuration.model.support.delegation.DelegationAutoRedirectTypes;
import org.apereo.cas.web.BaseDelegatedAuthenticationTests;
import org.apereo.cas.web.DelegatedClientIdentityProviderConfiguration;
import lombok.val;
import org.apache.hc.core5.http.HttpStatus;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.pac4j.core.client.Clients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.webflow.context.ExternalContextHolder;
import org.springframework.webflow.context.servlet.ServletExternalContext;
import org.springframework.webflow.execution.RequestContextHolder;
import org.springframework.webflow.test.MockRequestContext;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.*;
/**
* This is {@link DelegatedClientIdentityProviderConfigurationGroovyPostProcessorTests}.
*
* @author Misagh Moayyed
* @since 6.5.0
*/
@SpringBootTest(classes = BaseDelegatedAuthenticationTests.SharedTestConfiguration.class,
properties = "cas.authn.pac4j.core.groovy-provider-post-processor.location=classpath:GroovyClientProviderProcessor.groovy")
@Tag("Delegation")
class DelegatedClientIdentityProviderConfigurationGroovyPostProcessorTests {
@Autowired
@Qualifier("delegatedClientIdentityProviderConfigurationPostProcessor")
private DelegatedClientIdentityProviderConfigurationPostProcessor delegatedClientIdentityProviderConfigurationPostProcessor;
@Autowired
@Qualifier("builtClients")
private Clients builtClients;
@Test
void verifyOperation() throws Exception {
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
RequestContextHolder.setRequestContext(context);
ExternalContextHolder.setExternalContext(context.getExternalContext());
val client = builtClients.findClient("CasClient").get();
val provider = DelegatedClientIdentityProviderConfiguration.builder().name(client.getName()).build();
val clientConfig = Set.of(provider);
delegatedClientIdentityProviderConfigurationPostProcessor.process(context, clientConfig);
assertEquals("TestTitle", clientConfig.iterator().next().getTitle());
delegatedClientIdentityProviderConfigurationPostProcessor.destroy();
assertEquals(HttpStatus.SC_MOVED_TEMPORARILY, response.getStatus());
assertSame(DelegationAutoRedirectTypes.CLIENT, provider.getAutoRedirectType());
}
}
| [
"[email protected]"
] | |
5083f76df81fd7d41195bb670e5a096bc59ab8a0 | c0b97e8934bace7e787a9d6c354fc565d6ed8376 | /src/main/java/com/baziuk/spring/booking/service/BookingInfoAccessService.java | c95fa36db78e1788679a652f505bb70a48a525a7 | [] | no_license | maksymbaziuk/SpringTrainingCinema | 21b10c4380e2113fedbaf578d157734a45a612cb | da3d80686a21ebc8c02d0184be90fb49290547f5 | refs/heads/master | 2021-06-09T11:03:04.908775 | 2016-11-30T10:21:45 | 2016-11-30T10:21:45 | 69,377,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 912 | java | package com.baziuk.spring.booking.service;
import com.baziuk.spring.user.web.bean.CurrentUser;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Service;
/**
* Created by Maks on 11/19/16.
*/
@Service
public class BookingInfoAccessService {
public boolean checkIfTicketAccessable(Authentication authentication, long id){
Object principal = authentication.getPrincipal();
if (principal == null || "anonymousUser".equals(principal))
return false;
CurrentUser currentUser = (CurrentUser) authentication.getPrincipal();
boolean result = false;
if (currentUser != null){
result = currentUser.getUser().getBoughtTickets().stream()
.filter(ticket -> ticket.getId() == id)
.findFirst()
.isPresent();
}
return result;
}
}
| [
"[email protected]"
] | |
565bbf472dbd47416643c6e68f672389de3cd00e | 3089ff0fbd460ddda57be37c7b931efc973bddad | /inkmall-cart-interface/src/main/java/cn/link/inkmall/cart/bean/CartItem.java | f7063b2cc5ba2b7a0efd3a5c29516a8002f1eaa4 | [] | no_license | LinkWu98/inkmall | 8f2671b1a8d496e2ad539f9d0ba28e99e595c7a4 | 5723122b5ba1636d6204ff9b3248d4e0347f5312 | refs/heads/master | 2022-12-04T22:22:07.696121 | 2020-08-24T11:54:45 | 2020-08-24T11:54:45 | 289,914,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | package cn.link.inkmall.cart.bean;
import cn.link.inkmall.pms.entity.SkuAttrValueEntity;
import cn.link.inkmall.sms.vo.ItemSaleVo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 购物车商品模型
* @Author: Link
* @Date: 2020/6/1 23:44
* @Version 1.0
*/
@Data
public class CartItem {
private Long skuId;
private String defaultImage;
private String title;
private BigDecimal price;
private Integer count;
private List<SkuAttrValueEntity> saleAttrs;
private List<ItemSaleVo> sales;
private Boolean store = false;
/**
* 商品的实时价格
*/
private BigDecimal currentPrice;
/**
* 是否选中
*/
private Boolean check = true;
}
| [
"[email protected]"
] | |
91d4cb20010c80bf4552aca4f2fddbb5a83888a0 | dc7f335c0675282835ddbdaced72585e086ba109 | /Welcome4.java | 463dd335c10ca4ea6febc77796e5f889e73b7dfe | [] | no_license | adrianteri/Java-practice | cb2d79513581a6d5f533729542bc3ddf1d5b0fc1 | 6897bd3a46dea90dc7a9c4ecdd7ef884a636bae8 | refs/heads/main | 2022-07-15T17:18:51.357160 | 2022-07-05T17:25:35 | 2022-07-05T17:25:35 | 49,717,305 | 0 | 0 | null | 2022-07-05T17:25:36 | 2016-01-15T12:23:16 | Java | UTF-8 | Java | false | false | 280 | java | // My fourth Java program
public class Welcome4
{
//main method starts execution of Java application
public static void main(String[] args)
{
System.out.printf("%s\n%s\n",
"Welcome to", "Java Programming!");
}// end main method
}//end class Welcome4 | [
"[email protected]"
] | |
d1ab056d5aecd438a9e5717abbdaeb49cbe67faf | 0224f5b1a90892e6863174e540beeb43019dc4f9 | /src/Guess2/Guess2.java | 299cc19159b0fe9e4379a37e19e64d2510f64deb | [] | no_license | Racious/practice | 3492f55bdfa8acabdbe501db648d45519888a94b | de284fb3edce9c6f39011b219a5f4b37858700fa | refs/heads/master | 2021-03-01T13:23:36.076865 | 2020-08-28T08:43:16 | 2020-08-28T08:43:16 | 245,789,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package Guess2;
import java.util.Random;
import java.util.Scanner;
//簡易猜數字
public class Guess2 {
public static void main(String[] args) {
System.out.println("猜數字! 請猜0~99的數字");
//產生亂數0~99
Random random = new Random();
int x = random.nextInt(100);
//答案
//System.out.println(x);
//請求輸入
Scanner req = new Scanner(System.in);
Calc ans = new Calc();
while (req.hasNext()) {
//判斷大小
int y = req.nextInt();
//將亂數值x及猜測值y後送play方法計算,並傳回布林值
if (ans.play(y, x)) {
return;
}
}
}
} | [
"[email protected]"
] | |
05cd11e373f3e292dfc53186e22e01235cb0c9ae | 2da2adb8f7e1a39d3edd3cc3503e7aa2232c28b8 | /src/main/java/ua/george_nika/simulation/model/entity/error/GetEntityInfoException.java | 4aff2e79bf2680e22b97caf4e2e3ee207746b6d8 | [] | no_license | GeorgeNika/ControlledSimulation | fe7cc6f1a729da07b8b5d37da4015d1ff2a9b464 | 4a3f4d8b9f939116ca5b81a5d4ef4fada0b9a70a | refs/heads/master | 2021-01-10T17:31:43.960899 | 2016-02-01T09:28:55 | 2016-02-01T09:28:55 | 49,766,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package ua.george_nika.simulation.model.entity.error;
import ua.george_nika.simulation.util.error.NoUserFriendlyException;
@SuppressWarnings("unused")
public class GetEntityInfoException extends NoUserFriendlyException {
public GetEntityInfoException() {
}
public GetEntityInfoException(String message) {
super(message);
}
public GetEntityInfoException(String message, Throwable cause) {
super(message, cause);
}
public GetEntityInfoException(String loggerName, String className, String message, Throwable cause) {
super(loggerName, className, message, cause);
}
}
| [
"[email protected]"
] | |
ddbef5409b0a413359d4c00d85d34e2717b40e2e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/1/1_69a6cf193da094385634ec165c5478f8cd79c63a/GitRepositoryServiceProvider/1_69a6cf193da094385634ec165c5478f8cd79c63a_GitRepositoryServiceProvider_t.java | 13ef84ea57514a45450a25a2347fe7c25d2397b0 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,404 | java | /**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.collect.ImmutableSet;
import sonia.scm.repository.GitRepositoryHandler;
import sonia.scm.repository.Repository;
import sonia.scm.repository.api.Command;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.util.Set;
/**
*
* @author Sebastian Sdorra
*/
public class GitRepositoryServiceProvider extends RepositoryServiceProvider
{
/** Field description */
//J-
public static final Set<Command> COMMANDS = ImmutableSet.of(
Command.BLAME,
Command.BROWSE,
Command.CAT,
Command.DIFF,
Command.LOG,
Command.TAGS,
Command.BRANCHES,
Command.INCOMING,
Command.OUTGOING,
Command.PUSH
);
//J+
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
*
*
* @param handler
* @param repository
*/
public GitRepositoryServiceProvider(GitRepositoryHandler handler,
Repository repository)
{
this.handler = handler;
this.repository = repository;
context = new GitContext(handler.getDirectory(repository));
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @throws IOException
*/
@Override
public void close() throws IOException
{
context.close();
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @return
*/
@Override
public BlameCommand getBlameCommand()
{
return new GitBlameCommand(context, repository);
}
/**
* Method description
*
*
* @return
*/
@Override
public BranchesCommand getBranchesCommand()
{
return new GitBranchesCommand(context, repository);
}
/**
* Method description
*
*
* @return
*/
@Override
public BrowseCommand getBrowseCommand()
{
return new GitBrowseCommand(context, repository);
}
/**
* Method description
*
*
* @return
*/
@Override
public CatCommand getCatCommand()
{
return new GitCatCommand(context, repository);
}
/**
* Method description
*
*
* @return
*/
@Override
public DiffCommand getDiffCommand()
{
return new GitDiffCommand(context, repository);
}
/**
* Method description
*
*
* @return
*/
@Override
public IncomingCommand getIncomingCommand()
{
return new GitIncomingCommand(handler, context, repository);
}
/**
* Method description
*
*
* @return
*/
@Override
public LogCommand getLogCommand()
{
return new GitLogCommand(context, repository);
}
/**
* Method description
*
*
* @return
*/
@Override
public PushCommand getPushCommand()
{
return new GitPushCommand(handler, context, repository);
}
/**
* Method description
*
*
* @return
*/
@Override
public Set<Command> getSupportedCommands()
{
return COMMANDS;
}
/**
* Method description
*
*
* @return
*/
@Override
public TagsCommand getTagsCommand()
{
return new GitTagsCommand(context, repository);
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private GitContext context;
/** Field description */
private GitRepositoryHandler handler;
/** Field description */
private Repository repository;
}
| [
"[email protected]"
] | |
ccef69f138b62d310d06ed0a2eb12e027deace9c | b1b740bb45fdf48922eab2c5dba66dde844fca8d | /core/src/zzz/box2dtest/OneSidedPlatform.java | e4720e36838509449ab1b9f01feddb7f7bc48fb5 | [] | no_license | dbuedo/chapas-game | 0210dbf659ad51531de34a1e276b61e76b3a15d6 | 793c7bf6079cdac18eee171bacdd7d19ca4954ae | refs/heads/master | 2021-01-21T09:11:46.973716 | 2014-06-27T17:52:44 | 2014-06-27T17:52:44 | 19,467,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,594 | java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
/*
* Copyright 2010 Mario Zechner ([email protected]), Nathan Sweet ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package zzz.box2dtest;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.ContactFilter;
import com.badlogic.gdx.physics.box2d.EdgeShape;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.World;
public class OneSidedPlatform extends Box2DTest {
enum State {
Unknown, Above, Below
}
Fixture m_platform;
Fixture m_character;
float m_bottom;
float m_top;
float m_radius;
State m_state;
@Override
protected void createWorld (World world) {
{
BodyDef bd = new BodyDef();
Body ground = world.createBody(bd);
EdgeShape shape = new EdgeShape();
shape.set(new Vector2(-20.0f, 0), new Vector2(20.0f, 0f));
ground.createFixture(shape, 0);
shape.dispose();
}
{
BodyDef bd = new BodyDef();
bd.position.set(0, 10);
Body body = world.createBody(bd);
PolygonShape shape = new PolygonShape();
shape.setAsBox(3, 0.5f);
m_platform = body.createFixture(shape, 0);
m_bottom = 10.0f - 0.5f;
m_top = 10.0f + 0.5f;
}
{
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(0, 12);
Body body = world.createBody(bd);
m_radius = 0.5f;
CircleShape shape = new CircleShape();
shape.setRadius(m_radius);
m_character = body.createFixture(shape, 20.0f);
shape.dispose();
m_state = State.Unknown;
}
world.setContactFilter(new ContactFilter() {
@Override
public boolean shouldCollide (Fixture fixtureA, Fixture fixtureB) {
if ((fixtureA == m_platform && fixtureB == m_character) || (fixtureA == m_platform && fixtureB == m_character)) {
Vector2 position = m_character.getBody().getPosition();
if (position.y < m_top + m_radius - 3.0f * 0.005f)
return false;
else
return true;
} else
return true;
}
});
}
}
| [
"[email protected]"
] | |
ab28fe2c326982380bdac102f6bf84a6b7c836ae | b954ba831d3ef228e7a26dd707f923d34cb95755 | /Bird_work/我的项目/Contacts/Contacts_liuqipeng/src/com/yunos/alicontacts/quickcall/QuickCallSetting.java | a7d70b7ac5531ff2d79a7066c6534d81150734f3 | [
"Apache-2.0"
] | permissive | miswenwen/My_bird_work | cd8b0521509a8664e1802aca179ecdd89dff7726 | a858ba5bfd6b7acaa985deefb459be87eb668019 | refs/heads/master | 2020-06-11T00:46:12.389162 | 2017-06-21T08:50:35 | 2017-06-21T08:50:35 | 75,831,259 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 6,544 | java |
package com.yunos.alicontacts.quickcall;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.database.Cursor;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.PhoneLookup;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import android.view.KeyEvent;
import com.yunos.alicontacts.sim.SimUtil;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
public class QuickCallSetting {
public static final String TAG = QuickCallSetting.class.getSimpleName();
private static QuickCallSetting mQuickCallSetting;
private SharedPreferences mPrefs;
private HashMap<Integer, String> mSpeedDialMap = new HashMap<Integer, String>();
private HashMap<Integer, Integer> mDefaultSimMap = new HashMap<Integer, Integer>();
private static final String PREFIX_NUM = "SpeedNum_";
private static final String PREFIX_SIM = "SpeedSim_";
private final boolean mIsMultiSim;
public static final String EXTRAPOS = "pos";
public static final String PICMETHOD = "picmethod";
private static final int[] mKeyCodeArray = new int[] {
KeyEvent.KEYCODE_1, KeyEvent.KEYCODE_2, KeyEvent.KEYCODE_3, KeyEvent.KEYCODE_4,
KeyEvent.KEYCODE_5, KeyEvent.KEYCODE_6, KeyEvent.KEYCODE_7, KeyEvent.KEYCODE_8,
KeyEvent.KEYCODE_9
};
private QuickCallSetting(Context c) {
mPrefs = PreferenceManager.getDefaultSharedPreferences(c);
mIsMultiSim = SimUtil.MULTISIM_ENABLE;
initQuickCallSetting();
}
private void initQuickCallSetting() {
synchronized (mSpeedDialMap) {
for (int i = 0; i < mKeyCodeArray.length; i++) {
String key = PREFIX_NUM + String.valueOf(mKeyCodeArray[i]);
String phoneNum = mPrefs.getString(key, null);
if (!TextUtils.isEmpty(phoneNum)) {
mSpeedDialMap.put(mKeyCodeArray[i], phoneNum);
}
}
}
if (mIsMultiSim) {
synchronized (mDefaultSimMap) {
for (int i = 0; i < mKeyCodeArray.length; i++) {
String key = PREFIX_SIM + String.valueOf(mKeyCodeArray[i]);
int defaultSim = mPrefs.getInt(key, -1);
mDefaultSimMap.put(mKeyCodeArray[i], defaultSim);
}
}
}
}
public static QuickCallSetting getQuickCallInstance(Context c) {
if (mQuickCallSetting == null) {
mQuickCallSetting = new QuickCallSetting(c);
}
return mQuickCallSetting;
}
public String getPhoneNumber(int pos) {
synchronized (mSpeedDialMap) {
return mSpeedDialMap.get(pos);
}
}
public void addQuickDialSetting(int pos, String num) {
if (!TextUtils.isEmpty(num)) {
synchronized (mSpeedDialMap) {
String key = PREFIX_NUM + pos;
mSpeedDialMap.put(pos, num);
Editor e = mPrefs.edit();
e.putString(key, num);
e.commit();
}
}
}
public void deleteQuickDialSetting(int pos) {
String key = PREFIX_NUM + pos;
synchronized (mSpeedDialMap) {
mSpeedDialMap.remove(pos);
}
synchronized (mDefaultSimMap) {
mDefaultSimMap.remove(pos);
}
Editor e = mPrefs.edit();
e.remove(key);
if (mIsMultiSim) {
key = PREFIX_SIM + pos;
e.remove(key);
}
e.commit();
}
public void setDefaultQuickDialSim(int pos, int simid) {
if (mIsMultiSim) {
synchronized (mDefaultSimMap) {
mDefaultSimMap.put(pos, simid);
}
String key = PREFIX_SIM + pos;
Editor e = mPrefs.edit();
e.putInt(key, simid);
e.commit();
}
}
public Pair<String, String> getNameAndPhoneNumber(Context context, char keyChar) {
int numberKey = keyChar - '0' + KeyEvent.KEYCODE_0;
String number = getPhoneNumber(numberKey);
Pair<String, String> nameAndPhoneNumber = Pair.create("", number);
if (!TextUtils.isEmpty(number)) {
Cursor phoneCursor = null;
Uri phoneUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
try {
phoneCursor = context.getContentResolver().query(phoneUri,
new String[] {Phone.DISPLAY_NAME}, null, null, null);
if (phoneCursor != null && phoneCursor.moveToFirst()) {
nameAndPhoneNumber = Pair.create(phoneCursor.getString(0), number);
/* YUNOS BEGIN PB */
//##email:[email protected]
//##BugID:(5883538) ##date:2015/05/14
//##description:add edit contact function when set the quick call
} else {
nameAndPhoneNumber = Pair.create("", number);
}
/* YUNOS END PB */
} catch (Exception e) {
Log.e(TAG, "phone query exception", e);
} finally {
if (phoneCursor != null) {
phoneCursor.close();
}
}
}
return nameAndPhoneNumber;
}
public boolean hasQuickCallByNumber(String num, int pos) {
synchronized (mSpeedDialMap) {
Iterator<Entry<Integer, String>> iter = mSpeedDialMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<Integer, String> entry = (Map.Entry<Integer, String>) iter.next();
if ((Integer) entry.getKey() == pos) {
continue;
}
String phoneNum = (String) entry.getValue();
if (PhoneNumberUtils.compare(num, phoneNum)) {
return true;
}
}
return false;
}
}
public int getDefaultQuickDialSim(int pos) {
synchronized (mDefaultSimMap) {
if (mDefaultSimMap.containsKey(pos)) {
return mDefaultSimMap.get(pos);
} else {
return -1;
}
}
}
}
| [
"[email protected]"
] | |
eee7f1516c5f40df1f8b6ed77f47be5664be99d0 | b020e8465e5e653df56d09e94270f97ad80325bb | /duo/src/command/CommandList.java | 6cc201de925c4291db11d06b450658402a840701 | [] | no_license | shinjooyoung/Marriage | 7b75aabc160cfbd353570828a142224f7e887805 | 36e980bb5f4f208a606e0d4422e27cfa4fb644c8 | refs/heads/master | 2021-08-12T03:07:57.727060 | 2021-08-02T12:05:39 | 2021-08-02T12:05:39 | 142,962,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,433 | java | package command;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import mybatis.model.*;
import mybatis.session.*;
public class CommandList implements Command
{
private String next;
ListRepository repo = new ListRepository();
MemberRepository Mrepo=new MemberRepository();
public CommandList( String _next ){
next = _next;
}
public String execute( HttpServletRequest request , HttpServletResponse response ) throws CommandException{
try{
request.setCharacterEncoding("euc-kr");
HttpSession session = request.getSession();
String user =(String)session.getAttribute("userId");
Member member=Mrepo.selectMemberByPk(user);
request.setAttribute("left_box", member);
List <HeartAndMember> OutList = repo.selectHeartByOut((String)session.getAttribute("userId"));
List <HeartAndMember> InList = repo.selectHeartByIn((String)session.getAttribute("userId"));
for(int i =0; i<OutList.size();i++)
{
System.out.println("commandList Name : "+OutList.get(i).getmName());}
request.setAttribute("paramOut", OutList );
request.setAttribute("paramIn", InList );
}catch( Exception ex ){
throw new CommandException("CommandList < 목록보기시 > " +ex.toString());
}
return next;
}
}
| [
"Joode@DESKTOP-B7A5D6F"
] | Joode@DESKTOP-B7A5D6F |
b0e3024153ad21b410036cee9e477c5e20fc2dba | 8e77593f74d8a401e9b50fd4d087f0789d736e0f | /billboard/app/src/main/java/com/glac/account/ProfileChange.java | 648b9951735876357b0d6c448ff9a70fb2f162fb | [] | no_license | sikthomas/billboard | da4de821da79c4fb2ef17dc0c484a952232cb6a2 | 78185b8db4b3c7fd2790e432c4ad3fcc156e1fab | refs/heads/master | 2020-05-19T17:28:28.385062 | 2019-05-06T06:36:19 | 2019-05-06T06:36:19 | 185,134,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,853 | java | package com.glac.account;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import com.glac.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.theartofdev.edmodo.cropper.CropImage;
import com.theartofdev.edmodo.cropper.CropImageView;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class ProfileChange extends AppCompatActivity {
private ImageView mImageToChange;
private Button mSubmit;
private FirebaseAuth auth;
private FirebaseFirestore firebaseFirestore;
private StorageReference storageReference;
private String user_id, iamge_url;
private Uri imageUri = null;
private boolean isChanged = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile_change);
firebaseFirestore = FirebaseFirestore.getInstance();
storageReference = FirebaseStorage.getInstance().getReference();
auth =FirebaseAuth.getInstance();
user_id = auth.getCurrentUser().getUid();
//initializing the items
mImageToChange = (ImageView)findViewById(R.id.imageToChange);
mSubmit = (Button)findViewById(R.id.btnSubmitToChange);
//pickiing the image from gallery
mImageToChange.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CropImage.activity().setGuidelines(CropImageView.Guidelines.ON).start(ProfileChange.this);
}
});
mSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (imageUri!=null){
final String randomName = UUID.randomUUID().toString();
final StorageReference reference = storageReference.child(user_id+" user_images").child(randomName+".jpg");
reference.putFile(imageUri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
reference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
Uri downld = uri;
editing(downld.toString());
}
});
}
});
}else {
Toast.makeText(ProfileChange.this, "Please pick image first...!", Toast.LENGTH_SHORT).show();
}
}
});
}
private void editing(String download_uri) {
Map<String, Object> objectMap = new HashMap<>();
objectMap.put("imageUrl",download_uri);
firebaseFirestore.collection("Users").document(user_id).update(objectMap).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Toast.makeText(ProfileChange.this, "Image profile successfully changed...", Toast.LENGTH_SHORT).show();
onBackPressed();
}else {
String error = task.getException().toString();
Toast.makeText(ProfileChange.this, "Something went wrong: "+error, Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
CropImage.ActivityResult result = CropImage.getActivityResult(data);
if (resultCode == RESULT_OK) {
imageUri = result.getUri();
mImageToChange.setImageURI(imageUri);
isChanged = true;
} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
Exception error = result.getError();
}
}
}
}
| [
"[email protected]"
] | |
e71b05522683c2b4a5ff1c815383c870a06733a8 | be01205bec4f82c6ee7eb72ba6b73d66f3c342b4 | /src/unitTests/PlaneTests.java | 59b780a556c7abd3251d12a36781c86f07b9a426 | [] | no_license | tablet123456/project | d09a30e694bb9d40f891a01dd0a0f65785b3f533 | a5bee291bae80e578083a1a649fd7766025e0c67 | refs/heads/master | 2020-03-13T07:39:22.386237 | 2018-06-17T22:45:07 | 2018-06-17T22:45:07 | 131,029,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,154 | java | package unitTests;
import primitives.*;
import geometries.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
import elements.*;
class PlaneTests {
@Test
public void testIntersectionPoints() throws Exception {
final int width = 3;
final int height = 3;
Ray[][] rays = new Ray[width][height];
Camera camera = new Camera(new Point3D(0.0, 0.0, 0.0),new Vector(0.0, 1.0, 0.0), new Vector(0.0, 0.0, -1.0));
// plane orthogonal to the view plane
Plane plane = new Plane(new Point3D(0.0, 0.0, -3.0), new Vector(0.0, 0.0, -1.0),new Color(255,128,0),new Material(1,1,1,1,1));
// 45 degrees to the view plane
Plane plane2 = new Plane(new Point3D(0.0, 0.0, -3.0), new Vector(0.0, 0.25, -1.0),new Color(255,128,0),new Material(1,1,1,1,1));
List<Point3D> intersectionPointsPlane = new ArrayList<Point3D>();
List<Point3D> intersectionPointsPlane2 = new ArrayList<Point3D>();
System.out.println("Camera:\n" + camera);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
rays[i][j] = camera.constructRayThroughPixel(width, height, j, i, 1, 3 * width, 3 * height);
Map<Geometry, List<Point3D>> rayIntersectionPoints = plane.findintersection(rays[i][j]);
Map<Geometry, List<Point3D>> rayIntersectionPoints2 = plane2.findintersection(rays[i][j]);
rayIntersectionPoints.forEach((k, v) -> {
List<Point3D> l = new ArrayList<Point3D>();
l = rayIntersectionPoints.get(k);
intersectionPointsPlane.addAll(l);
});
rayIntersectionPoints2.forEach((k, v) -> {
List<Point3D> l = new ArrayList<Point3D>();
l = rayIntersectionPoints2.get(k);
intersectionPointsPlane2.addAll(l);
});
}
}
assertTrue(intersectionPointsPlane.size() == 9);
assertTrue(intersectionPointsPlane2.size() == 9);
for (Point3D iPoint : intersectionPointsPlane)
System.out.println(iPoint);
System.out.println("---");
for (Point3D iPoint : intersectionPointsPlane2)
System.out.println(iPoint);
}
}
| [
"tzvibloom@TzviBloom"
] | tzvibloom@TzviBloom |
8e3d4cc3831aaa67a5a8d71c58e7926649fa115e | f0082bce63b6d2e0a7e41d1b77513aa5ca7319c5 | /app/src/main/java/com/blstream/neverendingstory/Interfaces/IEratosthenesSieve.java | b66b8a2d6b729deac6cfc4c3ae45abc6da9e2e1c | [] | no_license | jackowskiBLStream/NeverEndingStory | 0a416a0c2e5cfef87697d73d5c5de46c9a0af0cd | 4bca659479a9f1576244112a552c83da2e4c29de | refs/heads/master | 2021-01-10T10:27:45.788810 | 2016-03-21T10:28:20 | 2016-03-21T10:28:20 | 54,108,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package com.blstream.neverendingstory.Interfaces;
/**
* Created by blstream on 3/17/2016.
*/
public interface IEratosthenesSieve {
void start();
void stop();
}
| [
"[email protected]"
] | |
00d40e2f02f33a881c9c93a62c1b93e281dfebd4 | 5977d1fc0679f6240de1974b42afe7e883213dd9 | /algorithm/java/DistanceBetweenBusStops.java | 1cb0f79a0abc884609b3fdb2bfb4e04ae078b8cf | [
"MIT"
] | permissive | cocoa-maemae/leetcode | 918876c737d71d8705ce5a028ce70b514637b085 | b7724b4d10387797167b18ec36d77e7418a6d85a | refs/heads/master | 2021-08-30T00:18:49.135242 | 2021-08-20T18:37:08 | 2021-08-20T18:37:08 | 155,217,700 | 1 | 0 | MIT | 2021-02-03T01:54:58 | 2018-10-29T13:36:17 | Java | UTF-8 | Java | false | false | 1,988 | java | import java.io.*;
import java.util.*;
class Solution {
/**
* Make sure start comes before end
* Caculate the sum of target interval as well as the total sum
* The result will be the min of target interval sum and the remaining interval sum.
**/
public int distanceBetweenBusStops(int[] distance, int start, int destination) {
if (start > destination) {
int tmp = start;
start = destination;
destination = tmp;
}
int rest = 0, total = 0;
for (int i = 0; i < distance.length; i++) {
if (start <= i && destination > i) {
rest += distance[i];
}
total += distance[i];
}
return Math.min(rest, total - rest);
}
}
public class DistanceBetweenBusStops {
public static int[] stringToIntegerArray(String input) {
input = input.trim();
input = input.substring(1, input.length() - 1);
if (input.length() == 0) {
return new int[0];
}
String[] parts = input.split(",");
int[] output = new int[parts.length];
for (int index = 0; index < parts.length; index++) {
String part = parts[index].trim();
output[index] = Integer.parseInt(part);
}
return output;
}
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line;
while ((line = in.readLine()) != null) {
int[] distance = stringToIntegerArray(line);
line = in.readLine();
int start = Integer.parseInt(line);
line = in.readLine();
int destination = Integer.parseInt(line);
int ret = new Solution().distanceBetweenBusStops(distance, start, destination);
String out = String.valueOf(ret);
System.out.print(out + "\n");
break;
}
}
}
| [
"[email protected]"
] | |
c350015ef4721d663a360f031246b00d91cdd5e3 | 43d4eecf99b02655d8bd0c9a729d8ca2f5927dde | /app/src/main/java/com/example/weather/db/County.java | 2e62af946c29b44cf6d45a91577bd911790580b6 | [
"Apache-2.0"
] | permissive | chenjunbodev/Weather | 3fce6fef5de5ae385e4cbe8f7a96f4c79711eb8d | f054e21cba90f26a974ad20a20097c00ada53b3e | refs/heads/master | 2020-04-20T19:23:55.746242 | 2019-02-05T07:34:46 | 2019-02-05T07:34:46 | 169,048,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package com.example.weather.db;
import org.litepal.crud.DataSupport;
public class County extends DataSupport {
private int id;
private String countyName;
private String weatherId;
private int cityId;
public int getId(){
return id;
}
public String getCountyName(){
return countyName;
}
public String getWeatherId(){
return weatherId;
}
public int getCityId(){
return cityId;
}
public void setId(int id){
this.id=id;
}
public void setCountyName(String countyName){
this.countyName=countyName;
}
public void setWeatherId(String weatherId){
this.weatherId=weatherId;
}
public void setCityId(int cityId){
this.cityId=cityId;
}
}
| [
"[email protected]"
] | |
96c391a46f15982516cc8be20e7cee6429e43298 | e8d3182ae9d2e603ba50e617430adcdb4f040f25 | /part06-Part06_05.SantasWorkshop/src/main/java/Gift.java | bf17fc08622292cc1258eadf91b51d9cb095755b | [
"MIT"
] | permissive | mwk48/java-programming-I | 053fba30a821cba46385ba79adebbc3043a8277b | eccf6f559d87c42f785eff19890b85561fc841c5 | refs/heads/master | 2022-12-04T10:35:14.529280 | 2020-08-25T06:51:27 | 2020-08-25T06:51:27 | 289,980,467 | 0 | 0 | MIT | 2020-08-25T06:51:28 | 2020-08-24T16:27:54 | Java | UTF-8 | Java | false | false | 601 | java | /*
* 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.
*/
/**
*
* @author godknows
*/
public class Gift {
private String name;
private int weight;
public Gift(String name, int weight) {
this.name=name;
this.weight=weight;
}
public String getName() {
return this.name;
}
public int getWeight() {
return this.weight;
}
public String toString() {
return this.name+" ("+this.weight+" kg)";
}
}
| [
"[email protected]"
] | |
b94960e53570ac26905a8542998c26da9256fe27 | 037db1cffc88990e4fbd09f3c886e646cfb30248 | /src/java/com/r/base/SequencePerTable.java | f534de5a4807763fbb0e312e41f2c155db2028d9 | [] | no_license | rheinhartz/R-Solution | dd415fd173ba56ff906730d2646b02a68d189c2a | b78bad615c95e93bf847be85ca857bb4010fea6a | refs/heads/master | 2021-05-04T07:47:06.936715 | 2016-10-12T10:03:12 | 2016-10-12T10:03:12 | 70,651,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,218 | java | package com.r.base;
import java.util.Properties;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.Oracle10gDialect;
import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.id.SequenceGenerator;
import org.hibernate.type.Type;
public class SequencePerTable extends Oracle10gDialect {
public static final String PARAMETERS = "MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOCYCLE";
/**
* Get the native identifier generator class.
*
* @return TableNameSequenceGenerator.
*/
@Override
public Class<?> getNativeIdentifierGeneratorClass() {
return TableNameSequenceGenerator.class;
}
/**
* Creates a sequence per table instead of the default behavior of one
* sequence.
*/
public static class TableNameSequenceGenerator extends SequenceGenerator {
/**
* {@inheritDoc} If the parameters do not contain a
* {@link SequenceGenerator#SEQUENCE} name, we assign one based on the
* table name.
*/
@Override
public void configure(final Type type, final Properties params,
final Dialect dialect) {
if (params.getProperty(SEQUENCE) == null
|| params.getProperty(SEQUENCE).length() == 0) {
/* Sequence per table */
String tableName = params
.getProperty(PersistentIdentifierGenerator.TABLE);
if (tableName != null) {
params.setProperty(SEQUENCE, createSequenceName(tableName));
}
/* Non-Caching Sequence */
params.setProperty(PARAMETERS, SequencePerTable.PARAMETERS);
}
super.configure(type, params, dialect);
}
/**
* Construct a sequence name from a table name.
*
* @param tableName
* the table name
* @return the sequence name
*/
String createSequenceName(final String tableName) {
return "seq_" + tableName;
}
}
} | [
"Richard@Richard-PC"
] | Richard@Richard-PC |
831b9c65b8473be8205df3fee2ab9b1b3bfe71f9 | 415b28b9a163f8fc19c3c39975e8d39c1fa191d9 | /src/ticket/Executive.java | 9aada280a84e3b9bed8f23ddf8d412efd8259529 | [] | no_license | Yusrizall/lspoop | 9fc5b273f253bd1361d32b974eef22dbe460858c | 8a5fd79c9b886516a902a2f7f499a417985bec9d | refs/heads/master | 2023-04-14T21:04:19.911106 | 2021-04-09T20:44:37 | 2021-04-09T20:44:37 | 356,053,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | /*
* 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 ticket;
/**
*
* @author Yusrizal Abin Nabil
*/
public class Executive implements Ticket {
String name = "";
int price = 60000;
Executive(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public int getPrice() {
return this.price;
}
}
| [
"[email protected]"
] | |
74a4066a3db1813694efa0f4cc468665a33c67b8 | e67158740e4ab1a26d6d84be22c908bbf0d9efbb | /src/main/java/com/codingdojo/Ideas/repositories/IdeaRepo.java | f9e8fb00b12a3be18e9b33b1574132f2fc0be134 | [] | no_license | KyleKiyoshiTakahashi/Ideas-Java | 5eddd65e37db5808e10da0625fa620853fd44398 | c67a43e3559a054e6aa26a9ce8bfa6b17e04d9f1 | refs/heads/master | 2020-04-23T11:55:58.692737 | 2019-02-17T17:48:08 | 2019-02-17T17:48:08 | 171,152,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package com.codingdojo.Ideas.repositories;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.codingdojo.Ideas.models.Idea;
@Repository
public interface IdeaRepo extends CrudRepository<Idea, Long>{
List<Idea> findAll();
}
| [
"[email protected]"
] | |
eeddd5620f27c368ab81dc104ac9806e9168b006 | 1acd92a8de398abd96005a1ce7a5b9ed93b8a5cc | /app/src/main/java/com/yanyiyun/baseutils/adapter/SwipeMenuRecyclerViewAdapter.java | 10540cb465059fcfb8d525c603bcd910ee7f21eb | [] | no_license | wscoding/BaseUtils | 3ddf9a8f8f09a7cc158affa6ea19a4faa1b8a1f0 | 876450b3bd430e6915132732cde2e09684bbff8f | refs/heads/master | 2023-05-10T16:33:14.690981 | 2020-08-30T18:06:37 | 2020-08-30T18:06:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,642 | java | package com.yanyiyun.baseutils.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.yanyiyun.baseutils.R;
import com.yanyiyun.function.screenAdaptation.ScreenAdapterTools;
import java.util.ArrayList;
public class SwipeMenuRecyclerViewAdapter extends RecyclerView.Adapter {
private LayoutInflater inflater;
private Context mContext;
private ArrayList<String> data;
public SwipeMenuRecyclerViewAdapter(Context mContext,ArrayList<String> data) {
this.mContext = mContext;
this.data=data;
inflater=LayoutInflater.from(mContext);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view=inflater.inflate(R.layout.swipe_menu_recyclerview_item,parent,false);
ScreenAdapterTools.getInstance().loadView(view);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
ViewHolder viewHolder= (ViewHolder) holder;
viewHolder.item_tv.setText(data.get(position));
}
@Override
public int getItemCount() {
return data.size();
}
private class ViewHolder extends RecyclerView.ViewHolder{
TextView item_tv;
public ViewHolder(View itemView) {
super(itemView);
item_tv=itemView.findViewById(R.id.item_tv);
}
}
}
| [
"[email protected]"
] | |
e9a869c11eb7a39033db3f3dc2033fcc8ded7421 | aa617ed8c63ce1633cc57c2219df73bb0ca334f3 | /Mercadoni/app/src/androidTest/java/com/android/client/mercadoni/mercadoni/ApplicationTest.java | b1f30dbb9e662a8c095e34e56fa4813d7cedf1c7 | [] | no_license | cami7ord/mercadoniV2 | e7550a1aff5b104fc4e590d3e727568e4a47a48b | eab92a825b99f2b2ea9021b26e3280f5ec2597ca | refs/heads/master | 2021-01-17T17:03:45.539229 | 2016-07-11T03:28:16 | 2016-07-11T03:28:16 | 63,021,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.android.client.mercadoni.mercadoni;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
f6c138ec00fee7f61ba00b16d1e488198d987406 | 35cac98e630d56336c1b44ac029df72c7c186b03 | /src/main/java/me/hjjang/dddstart/domain/Receiver.java | 4efa4cb2fa5d485a84d82385ffc8d596096d3fdc | [] | no_license | dacapolife87/DDDStart | 851dc1c0a173c3e7c00c951d1435bced04617ea4 | 937845faf2297c96f9079cf610dd92899305cabd | refs/heads/master | 2023-03-13T06:07:47.466189 | 2021-03-03T13:51:29 | 2021-03-03T13:51:29 | 342,284,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package me.hjjang.dddstart.domain;
import java.util.Objects;
public class Receiver {
private String name;
private String phoneNumber;
public Receiver(String name, String phoneNumber) {
this.name = name;
this.phoneNumber = phoneNumber;
}
public String getName() {
return name;
}
public String getPhoneNumber() {
return phoneNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Receiver receiver = (Receiver) o;
return Objects.equals(name, receiver.name) &&
Objects.equals(phoneNumber, receiver.phoneNumber);
}
@Override
public int hashCode() {
return Objects.hash(name, phoneNumber);
}
}
| [
"[email protected]"
] | |
84a9419018abbe274b18ef626cd5aaea4f4ae814 | bd40d2c1972ce06a4f142ac53cf49bbf4d92301b | /app/src/main/java/com/xmi/store/fragment/base/BaseFramgment.java | 4e9a997b02b597b471164c1ad697796cdd0ec5b3 | [] | no_license | xiucui-yu/Xmi_Store | ad5d0bb34bfb358aebae797a6ae6b639926f8ac3 | 0e39950124043899ad82c1dfa481ac11e244b8b9 | refs/heads/master | 2021-01-21T12:58:57.350786 | 2016-05-05T07:25:48 | 2016-05-05T07:25:48 | 55,592,592 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,870 | java | package com.xmi.store.fragment.base;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.xmi.store.R;
import com.xmi.store.callback.ErrorClickListener;
import com.xmi.store.view.PageStateLayout;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* User: xiucui.yu
* Date: 2016-04-06
* Time: 18:23
* FIXME
*/
public abstract class BaseFramgment extends Fragment {
@Bind(R.id.swipe_refresh)
protected SwipeRefreshLayout swipeRefresh;
protected View mMainView;
private PageStateLayout stateLayout;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
initViewId();
ButterKnife.bind(this, mMainView);
stateLayout = new PageStateLayout(getActivity());
stateLayout.setContextView(mMainView);
stateLayout.setStatus(PageStateLayout.STATE_LOADING);
stateLayout.setErrorClickListener(listener);
/**
* 两种效果的代码完全相同,不同的只是兼容的v7,v4包,只需下载最新的v7兼容包就可以实现圆圈样式的下拉刷新。后面会附上最新v7包下载地址。
*/
swipeRefresh.setColorSchemeResources(R.color.theme_orange);
swipeRefresh.setSize(SwipeRefreshLayout.LARGE);
// 设置下拉刷新时的颜色值,颜色值需要定义在xml中
/* swipeRefresh
.setColorScheme(R.color.yellow,
R.color.green, R.color.blue,
R.color.purple);*/
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
BaseFramgment.this.onRefresh();
}
});
initAddition();
return stateLayout;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initData(0);
}
protected abstract void initData(int index);
protected abstract void initViewId();
protected abstract void initAddition();
protected abstract void onRefresh();
protected abstract void onMore();
ErrorClickListener listener = new ErrorClickListener() {
@Override
public void callback() {
stateLayout.setStatus(PageStateLayout.STATE_LOADING);
initData(0);
}
};
public void setStatus(int status) {
stateLayout.setStatus(status);
}
@Override
public void onDestroyView() {
super.onDestroyView();
ButterKnife.unbind(this);
}
}
| [
"[email protected]"
] | |
d02f6ce148407f4f0d2ade9996fde27933d64d50 | 84e0d675e974eac6b81c641d69a5fa00db539134 | /src/main/java/Animal.java | 289e83a751ea41ba335f7db870164ac73a046ae6 | [] | no_license | sindhu-31/CodingSolution | 164c3ccc5f399e66a50922ea33c11fbf893281c2 | 1adb6a22c1a55bf4c3db47f174a07f034d14b18a | refs/heads/master | 2022-11-15T07:42:07.148591 | 2020-07-16T02:22:05 | 2020-07-16T02:22:05 | 280,013,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 115 | java | package main.java;
public interface Animal {
boolean walk();
boolean fly();
boolean swim();
boolean sing();
}
| [
"[email protected]"
] | |
083e23d80e71af1d8cc6929dfb6d16f56ca15591 | 0d1dee356eebbc3a81d93cde94ebba3cb141f50b | /Lab4/debug/calculator/CalculatorGUI.java | cb61197fe2942ddbf05f6d445fe74bbb58726691 | [] | no_license | Tiaaanyu/Software_Construction | 16bfa2ad2f497ee43d30a7e402ee148587c8089a | 9763338e0978980e1cb24015b627f9689bf61986 | refs/heads/master | 2021-08-15T22:03:59.435515 | 2021-04-17T16:10:57 | 2021-04-17T16:10:57 | 125,737,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,324 | java | //Notes:
// If the user already entered a decimal, all subsequent decimals will be ignored for current input
// If the user enters a decimal without any other numbers that input will be ignored
package calculator;
import java.awt.Component;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.MenuBar;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class CalculatorGUI extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JButton[] btnNum = new JButton[10];
private JButton[] btnOp = new JButton[5];
private JButton btnCE, btnDecimal;
private JPanel pnlNum, pnlOp;
private JLabel txtResult;
private String buffer;
private String operation;
private float result;
private boolean init;
private Font largeFont = new Font("Arial", Font.BOLD, 22);
public CalculatorGUI() {
// variable to store the value of the state of the calculator
result = 0;
// String buffer for multi-digit inputs
buffer = "";
// String container for the type of arithmetic operation to perform
operation = "";
// Set whether the calculator state variables are storing valid values
// to handle edge cases
init = false;
// set attributes
setSize(330, 350);
setTitle("COSC121 Calculator");
setDefaultCloseOperation(EXIT_ON_CLOSE);
// create objects
txtResult = new JLabel("" + result);
txtResult.setFont(largeFont);
txtResult.setHorizontalAlignment(JTextField.RIGHT);
// buttons
for (int i = 0; i < btnNum.length; i++) {
//btnNum[i] = new JButton(1 + "");
btnNum[i] = new JButton(i + ""); //correct here.
btnNum[i].setFont(largeFont);
btnNum[i].addActionListener(new DigitActionListener());
}
btnDecimal = new JButton(".");
btnCE = new JButton("CE");
btnDecimal.setFont(largeFont);
btnCE.setFont(largeFont);
btnDecimal.addActionListener(new DigitActionListener());
btnCE.addActionListener(new CEActionListener());
btnOp[0] = new JButton("+");
btnOp[1] = new JButton("-");
btnOp[2] = new JButton("x");
btnOp[3] = new JButton("/");
btnOp[4] = new JButton("=");
// Set font of Operations and add Action Listeners
for (int i = 0; i < btnOp.length; i++) {
btnOp[i].setFont(largeFont);
btnOp[i].addActionListener(new OpActionListener());
}
// panels
pnlNum = new JPanel(new GridLayout(3, 4));
pnlOp = new JPanel(new GridLayout(5, 1));
// 3) ADDING
// add to panels
for (int i = 0; i < btnNum.length; i++)
pnlNum.add(btnNum[i]);
pnlNum.add(btnDecimal);
pnlNum.add(btnCE);
for (int i = 0; i < btnOp.length; i++)
//pnlOp.add(btnOp[1]);
pnlOp.add(btnOp[i]); //correct here.
// add to JFrame
add(txtResult, "North");
add(pnlNum);
add(pnlOp, "East");
}
//Method to process the input of digits and decimal points
public void processDigitInput(JButton value) {
// ignore decimal points if they are already exists one in buffer
if (!(buffer.contains(".") && value.getText().equals(".")))
buffer = buffer + value.getText();
}
// method to handle input from operation buttons
public void processOperationInput(String in) {
switch (in) {
case "+":
operation = "+";
case "-":
operation = "-";
case "x":
operation = "*";
case "/":
operation = "/";
}
}
// Carries out appropriate arithmetic operation based on state variables
public void performOperation() {
if (!buffer.equals(".")) {
// Handles edge case of first input after default state where buffer is empty and result is zero
if (!init && !buffer.equals("")) {
result = Float.parseFloat(buffer);
txtResult.setText("" + result);
buffer = "";
init = true;
}
// Find appropriate arithmetic operation to perform given the user's input
else if (!operation.equals("") && !buffer.equals("")) {
switch (operation) {
case "+":
result = result + Float.parseFloat(buffer);
buffer = "";
txtResult.setText("" + result);
init = true;
break;
case "-":
result = result - Float.parseFloat(buffer);
buffer = "";
txtResult.setText("" + result);
init = true;
break;
case "x":
result = result * Float.parseFloat(buffer);
buffer = "";
txtResult.setText("" + result);
init = true;
break;
case "/":
result = result / Float.parseFloat(buffer);
buffer = "";
txtResult.setText("" + result);
init = true;
break;
case "=":
txtResult.setText("" + result);
buffer = "";
operation = "";
result = 0;
init = true;
break;
}
System.out.println("Current result: " + result);
}
}
}
// Method to reset calculator's state to default
public void clear() {
result = 0;
txtResult.setText("" + result);
buffer = "";
operation = "";
init = false;
}
// Action listener for operation buttons
class OpActionListener extends JFrame implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent op) {
performOperation();
operation = ((JButton) op.getSource()).getText();
System.out.println(operation);
}
}
// Action listener for digit buttons
class DigitActionListener extends JFrame implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent digit) {
processDigitInput((JButton) digit.getSource());
System.out.println(buffer);
}
}
// Action listener for digit buttons
class CEActionListener extends JFrame implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent ce) {
clear();
}
}
public static void main(String[] args) {
new CalculatorGUI().setVisible(true);
}
}
| [
"[email protected]"
] | |
10844fd878e2a4d42e3996cf9159f398f9811687 | 2ff5976e83bf79af8acfb932c4d772fe52d199f5 | /src/com/roner/safari/commons/Subject.java | 754f2d82767869c1d447f64689bd2a920cf9be25 | [] | no_license | ronerjr/safari | f712e3d587310f07a5dc09e715265588a50d66fc | 06e6b0e21a5b32f6bd13b02ddbcdd9d285a67f08 | refs/heads/master | 2020-08-21T23:13:13.625547 | 2019-11-11T23:37:06 | 2019-11-11T23:37:06 | 216,268,845 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package com.roner.safari.commons;
public interface Subject {
boolean registerObserver(Observer observer);
boolean removeObserver(Observer observer);
void notifyObservers();
}
| [
"[email protected]"
] | |
ace0f57e7afb460650bb0c63c8d31389bd9068d2 | bf7b4c21300a8ccebb380e0e0a031982466ccd83 | /middlewareConcepts2014-master/Assignment3/lib/jacorb-3.4/src/generated/org/omg/Security/SecDelegationDirectivePolicy.java | bb8e0211cd10bd602b50ca9445e9fe0074023d80 | [] | no_license | Puriakshat/Tuberlin | 3fe36b970aabad30ed95e8a07c2f875e4912a3db | 28dcf7f7edfe7320c740c306b1c0593a6c1b3115 | refs/heads/master | 2021-01-19T07:30:16.857479 | 2014-11-06T18:49:16 | 2014-11-06T18:49:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package org.omg.Security;
/**
* Generated from IDL const "SecDelegationDirectivePolicy".
*
* @author JacORB IDL compiler V @project.version@
* @version generated at 27-May-2014 20:14:30
*/
public interface SecDelegationDirectivePolicy
{
int value = 38;
}
| [
"[email protected]"
] | |
08c02cacc7c7cd4a1b85a727a739c37d8e01198b | b6c8f949e23798f4a9fb3432cf20f066172b4a62 | /src/main/java/com/maktabatic/msreservation/MsReservationApplication.java | 7a90f53121fff23435ec055be340f20273e40f9a | [] | no_license | nourTM/ms-reservation | aaa24ab06d86ca24f161ff9b9cc145cf71c886dc | 24d7ef71a8c376b41b45f09d71095d82bb2d88d4 | refs/heads/main | 2023-07-17T18:29:09.935848 | 2021-08-28T22:56:06 | 2021-08-28T22:56:06 | 398,897,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.maktabatic.msreservation;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients
public class MsReservationApplication {
public static void main(String[] args) {
SpringApplication.run(MsReservationApplication.class, args);
}
}
| [
"[email protected]"
] | |
420f915c1821465eaab997345582ec5fb68472ad | 0a4d8f0672bcd1fbd917d8f69b114071593897f9 | /wyqp/wyqp-mj/src/main/java/cn/worldwalker/game/wyqp/mj/mock/MockPlayer.java | 7feb5da436a435a55fd1784de6a5f862de7c0bda | [] | no_license | worldwalker77/platform.nf | 746664bcffadbcec9c82008ea34e7a58f35a02dc | ba7f7f35461a33106ba6ab53b9bdd635892009ef | refs/heads/master | 2021-04-05T23:48:29.718839 | 2018-04-22T04:10:58 | 2018-04-22T04:10:58 | 124,726,762 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,616 | java | package cn.worldwalker.game.wyqp.mj.mock;
import java.util.ArrayList;
import java.util.List;
public class MockPlayer {
private Integer playerId;
private Integer curMoCard;
private List<Integer> handCardList = new ArrayList<>(16);
private List<Integer> pengCardList = new ArrayList<>(16);
private List<Integer> minGangCardList = new ArrayList<>(16);
private List<Integer> anGangCardList = new ArrayList<>(16);
public Integer getCurMoCard() {
return curMoCard;
}
public void setCurMoCard(Integer curMoCard) {
this.curMoCard = curMoCard;
}
public Integer getPlayerId() {
return playerId;
}
public void setPlayerId(Integer playerId) {
this.playerId = playerId;
}
public List<Integer> getHandCardList() {
return handCardList;
}
public void setHandCardList(List<Integer> handCardList) {
this.handCardList = handCardList;
}
public List<Integer> getPengCardList() {
return pengCardList;
}
public void setPengCardList(List<Integer> pengCardList) {
this.pengCardList = pengCardList;
}
public List<Integer> getMinGangCardList() {
return minGangCardList;
}
public void setMinGangCardList(List<Integer> minGangCardList) {
this.minGangCardList = minGangCardList;
}
public List<Integer> getAnGangCardList() {
return anGangCardList;
}
public void setAnGangCardList(List<Integer> anGangCardList) {
this.anGangCardList = anGangCardList;
}
}
| [
"[email protected]"
] | |
8f891f78b61dac47fb06b7a8766a6ff7650998d8 | 3b577ef1bad8c44bd8b3c861f9a99cdf2b66e11b | /src/main/java/com/monggovest/MonggoVestBackEnd/pagination/PageController.java | c9560b8199db9f58adc72dab711e586baa23da4c | [] | no_license | siiberad/JavaSpring-MonggoVestPlus | 38fae1b0c78adf731840c8f1e2b114cae8398f31 | 4bdcc91aec7b5b5b3b1d07992c8199e7b212cf33 | refs/heads/master | 2022-07-11T07:32:55.077012 | 2019-07-16T13:38:13 | 2019-07-16T13:38:13 | 179,471,702 | 0 | 0 | null | 2022-06-22T18:38:29 | 2019-04-04T10:00:42 | Java | UTF-8 | Java | false | false | 2,193 | java | package com.monggovest.MonggoVestBackEnd.pagination;
import com.monggovest.MonggoVestBackEnd.model.ProductModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = "/pagination")
public class PageController {
@Autowired
private PaginationService paginationService;
@RequestMapping(value = "/conditionalPagination", params = { "groupedBy","orderBy", "direction", "page",
"size" }, method = RequestMethod.GET)
@ResponseBody
public Page<ProductModel> findJsonDataByPageAndSize(@RequestParam("groupedBy") Long provinceId,@RequestParam("orderBy") String orderBy,
@RequestParam("direction") String direction, @RequestParam("page") int page,
@RequestParam("size") int size) {
if (!(direction.equals(Direction.ASCENDING.getDirectionCode())
|| direction.equals(Direction.DESCENDING.getDirectionCode()))) {
throw new PaginationSortingException("Invalid sort direction");
}
// ini buat sorting
if (!(orderBy.equals(OrderBy.HARGAMODAL.getOrderByCode()) || orderBy.equals(OrderBy.PRODUCTID.getOrderByCode()))) {
throw new PaginationSortingException("Invalid orderBy condition");
}
Page<ProductModel> list = paginationService.findJsonDataByCondition(provinceId, orderBy, direction, page, size);
return list;
}
@ExceptionHandler(PaginationSortingException.class)
public ResponseEntity<PagingSortingErrorResponse> exceptionHandler(Exception ex) {
PagingSortingErrorResponse pagingSortingErrorResponse = new PagingSortingErrorResponse();
pagingSortingErrorResponse.setErrorCode(HttpStatus.PRECONDITION_FAILED.value());
pagingSortingErrorResponse.setMessage(ex.getMessage());
return new ResponseEntity<PagingSortingErrorResponse>(pagingSortingErrorResponse, HttpStatus.OK);
}
}
| [
"[email protected]"
] | |
3790392a28e5fa54c5f34073f9c9005c7aad41dc | 369195370a8a37d963dbc8ac3c3b60e1e6b14f79 | /src/main/java/com/ali/entity/DynamicAnalysisOptionModel.java | 14eb9a2ca530f7d766b3c2ab811702a594c3dbd1 | [] | no_license | AliZhang999/springboot-beetlsql | a735866696414e1efcca4f1e953b9df1ca85df33 | 767f62dcceb08e00f7d0c340c6740b842c52be53 | refs/heads/master | 2020-04-02T17:24:21.805820 | 2018-12-03T01:30:53 | 2018-12-03T01:30:53 | 154,656,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | /**
*
*/
package com.ali.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 动态分析选项。
*
* @author qqwer
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DynamicAnalysisOptionModel {
private int startYear;
private int endYear;
// 选项,对应页面的学科
private List<Option> options;
// 指标组
private List<IndicationModel> indications;
}
| [
"[email protected]"
] | |
64c0a6a67599beaa266f5fbbe41d742c9c181df8 | 652b2842d281b98f06170545cd3af9b49bc65849 | /java-basic/src/main/java/basic/netty/ServerTest.java | 5d4fa99dbdb36e7769cd671bdb4b5d5f6cb7c83f | [] | no_license | LUCKYZHOUSTAR/JAVA-repository | bc55d028252eb2588c69f0ae921dd229fe4f4f38 | fb7538db24b0f35a05101d8932d77db0dd297389 | refs/heads/master | 2022-12-27T06:59:43.700820 | 2020-05-28T02:44:47 | 2020-05-28T02:44:47 | 110,965,806 | 1 | 1 | null | 2022-12-16T10:40:41 | 2017-11-16T11:56:07 | Java | UTF-8 | Java | false | false | 1,768 | java | package basic.netty;
import basic.netty.client.Client;
import basic.netty.client.DefaultClient;
import basic.netty.data.Request;
import basic.netty.server.DefaultConsumereProcessor;
import basic.netty.server.Server;
import basic.netty.server.ServerImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Author:chaoqiang.zhou
* @Description:
* @Date:Create in 15:33 2017/11/28
*/
public class ServerTest {
private static Map<String, String> map = new ConcurrentHashMap<>();
public static void main(String[] args) {
Server server = new ServerImpl(new DefaultConsumereProcessor());
Client client = new DefaultClient(server);
List<Request> requestList = new ArrayList();
for (int i = 0; i < 100; i++) {
Request request2 = new Request();
request2.setBody("我是测试的" + i);
requestList.add(request2);
}
// try {
requestList.forEach(data -> {
try {
Request result1 = (Request) client.invoke(data);
System.out.println(result1.getBody());
} catch (Throwable e) {
}
});
// for (int i = 0; i < 100; i++) {
//
// }
// Request result1 = (Request) client.invoke(request2);
// System.out.println(result1);
// System.out.println(InvokerResult.future.hashCode());
// InvokerResult<Request> future = InvokerResult.future.remove(request2.getId());
// Request result = future.getResult();
// System.out.println(result.getBody());
// } catch (Throwable e) {
// System.out.println(e);
// }
}
}
| [
"[email protected]"
] | |
ec18194788caa27a48b39b1502a6e3dab4cd3e2c | e6f149aa5bc647288e47ccc735ba465417eae535 | /JavaEE/spring-data/11-spring-data-jpa-asscociation-oneToMany/src/com/foureverhh/pojo/Student.java | 3ca3f824a9a7280b54908f1efaea87894c7a46ee | [] | no_license | foureverhh/PluralSightJavaPath | d90495af8431012054f87409621acaba63b1cf19 | a418bda6638efc640617f1fab4f48602ff54aedb | refs/heads/master | 2022-12-17T22:35:46.862044 | 2020-10-01T07:54:51 | 2020-10-01T07:54:51 | 186,674,112 | 0 | 0 | null | 2022-11-16T01:49:38 | 2019-05-14T18:00:39 | Java | UTF-8 | Java | false | false | 1,112 | java | package com.foureverhh.pojo;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name="t_user")
public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "user_id")
//strategy = GenerationType.IDENTITY 表示id自增长
private Integer id;
@Column(name = "user_name")
private String name;
@Column(name = "user_age")
private Integer age;
@OneToOne(cascade = CascadeType.PERSIST) //级联操作
@JoinColumn(name = "role_id") //JoinColumn 作用就是维护外键
private Role role;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
}
| [
"[email protected]"
] | |
f54b283a642c258610454304a237db13b6386fcc | 451b9e603a9cc11d5488b21921b3a839059d1528 | /Selfie besteak/DailySelfie/app/src/main/java/course/examples/DailySelfie/RecordAdpater.java | a3b11aa6b20753ea3425a4533f232b8b97f0d67d | [] | no_license | garibere13/Android | 8d4c5813844edac02d664c31b96cd9a9c60c7ec3 | faa13e64040619be588ea11bb6b38413913458de | refs/heads/master | 2020-04-28T15:49:37.191414 | 2019-03-13T09:44:11 | 2019-03-13T09:44:11 | 175,390,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,751 | java | package course.examples.DailySelfie;
import android.content.Context;
import android.os.Environment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
public class RecordAdpater extends BaseAdapter {
private ArrayList<SelfieRecord> mRecordList = new ArrayList<SelfieRecord>();
private static LayoutInflater inflater = null;
private Context mContext;
public RecordAdpater(Context context) {
mContext = context;
inflater = LayoutInflater.from(mContext);
File storageDir = mContext.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
if (storageDir != null) {
File[] selfies = storageDir.listFiles(new FilenameFilter() {
//@Override
public boolean accept(File file, String name) {
return name.endsWith(".jpg");
}
});
for (File file : selfies) {
SelfieRecord selfieRecord = new SelfieRecord(file.getAbsolutePath(), file.getName());
mRecordList.add(selfieRecord);
}
}
}
public int getCount() {
return mRecordList.size();
}
public Object getItem(int position) {
return mRecordList.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View newView = convertView;
final SelfieRecordView selfieRecordView;
final SelfieRecord currentRecord = mRecordList.get(position);
if (null == convertView) {
selfieRecordView = new SelfieRecordView();
newView = inflater.inflate(R.layout.selfie_listitem, parent, false);
selfieRecordView.checkBoxSelected = (CheckBox) newView.findViewById(R.id.checkbox_selected);
selfieRecordView.thumbnail = (ImageView) newView.findViewById(R.id.thumbnail);
selfieRecordView.selfieDate = (TextView) newView.findViewById(R.id.selfie_date);
newView.setTag(selfieRecordView);
}
else {
selfieRecordView = (SelfieRecordView) newView.getTag();
}
selfieRecordView.checkBoxSelected.setChecked(currentRecord.getSelected());
selfieRecordView.checkBoxSelected.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
//@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
currentRecord.setSelected(isChecked);
}
});
ImageHelper.setImageFromFilePath(currentRecord.getPath(), selfieRecordView.thumbnail);
selfieRecordView.selfieDate.setText(currentRecord.getDisplayName());
return newView;
}
static class SelfieRecordView {
CheckBox checkBoxSelected;
ImageView thumbnail;
TextView selfieDate;
}
public void add(SelfieRecord selfieRecord) {
mRecordList.add(selfieRecord);
notifyDataSetChanged();
}
public ArrayList<SelfieRecord> getAllRecords() {
return mRecordList;
}
public ArrayList<SelfieRecord> getSelectedRecords() {
ArrayList<SelfieRecord> mSelectedRecordList = new ArrayList<SelfieRecord>();
for (SelfieRecord record : mRecordList) {
if (record.getSelected()) {
mSelectedRecordList.add(record);
}
}
return mSelectedRecordList;
}
}
| [
"[email protected]"
] | |
d40bebd00d070f7e98a2cdfdfa481036b5957252 | b5eef99e3f71a7a9ae6ada5ead912817cd734355 | /src/main/java/Aldo/App.java | 9bc7bba578befe7b5224a9664179ccb3c1c5d9f8 | [] | no_license | Aldo-A/FirstObjectsDemo | 0c04a6486f629ad45608b43f863af805453c7fa2 | c0d4c294f9c330f2541398501a5742f60ad25569 | refs/heads/master | 2022-12-27T18:19:11.882527 | 2020-06-05T18:41:29 | 2020-06-05T18:41:29 | 269,740,728 | 0 | 0 | null | 2020-10-13T22:35:46 | 2020-06-05T18:43:58 | Java | UTF-8 | Java | false | false | 285 | java | package Aldo;
/**
* Hello world!
*/
public final class App {
private App() {
}
/**
* Says hello to the world.
* @param args The arguments of the program.
*/
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
| [
"[email protected]"
] | |
fd16a9047de78eec656e88c0bd54cb64fed670a8 | 219f4c708d653fe0f0a8722fcaa5e313498be434 | /components/adaptors/event-output-adaptor/org.wso2.carbon.event.output.adaptor.rdbms/src/main/java/org/wso2/carbon/event/output/adaptor/rdbms/internal/jaxbMappings/Element.java | 6d081efedbcd4e4fad665760a31bdb0e10ef1302 | [
"Apache-2.0"
] | permissive | isuruf/carbon-event-processing | 4709d0224d9c5eae0dccc81d8a177540be48776b | 6e3660647451ea8e69eb1bae5117aa385e411691 | refs/heads/master | 2020-12-25T16:13:27.077109 | 2015-03-10T12:30:25 | 2015-03-10T12:30:25 | 31,959,140 | 0 | 1 | null | 2015-03-10T13:32:57 | 2015-03-10T13:32:57 | null | UTF-8 | Java | false | false | 1,415 | java | /*
* Copyright (c) 2014-2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.event.output.adaptor.rdbms.internal.jaxbMappings;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
/**
* Contain key value pair of a element eg: key- String value- VARCHAR
*/
@XmlAccessorType(XmlAccessType.NONE)
public class Element {
private String key;
private String value;
public String getKey() {
return key;
}
@XmlAttribute
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
@XmlValue
public void setValue(String value) {
this.value = value;
}
}
| [
"damith@damith-Latitude-E6540"
] | damith@damith-Latitude-E6540 |
8931bde194c5b24aacfcbb954bddd840fa4eb78a | db335184867db96711235a261d8f771f7bbe4a62 | /java/src/main/java/com/ly/java/javanio/c05selector/ClientWorker.java | e1823531e1b30965570505522c98fdc46181e5b7 | [
"MIT"
] | permissive | liyong299/normal | 91f3b5dd346c7a838c8fb8922833b3ea8b6ff0a6 | 97d7df786b720bacdba7329c35062aff3e6afb60 | refs/heads/master | 2020-05-21T04:47:38.732764 | 2017-05-09T15:13:45 | 2017-05-09T15:13:45 | 50,655,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,665 | java | package com.ly.java.javanio.c05selector;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Set;
public class ClientWorker implements Runnable {
private Selector selector;
private Charset charset;
public ClientWorker(Selector selector, Charset charset)
{
this.selector = selector;
this.charset = charset;
}
public void run() {
try
{
while(true)
{
int readyChannels = selector.select();
if (readyChannels == 0) continue;
Set<SelectionKey> set = selector.selectedKeys();
Iterator<SelectionKey> iterator = set.iterator();
while (iterator.hasNext())
{
SelectionKey selectionKey = iterator.next();
iterator.remove();
handlerKey(selectionKey);
}
}
}
catch(IOException ex)
{
ex.printStackTrace();
}
}
private void handlerKey(SelectionKey selectionKey) throws IOException {
if (selectionKey.isReadable())
{
// ????NIO????Channel????????????????????????selectionKey??????????????????SocketChannel
// ??????????????????????????
SocketChannel sc = (SocketChannel) selectionKey.channel();
ByteBuffer readBuffer = ByteBuffer.allocate(4096);
String content = "";
while (sc.read(readBuffer) > 0)
{
readBuffer.flip();
content = content + charset.decode(readBuffer);
}
System.out.println("?????????? " + content);
selectionKey.interestOps(SelectionKey.OP_READ);
}
}
}
| [
"[email protected]"
] | |
197d93cc88c75b74e0e3b1052196531a82d411b9 | b60988bbb6d45ea3732c62b9bc4b7f726fa91f4a | /JSPTutorial/src/com/company/java/UserRegistration.java | e3f309b9604f9ab719cba84018e78370078da4b6 | [] | no_license | purnamagar89/JSP-Servlets | 2f98296906bad1c8b8616cd1a38d0a192a328c63 | 985cec82c7677ffe6ab2d2b5331d5aae973eda64 | refs/heads/master | 2021-01-18T18:16:03.877552 | 2017-06-12T20:31:26 | 2017-06-12T20:31:26 | 86,852,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package com.company.java;
public class UserRegistration {
private String firstname, lastname;
private int id, age;
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
| [
"[email protected]"
] | |
92d2cd6c0f8583b63a0c598d13bae1bfb10df32c | c97477e4acfce7320bbf983f13cc3c023d7a9940 | /src/main/java/top/zbsong/community/model/UserExample.java | ae2b8e3e3a5bd03530a0dcd41f67e8aad9496346 | [] | no_license | songzblink/community | 851ef9f67ed55ce462522d03d7dfea829562f03f | 0819e4e0c899c96816c74a4315776483590680a5 | refs/heads/main | 2023-04-18T19:07:49.120705 | 2021-05-06T13:08:17 | 2021-05-06T13:08:17 | 360,192,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,888 | java | package top.zbsong.community.model;
import java.util.ArrayList;
import java.util.List;
public class UserExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public UserExample() {
oredCriteria = new ArrayList<>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("ID is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("ID is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("ID =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("ID <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("ID >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("ID >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("ID <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("ID <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("ID in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("ID not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("ID between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("ID not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andAccountIdIsNull() {
addCriterion("ACCOUNT_ID is null");
return (Criteria) this;
}
public Criteria andAccountIdIsNotNull() {
addCriterion("ACCOUNT_ID is not null");
return (Criteria) this;
}
public Criteria andAccountIdEqualTo(String value) {
addCriterion("ACCOUNT_ID =", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdNotEqualTo(String value) {
addCriterion("ACCOUNT_ID <>", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdGreaterThan(String value) {
addCriterion("ACCOUNT_ID >", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdGreaterThanOrEqualTo(String value) {
addCriterion("ACCOUNT_ID >=", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdLessThan(String value) {
addCriterion("ACCOUNT_ID <", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdLessThanOrEqualTo(String value) {
addCriterion("ACCOUNT_ID <=", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdLike(String value) {
addCriterion("ACCOUNT_ID like", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdNotLike(String value) {
addCriterion("ACCOUNT_ID not like", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdIn(List<String> values) {
addCriterion("ACCOUNT_ID in", values, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdNotIn(List<String> values) {
addCriterion("ACCOUNT_ID not in", values, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdBetween(String value1, String value2) {
addCriterion("ACCOUNT_ID between", value1, value2, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdNotBetween(String value1, String value2) {
addCriterion("ACCOUNT_ID not between", value1, value2, "accountId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("NAME is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("NAME is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("NAME =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("NAME <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("NAME >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("NAME >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("NAME <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("NAME <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("NAME like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("NAME not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("NAME in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("NAME not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("NAME between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("NAME not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andTokenIsNull() {
addCriterion("TOKEN is null");
return (Criteria) this;
}
public Criteria andTokenIsNotNull() {
addCriterion("TOKEN is not null");
return (Criteria) this;
}
public Criteria andTokenEqualTo(String value) {
addCriterion("TOKEN =", value, "token");
return (Criteria) this;
}
public Criteria andTokenNotEqualTo(String value) {
addCriterion("TOKEN <>", value, "token");
return (Criteria) this;
}
public Criteria andTokenGreaterThan(String value) {
addCriterion("TOKEN >", value, "token");
return (Criteria) this;
}
public Criteria andTokenGreaterThanOrEqualTo(String value) {
addCriterion("TOKEN >=", value, "token");
return (Criteria) this;
}
public Criteria andTokenLessThan(String value) {
addCriterion("TOKEN <", value, "token");
return (Criteria) this;
}
public Criteria andTokenLessThanOrEqualTo(String value) {
addCriterion("TOKEN <=", value, "token");
return (Criteria) this;
}
public Criteria andTokenLike(String value) {
addCriterion("TOKEN like", value, "token");
return (Criteria) this;
}
public Criteria andTokenNotLike(String value) {
addCriterion("TOKEN not like", value, "token");
return (Criteria) this;
}
public Criteria andTokenIn(List<String> values) {
addCriterion("TOKEN in", values, "token");
return (Criteria) this;
}
public Criteria andTokenNotIn(List<String> values) {
addCriterion("TOKEN not in", values, "token");
return (Criteria) this;
}
public Criteria andTokenBetween(String value1, String value2) {
addCriterion("TOKEN between", value1, value2, "token");
return (Criteria) this;
}
public Criteria andTokenNotBetween(String value1, String value2) {
addCriterion("TOKEN not between", value1, value2, "token");
return (Criteria) this;
}
public Criteria andGmtCreateIsNull() {
addCriterion("GMT_CREATE is null");
return (Criteria) this;
}
public Criteria andGmtCreateIsNotNull() {
addCriterion("GMT_CREATE is not null");
return (Criteria) this;
}
public Criteria andGmtCreateEqualTo(Long value) {
addCriterion("GMT_CREATE =", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotEqualTo(Long value) {
addCriterion("GMT_CREATE <>", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateGreaterThan(Long value) {
addCriterion("GMT_CREATE >", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateGreaterThanOrEqualTo(Long value) {
addCriterion("GMT_CREATE >=", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateLessThan(Long value) {
addCriterion("GMT_CREATE <", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateLessThanOrEqualTo(Long value) {
addCriterion("GMT_CREATE <=", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateIn(List<Long> values) {
addCriterion("GMT_CREATE in", values, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotIn(List<Long> values) {
addCriterion("GMT_CREATE not in", values, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateBetween(Long value1, Long value2) {
addCriterion("GMT_CREATE between", value1, value2, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotBetween(Long value1, Long value2) {
addCriterion("GMT_CREATE not between", value1, value2, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtModifiedIsNull() {
addCriterion("GMT_MODIFIED is null");
return (Criteria) this;
}
public Criteria andGmtModifiedIsNotNull() {
addCriterion("GMT_MODIFIED is not null");
return (Criteria) this;
}
public Criteria andGmtModifiedEqualTo(Long value) {
addCriterion("GMT_MODIFIED =", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotEqualTo(Long value) {
addCriterion("GMT_MODIFIED <>", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedGreaterThan(Long value) {
addCriterion("GMT_MODIFIED >", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedGreaterThanOrEqualTo(Long value) {
addCriterion("GMT_MODIFIED >=", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedLessThan(Long value) {
addCriterion("GMT_MODIFIED <", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedLessThanOrEqualTo(Long value) {
addCriterion("GMT_MODIFIED <=", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedIn(List<Long> values) {
addCriterion("GMT_MODIFIED in", values, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotIn(List<Long> values) {
addCriterion("GMT_MODIFIED not in", values, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedBetween(Long value1, Long value2) {
addCriterion("GMT_MODIFIED between", value1, value2, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotBetween(Long value1, Long value2) {
addCriterion("GMT_MODIFIED not between", value1, value2, "gmtModified");
return (Criteria) this;
}
public Criteria andBioIsNull() {
addCriterion("BIO is null");
return (Criteria) this;
}
public Criteria andBioIsNotNull() {
addCriterion("BIO is not null");
return (Criteria) this;
}
public Criteria andBioEqualTo(String value) {
addCriterion("BIO =", value, "bio");
return (Criteria) this;
}
public Criteria andBioNotEqualTo(String value) {
addCriterion("BIO <>", value, "bio");
return (Criteria) this;
}
public Criteria andBioGreaterThan(String value) {
addCriterion("BIO >", value, "bio");
return (Criteria) this;
}
public Criteria andBioGreaterThanOrEqualTo(String value) {
addCriterion("BIO >=", value, "bio");
return (Criteria) this;
}
public Criteria andBioLessThan(String value) {
addCriterion("BIO <", value, "bio");
return (Criteria) this;
}
public Criteria andBioLessThanOrEqualTo(String value) {
addCriterion("BIO <=", value, "bio");
return (Criteria) this;
}
public Criteria andBioLike(String value) {
addCriterion("BIO like", value, "bio");
return (Criteria) this;
}
public Criteria andBioNotLike(String value) {
addCriterion("BIO not like", value, "bio");
return (Criteria) this;
}
public Criteria andBioIn(List<String> values) {
addCriterion("BIO in", values, "bio");
return (Criteria) this;
}
public Criteria andBioNotIn(List<String> values) {
addCriterion("BIO not in", values, "bio");
return (Criteria) this;
}
public Criteria andBioBetween(String value1, String value2) {
addCriterion("BIO between", value1, value2, "bio");
return (Criteria) this;
}
public Criteria andBioNotBetween(String value1, String value2) {
addCriterion("BIO not between", value1, value2, "bio");
return (Criteria) this;
}
public Criteria andAvatarUrlIsNull() {
addCriterion("AVATAR_URL is null");
return (Criteria) this;
}
public Criteria andAvatarUrlIsNotNull() {
addCriterion("AVATAR_URL is not null");
return (Criteria) this;
}
public Criteria andAvatarUrlEqualTo(String value) {
addCriterion("AVATAR_URL =", value, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlNotEqualTo(String value) {
addCriterion("AVATAR_URL <>", value, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlGreaterThan(String value) {
addCriterion("AVATAR_URL >", value, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlGreaterThanOrEqualTo(String value) {
addCriterion("AVATAR_URL >=", value, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlLessThan(String value) {
addCriterion("AVATAR_URL <", value, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlLessThanOrEqualTo(String value) {
addCriterion("AVATAR_URL <=", value, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlLike(String value) {
addCriterion("AVATAR_URL like", value, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlNotLike(String value) {
addCriterion("AVATAR_URL not like", value, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlIn(List<String> values) {
addCriterion("AVATAR_URL in", values, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlNotIn(List<String> values) {
addCriterion("AVATAR_URL not in", values, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlBetween(String value1, String value2) {
addCriterion("AVATAR_URL between", value1, value2, "avatarUrl");
return (Criteria) this;
}
public Criteria andAvatarUrlNotBetween(String value1, String value2) {
addCriterion("AVATAR_URL not between", value1, value2, "avatarUrl");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table USER
*
* @mbg.generated do_not_delete_during_merge Fri Apr 30 14:30:34 CST 2021
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table USER
*
* @mbg.generated Fri Apr 30 14:30:34 CST 2021
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
400ba1dd548282f6b7e2d8f898157c73d3de89fd | 1bee3a7f6e9d5bd26a65c0aa8cfd4440e0f449f3 | /sm-core-model/src/main/java/com/salesmanager/core/model/catalog/catalog/CatalogEntry.java | d26d8a7c59478a21d1382c403b8c3d86f4b7a95f | [] | permissive | msadiqh/shopizer | 112ce2eff91650764261adbd3721169368aac18c | e246e6655e0eb5bbb596c0d6cd46dc4237d613bc | refs/heads/master | 2022-10-17T08:40:59.838170 | 2020-07-23T11:58:26 | 2020-07-23T11:58:26 | 248,799,644 | 0 | 4 | Apache-2.0 | 2020-03-29T10:22:30 | 2020-03-20T16:16:06 | Java | UTF-8 | Java | false | false | 3,003 | java | package com.salesmanager.core.model.catalog.catalog;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import com.salesmanager.core.constants.SchemaConstant;
import com.salesmanager.core.model.catalog.category.Category;
import com.salesmanager.core.model.catalog.product.Product;
import com.salesmanager.core.model.common.audit.AuditSection;
import com.salesmanager.core.model.common.audit.Auditable;
import com.salesmanager.core.model.generic.SalesManagerEntity;
@Entity
@EntityListeners(value = com.salesmanager.core.model.common.audit.AuditListener.class)
@Table(name = "CATALOG_ENTRY", schema= SchemaConstant.SALESMANAGER_SCHEMA,uniqueConstraints=
@UniqueConstraint(columnNames = {"PRODUCT_ID", "CATEGORY_ID", "CATALOG_ID"}) )
public class CatalogEntry extends SalesManagerEntity<Long, CatalogEntry> implements Auditable {
@Embedded
private AuditSection auditSection = new AuditSection();
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.TABLE,
generator = "TABLE_GEN")
@TableGenerator(name = "TABLE_GEN",
table = "SM_SEQUENCER",
pkColumnName = "SEQ_NAME",
valueColumnName = "SEQ_COUNT",
allocationSize = SchemaConstant.DESCRIPTION_ID_ALLOCATION_SIZE,
initialValue = SchemaConstant.DESCRIPTION_ID_START_VALUE,
pkColumnValue = "CATALOG_ENT_SEQ_NEXT_VAL")
private Long id;
@ManyToOne
@JoinColumn(name = "PRODUCT_ID", nullable = false)
Product product;
@ManyToOne
@JoinColumn(name = "CATEGORY_ID", nullable = false)
Category category;
@ManyToOne
@JoinColumn(name = "CATALOG_ID", nullable = false)
private Catalog catalog;
@Column(name = "VISIBLE")
private boolean visible;
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public Catalog getCatalog() {
return catalog;
}
public void setCatalog(Catalog catalog) {
this.catalog = catalog;
}
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
@Override
public AuditSection getAuditSection() {
return auditSection;
}
@Override
public void setAuditSection(AuditSection audit) {
auditSection = audit;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
}
| [
"[email protected]"
] | |
2f2f3e634d4e1b15ef2691d9d3b0dacf8455f0ef | 7d028779c0fdf6db87b2f7f84e98c2eb9f4de72f | /packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java | b5caeef8e8cee5192de4417bccc6642354fec1d2 | [
"Apache-2.0",
"LicenseRef-scancode-unicode"
] | permissive | varund7726/android_frameworks_base | 51304ed27878ddbff402906811747f36dfda134c | 64ee33edcb1bae9d9eebb3344a6b7d732421932f | refs/heads/lollipop | 2021-10-05T02:12:31.991173 | 2015-03-29T03:29:18 | 2015-03-29T22:37:41 | 255,089,388 | 0 | 1 | NOASSERTION | 2020-04-12T13:34:15 | 2020-04-12T13:34:15 | null | UTF-8 | Java | false | false | 33,361 | java | /*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.screenshot;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.Notification;
import android.app.Notification.BigPictureStyle;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.PointF;
import android.media.MediaActionSound;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Environment;
import android.os.Process;
import android.provider.MediaStore;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Interpolator;
import android.widget.ImageView;
import android.provider.Settings;
import com.android.systemui.R;
import com.android.systemui.screenshot.DeleteScreenshot;
import java.io.File;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* POD used in the AsyncTask which saves an image in the background.
*/
class SaveImageInBackgroundData {
Context context;
Bitmap image;
Uri imageUri;
Runnable finisher;
int iconSize;
int result;
int previewWidth;
int previewheight;
void clearImage() {
image = null;
imageUri = null;
iconSize = 0;
}
void clearContext() {
context = null;
}
}
/**
* An AsyncTask that saves an image to the media store in the background.
*/
class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Void,
SaveImageInBackgroundData> {
private static final String TAG = "SaveImageInBackgroundTask";
private static final String SCREENSHOTS_DIR_NAME = "Screenshots";
private static final String SCREENSHOT_FILE_NAME_TEMPLATE = "Screenshot_%s.png";
private static final String SCREENSHOT_SHARE_SUBJECT_TEMPLATE = "Screenshot (%s)";
private final int mNotificationId;
private final NotificationManager mNotificationManager;
private final Notification.Builder mNotificationBuilder, mPublicNotificationBuilder;
private final File mScreenshotDir;
private final String mImageFileName;
private final String mImageFilePath;
private final long mImageTime;
private final BigPictureStyle mNotificationStyle;
private final int mImageWidth;
private final int mImageHeight;
// WORKAROUND: We want the same notification across screenshots that we update so that we don't
// spam a user's notification drawer. However, we only show the ticker for the saving state
// and if the ticker text is the same as the previous notification, then it will not show. So
// for now, we just add and remove a space from the ticker text to trigger the animation when
// necessary.
private static boolean mTickerAddSpace;
SaveImageInBackgroundTask(Context context, SaveImageInBackgroundData data,
NotificationManager nManager, int nId) {
Resources r = context.getResources();
// Prepare all the output metadata
mImageTime = System.currentTimeMillis();
String imageDate = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date(mImageTime));
mImageFileName = String.format(SCREENSHOT_FILE_NAME_TEMPLATE, imageDate);
mScreenshotDir = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), SCREENSHOTS_DIR_NAME);
mImageFilePath = new File(mScreenshotDir, mImageFileName).getAbsolutePath();
// Create the large notification icon
mImageWidth = data.image.getWidth();
mImageHeight = data.image.getHeight();
int iconSize = data.iconSize;
int previewWidth = data.previewWidth;
int previewHeight = data.previewheight;
final int shortSide = mImageWidth < mImageHeight ? mImageWidth : mImageHeight;
Bitmap preview = Bitmap.createBitmap(previewWidth, previewHeight, data.image.getConfig());
Canvas c = new Canvas(preview);
Paint paint = new Paint();
ColorMatrix desat = new ColorMatrix();
desat.setSaturation(0.25f);
paint.setColorFilter(new ColorMatrixColorFilter(desat));
Matrix matrix = new Matrix();
matrix.postTranslate((previewWidth - mImageWidth) / 2,
(previewHeight - mImageHeight) / 2);
c.drawBitmap(data.image, matrix, paint);
c.drawColor(0x40FFFFFF);
c.setBitmap(null);
Bitmap croppedIcon = Bitmap.createScaledBitmap(preview, iconSize, iconSize, true);
// Show the intermediate notification
mTickerAddSpace = !mTickerAddSpace;
mNotificationId = nId;
mNotificationManager = nManager;
final long now = System.currentTimeMillis();
mNotificationBuilder = new Notification.Builder(context)
.setTicker(r.getString(R.string.screenshot_saving_ticker)
+ (mTickerAddSpace ? " " : ""))
.setContentTitle(r.getString(R.string.screenshot_saving_title))
.setContentText(r.getString(R.string.screenshot_saving_text))
.setSmallIcon(R.drawable.stat_notify_image)
.setWhen(now)
.setColor(r.getColor(com.android.internal.R.color.system_notification_accent_color));
mNotificationStyle = new Notification.BigPictureStyle()
.bigPicture(preview);
mNotificationBuilder.setStyle(mNotificationStyle);
// For "public" situations we want to show all the same info but
// omit the actual screenshot image.
mPublicNotificationBuilder = new Notification.Builder(context)
.setContentTitle(r.getString(R.string.screenshot_saving_title))
.setContentText(r.getString(R.string.screenshot_saving_text))
.setSmallIcon(R.drawable.stat_notify_image)
.setCategory(Notification.CATEGORY_PROGRESS)
.setWhen(now)
.setColor(r.getColor(
com.android.internal.R.color.system_notification_accent_color));
mNotificationBuilder.setPublicVersion(mPublicNotificationBuilder.build());
Notification n = mNotificationBuilder.build();
n.flags |= Notification.FLAG_NO_CLEAR;
mNotificationManager.notify(nId, n);
// On the tablet, the large icon makes the notification appear as if it is clickable (and
// on small devices, the large icon is not shown) so defer showing the large icon until
// we compose the final post-save notification below.
mNotificationBuilder.setLargeIcon(croppedIcon);
// But we still don't set it for the expanded view, allowing the smallIcon to show here.
mNotificationStyle.bigLargeIcon(null);
}
@Override
protected SaveImageInBackgroundData doInBackground(SaveImageInBackgroundData... params) {
if (params.length != 1) return null;
if (isCancelled()) {
params[0].clearImage();
params[0].clearContext();
return null;
}
// By default, AsyncTask sets the worker thread to have background thread priority, so bump
// it back up so that we save a little quicker.
Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
Context context = params[0].context;
Bitmap image = params[0].image;
Resources r = context.getResources();
try {
// Create screenshot directory if it doesn't exist
mScreenshotDir.mkdirs();
// media provider uses seconds for DATE_MODIFIED and DATE_ADDED, but milliseconds
// for DATE_TAKEN
long dateSeconds = mImageTime / 1000;
// Save the screenshot to the MediaStore
ContentValues values = new ContentValues();
ContentResolver resolver = context.getContentResolver();
values.put(MediaStore.Images.ImageColumns.DATA, mImageFilePath);
values.put(MediaStore.Images.ImageColumns.TITLE, mImageFileName);
values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME, mImageFileName);
values.put(MediaStore.Images.ImageColumns.DATE_TAKEN, mImageTime);
values.put(MediaStore.Images.ImageColumns.DATE_ADDED, dateSeconds);
values.put(MediaStore.Images.ImageColumns.DATE_MODIFIED, dateSeconds);
values.put(MediaStore.Images.ImageColumns.MIME_TYPE, "image/png");
values.put(MediaStore.Images.ImageColumns.WIDTH, mImageWidth);
values.put(MediaStore.Images.ImageColumns.HEIGHT, mImageHeight);
Uri uri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
String subjectDate = DateFormat.getDateTimeInstance().format(new Date(mImageTime));
String subject = String.format(SCREENSHOT_SHARE_SUBJECT_TEMPLATE, subjectDate);
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("image/png");
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
Intent chooserIntent = Intent.createChooser(sharingIntent, null);
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NEW_TASK);
mNotificationBuilder.addAction(R.drawable.ic_menu_share,
r.getString(com.android.internal.R.string.share),
PendingIntent.getActivity(context, 0, chooserIntent,
PendingIntent.FLAG_CANCEL_CURRENT));
Intent deleteIntent = new Intent();
deleteIntent.setClass(context, DeleteScreenshot.class);
deleteIntent.putExtra(DeleteScreenshot.SCREENSHOT_URI, uri.toString());
mNotificationBuilder.addAction(R.drawable.ic_menu_delete,
r.getString(R.string.screenshot_delete_action),
PendingIntent.getBroadcast(context, 0, deleteIntent,
PendingIntent.FLAG_CANCEL_CURRENT));
OutputStream out = resolver.openOutputStream(uri);
image.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
out.close();
// update file size in the database
values.clear();
values.put(MediaStore.Images.ImageColumns.SIZE, new File(mImageFilePath).length());
resolver.update(uri, values, null, null);
params[0].imageUri = uri;
params[0].image = null;
params[0].result = 0;
} catch (Exception e) {
// IOException/UnsupportedOperationException may be thrown if external storage is not
// mounted
params[0].clearImage();
params[0].result = 1;
}
// Recycle the bitmap data
if (image != null) {
image.recycle();
}
return params[0];
}
@Override
protected void onPostExecute(SaveImageInBackgroundData params) {
if (isCancelled()) {
params.finisher.run();
params.clearImage();
params.clearContext();
return;
}
if (params.result > 0) {
// Show a message that we've failed to save the image to disk
GlobalScreenshot.notifyScreenshotError(params.context, mNotificationManager);
} else {
// Show the final notification to indicate screenshot saved
Resources r = params.context.getResources();
// Create the intent to show the screenshot in gallery
Intent launchIntent = new Intent(Intent.ACTION_VIEW);
launchIntent.setDataAndType(params.imageUri, "image/png");
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
final long now = System.currentTimeMillis();
mNotificationBuilder
.setContentTitle(r.getString(R.string.screenshot_saved_title))
.setContentText(r.getString(R.string.screenshot_saved_text))
.setContentIntent(PendingIntent.getActivity(params.context, 0, launchIntent, 0))
.setWhen(now)
.setAutoCancel(true)
.setColor(r.getColor(
com.android.internal.R.color.system_notification_accent_color));;
// Update the text in the public version as well
mPublicNotificationBuilder
.setContentTitle(r.getString(R.string.screenshot_saved_title))
.setContentText(r.getString(R.string.screenshot_saved_text))
.setContentIntent(PendingIntent.getActivity(params.context, 0, launchIntent, 0))
.setWhen(now)
.setAutoCancel(true)
.setColor(r.getColor(
com.android.internal.R.color.system_notification_accent_color));
mNotificationBuilder.setPublicVersion(mPublicNotificationBuilder.build());
Notification n = mNotificationBuilder.build();
n.flags &= ~Notification.FLAG_NO_CLEAR;
mNotificationManager.notify(mNotificationId, n);
}
params.finisher.run();
params.clearContext();
}
}
/**
* TODO:
* - Performance when over gl surfaces? Ie. Gallery
* - what do we say in the Toast? Which icon do we get if the user uses another
* type of gallery?
*/
class GlobalScreenshot {
private static final String TAG = "GlobalScreenshot";
protected static final int SCREENSHOT_NOTIFICATION_ID = 789;
private static final int SCREENSHOT_FLASH_TO_PEAK_DURATION = 130;
private static final int SCREENSHOT_DROP_IN_DURATION = 430;
private static final int SCREENSHOT_DROP_OUT_DELAY = 500;
private static final int SCREENSHOT_DROP_OUT_DURATION = 430;
private static final int SCREENSHOT_DROP_OUT_SCALE_DURATION = 370;
private static final int SCREENSHOT_FAST_DROP_OUT_DURATION = 320;
private static final float BACKGROUND_ALPHA = 0.5f;
private static final float SCREENSHOT_SCALE = 1f;
private static final float SCREENSHOT_DROP_IN_MIN_SCALE = SCREENSHOT_SCALE * 0.725f;
private static final float SCREENSHOT_DROP_OUT_MIN_SCALE = SCREENSHOT_SCALE * 0.45f;
private static final float SCREENSHOT_FAST_DROP_OUT_MIN_SCALE = SCREENSHOT_SCALE * 0.6f;
private static final float SCREENSHOT_DROP_OUT_MIN_SCALE_OFFSET = 0f;
private final int mPreviewWidth;
private final int mPreviewHeight;
private Context mContext;
private WindowManager mWindowManager;
private WindowManager.LayoutParams mWindowLayoutParams;
private NotificationManager mNotificationManager;
private Display mDisplay;
private DisplayMetrics mDisplayMetrics;
private Matrix mDisplayMatrix;
private Bitmap mScreenBitmap;
private View mScreenshotLayout;
private ImageView mBackgroundView;
private ImageView mScreenshotView;
private ImageView mScreenshotFlash;
private AnimatorSet mScreenshotAnimation;
private int mNotificationIconSize;
private float mBgPadding;
private float mBgPaddingScale;
private AsyncTask<SaveImageInBackgroundData, Void, SaveImageInBackgroundData> mSaveInBgTask;
private MediaActionSound mCameraSound;
private final int mSfHwRotation;
/**
* @param context everything needs a context :(
*/
public GlobalScreenshot(Context context) {
Resources r = context.getResources();
mContext = context;
LayoutInflater layoutInflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// Inflate the screenshot layout
mDisplayMatrix = new Matrix();
mScreenshotLayout = layoutInflater.inflate(R.layout.global_screenshot, null);
mBackgroundView = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot_background);
mScreenshotView = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot);
mScreenshotFlash = (ImageView) mScreenshotLayout.findViewById(R.id.global_screenshot_flash);
mScreenshotLayout.setFocusable(true);
mScreenshotLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// Intercept and ignore all touch events
return true;
}
});
// Setup the window that we are going to use
mWindowLayoutParams = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0, 0,
WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_FULLSCREEN
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
PixelFormat.TRANSLUCENT);
mWindowLayoutParams.setTitle("ScreenshotAnimation");
mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
mNotificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mDisplay = mWindowManager.getDefaultDisplay();
mDisplayMetrics = new DisplayMetrics();
mDisplay.getRealMetrics(mDisplayMetrics);
// Get the various target sizes
mNotificationIconSize =
r.getDimensionPixelSize(android.R.dimen.notification_large_icon_height);
// Scale has to account for both sides of the bg
mBgPadding = (float) r.getDimensionPixelSize(R.dimen.global_screenshot_bg_padding);
mBgPaddingScale = mBgPadding / mDisplayMetrics.widthPixels;
// determine the optimal preview size
int panelWidth = 0;
try {
panelWidth = r.getDimensionPixelSize(R.dimen.notification_panel_width);
} catch (Resources.NotFoundException e) {
}
if (panelWidth <= 0) {
// includes notification_panel_width==match_parent (-1)
panelWidth = mDisplayMetrics.widthPixels;
}
mPreviewWidth = panelWidth;
mPreviewHeight = r.getDimensionPixelSize(R.dimen.notification_max_height);
// Setup the Camera shutter sound
mCameraSound = new MediaActionSound();
mCameraSound.load(MediaActionSound.SHUTTER_CLICK);
// Load hardware rotation from prop
mSfHwRotation = android.os.SystemProperties.getInt("ro.sf.hwrotation",0) / 90;
}
/**
* Creates a new worker thread and saves the screenshot to the media store.
*/
private void saveScreenshotInWorkerThread(Runnable finisher) {
SaveImageInBackgroundData data = new SaveImageInBackgroundData();
data.context = mContext;
data.image = mScreenBitmap;
data.iconSize = mNotificationIconSize;
data.finisher = finisher;
data.previewWidth = mPreviewWidth;
data.previewheight = mPreviewHeight;
if (mSaveInBgTask != null) {
mSaveInBgTask.cancel(false);
}
mSaveInBgTask = new SaveImageInBackgroundTask(mContext, data, mNotificationManager,
SCREENSHOT_NOTIFICATION_ID).execute(data);
}
/**
* @return the current display rotation in degrees
*/
private float getDegreesForRotation(int value) {
switch (value) {
case Surface.ROTATION_90:
return 360f - 90f;
case Surface.ROTATION_180:
return 360f - 180f;
case Surface.ROTATION_270:
return 360f - 270f;
}
return 0f;
}
/**
* Takes a screenshot of the current display and shows an animation.
*/
void takeScreenshot(Runnable finisher, boolean statusBarVisible, boolean navBarVisible) {
// We need to orient the screenshot correctly (and the Surface api seems to take screenshots
// only in the natural orientation of the device :!)
mDisplay.getRealMetrics(mDisplayMetrics);
float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels};
int rot = mDisplay.getRotation();
// Allow for abnormal hardware orientation
rot = (rot + mSfHwRotation) % 4;
float degrees = getDegreesForRotation(rot);
boolean requiresRotation = (degrees > 0);
if (requiresRotation) {
// Get the dimensions of the device in its native orientation
mDisplayMatrix.reset();
mDisplayMatrix.preRotate(-degrees);
mDisplayMatrix.mapPoints(dims);
dims[0] = Math.abs(dims[0]);
dims[1] = Math.abs(dims[1]);
}
// Take the screenshot
mScreenBitmap = SurfaceControl.screenshot((int) dims[0], (int) dims[1]);
if (mScreenBitmap == null) {
notifyScreenshotError(mContext, mNotificationManager);
finisher.run();
return;
}
Bitmap ss = Bitmap.createBitmap(mDisplayMetrics.widthPixels,
mDisplayMetrics.heightPixels, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(ss);
if (requiresRotation) {
// Rotate the screenshot to the current orientation
c.translate(ss.getWidth() / 2, ss.getHeight() / 2);
c.rotate(degrees);
c.translate(-dims[0] / 2, -dims[1] / 2);
}
c.drawBitmap(mScreenBitmap, 0, 0, null);
c.setBitmap(null);
// Recycle the previous bitmap
mScreenBitmap.recycle();
mScreenBitmap = ss;
// Optimizations
mScreenBitmap.setHasAlpha(false);
mScreenBitmap.prepareToDraw();
// Start the post-screenshot animation
startAnimation(finisher, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels,
statusBarVisible, navBarVisible);
}
/**
* Starts the animation after taking the screenshot
*/
private void startAnimation(final Runnable finisher, int w, int h, boolean statusBarVisible,
boolean navBarVisible) {
// Add the view for the animation
mScreenshotView.setImageBitmap(mScreenBitmap);
mScreenshotLayout.requestFocus();
// Setup the animation with the screenshot just taken
if (mScreenshotAnimation != null) {
mScreenshotAnimation.end();
mScreenshotAnimation.removeAllListeners();
}
mWindowManager.addView(mScreenshotLayout, mWindowLayoutParams);
ValueAnimator screenshotDropInAnim = createScreenshotDropInAnimation();
ValueAnimator screenshotFadeOutAnim = createScreenshotDropOutAnimation(w, h,
statusBarVisible, navBarVisible);
mScreenshotAnimation = new AnimatorSet();
mScreenshotAnimation.playSequentially(screenshotDropInAnim, screenshotFadeOutAnim);
mScreenshotAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// Save the screenshot once we have a bit of time now
saveScreenshotInWorkerThread(finisher);
mWindowManager.removeView(mScreenshotLayout);
// Clear any references to the bitmap
mScreenBitmap = null;
mScreenshotView.setImageBitmap(null);
}
});
mScreenshotLayout.post(new Runnable() {
@Override
public void run() {
// Play the shutter sound to notify that we've taken a screenshot
if (Settings.System.getInt(mContext.getContentResolver(),
Settings.System.SCREENSHOT_SOUND, 0) == 1)
mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mScreenshotView.buildLayer();
mScreenshotAnimation.start();
}
});
}
private ValueAnimator createScreenshotDropInAnimation() {
final float flashPeakDurationPct = ((float) (SCREENSHOT_FLASH_TO_PEAK_DURATION)
/ SCREENSHOT_DROP_IN_DURATION);
final float flashDurationPct = 2f * flashPeakDurationPct;
final Interpolator flashAlphaInterpolator = new Interpolator() {
@Override
public float getInterpolation(float x) {
// Flash the flash view in and out quickly
if (x <= flashDurationPct) {
return (float) Math.sin(Math.PI * (x / flashDurationPct));
}
return 0;
}
};
final Interpolator scaleInterpolator = new Interpolator() {
@Override
public float getInterpolation(float x) {
// We start scaling when the flash is at it's peak
if (x < flashPeakDurationPct) {
return 0;
}
return (x - flashDurationPct) / (1f - flashDurationPct);
}
};
ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
anim.setDuration(SCREENSHOT_DROP_IN_DURATION);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mBackgroundView.setAlpha(0f);
mBackgroundView.setVisibility(View.VISIBLE);
mScreenshotView.setAlpha(0f);
mScreenshotView.setTranslationX(0f);
mScreenshotView.setTranslationY(0f);
mScreenshotView.setScaleX(SCREENSHOT_SCALE + mBgPaddingScale);
mScreenshotView.setScaleY(SCREENSHOT_SCALE + mBgPaddingScale);
mScreenshotView.setVisibility(View.VISIBLE);
mScreenshotFlash.setAlpha(0f);
mScreenshotFlash.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(android.animation.Animator animation) {
mScreenshotFlash.setVisibility(View.GONE);
}
});
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float t = (Float) animation.getAnimatedValue();
float scaleT = (SCREENSHOT_SCALE + mBgPaddingScale)
- scaleInterpolator.getInterpolation(t)
* (SCREENSHOT_SCALE - SCREENSHOT_DROP_IN_MIN_SCALE);
mBackgroundView.setAlpha(scaleInterpolator.getInterpolation(t) * BACKGROUND_ALPHA);
mScreenshotView.setAlpha(t);
mScreenshotView.setScaleX(scaleT);
mScreenshotView.setScaleY(scaleT);
mScreenshotFlash.setAlpha(flashAlphaInterpolator.getInterpolation(t));
}
});
return anim;
}
private ValueAnimator createScreenshotDropOutAnimation(int w, int h, boolean statusBarVisible,
boolean navBarVisible) {
ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
anim.setStartDelay(SCREENSHOT_DROP_OUT_DELAY);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mBackgroundView.setVisibility(View.GONE);
mScreenshotView.setVisibility(View.GONE);
mScreenshotView.setLayerType(View.LAYER_TYPE_NONE, null);
}
});
if (!statusBarVisible || !navBarVisible) {
// There is no status bar/nav bar, so just fade the screenshot away in place
anim.setDuration(SCREENSHOT_FAST_DROP_OUT_DURATION);
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float t = (Float) animation.getAnimatedValue();
float scaleT = (SCREENSHOT_DROP_IN_MIN_SCALE + mBgPaddingScale)
- t * (SCREENSHOT_DROP_IN_MIN_SCALE - SCREENSHOT_FAST_DROP_OUT_MIN_SCALE);
mBackgroundView.setAlpha((1f - t) * BACKGROUND_ALPHA);
mScreenshotView.setAlpha(1f - t);
mScreenshotView.setScaleX(scaleT);
mScreenshotView.setScaleY(scaleT);
}
});
} else {
// In the case where there is a status bar, animate to the origin of the bar (top-left)
final float scaleDurationPct = (float) SCREENSHOT_DROP_OUT_SCALE_DURATION
/ SCREENSHOT_DROP_OUT_DURATION;
final Interpolator scaleInterpolator = new Interpolator() {
@Override
public float getInterpolation(float x) {
if (x < scaleDurationPct) {
// Decelerate, and scale the input accordingly
return (float) (1f - Math.pow(1f - (x / scaleDurationPct), 2f));
}
return 1f;
}
};
// Determine the bounds of how to scale
float halfScreenWidth = (w - 2f * mBgPadding) / 2f;
float halfScreenHeight = (h - 2f * mBgPadding) / 2f;
final float offsetPct = SCREENSHOT_DROP_OUT_MIN_SCALE_OFFSET;
final PointF finalPos = new PointF(
-halfScreenWidth + (SCREENSHOT_DROP_OUT_MIN_SCALE + offsetPct) * halfScreenWidth,
-halfScreenHeight + (SCREENSHOT_DROP_OUT_MIN_SCALE + offsetPct) * halfScreenHeight);
// Animate the screenshot to the status bar
anim.setDuration(SCREENSHOT_DROP_OUT_DURATION);
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float t = (Float) animation.getAnimatedValue();
float scaleT = (SCREENSHOT_DROP_IN_MIN_SCALE + mBgPaddingScale)
- scaleInterpolator.getInterpolation(t)
* (SCREENSHOT_DROP_IN_MIN_SCALE - SCREENSHOT_DROP_OUT_MIN_SCALE);
mBackgroundView.setAlpha((1f - t) * BACKGROUND_ALPHA);
mScreenshotView.setAlpha(1f - scaleInterpolator.getInterpolation(t));
mScreenshotView.setScaleX(scaleT);
mScreenshotView.setScaleY(scaleT);
mScreenshotView.setTranslationX(t * finalPos.x);
mScreenshotView.setTranslationY(t * finalPos.y);
}
});
}
return anim;
}
static void notifyScreenshotError(Context context, NotificationManager nManager) {
Resources r = context.getResources();
// Clear all existing notification, compose the new notification and show it
Notification.Builder b = new Notification.Builder(context)
.setTicker(r.getString(R.string.screenshot_failed_title))
.setContentTitle(r.getString(R.string.screenshot_failed_title))
.setContentText(r.getString(R.string.screenshot_failed_text))
.setSmallIcon(R.drawable.stat_notify_image_error)
.setWhen(System.currentTimeMillis())
.setVisibility(Notification.VISIBILITY_PUBLIC) // ok to show outside lockscreen
.setCategory(Notification.CATEGORY_ERROR)
.setAutoCancel(true)
.setColor(context.getResources().getColor(
com.android.internal.R.color.system_notification_accent_color));
Notification n =
new Notification.BigTextStyle(b)
.bigText(r.getString(R.string.screenshot_failed_text))
.build();
nManager.notify(SCREENSHOT_NOTIFICATION_ID, n);
}
}
| [
"[email protected]"
] | |
5e19ba3b035cbb61a85a6cfe1bd81aee5bc8995d | b261882ec11b2a17b9a4694bd9bad219d088dc41 | /hu.bme.eafi.linuxnetconf.diagram/src/linuxnetconf/diagram/navigator/LinuxnetconfDomainNavigatorLabelProvider.java | 51d33dc7c6bcffe8fcdbac0cd2dd06e5da7433c5 | [] | no_license | farkast21/linuxconfgenerator_eafi | c01a45994000a2d3d277bba280678e8c7c70a4ce | 3a01ada6c9f46fbbe3c3e2f25ad7fa1670450924 | refs/heads/master | 2021-01-13T01:30:22.271730 | 2011-12-13T01:31:18 | 2011-12-13T01:31:18 | 2,687,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,186 | java | package linuxnetconf.diagram.navigator;
import linuxnetconf.diagram.part.LinuxnetconfDiagramEditorPlugin;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
import org.eclipse.ui.navigator.ICommonLabelProvider;
/**
* @generated
*/
public class LinuxnetconfDomainNavigatorLabelProvider implements
ICommonLabelProvider {
/**
* @generated
*/
private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(
LinuxnetconfDiagramEditorPlugin.getInstance()
.getItemProvidersAdapterFactory());
/**
* @generated
*/
public void init(ICommonContentExtensionSite aConfig) {
}
/**
* @generated
*/
public Image getImage(Object element) {
if (element instanceof LinuxnetconfDomainNavigatorItem) {
return myAdapterFactoryLabelProvider
.getImage(((LinuxnetconfDomainNavigatorItem) element)
.getEObject());
}
return null;
}
/**
* @generated
*/
public String getText(Object element) {
if (element instanceof LinuxnetconfDomainNavigatorItem) {
return myAdapterFactoryLabelProvider
.getText(((LinuxnetconfDomainNavigatorItem) element)
.getEObject());
}
return null;
}
/**
* @generated
*/
public void addListener(ILabelProviderListener listener) {
myAdapterFactoryLabelProvider.addListener(listener);
}
/**
* @generated
*/
public void dispose() {
myAdapterFactoryLabelProvider.dispose();
}
/**
* @generated
*/
public boolean isLabelProperty(Object element, String property) {
return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
}
/**
* @generated
*/
public void removeListener(ILabelProviderListener listener) {
myAdapterFactoryLabelProvider.removeListener(listener);
}
/**
* @generated
*/
public void restoreState(IMemento aMemento) {
}
/**
* @generated
*/
public void saveState(IMemento aMemento) {
}
/**
* @generated
*/
public String getDescription(Object anElement) {
return null;
}
}
| [
"[email protected]"
] | |
77367b7ad73f925d43fd588ce80099dd08acfb13 | 44a799bd8fef694f6a24945fc5b3b5c885a3355e | /smbms/src/main/java/com/liang/dao/Role/RoleDao.java | 9ecb9caf584a31fc8d4dbec194374b6243334a75 | [] | no_license | alpcaca0v0/smbms | 48e63d6fe3e9870dbf5b5cc79d03e94fd7599064 | e312e9f31699b93d9989c996563269f5c479327f | refs/heads/main | 2023-07-07T16:56:08.442527 | 2021-08-26T02:57:33 | 2021-08-26T02:57:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package com.liang.dao.Role;
import com.liang.pojo.Role;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
public interface RoleDao {
//获取角色列表
public List<Role> getRoleList(Connection conn) throws SQLException;
}
| [
"[email protected]"
] | |
d567c6fc5cbc336c1dfb17ef07e5c38022d59690 | 401c3cf04507f577bfc285da86a6af25ecea7a69 | /CoastLine 2.1/app/src/main/java/com/coastline20/activity/miaoli/yuanli/Yuanli5Activity.java | 360794d7f49bd67cd38743c10ee5abef11ef2343 | [] | no_license | SpicyBoyd/CoastLineApp | 59139e76f7fa7af8b8e55955320ee53e4ddf6578 | 8f24f63de925f4c30ac35527f7efd21f13b481b4 | refs/heads/master | 2021-09-14T09:15:35.834398 | 2018-05-11T04:24:55 | 2018-05-11T04:24:55 | 124,340,147 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,505 | java | package com.coastline20.activity.miaoli.yuanli;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import com.coastline20.R;
import com.coastline20.entity.SpotEntity;
import com.coastline20.adapter.SpotPagerAdapter;
public class Yuanli5Activity extends AppCompatActivity {
private CollapsingToolbarLayout toolbarLayout;
private ImageView imageView;
private Toolbar toolbar;
private TabLayout tabLayout;
private ViewPager viewPager;
private String[] titles;
private SpotEntity entity;
// Spot 修改資料的地方
private void init() {
toolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
imageView = (ImageView) findViewById(R.id.toolbar_image);
toolbar = (Toolbar) findViewById(R.id.toolbar);
tabLayout = (TabLayout) findViewById(R.id.tab_layout);
viewPager = (ViewPager) findViewById(R.id.view_pager);
entity = new SpotEntity(
getResources(),
R.drawable.yuanlispot5,
R.array.yuanli_spot_name,
5,
new int[]{R.drawable.yuanlispot5_1,
R.drawable.yuanlispot5_2, R.drawable.yuanlispot5_3,
R.drawable.yuanlispot5_4, R.drawable.yuanlispot5_5},
R.array.yuanli5_info,
R.array.yuanli_spot_address);
titles = getResources().getStringArray(entity.getTabTitle());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_spot);
init();
setToolbar();
setToolbarLayout();
setTabLayout();
setViewPager();
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager));
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
}
// 設定 CollapsingToolbarLayout
private void setToolbarLayout() {
imageView.setImageResource(entity.getToolbarImage());
toolbarLayout.setTitle(getResources().getStringArray(entity.getSpotName())[entity.getSpotNum()]);
toolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
toolbarLayout.setExpandedTitleColor(Color.WHITE);
}
// 設定 Toolbar
private void setToolbar() {
setSupportActionBar(toolbar);
}
// 設定 TabLayout
private void setTabLayout() {
for (String title : titles) {
tabLayout.addTab(tabLayout.newTab().setText(title));
}
}
// 設定 ViewPager
private void setViewPager() {
SpotPagerAdapter pagerAdapter = new SpotPagerAdapter(getSupportFragmentManager(), titles, entity.getFragmentList());
viewPager.setAdapter(pagerAdapter);
tabLayout.setupWithViewPager(viewPager);
}
// 設定 FloatingActionButton
public void mapGuide(View view) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" +
getResources().getStringArray(entity.getAddress())[entity.getSpotNum()]));
startActivity(intent);
}
}
| [
"[email protected]"
] | |
ec1e40e58180eadb5c3f7cf5599b080938c32717 | 55ada3f8bbbdbf233e3d74eee89b313281141e52 | /osa14-Osa14_06.Hymio/src/main/java/hymio/HymioSovellus.java | 156337bdbe8b8d525e9dbc71c947515f6b7f4b70 | [] | no_license | hamaju/mooc-2020-ohjelmointi-ii | 5f89e9c3e15c5e86e7aa547c12f7f3de0421a0c9 | 937a7c64b096f565347a155bd9ceb64ec4e49682 | refs/heads/main | 2023-07-15T21:36:54.009452 | 2021-08-17T18:36:24 | 2021-08-17T18:36:24 | 397,356,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package hymio;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class HymioSovellus extends Application {
@Override
public void start(Stage ikkuna) {
Canvas piirtoalusta = new Canvas(400, 400);
GraphicsContext piirturi = piirtoalusta.getGraphicsContext2D();
BorderPane asettelu = new BorderPane();
asettelu.setCenter(piirtoalusta);
// silmät
// 50x50 kokoinen suorakulmio, jonka vasen yläkulma alkaa pisteestä (100, 60)
piirturi.fillRect(100, 70, 50, 50);
piirturi.fillRect(250, 70, 50, 50);
// suun viiva
piirturi.fillRect(100, 250, 200, 50);
// suupielet
piirturi.fillRect(50, 200, 50, 50);
piirturi.fillRect(300, 200, 50, 50);
Scene nakyma = new Scene(asettelu);
ikkuna.setScene(nakyma);
ikkuna.show();
}
public static void main(String[] args) {
launch(HymioSovellus.class);
}
}
| [
"[email protected]"
] | |
7dbb564781219b1426f0196e8001386151d12ba0 | 55060cb3471b4d00543cde26e0b6f0e3f4cb525a | /src/test/_111minDepth.java | ed3a2d9e0a0be23db093c72d4fffcc76444c43e5 | [] | no_license | kuangbo/leetcode | 3fc72ac079ca586bc3f5260b4107a2d9c4d4d8c6 | a912371c27d27e49cb97c8f1149fbf20f0faec70 | refs/heads/main | 2023-04-16T10:28:22.182877 | 2021-04-13T13:23:30 | 2021-04-13T13:23:30 | 313,488,467 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,037 | java | package test;
import java.util.LinkedList;
import java.util.Queue;
/**
* Created with IntelliJ IDEA.
* User: kuangbo
* Date: 2020/8/18
* Time: 下午3:48
*/
public class _111minDepth {
public static void main(String[] args) {
TreeNode root = new TreeNode(1);
TreeNode p = root;
for (int i = 0; i < 4; i++) {
p.left = new TreeNode(i + 2);
p = p.left;
}
int res = minDepth_bfs(root);
System.out.println(res);
}
public static int minDepth_bfs(TreeNode root) {
if (root == null)
return 0;
Queue<TreeNode> queue = new LinkedList<>();
queue.add(root);
int depth = 1;
while (!queue.isEmpty()) {
int count = queue.size();
while (count > 0) {
TreeNode now = queue.poll();
if (now.left == null && now.right == null) {
return depth;
}
if (now.left != null) {
queue.add(now.left);
}
if (now.right != null) {
queue.add(now.right);
}
count--;
}
depth++;
}
return depth;
}
public static int minDepth(TreeNode root) {
if (root == null) // 当前节点为null,返回0
return 0;
// 如果左右节点有一个为null,直接返回子树最小深度+1
if (root.left == null && root.right != null)
return minDepth(root.right) + 1;
if (root.left != null && root.right == null)
return minDepth(root.left) + 1;
// 递归遍历左右子树
int left = minDepth(root.left);
int right = minDepth(root.right);
return Math.min(left, right) + 1; // 返回左右子树最小深度+1
}
public static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
}
| [
"[email protected]"
] | |
fbbbdc67d4f727e11b3f151e393ce9123c87144b | b63e8bbc61fb20495870126885d4778d7cfcbf0f | /src/com/day6/coupon/Coupon.java | bfc917b5366daa916fe5993cf0e659be229e566f | [] | no_license | pavaniprabha/assignmentday6 | f66f0252382087a8bdecdb54d6d8e62f274f582c | b0ab4b631f6e3d3741dcd666246e6b41749a026b | refs/heads/master | 2023-06-30T08:15:51.741407 | 2021-08-01T05:43:02 | 2021-08-01T05:43:02 | 391,389,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.day6.coupon;
public class Coupon {
public static void main(String[] args)
{
char[] chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789".toCharArray();
int max=100000000;
int random=(int) (Math.random()*max);
StringBuffer sb=new StringBuffer();
while (random>0)
{
sb.append(chars[random % chars.length]);
random /= chars.length;
}
String CouponNumber =sb.toString();
System.out.println("Coupon Number: "+CouponNumber);
}
}
| [
"[email protected]"
] | |
49b930da9ac994661059b520753c9ae7d8cf46ba | 0d1dbe6c4563ca67f9a79c13c49ecce50e3ef060 | /oto_all/oto-lite/src/main/java/edu/arizona/biosemantics/oto/lite/action/ParserAction.java | 163de0d25c91f8b7b7f18fba0950664ad0dc2324 | [] | no_license | rodenhausen/andrew_backup | 4301876767c0eff6a1fb66b4f4c7d4caf9177368 | da39edffa08cad6d3ca9bf2f0e047ba4c7732216 | refs/heads/master | 2021-01-20T11:30:37.067858 | 2015-03-02T18:22:47 | 2015-03-02T18:22:47 | 31,552,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 923 | java | package edu.arizona.biosemantics.oto.lite.action;
/**
* @author Partha Pratim Sanyal
*/
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**
* This abstract class serves as the base class of all the Action classes.
* It contains a set of methods that could be used to access the session related
* information of the user
* @author Partha
*
*/
public abstract class ParserAction extends Action {
/**
* This is an abstract method that has to be implemented by the subclasses as per requirement
*/
public abstract ActionForward execute(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception;
}
| [
"[email protected]"
] | |
5d01e59e5e8dfe758b8fadf0faaf2677c0470b15 | df94b2618dfcfb525cebef04c466326db640ffe7 | /VideoJuego/src/main/java/com/utn/ac/cr/videojuego/Main.java | 16bd76c889bb9c302cd7c6e183e45ffdad33794a | [] | no_license | jdanielr07/ISW-200 | 78b02de8fa81d30f84eddfb3aa03e0dd3601719b | c7da2bf39784f9a662648713690c9a0aa12b9d91 | refs/heads/master | 2022-12-20T18:40:05.227620 | 2019-06-25T14:53:27 | 2019-06-25T14:53:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.utn.ac.cr.videojuego;
/**
*
* @author Daniel
*/
public class Main {
public static void main(String[] args) {
Guerreros g = new Guerreros("Alfa",50,"Burbujas de jabón");
g.combatir(2);
System.out.println("El nivel de energia de "+g.getNombre()+" es "+g.getEnergia() + ", ataca con: "+g.getArma());
Magos m1 =new Magos("Harry","Quemar");
m1.encantar();
System.out.println("El nivel de energia de "+m1.getNombre()+" es "+m1.getEnergia()+", poder: "+m1.getPoder());
}
}
| [
"[email protected]"
] | |
505e896a8549096a948a63f6d8c39f460a1fbcf9 | 4abc6db1324d1de6715a3723d65974730ffe17c6 | /strategy/Item.java | 2d4678de72365fce4cbbbf205fa0ed8c7ddbe163 | [] | no_license | Bishwa05/Design-Patterns | 511eadcc9cdf264adf86e494659e9a38f34ad526 | 51768a13c9a032cf210e093105074067d0671d04 | refs/heads/master | 2021-01-01T05:58:46.297298 | 2017-07-15T15:35:27 | 2017-07-15T15:35:27 | 97,324,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package strategy;
public class Item {
private String upcCode;
private int price;
public Item(String upc, int cost){
this.upcCode=upc;
this.price=cost;
}
public String getUpcCode() {
return upcCode;
}
public int getPrice() {
return price;
}
}
| [
"[email protected]"
] | |
6f56cd81f471619be448b7af84c0ff34a51ce591 | f91e33a16c37525aa8d22bb6852a905ee7c6c5a4 | /src/test/java/com/abkus1/training/jenkins/JenkinsCalcTest.java | aa55e8848fbb73f3c469072f5bc82985efaf7ce5 | [] | no_license | abkus1/JenkinsMavenProject | 8fbc3037c30ce332e4fd3f451ab8b050194b57b3 | 58e53cc69d154c23d1a65a6766f3100518878d26 | refs/heads/master | 2022-11-21T09:36:45.994432 | 2020-07-09T11:25:34 | 2020-07-09T11:25:34 | 260,665,286 | 0 | 0 | null | 2020-05-02T10:41:33 | 2020-05-02T10:41:33 | null | UTF-8 | Java | false | false | 408 | java | package com.abkus1.training.jenkins;
import static org.junit.Assert.*;
import org.junit.Test;
public class JenkinsCalcTest {
@Test
public void addTest() {
JenkinsCalculator myCalc = new JenkinsCalculator();
assertEquals(10, myCalc.addNumbers(5,5));
}
@Test
public void subtractTest() {
JenkinsCalculator myCalc = new JenkinsCalculator();
assertEquals(5, myCalc.subtractNumbers(10,5));
}
} | [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.