blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
067cd624b991c3688deada0f3502181be587e945 | 00a8b756f1c70b68ab007a4e6f5d44b184c69f4f | /hrs_package/.svn/pristine/13/13f7d36979a8dd4a60485c9cee51f130805a95d5.svn-base | 5098421b66e9bd72cc4be089c657e73ffa5db4db | [
"MIT"
] | permissive | fantisticjob/hrs_pro | f109d86cffbf06817f886176d5afc233a2d69fc0 | 81d743ebe4601e5c5e94a3d2723dc2bb974cc4fa | refs/heads/main | 2023-03-26T03:08:21.051259 | 2021-03-17T03:51:36 | 2021-03-17T03:51:36 | 346,602,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,351 | package com.hausontech.hrs.serviceImpl.dataProcessing;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;
import org.quartz.StatefulJob;
import com.hausontech.hrs.api.constants.JobStatus;
import com.hausontech.hrs.api.engine.ICalculationDao;
import com.hausontech.hrs.bean.dataProcess.AllocRequestInstanceHistoryRecord;
import com.hausontech.hrs.daoImpl.IBaseDao2;
import com.hausontech.hrs.daoImpl.dataPorcessing.mapper.HaeAllocInstanceMapper;
import com.hausontech.hrs.exceptions.DuplicateJobRunningException;
/**
* 任务执行类
* KETTLE初始化、运行等在service层所以job执行任务类只能在service层
*/
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
public class QuartzStatefulJob implements StatefulJob {
@Override
public void execute(JobExecutionContext content) throws JobExecutionException {
JobDataMap dataMap = content.getJobDetail().getJobDataMap();
AllocRequestInstanceHistoryRecord requestHistoryBean = (AllocRequestInstanceHistoryRecord) dataMap.get("requestHistoryBean");
String jobName=(String) dataMap.get("jobName");
HaeAllocInstanceMapper allocInstanceMapper = (HaeAllocInstanceMapper) dataMap.get("allocInstanceMapper");
IBaseDao2 baseDao2=(IBaseDao2)dataMap.get("baseDao2");
long primaryKey = 0;
primaryKey=baseDao2.getAutoGeneratedPrimaryKey("HAE_ALLOC_INSTANCE_HISTORY_S");
requestHistoryBean.setHistoryId(primaryKey);
try {
allocInstanceMapper.saveAllocRequestInstanceHistoryRecord(requestHistoryBean);
} catch (SQLException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
boolean isError = false;
String errorMsg = "";
String returnvalue ="";
long startTime = System.currentTimeMillis();
try {
AllocRequestInstanceHistoryRecord queryBean = new AllocRequestInstanceHistoryRecord();
queryBean.setStatus(JobStatus.PROCESSING);
int processingCount = allocInstanceMapper.getAllocRequestInstanceHistoryRecordCount(null,queryBean.getStatus());
queryBean.setStatus(JobStatus.ROLLBACKING);
int rollbackingCount =allocInstanceMapper.getAllocRequestInstanceHistoryRecordCount(null,queryBean.getStatus());
int runningCount = processingCount + rollbackingCount;
if (0 < runningCount) {
throw new DuplicateJobRunningException();
} else {
// set job instance status
requestHistoryBean.setStatus(JobStatus.PROCESSING);
requestHistoryBean.setStartTime(new Date());
requestHistoryBean.setMessage("");
allocInstanceMapper.updateAllocRequestInstanceHistoryRecord(requestHistoryBean);
// Execute content
// CalculationDao calDao = new CalculationDao();
// this.calculationDao.generateFinIndexAlloc(requestBean);
// get item constant list
Map map = new HashMap();
map.put("returnvalue", "");
map.put("historyId", requestHistoryBean.getHistoryId());
allocInstanceMapper.getItemContentsAlloc(map);
returnvalue=(String)map.get("returnvalue");
/*
* if (0 < contentList.size()) { //calculation in the group
* calculationResult = this.calculateInGroup(contentList); }
*/
if (!"S101".equals(returnvalue)) {
isError = true;
}
}
} catch (DuplicateJobRunningException de) {
isError = true;
errorMsg = "已经有任务处于运行状态,不允许多个任务同时执行";
requestHistoryBean.setStatus("error");
try {
allocInstanceMapper.updateAllocRequestInstanceHistoryRecord(requestHistoryBean);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
throw de;
} catch (DuplicateJobRunningException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (Exception e) {
isError = true;
errorMsg = e.toString();
requestHistoryBean.setStatus("error");
try {
allocInstanceMapper.updateAllocRequestInstanceHistoryRecord(requestHistoryBean);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
System.out.println("Error happens when calculation: " + e);
}
// if there's result , then insert result into db
/*
* if (calculationResult != null && !calculationResult.isEmpty()) { try
* { calculationDao.insertCalculationItems(calculationResult,
* requestBean.getRequestUser(), requestBean.getInstanceId()); } catch
* (SQLException e) { isError = true; errorMsg = e.toString(); } }
*/
if (isError) {
requestHistoryBean.setStatus(JobStatus.FAILED);
requestHistoryBean.setMessage(errorMsg);
} else {
requestHistoryBean.setStatus(JobStatus.SUCCESS);
}
requestHistoryBean.setStatus(returnvalue);
requestHistoryBean.setEndTime(new Date());
requestHistoryBean.setElapsedTime(System.currentTimeMillis() - startTime);
try {
allocInstanceMapper.updateAllocRequestInstanceHistoryRecord(requestHistoryBean);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("并行-------执行任务名是="+jobName);
}
} | [
"1048508578@qq.com"
] | 1048508578@qq.com | |
e575716f4a8c423b8531ca59c68fe5d026c88126 | bba396369c217b919fa07b06803b49cf2499746e | /app/src/main/java/com/example/shui/enjoyfinancial/feature/mine/PayOrderActivity.java | ded662fd87a53e7fffcacc2decd9d95e105dd934 | [] | no_license | shuiyouwen/EnjoyFinancial | c6a316901cbdd0baf8f29086b4e16ae9fc2e6168 | 2f4a5899479cadd094e45496aed27bd6abfbacb4 | refs/heads/master | 2021-07-03T19:41:47.815317 | 2017-09-26T08:40:55 | 2017-09-26T08:40:55 | 104,719,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,679 | java | package com.example.shui.enjoyfinancial.feature.mine;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;
import com.example.shui.enjoyfinancial.R;
import com.example.shui.enjoyfinancial.adapter.RepaymentPlanAdapter;
import com.example.shui.enjoyfinancial.base.BaseActivity;
import java.util.Arrays;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* 支付订单
* Created by Shui on 2017/9/11.
*/
public class PayOrderActivity extends BaseActivity {
@BindView(R.id.tv_name)
TextView mTvName;
@BindView(R.id.tv_address)
TextView mTvAddress;
@BindView(R.id.rv_repayment_plan)
RecyclerView mRvRepaymentPlan;
private Unbinder mBind;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pay_order);
mBind = ButterKnife.bind(this);
initView();
}
private void initView() {
List<String> data = Arrays.asList("1", "2", "3", "4");
RepaymentPlanAdapter adapter = new RepaymentPlanAdapter(data);
mRvRepaymentPlan.setAdapter(adapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
mRvRepaymentPlan.setLayoutManager(layoutManager);
}
@Override
protected void onDestroy() {
mBind.unbind();
super.onDestroy();
}
@Override
protected int getPageTitle() {
return R.string.my_order;
}
}
| [
"androidforwork@163.com"
] | androidforwork@163.com |
eb33ff8da15f80d6b3ff569509eaeb17da9b6fce | 86505462601eae6007bef6c9f0f4eeb9fcdd1e7b | /bin/modules/notification/notificationservices/src/de/hybris/platform/notificationservices/mapping/ProcessorMappingRegistrar.java | ac2a8350980d1e02cc9b30b93805e233a353d6f4 | [] | no_license | jp-developer0/hybrisTrail | 82165c5b91352332a3d471b3414faee47bdb6cee | a0208ffee7fee5b7f83dd982e372276492ae83d4 | refs/heads/master | 2020-12-03T19:53:58.652431 | 2020-01-02T18:02:34 | 2020-01-02T18:02:34 | 231,430,332 | 0 | 4 | null | 2020-08-05T22:46:23 | 2020-01-02T17:39:15 | null | UTF-8 | Java | false | false | 1,529 | java | /*
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
*/
package de.hybris.platform.notificationservices.mapping;
import de.hybris.platform.notificationservices.enums.NotificationChannel;
import de.hybris.platform.notificationservices.enums.NotificationType;
import de.hybris.platform.notificationservices.processor.Processor;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Required;
/**
* register one processor to one specific registry
*/
public class ProcessorMappingRegistrar
{
private ProcessorMappingRegistry registry;
private NotificationType notificationType;
private NotificationChannel notificationChannel;
private Processor processor;
protected ProcessorMappingRegistry getRegistry()
{
return registry;
}
@Required
public void setRegistry(final ProcessorMappingRegistry registry)
{
this.registry = registry;
}
@Required
public void setNotificationType(final NotificationType notificationType)
{
this.notificationType = notificationType;
}
@Required
public void setProcessor(final Processor processor)
{
this.processor = processor;
}
@Required
public void setNotificationChannel(NotificationChannel notificationChannel)
{
this.notificationChannel = notificationChannel;
}
/**
* add new processor mapped with one specific notification type to one channel registry
*/
@PostConstruct
public void registerMapping()
{
registry.addMapping(notificationChannel, notificationType, processor);
}
}
| [
"juan.gonzalez.working@gmail.com"
] | juan.gonzalez.working@gmail.com |
48be13609394881903c671b31def36dddaabe923 | 83d3a015d2b1a4165283512c697b4974b087221a | /sspserver/src/main/java/com/vaolan/sspserver/controller/LoadAdvPlanController.java | af58bbc23a028d266b412889b6580d39f11154bf | [] | no_license | tsienlu/window_system | 9fe46a78d182496be7ca50248b3de463ee62580b | 84b2fb5cb9ca9e3d0d8d91c12dd343a8d2e0522c | refs/heads/master | 2021-06-09T13:26:07.599490 | 2015-11-17T06:33:50 | 2015-11-17T06:33:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,046 | java | package com.vaolan.sspserver.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import redis.clients.jedis.Jedis;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hidata.framework.cache.redis.JedisPoolWriper;
import com.vaolan.sspserver.filter.AdPlanFilter;
import com.vaolan.sspserver.model.AdFreshInfo;
import com.vaolan.sspserver.model.AdMaterial;
import com.vaolan.sspserver.model.AdvPlan;
import com.vaolan.sspserver.model.NumEntity;
import com.vaolan.sspserver.timer.DBInfoFresh;
import com.vaolan.sspserver.util.Config;
import com.vaolan.sspserver.util.Constant;
import com.vaolan.sspserver.util.DateUtils;
import com.vaolan.sspserver.util.ExcelUtil;
import com.vaolan.sspserver.util.HttpUtil;
import com.vaolan.sspserver.util.OnlineMonitorUtil;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
@Controller
public class LoadAdvPlanController {
private static Logger logger = Logger
.getLogger(LoadAdvPlanController.class);
@Resource(name = "dbinfo")
private DBInfoFresh dbInfo;
@Resource(name = "jedisPool_adstat")
private JedisPoolWriper jedisPool;
@Autowired
private AdPlanFilter adPlanFilter;
@Autowired
private OnlineMonitorUtil olm;
/**
* 测试关键词查询
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/getCurPvNum", produces = "application/json")
@ResponseBody
public String getCurPvNum(HttpServletRequest request,
HttpServletResponse response) {
return dbInfo.getPvCountStr();
}
/**
* 展示系统当前的投放信息
* @param request
* @param response
* @param model
* @return
*/
@RequestMapping("/displayadinfo_new")
public String displayadinfoNew(HttpServletRequest request,
HttpServletResponse response, Model model) {
String ssp_cache_fresh_ipport = Config
.getProperty("ssp_cache_fresh_ipport");
Map<String, List<AdFreshInfo>> adFreshMap = new HashMap<String, List<AdFreshInfo>>();
if (null != ssp_cache_fresh_ipport) {
String[] sspservers = ssp_cache_fresh_ipport.split(",");
for (String sspserver : sspservers) {
String sspUrl = "http://" + sspserver + "/advPlanGet";
String responseJson = HttpUtil.accessURLByGetMethod(sspUrl);
List<AdFreshInfo> adFreshInfoList = new ArrayList<AdFreshInfo>();
if (StringUtils.isNotBlank(responseJson)) {
JSONArray ja = JSONArray.parseArray(responseJson);
int allAdCount = 0;
int allClickCount = 0;
int allNeedCount = 0;
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = (JSONObject) ja.get(i);
AdFreshInfo adFreshInfo = new AdFreshInfo();
adFreshInfo.setAdId(jo.getString("adId"));
adFreshInfo.setAdName(jo.getString("adName"));
adFreshInfo.setChannel(jo.getString("channel"));
adFreshInfo.setCrowdOrMt(jo.getString("crowdOrMt"));
adFreshInfo.setAdCount(jo.getString("adCount"));
adFreshInfo.setAdStatus(jo.getString("adStatus"));
adFreshInfo.setSize(jo.getString("size"));
adFreshInfo.setDayLimitCount(jo
.getString("dayLimitCount"));
adFreshInfo.setClickCount(jo.getString("clickCount"));
adFreshInfo.setClickRate(jo.getString("clickRate"));
adFreshInfo.setStopTime(jo.getString("stopTime"));
adFreshInfo.setCloseType(jo.getString("closeType"));
adFreshInfo.setFinishRate(jo.getString("finishRate"));
adFreshInfoList.add(adFreshInfo);
allAdCount += Integer.parseInt(jo.getString("adCount"));
allClickCount += Integer.parseInt(jo
.getString("clickCount"));
allNeedCount += Integer.parseInt(jo
.getString("dayLimitCount"));
}
AdFreshInfo adSum = new AdFreshInfo();
adSum.setAdId("sum");
adSum.setAdCount(allAdCount + "");
adSum.setClickCount(allClickCount + "");
adSum.setDayLimitCount(allNeedCount + "");
adFreshInfoList.add(adSum);
}
adFreshMap.put(sspserver, adFreshInfoList);
}
}
String vaildOnlineVal = olm.getVaildSspPushOnLineVal();
String allOnlineVal = olm.getAllSspPushOnLineVal();
String todayVal = olm.getSspPushDaySumVal();
String todayValJS = olm.getSspPushDaySumValJS();
String todayValSH = olm.getSspPushDaySumValSH();
String frameNum = olm.getframeNum();
String adShowNum = olm.getAdShowNum();
String blankNum = olm.getBlankNum();
String frameNumJS = olm.getframeNumJS();
String adShowNumJS = olm.getAdShowNumJS();
String blankNumJS = olm.getBlankNumJS();
String frameNumSH = olm.getframeNumSH();
String adShowNumSH = olm.getAdShowNumSH();
String blankNumSH = olm.getBlankNumSH();
model.addAttribute("adFreshInfoMap", adFreshMap);
model.addAttribute("vaildOnlineVal", vaildOnlineVal);
model.addAttribute("allOnlineVal", allOnlineVal);
model.addAttribute("todayVal", todayVal);
model.addAttribute("todayValJS", todayValJS);
model.addAttribute("todayValSH", todayValSH);
model.addAttribute("frameNum", frameNum);
model.addAttribute("adShowNum", adShowNum);
model.addAttribute("blankNum", blankNum);
model.addAttribute("frameNumJS", frameNumJS);
model.addAttribute("adShowNumJS", adShowNumJS);
model.addAttribute("blankNumJS", blankNumJS);
model.addAttribute("frameNumSH", frameNumSH);
model.addAttribute("adShowNumSH", adShowNumSH);
model.addAttribute("blankNumSH", blankNumSH);
return "view/fresh_new";
}
@RequestMapping(value="downloadExcel")
public String download(HttpServletRequest request,HttpServletResponse response) throws IOException{
// 查询数据
String startTime = request.getParameter("startTime");
String endTime = request.getParameter("endTime");
String fileName="excel文件";
//填充projects数据
List<NumEntity> projects=getNumEntities(startTime, endTime);
List<Map<String,Object>> list=createExcelRecord(projects);
String columnNames[]={"日期","总数:有效请求量","总数:被封装次数","总数:真实展现次数","总数:打空次数",
"江苏:有效请求量", "江苏:被封装次数","江苏:真实展现次数", "江苏:打空次数", "上海:有效请求量",
"上海:被封装次数", "上海:真实展现次数","上海:打空次数"};//列名
String keys[] = {"curDate","todayVal","frameNum","adShowNum","blankNum","todayValJS",
"frameNumJS", "adShowNumJS", "blankNumJS", "todayValSH", "frameNumSH","adShowNumSH","blankNumSH"};//map中的key
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ExcelUtil.createWorkBook(list,keys,columnNames).write(os);
} catch (IOException e) {
e.printStackTrace();
}
byte[] content = os.toByteArray();
InputStream is = new ByteArrayInputStream(content);
// 设置response参数,可以打开下载页面
response.reset();
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename="+ new String((fileName + ".xls").getBytes(), "iso-8859-1"));
ServletOutputStream out = response.getOutputStream();
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
bis = new BufferedInputStream(is);
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
// Simple read/write loop.
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (final IOException e) {
throw e;
} finally {
if (bis != null)
bis.close();
if (bos != null)
bos.close();
}
return null;
}
private List<Map<String, Object>> createExcelRecord(List<NumEntity> projects) {
List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("sheetName", "sheet1");
listmap.add(map);
NumEntity project=null;
for (int j = 0; j < projects.size(); j++) {
project=projects.get(j);
Map<String, Object> mapValue = new HashMap<String, Object>();
mapValue.put("curDate", project.getCurDate());
mapValue.put("todayVal", project.getTodayVal());
mapValue.put("frameNum", project.getFrameNum());
mapValue.put("adShowNum", project.getAdShowNum());
mapValue.put("blankNum", project.getBlankNum());
mapValue.put("todayValJS", project.getTodayValJS());
mapValue.put("frameNumJS", project.getFrameNumJS());
mapValue.put("adShowNumJS", project.getAdShowNumJS());
mapValue.put("blankNumJS", project.getBlankNumJS());
mapValue.put("todayValSH", project.getTodayValSH());
mapValue.put("frameNumSH", project.getFrameNumSH());
mapValue.put("adShowNumSH", project.getAdShowNumSH());
mapValue.put("blankNumSH", project.getBlankNumSH());
listmap.add(mapValue);
}
return listmap;
}
@RequestMapping(value = "/queryHistoryNum")
public String queryHistoryNum(HttpServletRequest request,
HttpServletResponse responsel, Model model) {
// 查询数据
String startTime = request.getParameter("startTime");
String endTime = request.getParameter("endTime");
List<NumEntity> numEntities = getNumEntities(startTime, endTime);
model.addAttribute("numEntities", numEntities);
return "view/history_num_query";
}
public List<NumEntity> getNumEntities(String startTime, String endTime) {
List<String> days = DateUtils.getDateArr(startTime, endTime, "yyyy-MM-dd");
String[] dayArr = new String[days.size()];
dayArr = days.toArray(dayArr);
List<String> todayVals = olm.getMSspPushDaySumVal(dayArr);
List<String> todayValJSs = olm.getMSspPushDaySumValJS(dayArr);
List<String> todayValSHs = olm.getMSspPushDaySumValSH(dayArr);
List<String> frameNums = olm.getMframeNum(dayArr);
List<String> adShowNums = olm.getMAdShowNum(dayArr);
List<String> blankNums = olm.getMBlankNum(dayArr);
List<String> frameNumJSs = olm.getMframeNumJS(dayArr);
List<String> adShowNumJSs = olm.getMAdShowNumJS(dayArr);
List<String> blankNumJSs = olm.getMBlankNumJS(dayArr);
List<String> frameNumSHs = olm.getMframeNumSH(dayArr);
List<String> adShowNumSHs = olm.getMAdShowNumSH(dayArr);
List<String> blankNumSHs = olm.getMBlankNumSH(dayArr);
List<NumEntity> numEntities = new ArrayList<NumEntity>();
for(int i=0; i< days.size(); i++) {
NumEntity entity = new NumEntity();
entity.setCurDate(days.get(i));
entity.setTodayVal(todayVals.get(i));
entity.setTodayValJS(todayValJSs.get(i));
entity.setTodayValSH(todayValSHs.get(i));
entity.setFrameNum(frameNums.get(i));
entity.setAdShowNum(adShowNums.get(i));
entity.setBlankNum(blankNums.get(i));
entity.setFrameNumJS(frameNumJSs.get(i));
entity.setAdShowNumJS(adShowNumJSs.get(i));
entity.setBlankNumJS(blankNumJSs.get(i));
entity.setFrameNumSH(frameNumSHs.get(i));
entity.setAdShowNumSH(adShowNumSHs.get(i));
entity.setBlankNumSH(blankNumSHs.get(i));
numEntities.add(entity);
}
return numEntities;
}
@RequestMapping("/reloadinit_new")
public String reloadInitNew(HttpServletRequest request,
HttpServletResponse response) {
String ipport = request.getParameter("ipport");
if (StringUtils.isNotBlank(ipport)) {
String sspUrl = "http://" + ipport + "/reload";
String ret = HttpUtil.accessURLByGetMethod(sspUrl);
if ("0".equals(ret)) {
logger.error("load:" + sspUrl + " ## load fail !!");
} else {
logger.info("load:" + sspUrl + " ## load sucess !!");
}
}
return "redirect:/displayadinfo_new";
}
@RequestMapping(value = "/trafficInfo",produces = "application/json;charset=UTF-8")
@ResponseBody
public String trafficInfo(HttpServletRequest request,HttpServletResponse response){
String tInfo = "";
String vaildOnlineVal = olm.getVaildSspPushOnLineVal();
String allOnlineVal = olm.getAllSspPushOnLineVal();
String todayVal = olm.getSspPushDaySumVal();
String frameNum = olm.getframeNum();
String adShowNum = olm.getAdShowNum();
JSONObject trafficJson = new JSONObject();
trafficJson.put("vaildOnlineVal", vaildOnlineVal);
trafficJson.put("allOnlineVal", allOnlineVal);
trafficJson.put("todayVal", todayVal);
trafficJson.put("frameNum", frameNum);
trafficJson.put("adShowNum", adShowNum);
tInfo = trafficJson.toString();
return tInfo;
}
@RequestMapping(value = "/advPlanGet", produces = "application/json;charset=UTF-8")
@ResponseBody
public String advPlanGet(HttpServletRequest request,
HttpServletResponse response) {
String jaStr = "";
try {
Map<String, AdvPlan> advPlanMap2 = dbInfo.getAdvPlanMap2();
JSONArray ja = new JSONArray();
for (String adId : advPlanMap2.keySet()) {
AdvPlan advPlan = advPlanMap2.get(adId);
String size = "";
if (Constant.LINK_TYPE_M.equals(advPlan.getAdInstance()
.getLinkType())) {
List<AdMaterial> admList = advPlan.getAdMaterials();
AdMaterial admaterial = admList.get(0);
size = admaterial.getMaterialSizeValue();
} else if (Constant.LINK_TYPE_E.equals(advPlan.getAdInstance()
.getLinkType())) {
size = advPlan.getAdExtLink().getPicSize();
} else if (Constant.LINK_TYPE_J.equals(advPlan.getAdInstance().getLinkType())){
size = advPlan.getAdExtLink().getPicSize();
} else if (Constant.LINK_TYPE_L.equals(advPlan.getAdInstance().getLinkType())){
size = advPlan.getAdExtLink().getPicSize();
}
Jedis client = jedisPool.getJedis();
Map<String, String> adstatMap = client.hgetAll("adstat_main_"
+ advPlan.getAdInstance().getAdId());
String clickCount = adstatMap.get("today_click_num") == null ? "0"
: adstatMap.get("today_click_num");
String adCount = adstatMap.get("today_pv_num") == null ? "0"
: adstatMap.get("today_pv_num");
double clickCountDouble = 0;
if (!"0".equals(adCount)) {
clickCountDouble = Double.parseDouble(clickCount)
/ Double.parseDouble(adCount) * 100;
}
jedisPool.releaseJedis(client);
JSONObject jb = new JSONObject();
if(advPlan.getAdInstance().getAdUsefulType().equalsIgnoreCase("N")) {
jb.put("channel", "需求平台");
} else if(advPlan.getAdInstance().getAdUsefulType().equalsIgnoreCase("S")) {
jb.put("channel", "VFOCUS");
}
jb.put("adId", adId);
jb.put("adName", advPlan.getAdInstance().getAdName());
jb.put("size", size);
jb.put("dayLimitCount", advPlan.getDayLimit());
jb.put("stopTime", advPlan.getAdInstance().getEndTime());
jb.put("clickCount", clickCount);
jb.put("adCount", adCount);
jb.put("clickRate", clickCountDouble + "");
double finishRate = 0;
if (!"0".equals(advPlan.getDayLimit())) {
finishRate = Double.parseDouble(adCount)
/ Double.parseDouble(advPlan.getDayLimit() + "")
* 100;
}
jb.put("finishRate", finishRate);
boolean bdl = adPlanFilter.isBeyondDayLimit(advPlan);
if (bdl) {
jb.put("adStatus", "正在投放");
} else {
jb.put("adStatus", "今日到量停止");
}
if ("0".equals(advPlan.getAdInstance().getCloseType())) {
jb.put("closeType", "上面");
} else if ("1".equals(advPlan.getAdInstance().getCloseType())) {
jb.put("closeType", "嵌入");
} else if ("2".equals(advPlan.getAdInstance().getCloseType())) {
jb.put("closeType", "死叉");
} else if ("R".equals(advPlan.getAdInstance().getCloseType())) {
jb.put("closeType", "混合");
}
boolean b = advPlan.isDmpCrowdMatch();
if (b) {
jb.put("crowdOrMt", "人群精准");
} else {
Set<String> targets = new HashSet<String>();
if (advPlan.isAdAcctTargetFilter()) {
targets.add("(ad帐号定向");
}
if (advPlan.isSiteFilter()) {
targets.add("域名定向");
}
if (advPlan.isUrlFilter()) {
targets.add("url定向");
}
if (advPlan.getIsPosIpTargetFilter()) {
targets.add("IP正向定向");
}
if (advPlan.getIsNegIpTargetFilter()) {
targets.add("IP负向定向");
}
if (advPlan.isRegionTargetFilter()) {
targets.add("地域定向");
}
if (advPlan.isLabelFilter()) {
targets.add("标签定向");
}
if (advPlan.isKeywordFilter()) {
if(advPlan.getAdPlanKeyWord().getIsJisoujitou().equals("1")) {
targets.add("关键词定向-即搜即投");
} else {
targets.add("关键词定向-离线关键词");
}
}
if ("1".equals(advPlan.getAdTimeFrequency().getIsUniform())) {
targets.add("均匀投放["
+ advPlan.getAdTimeFrequency().getMinuteLimit()
+ "]");
}
jb.put("crowdOrMt", "盲投" + targets.toString());
}
ja.add(jb);
}
jaStr = ja.toString();
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
} catch (Exception e) {
logger.error("刷新advInfo失败:", e);
}
return jaStr;
}
@RequestMapping("/reload")
@ResponseBody
public String reload(HttpServletRequest request,
HttpServletResponse response) {
String ret = "";
try {
dbInfo.freshAdvInfo();
ret = "1";
} catch (Exception e) {
ret = "0";
e.printStackTrace();
logger.error("加载出错", e);
}
return ret;
}
public static void main(String[] args) {
Set<String> targets = new HashSet<String>();
targets.add("ad帐号定向");
targets.add("域名定向");
targets.add("url定向");
}
}
| [
"shan3275@gmail.com"
] | shan3275@gmail.com |
2b24a0e31abaca39ab2e54ac5ea9f9524d55c706 | 7971c95efd3b062a6ae00b32b73d5989c107d708 | /app/src/main/java/com/firstexample/emarkova/session13/data/entity/WeatherForecast.java | dde05700d4bfbe987fc97a1b20234603439cecf7 | [] | no_license | katemeronandroid/Session13 | 7ec9106abe7e6142036bc4ab3340c5a3dd1e2f80 | 16e2dd61c47acf9b3d62664ef6cb21f57c7117f0 | refs/heads/master | 2020-03-22T17:29:00.877120 | 2018-08-29T12:57:40 | 2018-08-29T12:57:40 | 140,397,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.firstexample.emarkova.session13.data.entity;
import com.google.gson.annotations.SerializedName;
public class WeatherForecast {
@SerializedName("daily")
private WeekWeather weekForecast;
public WeekWeather getWeekForecast() {
return weekForecast;
}
public void setWeekForecast(WeekWeather weekForecast) {
this.weekForecast = weekForecast;
}
}
| [
"djisachan@gmail.com"
] | djisachan@gmail.com |
72160d654733df8211ee1468fd888ec6a07a0b2c | f94576d17f63f8f6ce7ffa8a257ada5b0e513ddf | /src/test/RockTest.java | fb8baf493d61c337d04cd8d035146d32dab88bd1 | [] | no_license | Rodrigofz/cc3002-tarea1 | 5eebb82404fb1579009f3d16a0dcc138d8f48bd1 | f5ac4344b8f5d52e5842ca3680215a9543d0af69 | refs/heads/master | 2021-09-12T09:28:27.076242 | 2018-04-15T18:01:59 | 2018-04-15T18:01:59 | 129,255,711 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,352 | java | package test;
import org.junit.Before;
//Import attackers
import Tarea1.Knight;
import Tarea1.FireMage;
import Tarea1.Priest;
import Tarea1.Goblin;
import Tarea1.IceGolem;
import Tarea1.Undead;
//Import attackables
import Tarea1.Rock;
import org.junit.Test;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNull;
public class RockTest {
//Rock
protected Rock rock;
//Attackers
protected Knight knight;
protected FireMage fireMage;
protected Priest priest;
protected Goblin goblin;
protected IceGolem iceGolem;
protected Undead undead;
@Before
public void setUp(){
//Practice dummy
rock = new Rock();
//Attackers
knight = new Knight("Pepe");
fireMage = new FireMage("Alexander");
priest = new Priest("Juan Pablo");
goblin = new Goblin();
iceGolem = new IceGolem();
undead = new Undead();
}
@Test
public void attackedByKnightTest(){
double expected = 65;
//Knight attacks rock
knight.attack(rock);
rock.status();
//The knight losses life
assertEquals(expected, knight.getHP());
}
@Test
public void attackedByPriestTest(){
double expected = 39;
//Priest attacks rock
priest.attack(rock);
//The priest losses life
assertEquals(expected, priest.getHP());
}
@Test
public void attackedByFireMagetTest(){
double expected = 45;
//FireMage attacks rock
fireMage.attack(rock);
//The fireMage losses life
assertEquals(expected, fireMage.getHP());
}
@Test
public void attackedByUndeadTest(){
double expected = 30;
//Undead attacks rock
undead.attack(rock);
//Nothing happens
assertEquals(expected, undead.getHP());
}
@Test
public void attackedByGoblinTest(){
double expected = 40;
//Goblin attacks rock
goblin.attack(rock);
//Nothing happens
assertEquals(expected, goblin.getHP());
}
@Test
public void attackedByIceGolemTest(){
double expected = 90;
//IceGolem attacks rock
iceGolem.attack(rock);
//Nothing happens
assertEquals(expected, iceGolem.getHP());
}
}
| [
"rodrigo.fuentes.z@ug.uchile.cl"
] | rodrigo.fuentes.z@ug.uchile.cl |
5577b735eb2eaf3981c1760ff4f75ff85cb09d36 | a57bdc5e333e75bf7969777c1db85fcf5db5f756 | /payment-service/src/main/java/com/invillia/acme/paymentservice/exception/PaymentError.java | bc8ea54def79c2ef71174f368aa811259d21df5c | [] | no_license | ArthurFritz/backend-challenge | da3ca27c62ac88081b889a57fe61c87ecea8c6a2 | f3407c802a017bd119150fd90d799445a2d06a0e | refs/heads/master | 2020-04-20T11:22:00.000782 | 2019-02-03T23:18:24 | 2019-02-03T23:18:24 | 168,814,320 | 0 | 0 | null | 2019-02-02T09:11:10 | 2019-02-02T09:11:09 | null | UTF-8 | Java | false | false | 396 | java | package com.invillia.acme.paymentservice.exception;
import com.invillia.acme.paymentservice.enums.PaymentStatus;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.BAD_REQUEST)
public class PaymentError extends RuntimeException {
public PaymentError() {
super("There is already a payment");
}
}
| [
"arthurfritzz@gmail.com"
] | arthurfritzz@gmail.com |
b6eaac692613efe6ff4120f7ea4fdd7a7cb91ea7 | 96d75e59dfedc5e381b924855e2bba7925cac18b | /LearnCoding/assigments/src/v1_command/Test.java | 9d38220c2b48a474351ae8d33ad8265e37240bc6 | [] | no_license | sunquan9301/MyCode | f6d22e86fc6b061d3bd01af259f4bebe98c62e85 | ea86ef25c2ab9c60869a10bd05a42fa766da7509 | refs/heads/master | 2023-09-01T01:00:27.650287 | 2023-08-29T11:35:42 | 2023-08-29T11:35:42 | 258,442,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package v1_command;
public class Test {
public static void main(String[] args) {
RemoteControl remote = new RemoteControl();
Light light = new Light();
LightOnCommand lightOn = new LightOnCommand(light);
LightOffCommand lightOff = new LightOffCommand(light);
remote.setCommand(0,lightOn,lightOff);
remote.offButtonWasPushed(0);
remote.onButtonWasPushed(0);
remote.undo();
}
} | [
"sunquan9301@163.com"
] | sunquan9301@163.com |
6d94d9b0dfbaadfbb1bde4bc60284b81d041798f | 62b10aaa52a5c1fc9f63eddfd35caabecf29391c | /newones/vision-service-requestapi-test/vision-service-requestapi-test/generated-sources/axis/com/vsp/bl/product/dto/rate/v002/RateDiscount.java | 343884ce44cb4eaea6ba1942d79704cdf81a1540 | [] | no_license | seemathakur/ram | 398eddf56fe23aa35c5153f7ab267dfdf3c98908 | 26089fc28214e87eb585d27cb178668585350b40 | refs/heads/master | 2021-01-23T18:31:10.472058 | 2017-02-24T04:54:01 | 2017-02-24T04:54:01 | 83,002,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,609 | java | /**
* RateDiscount.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.vsp.bl.product.dto.rate.v002;
public class RateDiscount implements java.io.Serializable {
private com.vsp.xl.dto.v003.CurrencyValue amount;
private com.vsp.xl.dto.v002.SimpleCode type;
public RateDiscount() {
}
public RateDiscount(
com.vsp.xl.dto.v003.CurrencyValue amount,
com.vsp.xl.dto.v002.SimpleCode type) {
this.amount = amount;
this.type = type;
}
/**
* Gets the amount value for this RateDiscount.
*
* @return amount
*/
public com.vsp.xl.dto.v003.CurrencyValue getAmount() {
return amount;
}
/**
* Sets the amount value for this RateDiscount.
*
* @param amount
*/
public void setAmount(com.vsp.xl.dto.v003.CurrencyValue amount) {
this.amount = amount;
}
/**
* Gets the type value for this RateDiscount.
*
* @return type
*/
public com.vsp.xl.dto.v002.SimpleCode getType() {
return type;
}
/**
* Sets the type value for this RateDiscount.
*
* @param type
*/
public void setType(com.vsp.xl.dto.v002.SimpleCode type) {
this.type = type;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof RateDiscount)) return false;
RateDiscount other = (RateDiscount) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.amount==null && other.getAmount()==null) ||
(this.amount!=null &&
this.amount.equals(other.getAmount()))) &&
((this.type==null && other.getType()==null) ||
(this.type!=null &&
this.type.equals(other.getType())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getAmount() != null) {
_hashCode += getAmount().hashCode();
}
if (getType() != null) {
_hashCode += getType().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RateDiscount.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://v002.rate.dto.product.bl.vsp.com", "RateDiscount"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("amount");
elemField.setXmlName(new javax.xml.namespace.QName("", "amount"));
elemField.setXmlType(new javax.xml.namespace.QName("http://v003.dto.xl.vsp.com", "CurrencyValue"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("type");
elemField.setXmlName(new javax.xml.namespace.QName("", "type"));
elemField.setXmlType(new javax.xml.namespace.QName("http://v002.dto.xl.vsp.com", "SimpleCode"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"seema.thakur@vsp.com"
] | seema.thakur@vsp.com |
c332fba9d770ec36ffad11c095c2073b2e604c95 | d512f7917f2bb3a5cad8e1e4e59d0687ef580889 | /gateway-payment/src/main/java/com/gateway/payment/persistence/mapper/IOrderExtendMapper.java | d7230018a6b410a529c74eed932ab5d65b7c3d5a | [] | no_license | happyjianguo/gateway-1 | 56117e63b09dfc543b711a50944bfffbbf2019fa | b00d78788b6b7b40dee61623bfb556718de8c205 | refs/heads/master | 2020-09-02T20:13:23.843583 | 2018-06-26T03:43:00 | 2018-06-26T03:43:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.gateway.payment.persistence.mapper;
import com.gateway.payment.entity.OrderExtendEntity;
import com.github.abel533.mapper.Mapper;
import org.springframework.stereotype.Repository;
/**
* 订单扩展mapper
*
* @since 2018年1月10日
*/
@Repository
public interface IOrderExtendMapper extends Mapper<OrderExtendEntity> {
} | [
"2773126292@qq.com"
] | 2773126292@qq.com |
7d54f448b2a11fd9a37d31b41956ae760bd772a2 | 363ef510c99fe6109818d02fe3fa29a6b5d45750 | /src/main/java/com/fourquality/mandata/config/AsyncConfiguration.java | 5b3e00781c6301ac83e875eb3d6f0982ea0e80ba | [] | no_license | Andersonfls/mandata | 1fc5af29f31acfe82088104312c19ffdfb174585 | df03a47c74bf1203a8b5a8963d231bcfa7c18240 | refs/heads/main | 2023-05-01T20:21:07.961605 | 2021-05-05T23:32:24 | 2021-05-05T23:32:24 | 364,723,873 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,301 | java | package com.fourquality.mandata.config;
import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor;
import io.github.jhipster.config.JHipsterProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.*;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
@Configuration
@EnableAsync
@EnableScheduling
public class AsyncConfiguration implements AsyncConfigurer, SchedulingConfigurer {
private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class);
private final JHipsterProperties jHipsterProperties;
public AsyncConfiguration(JHipsterProperties jHipsterProperties) {
this.jHipsterProperties = jHipsterProperties;
}
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
log.debug("Creating Async Task Executor");
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize());
executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize());
executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity());
executor.setThreadNamePrefix("mandata-Executor-");
return new ExceptionHandlingAsyncTaskExecutor(executor);
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new SimpleAsyncUncaughtExceptionHandler();
}
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.setScheduler(scheduledTaskExecutor());
}
@Bean
public Executor scheduledTaskExecutor() {
return Executors.newScheduledThreadPool(jHipsterProperties.getAsync().getCorePoolSize());
}
}
| [
"c1316893@interno.bb.com.br"
] | c1316893@interno.bb.com.br |
90d3588078bb8f9a14017edea9242f1dea1d2b89 | 1a7eee16551aa4d77d47ee1fab4e6116d0102715 | /DecoratorMode/src/com/j2h/decorator/IPDataDecorator.java | c58cf8a40152d17a84c551e9f04807414884cad0 | [] | no_license | jing2huang/DesignPattern | 5469f4fac96b7e3388390441cf4c4222ac7e3857 | 9ab08fa817478ca2610648a1fe5eec39c23404b6 | refs/heads/main | 2023-08-19T01:12:30.230556 | 2021-09-06T09:17:10 | 2021-09-06T09:17:10 | 387,974,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.j2h.decorator;
public class IPDataDecorator extends DataDecorator {
public IPDataDecorator(Data data) {
super(data);
}
public void addHeader() {
System.out.print("Data add IP header, ");
}
@Override
public void send() {
addHeader();
data.send();
}
}
| [
"jing2huang@163.com"
] | jing2huang@163.com |
92a436d6d1f94850526e0ee284362e5ce3ddb6cf | 2fd313331a5adab2f0b1ed34eaf252e708fae2e4 | /plants-file-storage-service/src/main/java/uk/gov/defra/plants/filestorage/validation/exception/EmptyFileConstraintViolation.java | c4b495a60e3c35367780f33b04feaecde356edfe | [
"LicenseRef-scancode-unknown-license-reference",
"OGL-UK-3.0"
] | permissive | DEFRA/trade-phes | db685bb6794f6b3ae1a733ca591db35cba36a503 | 604c051a6aebcf227fc49856ca37a1994cdf38a8 | refs/heads/master | 2023-07-12T10:34:53.003186 | 2021-08-13T13:57:33 | 2021-08-13T13:57:33 | 381,072,668 | 3 | 2 | NOASSERTION | 2021-08-13T13:57:34 | 2021-06-28T15:06:53 | Java | UTF-8 | Java | false | false | 459 | java | package uk.gov.defra.plants.filestorage.validation.exception;
import uk.gov.defra.plants.common.exception.ConstraintViolationExceptionBase;
import uk.gov.defra.plants.filestorage.representation.DocumentCategory;
public class EmptyFileConstraintViolation extends ConstraintViolationExceptionBase {
public EmptyFileConstraintViolation(DocumentCategory documentCategory) {
super(documentCategory.getEmptyFileErrorMessge(), "size", "uploadedFile");
}
}
| [
"david.jones3@defra.gov.uk"
] | david.jones3@defra.gov.uk |
fe615883d0dcfd3bf33eb38ce42c3a754068cc74 | b42c26751f39e08b67131c94407930c35d4dd314 | /src/main/java/leetcode/p1545/Solution.java | 1e12a5154e26ee8be8de2e8351111ee17ffe21ba | [] | no_license | likaiwalkman/Study-Algorithm | 3d10532e5c7743b504ddd4319498096e46a5f245 | 3e713896a4492827e865bdce5146afb5ca503462 | refs/heads/master | 2023-08-16T23:52:06.778704 | 2023-08-16T19:39:27 | 2023-08-16T19:39:27 | 43,125,205 | 0 | 0 | null | 2022-06-17T01:56:24 | 2015-09-25T09:03:22 | Java | UTF-8 | Java | false | false | 581 | java | package leetcode.p1545;
public class Solution {
public char findKthBit(int n, int k) {
int recursive = recursive(n, k);
return (char)('0' + recursive);
}
public int recursive(int n, int k){
if(n==1){
return 0;
}
Double powDouble = Math.pow(2, n-1);
int pow = powDouble.intValue();
if (k == pow ){
return 1;
}else if(k < pow) {
return recursive(n-1, k);
}else {
int v = recursive(n-1, 2*pow-k);
return v == 1 ? 0 : 1;
}
}
}
| [
"likai@hys-inc.cn"
] | likai@hys-inc.cn |
2bf07fcf2a2e94eec76b50592647e4ac4a40e925 | e6cf1453753be700bea252360e17060cb2a04ead | /src/main/java/com/szmirren/common/LanguageKey.java | 260511b814b7711d2780f8d53ac0fbd56ff697bc | [
"MIT"
] | permissive | feigezc/Spring-generator | 8369f4358ce251f6d6bf4b640f151ea709ef9f20 | 6f37c0b3a31bb7268b989b98b9a4354b7b1a6a10 | refs/heads/master | 2020-03-21T22:25:41.203703 | 2018-06-29T02:27:12 | 2018-06-29T02:27:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,105 | java | package com.szmirren.common;
/**
* 语言国际化的常量
*
* @author <a href="http://szmirren.com">Mirren</a>
*
*/
public interface LanguageKey {
// =========================页面标题==============================
/** 创建数据库连接 */
static final String PAGE_CREATE_CONNECTION = "page.createConnection";
/** 修改数据库连接 */
static final String PAGE_UPDATE_CONNECTION = "page.updateConnection";
// =========================提示语================================
/** 生成路径不能为空 */
static final String TIPS_PATH_CANT_EMPTY = "tips.pathCantEmpty";
/** 首页-提示先选择表名 */
static final String INDEX_TIPS_SELECT_TABLE_NAME = "index.selectTableTips";
/** 首页-提示先选择表名或者全库生成 */
static final String INDEX_TIPS_CREATE_TABLE = "index.createTableTips";
/** 首页-配置文件的配置信息表格提示 */
static final String HISTORY_CONFIG_TABLE_TIPS = "historyConfig.tableTips";
// ========================通用区域===============================
/** 通用设置按钮 */
static final String COMMON_BTN_SET = "common.btnSet";
// ======================首页相关区域==============================
/** 首页的数据连接 */
static final String INDEX_LBL_CONNECTION = "index.lblConnection";
/** 首页的配置信息 */
static final String INDEX_LBL_CONFIG = "index.lblConfig";
/** 首页的使用帮助 */
static final String INDEX_LBL_INSTRUCTIONS = "index.lblInstructions";
/** 首页的设置 */
static final String INDEX_LBL_SETTING = "index.lblSetting";
/** 首页的保存配置提示 */
static final String INDEX_SAVE_CONFIG_TIPS = "index.saveConfigTips";
/** 首页的保存配置不合格提示 */
static final String INDEX_SAVE_CONFIG_NOT_C_TIPS = "index.saveConfigNotCTips";
/** 首页-项目路径文字 */
static final String INDEX_LBL_PROJECT_PATH = "index.lblProjectPath";
/** 首页-项目路径输入框 */
static final String INDEX_TXT_PROJECT_PATH = "index.txtProjectPath";
/** 首页-选择项目路径 */
static final String INDEX_BTN_SELECT_FILE = "index.btnSelectFile";
/** 首页-表名 */
static final String INDEX_LBL_TABLE_NAME = "index.lblTableName";
/** 首页-表名输入框提示 */
static final String INDEX_TXT_TABLE_NAME = "index.txtTableName";
/** 首页-实体类包名 */
static final String INDEX_LBL_ENTITY_PACKAGE = "index.lblEntityPackage";
/** 首页-Service接口包名 */
static final String INDEX_LBL_SERVICE_PACKAGE = "index.lblServicePackage";
/** 首页-Service实现类包名 */
static final String INDEX_LBL_SERVICE_IMPL_PACKAGE = "index.lblServiceImplPackage";
/** 首页-Router包名 */
static final String INDEX_LBL_ROUTER_PACKAGE = "index.lblRouterPackage";
/** 首页-SQL包名 */
static final String INDEX_LBL_SQL_PACKAGE = "index.lblSqlPackage";
/** 首页-SqlAssist包名 */
static final String INDEX_LBL_ASSIST_PACKAGE = "index.lblAssistPackage";
/** 首页-AbstractSQL包名 */
static final String INDEX_LBL_ABSTRACT_SQL_PACKAGE = "index.lblAbstractSqlPackage";
/** 首页-Mapper包名 */
static final String INDEX_LBL_MAPPER_PACKAGE = "index.lblSqlParamsPackage";
/** 首页-单元测试包名 */
static final String INDEX_LBL_UNIT_TEST_PACKAGE = "index.lblUnitTestPackage";
/** 首页-实体类类名 */
static final String INDEX_LBL_ENTITY_NAME = "index.lblEntityName";
/** 首页-Service接口名 */
static final String INDEX_LBL_SERVICE_NAME = "index.lblServiceName";
/** 首页-Service实现类名 */
static final String INDEX_LBL_SERVICE_IMPL_NAME = "index.lblServiceImplName";
/** 首页-Router类名 */
static final String INDEX_LBL_ROUTER_NAME = "index.lblRouterName";
/** 首页-SQL类名 */
static final String INDEX_LBL_SQL_NAME = "index.lblSqlName";
/** 首页-SqlAssist类名 */
static final String INDEX_LBL_ASSIST_NAME = "index.lblAssistName";
/** 首页-AbstractSql类名 */
static final String INDEX_LBL_ABSTRACT_SQL_NAME = "index.lblAbstractSqlName";
/** 首页-SqlAndParams类名 */
static final String INDEX_LBL_MAPPER_NAME = "index.lblSqlParamsName";
/** 首页-单元测试类名 */
static final String INDEX_LBL_UNIT_TEST_NAME = "index.lblUnitTestName";
/** 首页-正在生成提示语句 */
static final String INDEX_RUN_CREATE_TIPS_TEXT = "index.runCreateTipsText";
/** 首页-自定义包名与类 */
static final String INDEX_LBL_SET_CUSTOM = "index.lblSetCustom";
/** 首页-自定义属性 */
static final String INDEX_LBL_SET_CUSTOM_PROPERTY = "index.lblSetCustomProperty";
/** 首页-文件编码格式 */
static final String INDEX_LBL_CODE_FORMAT = "index.lblCodeFormat";
/** 首页-执行创建 */
static final String INDEX_BTN_RUN_CREATE = "index.btnRunCreate";
/** 首页-保存配置文件 */
static final String INDEX_BTN_SAVE_CONFIG = "index.btnSaveConfig";
/** 首页-数据库数右键打开连接 */
static final String INDEX_TVMI_OPEN_CONNECT = "index.tvmiOpenConnect";
/** 首页-数据库数右键关闭连接 */
static final String INDEX_TVMI_CLOSE_CONNECT = "index.tvmiCloseConnect";
/** 首页-数据库数右键修改连接 */
static final String INDEX_TVMI_UPDATE_CONNECT = "index.tvmiUpdateConnect";
/** 首页-数据库数右键删除连接 */
static final String INDEX_TVMI_DELETE_CONNECT = "index.tvmiDeleteConnect";
/** 首页-数据库数右键生成全库 */
static final String INDEX_TVMI_CREATE_FULL_DB = "index.tvmiCreateFullDB";
// ========================使用帮助区域===============================
/** 使用帮助-当前版本 */
static final String INSTRUCTION_LBL_Version = "instruction.lblVersion";
/** 使用帮助-使用帮助 */
static final String INSTRUCTION_LBL_INSTRUCTIONS = "instruction.lblInstructions";
/** 使用帮助-开源地址 */
static final String INSTRUCTION_LBL_PROJECT_PATH = "instruction.lblProjectPath";
/** 使用帮助-模板仓库 */
static final String INSTRUCTION_LBL_TEMPLATE_PATH = "instruction.lblTemplatePath";
/** 使用帮助-QQ交流群 */
static final String INSTRUCTION_LBL_TALK_GROUP_IN_QQ = "instruction.lblTalkGroupInQQ";
/** 使用帮助-作者邮箱 */
static final String INSTRUCTION_LBL_AUTHORS_EMAIL = "instruction.lblAuthorsEmail";
// =======================设置区域================================
/** 设置-语言 */
static final String SETTING_LBL_LANGUAGE = "setting.lblLanguage";
// ======================新建数据库连接==============================
/** 数据库连接-连接名称 */
static final String CONN_LBL_CONN_NAME = "conn.lblConnName";
/** 数据库连接-连接地址 */
static final String CONN_LBL_CONN_URL = "conn.lblConnURL";
/** 数据库连接-端口号 */
static final String CONN_LBL_LISTEN_PORT = "conn.lblListenPort";
/** 数据库连接-数据库类型 */
static final String CONN_LBL_DB_TYPE = "conn.lblDBType";
/** 数据库连接-数据库名字 */
static final String CONN_LBL_DB_NAME = "conn.lblDBName";
/** 数据库连接-用户名 */
static final String CONN_LBL_USER_NAME = "conn.lblUserName";
/** 数据库连接-用户密码 */
static final String CONN_LBL_USER_PWD = "conn.lblUserPwd";
/** 数据库连接-数据库编码 */
static final String CONN_LBL_DB_CODING = "conn.lblDBCoding";
/** 数据库连接-连接名称 */
static final String CONN_TXT_CONN_NAME = "conn.txtConnName";
/** 数据库连接-连接地址 */
static final String CONN_TXT_CONN_URL = "conn.txtConnURL";
/** 数据库连接-端口号 */
static final String CONN_TXT_LISTEN_PORT = "conn.txtListenPort";
/** 数据库连接-数据库类型 */
static final String CONN_CBO_DB_TYPE = "conn.cboDBType";
/** 数据库连接-数据库名称 */
static final String CONN_TXT_DB_NAME = "conn.txtDBName";
/** 数据库连接-用户名字 */
static final String CONN_TXT_USER_NAME = "conn.txtUserName";
/** 数据库连接-用户密码 */
static final String CONN_TXT_USER_PWD = "conn.txtUserPwd";
/** 数据库连接-测试连接 */
static final String CONN_BTN_TEST_CONN = "conn.btnTestConn";
/** 数据库连接-保存 */
static final String CONN_BTN_SAVE = "conn.btnSave";
/** 数据库连接-取消 */
static final String CONN_BTN_CANCEL = "conn.btnCancel";
// ========================配置信息==================================
/** 数据库连接-提示语句 */
static final String CONFIG_LBL_TIPS = "config.lblTips";
/** 数据库连接-配置信息文件名 */
static final String CONFIG_TD_INFO = "config.tdInfo";
/** 数据库连接-操作 */
static final String CONFIG_TD_OPERATION = "config.tdOperation";
/** 数据库连接-加载 */
static final String CONFIG_BTN_LOAD = "config.btnLoad";
/** 数据库连接-删除 */
static final String CONFIG_BTN_DATELE = "config.btnDelete";
// ========================设置==================================
/** 设置实体类-是否创建 */
static final String SET_ENTITY_TD_CREATE = "setEntity.tdcreate";
/** 设置实体类-数据库列名 */
static final String SET_ENTITY_TD_COLUMN = "setEntity.tdColumn";
/** 设置实体类-SQL数据类型 */
static final String SET_ENTITY_TD_SQL_TYPE = "setEntity.tdSqlType";
/** 设置实体类-java数据类型 */
static final String SET_ENTITY_TD_JAVA_TYPE = "setEntity.tdJavaType";
/** 设置实体类-字段属性名 */
static final String SET_ENTITY_TD_FIELD = "setEntity.tdField";
/** 设置实体类-表的别名 */
static final String SET_ENTITY_LBL_TABLE_ALIAS = "setEntity.lblTableAlias";
/** 设置实体类-表的别名 */
static final String SET_ENTITY_TXT_TABLE_ALIAS = "setEntity.txtTableAlias";
/** 设置实体类-主键名称 */
static final String SET_ENTITY_LBL_PRIMARY_KEY = "setEntity.lblPrimaryKey";
/** 设置实体类-主键名称 */
static final String SET_ENTITY_TXT_PRIMARY_KEY = "setEntity.txtPrimaryKey";
/** 设置实体类- 自定属性类型 */
static final String SET_ENTITY_LBL_KEY = "setEntity.lblKey";
/** 设置实体类-自定属性类型 */
static final String SET_ENTITY_TXT_KEY = "setEntity.txtKey";
/** 设置实体类-自定属性类型名称 */
static final String SET_ENTITY_LBL_VALUE = "setEntity.lblValue";
/** 设置实体类-自定属性类型名称 */
static final String SET_ENTITY_TXT_VALUE = "setEntity.txtValue";
/** 设置实体类-字段驼峰命名 */
static final String SET_CHK_FIELD_CAMEL = "setEntity.chkFieldCamel";
/** 设置-表格详情 */
static final String SET_TBL_TIPS = "set.tblTips";
/** 设置-列详情 */
static final String SET_TD_DESCRIBE = "set.tdDescribe";
/** 设置-提示语句 */
static final String SET_LBL_TIPS = "set.lblTips";
/** 设置-保存配置 */
static final String SET_BTN_SAVE_CONFIG = "set.btnSaveConfig";
/** 设置-添加自定义属性 */
static final String SET_LBL_ADD_CUSTOM_PROPERTY = "set.lblAddCustomProperty";
/** 设置-详情 */
static final String SET_LBL_DESCRIBE = "set.lblDescribe";
/** 设置-添加属性key */
static final String SET_TXT_KEY = "set.txtKey";
/** 设置-添加属性value */
static final String SET_TXT_VALUE = "set.txtValue";
/** 设置-添加属性描述 */
static final String SET_TXT_DESCRIBE = "set.txtDescribe";
/** 设置-添加属性 */
static final String SET_BTN_ADD_PROPERTY = "set.btnAddProperty";
/** 设置-模板 */
static final String SET_LBL_TEMPLATE = "set.lblTemplate";
/** 设置-模板 */
static final String SET_CBO_TEMPLATE = "set.cboTemplate";
/** 设置-确定 */
static final String SET_BTN_CONFIRM = "set.btnConfirm";
/** 设置-取消 */
static final String SET_BTN_CANCEL = "set.btnCancel";
/** 设置-取消设置的提示 */
static final String SET_BTN_CANCEL_TIPS = "set.btnCancelTips";
/** 设置-覆盖存在的文件 */
static final String SET_CHK_OVERRIDE_FILE = "set.chkOverrideFile";
/** 设置-根据数据库类型自动选择 */
static final String SET_ABSTRACT_AUTOMATIC = "set.abstractAutomatic";
/** 设置-表格属性中删除menu */
static final String SET_TBL_MENU_ITEM_DELETE = "set.tblMenuItemDelete";
/** 设置-表格属性中删除提示语句 */
static final String SET_TBL_MENU_ITEM_DELETE_CONFIRM = "set.tblMenuItemDeleteConfirm";
/** 设置-通用包名 */
static final String SET_COMMON_PACKAGE_NAME = "set.commonPackageName";
/** 设置-通用类名 */
static final String SET_COMMON_CLASS_NAME = "set.commonPackageName";
/** 设置-通用模板名 */
static final String SET_COMMON_TEMPLATE_NAME = "set.commonTemplateName";
/** 设置-文本属性包名 */
static final String SET_LBL_PACKAGE_NAME = "set.lblPackageName";
/** 设置-文本属性类名 */
static final String SET_LBL_CLASS_NAME = "set.lblClassName";
/** 设置-输入框属性包名 */
static final String SET_TXT_PACKAGE_NAME = "set.txtPackageName";
/** 设置-输入框属性类名 */
static final String SET_TXT_CLASS_NAME = "set.txtClassName";
}
| [
"690389491@qq.com"
] | 690389491@qq.com |
5fb12939f2a412ac58e4c35a8e20209e1ea42d47 | 67fd85aa695cef0ae3fcc9bb218a81aea84ddf26 | /app/src/main/java/android/nsahukar/com/popularmovies2/sync/MoviesSyncTask.java | 3993543e2f07d5b50d7c64988da3379cc50a08ef | [] | no_license | nsahukar/PopularMovies2 | 156444b5660d5ef7c2e07cd824d0240ac6e37baf | d5760a59e85c6c81885c0d21dcf243ce807c8bea | refs/heads/master | 2021-01-21T06:53:05.885107 | 2017-09-30T13:04:39 | 2017-09-30T13:04:39 | 91,591,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,681 | java | package android.nsahukar.com.popularmovies2.sync;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.nsahukar.com.popularmovies2.data.MoviesContract;
import android.nsahukar.com.popularmovies2.utilities.MoviesJsonUtils;
import android.nsahukar.com.popularmovies2.utilities.MoviesNetworkUtils;
import org.json.JSONException;
import java.io.IOException;
import java.net.URL;
/**
* Created by Nikhil on 04/05/17.
*/
public class MoviesSyncTask {
private static void syncPopularMovies(Context context) {
try {
// get popular movies url
URL popularMoviesURL = new URL(MoviesNetworkUtils.getPopularMoviesUrl());
// use the url to retrieve the JSON
final String popularMoviesJSONResponse = MoviesNetworkUtils.
getResponseFromHttpUrl(popularMoviesURL);
// parse the json into a list of movies content values
ContentValues[] popularMoviesContentValues = MoviesJsonUtils.
getPopularMoviesContentValuesFromJson(popularMoviesJSONResponse);
if (popularMoviesContentValues != null && popularMoviesContentValues.length != 0) {
// get a handle on the content resolver to delete and insert data
ContentResolver moviesContentResolver = context.getContentResolver();
// delete old popular movies data
Uri popularMoviesUri = MoviesContract.MoviesEntry.getPopularMoviesContentUri();
moviesContentResolver.delete(popularMoviesUri, null, null);
// insert our new popular movies data into movies content provider
moviesContentResolver.bulkInsert(MoviesContract.MoviesEntry.CONTENT_URI, popularMoviesContentValues);
}
} catch (IOException | JSONException e) {
e.printStackTrace();
}
}
private static void syncTopRatedMovies(Context context) {
try {
// get top rated movies url
URL topRatedMoviesURL = new URL(MoviesNetworkUtils.getTopRatedMoviesUrl());
// use the url to retrieve the JSON
final String topRatedMoviesJSONResponse = MoviesNetworkUtils.getResponseFromHttpUrl(topRatedMoviesURL);
// parse the json into a list of movies content values
ContentValues[] topRatedMoviesContentValues = MoviesJsonUtils.getTopRatedMoviesContentValuesFromJson(topRatedMoviesJSONResponse);
if (topRatedMoviesContentValues != null && topRatedMoviesContentValues.length != 0) {
// get a handle on the content resolver to delete and insert data
ContentResolver moviesContentResolver = context.getContentResolver();
// delete old top rated movies data
Uri topRatedMoviesUri = MoviesContract.MoviesEntry.getTopRatedMoviesContentUri();
moviesContentResolver.delete(topRatedMoviesUri, null, null);
// insert our new top rated movies data into movies content provider
moviesContentResolver.bulkInsert(MoviesContract.MoviesEntry.CONTENT_URI, topRatedMoviesContentValues);
}
} catch (IOException | JSONException e) {
e.printStackTrace();
}
}
/*
performs the network request for movies, parses the JSON from that request, and
inserts the new movies information into the ContentProvider.
*/
synchronized public static void syncMovies(Context context) {
syncPopularMovies(context);
syncTopRatedMovies(context);
}
}
| [
"nsahukar@gmail.com"
] | nsahukar@gmail.com |
f2714412947ac97e6a8582303384b59171e2b184 | 13f127d101007f16c639cf78b2c283afb14e02f8 | /app/src/main/java/app/pokedex/PokedexActivity.java | f24f9e4cfae3ed7f1b2c6846c378c36aef3ff74a | [] | no_license | aaricocheam/pokedex-android | 37103c9ba30ba4b6330ff49899ccf69808476564 | a06044bd9ca241b94f3c485dd0f3c240db56b6fd | refs/heads/main | 2023-06-13T23:24:19.044877 | 2021-07-14T06:56:21 | 2021-07-14T06:56:21 | 385,829,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,657 | java | package app.pokedex;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.util.List;
import app.pokedex.network.PokeCallBack;
import app.pokedex.network.models.Pokemon;
import app.pokedex.network.models.PokemonListResponse;
import app.pokedex.pokemon.PokemonAdapter;
import app.pokedex.utils.Constant;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class PokedexActivity extends BaseActivity {
List<Pokemon> pokemonList;
PokemonAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pokedex);
EditText etPokeAdd = findViewById(R.id.etPokeAdd);
Button btPokemonAdd = findViewById(R.id.btPokemonAdd);
btPokemonAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String poke = etPokeAdd.getText().toString();
if (poke.isEmpty()) {
return;
}
Pokemon pokemon = new Pokemon(poke, "");
pokemonList.add(0, pokemon);
adapter.notifyDataSetChanged();
}
});
final RecyclerView rvPokemonList = findViewById(R.id.rvPokemonList);
Call<PokemonListResponse> call = loader.getPokemonList();
call.enqueue(new PokeCallBack<PokemonListResponse>(PokedexActivity.this, true) {
@Override
public void onResponse(Call<PokemonListResponse> call, Response<PokemonListResponse> response) {
super.onResponse(call, response);
if (response.isSuccessful()) {
pokemonList = response.body().getPokemonList();
adapter = new PokemonAdapter(pokemonList, PokedexActivity.this);
rvPokemonList.setAdapter(adapter);
rvPokemonList.setHasFixedSize(true);
RecyclerView.LayoutManager manager = new LinearLayoutManager(PokedexActivity.this);
rvPokemonList.setLayoutManager(manager);
} else {
//Toast.makeText(PokedexActivity.this, "Fallo en el servidor", Toast.LENGTH_SHORT).show();
showDialogError();
}
}
@Override
public void onFailure(Call<PokemonListResponse> call, Throwable t) {
super.onFailure(call, t);
Log.e(Constant.DEBUG_POKEMON, t.getMessage());
showDialogError();
}
});
/*call.enqueue(new Callback<PokemonListResponse>() {
@Override
public void onResponse(Call<PokemonListResponse> call, Response<PokemonListResponse> response) {
pokemonList = response.body().getPokemonList();
adapter = new PokemonAdapter(pokemonList, PokedexActivity.this);
rvPokemonList.setAdapter(adapter);
rvPokemonList.setHasFixedSize(true);
RecyclerView.LayoutManager manager = new LinearLayoutManager(PokedexActivity.this);
rvPokemonList.setLayoutManager(manager);
}
@Override
public void onFailure(Call<PokemonListResponse> call, Throwable t) {
Log.e(Constant.DEBUG_POKEMON, t.getMessage());
}
});*/
}
} | [
"anthony.dam91@gmail.com"
] | anthony.dam91@gmail.com |
f4a4c7133ced63ae9a3cb6c5b55566d7454b9622 | b9ad59e9295727d0109d0868911ddf245f1d7ff5 | /Android/src/com/noughmad/ntasks/sync/Bridge.java | 9e60b27b1189b6163360856e75d0a0537832fb15 | [] | no_license | Noughmad/nTasks | 489697541a69d9961f8ba2ade39da7d77d130777 | 5c0b424708aa7530e1eaa4e4a84fa0aa2d02e1cd | refs/heads/master | 2016-09-09T17:00:48.377825 | 2012-10-21T19:50:21 | 2012-10-21T19:50:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,345 | java | package com.noughmad.ntasks.sync;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import android.content.ContentProviderClient;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;
import android.os.RemoteException;
import android.provider.BaseColumns;
import com.noughmad.ntasks.Database;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
public class Bridge {
public final static String OBJECT_TABLE_NAME = "Object";
public final static String KEY_OBJECT_PARSEID = "parseObjectId";
public final static String KEY_OBJECT_CLASSNAME = "className";
public final static String KEY_OBJECT_CREATED = "createdAt";
public final static String KEY_OBJECT_MODIFIED = "updatedAt";
public final static String KEY_OBJECT_LOCAL = "local";
public final static String OBJECT_TABLE_CREATE =
"CREATE TABLE " + OBJECT_TABLE_NAME + " (" +
BaseColumns._ID + " INTEGER PRIMARY KEY, " +
KEY_OBJECT_PARSEID + " TEXT, " +
KEY_OBJECT_CLASSNAME + " TEXT, " +
KEY_OBJECT_CREATED + " INTEGER, " +
KEY_OBJECT_MODIFIED + " INTEGER, " +
KEY_OBJECT_LOCAL + " INTEGER);";
public final static String[] objectColumns = new String[] {
KEY_OBJECT_PARSEID
};
public static class Options {
String className;
Map<String, String> foreignKeys;
List<String> dateColumns;
List<String> textColumns;
List<String> intColumns;
List<String> fileColumns;
}
private Context mActivity;
Bridge(Context context) {
mActivity = context;
}
void upload(final Options options) throws RemoteException, ParseException {
Uri uri = Uri.withAppendedPath(Database.BASE_URI, Database.IS_LOCAL + "/" + options.className);
ContentProviderClient client = mActivity.getContentResolver().acquireContentProviderClient(uri);
List<String> columns = new ArrayList<String>();
columns.add(options.className + "." + Database.ID);
columns.add(Database.KEY_OBJECT);
columns.add(KEY_OBJECT_PARSEID);
if (options.foreignKeys != null) {
columns.addAll(options.foreignKeys.keySet());
}
if (options.textColumns != null) {
columns.addAll(options.textColumns);
}
if (options.intColumns != null) {
columns.addAll(options.intColumns);
}
if (options.dateColumns != null) {
columns.addAll(options.dateColumns);
}
if (options.fileColumns != null) {
columns.addAll(options.fileColumns);
}
Map<Long,ParseObject> objects = new HashMap<Long,ParseObject>();
Cursor cursor = client.query(uri, columns.toArray(new String[] {}), null, null, null);
if (!cursor.moveToFirst()) {
return;
}
while (!cursor.isAfterLast()) {
long id = cursor.getLong(0);
ParseObject object = new ParseObject(options.className);
int i = 3;
for (Entry<String,String> entry : options.foreignKeys.entrySet()) {
Uri keyUri = ContentUris.withAppendedId(Uri.withAppendedPath(Database.BASE_URI, OBJECT_TABLE_NAME), cursor.getLong(i));
Cursor keyCursor = client.query(keyUri, new String[] {KEY_OBJECT_PARSEID}, null, null, null);
ParseObject key = new ParseObject(entry.getValue());
key.setObjectId(keyCursor.getString(0));
object.put(entry.getKey(), key);
++i;
}
for (String entry : options.textColumns) {
object.put(entry, cursor.getString(i));
++i;
}
for (String entry : options.intColumns) {
object.put(entry, cursor.getInt(i));
++i;
}
for (String entry : options.dateColumns) {
object.put(entry, new Date(cursor.getLong(i)));
++i;
}
for (String entry : options.fileColumns) {
File file = new File(cursor.getString(i));
if (file.exists() && file.isFile()) {
byte[] buffer = new byte[(int) file.length()];
try {
FileInputStream stream = new FileInputStream(file);
stream.read(buffer);
stream.close();
ParseFile pf = new ParseFile("icon.png", buffer);
pf.save();
object.put(entry, file);
} catch (IOException e) {
e.printStackTrace();
object.remove(entry);
}
}
++i;
}
objects.put(id, object);
}
client.release();
ParseObject.saveAll(new ArrayList<ParseObject>(objects.values()));
uri = Uri.withAppendedPath(Database.BASE_URI, OBJECT_TABLE_NAME);
client = mActivity.getContentResolver().acquireContentProviderClient(uri);
ContentValues values = new ContentValues();
for (Entry<Long,ParseObject> entry : objects.entrySet()) {
values.put(KEY_OBJECT_PARSEID, entry.getValue().getObjectId());
client.update(ContentUris.withAppendedId(uri, entry.getKey()), values, null, null);
}
values.clear();
values.put(KEY_OBJECT_LOCAL, 0);
client.update(uri, values, KEY_OBJECT_CLASSNAME + " = ?", new String[] {options.className});
client.release();
}
void download(final Options options) throws ParseException, RemoteException {
// TODO:
long lastSync = 1000;
final Uri uri = Uri.withAppendedPath(Database.BASE_URI, options.className);
ParseQuery query = new ParseQuery(options.className);
query.whereGreaterThan("updatedAt", lastSync);
List<ParseObject> objects = query.find();
ContentProviderClient client = mActivity.getContentResolver().acquireContentProviderClient(uri);
for (ParseObject object : objects) {
Cursor existing = client.query(Uri.withAppendedPath(uri, Database.EXISTS_PARSE_ID + "/" + object.getObjectId()), new String[] {options.className + '.' + Database.ID}, null, null, null);
boolean exists = existing.moveToFirst();
existing.close();
ContentValues values = new ContentValues();
for (String entry : options.textColumns) {
values.put(entry, object.getString(entry));
}
for (String entry : options.intColumns) {
values.put(entry, object.getInt(entry));
}
for (String entry : options.dateColumns) {
values.put(entry, object.getDate(entry).getTime());
}
for (String entry : options.fileColumns) {
ParseFile pf = (ParseFile) object.get(entry);
byte[] buffer = pf.getData();
File file = new File(
mActivity.getExternalFilesDir(Environment.DIRECTORY_PICTURES),
"project_icon_" + object.getObjectId() + ".png"
);
try {
FileOutputStream stream = new FileOutputStream(file);
stream.write(buffer);
stream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
values.put(entry, file.getAbsolutePath());
}
if (exists) {
// A record for this object already exists
long id = existing.getLong(0);
client.update(ContentUris.withAppendedId(uri, id), values, null, null);
} else {
client.insert(uri, values);
}
}
}
void sync(Options options) throws RemoteException, ParseException {
upload(options);
download(options);
// TODO: Delete records from either the server or the client, depending on their age
}
}
| [
"miha@noughmad.eu"
] | miha@noughmad.eu |
34889973e895fce52286c95929981950faf6ac92 | 86eab5950d82802ed7f34f62f54604f73d4cd8a1 | /Tenposs/app/src/main/java/jp/tenposs/datamodel/SigninInfo.java | a8d2ec7aec44f939ad186f5fe5745d63844846b0 | [] | no_license | HUNTERS1984/tenposs_app_android | 82d071eb067f5f5fbd1daa20970fd5502f92e2fb | 56d9f6adba1dbdf78536a6b5e666bd187311290c | refs/heads/master | 2020-05-21T16:40:35.561096 | 2017-01-06T11:05:45 | 2017-01-06T11:05:45 | 64,269,138 | 1 | 0 | null | 2016-12-19T10:16:16 | 2016-07-27T02:08:04 | Java | UTF-8 | Java | false | false | 2,527 | java | package jp.tenposs.datamodel;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by ambient on 7/26/16.
*/
public class SignInInfo {
public final static String admin = "admin";
public final static String client = "client";
public final static String staff = "staff";
public final static String user = "user";
public final static String ios = "ios";
public final static String android = "android";
public final static String web = "web";
public static class Request extends CommonRequest {
public String email;
String password;
public String role;
public String platform = android;
public void setPassword(String password) {
this.password = password;
}
@Override
String sigInput() {
return app_id + "" + time + "" + email + "" + password + "" + privateKey;
}
@Override
ArrayList<String> getAvailableParams() {
return null;
}
public HashMap<String, String> getFormData() {
generateSig();
HashMap<String, String> formData = new HashMap<>();
try {
formData.put("email", email);
formData.put("password", password);
formData.put("role", role);
formData.put("platform", platform);
} catch (Exception ignored) {
}
return formData;
}
}
public static class Response extends CommonResponse {
public Token data;
}
public class Token implements Serializable {
public String token;
public String refresh_token;
public String access_refresh_token_href;
public boolean first_login;
}
/*{
"code": "1000"
, "message": "OK"
, "data": {
"token": "f5a1b79f8f3981ed8c86044e88d1849e"
, "app_id": "1"
, "id": 44
, "email": null
, "social_type": "1"
, "social_id": "1471523209531107"
, "profile": {
"name": "Nguyễn Huy Phúc"
, "gender": "0"
, "address": "東京都"
, "avatar_url": "uploads\/7c7732c35a15e45ab93f5a2ad6a424c3.png"
, "facebook_status": "0"
, "twitter_status": "0"
, "instagram_status": "0"
}
}
}*/
} | [
"huyphuctt@gmail.com"
] | huyphuctt@gmail.com |
7c4112a14634322668b15e146badf5d0b1bbf29b | 861b7491dfffd9695235500fcf3df0f0e650fe37 | /app/src/main/java/com/sht/smartlock/phone/ui/chatting/holder/LocationViewHolder.java | aba8688b4938d4b4b173d7903ee1c976175721c0 | [] | no_license | kaka17/SmartLock | bc879f186f26e5fa76a85c7ecbd954ef03c78cd2 | fae54d97e18af9a5ecc0e3ddf7a25786605bd403 | refs/heads/master | 2020-03-16T07:40:59.255022 | 2018-05-09T02:14:10 | 2018-05-09T02:14:10 | 132,581,147 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,183 | java | package com.sht.smartlock.phone.ui.chatting.holder;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.sht.smartlock.R;
import com.sht.smartlock.phone.ui.chatting.base.EmojiconTextView;
public class LocationViewHolder extends BaseHolder {
public View chattingContent;
/**
* TextView that display IMessage description.
*/
public EmojiconTextView descTextView;
public RelativeLayout relativeLayout;
/**
* @param type
*/
public LocationViewHolder(int type) {
super(type);
}
public BaseHolder initBaseHolder(View baseView , boolean receive) {
super.initBaseHolder(baseView);
chattingTime = (TextView) baseView.findViewById(R.id.chatting_time_tv);
chattingUser = (TextView) baseView.findViewById(R.id.chatting_user_tv);
descTextView = (EmojiconTextView) baseView.findViewById(R.id.tv_location);
checkBox = (CheckBox) baseView.findViewById(R.id.chatting_checkbox);
chattingMaskView = baseView.findViewById(R.id.chatting_maskview);
chattingContent = baseView.findViewById(R.id.chatting_content_area);
relativeLayout=(RelativeLayout) baseView.findViewById(R.id.re_location);
if(receive) {
type = 10;
return this;
}
uploadState = (ImageView) baseView.findViewById(R.id.chatting_state_iv);
progressBar = (ProgressBar) baseView.findViewById(R.id.uploading_pb);
type = 11;
return this;
}
/**
* {@link CCPTextView} Display imessage text
* @return
*/
public EmojiconTextView getDescTextView() {
if(descTextView == null) {
descTextView = (EmojiconTextView) getBaseView().findViewById(R.id.chatting_content_itv);
}
return descTextView;
}
/**
*
* @return
*/
public ImageView getChattingState() {
if(uploadState == null) {
uploadState = (ImageView) getBaseView().findViewById(R.id.chatting_state_iv);
}
return uploadState;
}
/**
*
* @return
*/
public ProgressBar getUploadProgressBar() {
if(progressBar == null) {
progressBar = (ProgressBar) getBaseView().findViewById(R.id.uploading_pb);
}
return progressBar;
}
}
| [
"841623088@qq.com"
] | 841623088@qq.com |
d6b5a08a453f013cd4b75dc1ab0ddada2fc66c18 | 05b75bbb50b428c3a758d4e34f9b8a234fcecb75 | /src/UsingStringMethods.java | d9c4faa82dab30e758432082d643df419a930a9e | [] | no_license | austinzhwang/Assignments | c9bae75b43251df1669bd82d35ed0e52c648b931 | b58167c113d1536dbf74fbb61177066da3215dff | refs/heads/master | 2020-12-19T04:17:40.231704 | 2020-01-23T16:49:27 | 2020-01-23T16:49:27 | 235,618,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | import java.util.Scanner;
public class UsingStringMethods {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter a word: " );
String inputWord = in.nextLine();
System.out.print("Enter a number as an index : ");
int inputIndex = in.nextInt();
if (inputIndex > inputWord.length()-1) {
System.out.println("Index is larger than length");
} else {
System.out.println("The length of " + inputWord + " is: " + inputWord.length());
System.out.println("The substring from 0 to " + inputIndex + " is: " + inputWord.substring(0, inputIndex));
}
in.close();
}
} | [
"austinzhwang@gmail.com"
] | austinzhwang@gmail.com |
012e3072f0d9a5653938f8ca48327037aeea6249 | 2093cc481fe324d62bf834473e0e90ef482e27e5 | /app/src/test/java/xyz/hasaki/svgparse/ExampleUnitTest.java | 32d33fdabca100fbb03a1e645161262c9b66a52f | [] | no_license | YWD/SvgParse | fbc87e527b068049702e20c23813197d0c0e5fff | bb3d193f7bdab3983fdaf94870aa0e7a8db18052 | refs/heads/master | 2021-08-20T05:47:27.389144 | 2017-11-28T09:39:22 | 2017-11-28T09:39:22 | 112,315,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package xyz.hasaki.svgparse;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"wendong.yang@fuwo.com"
] | wendong.yang@fuwo.com |
a4966c6cee9435884c9179279136ff569ba9e150 | cfc26bb3b1c7a5c2ee6f488e36686807fca2091f | /src/main/java/com/yunkan/pattern/factory/Apple.java | 4dfda57ea6f6ba7b7f5ebc1c4e3ea7c317555f62 | [] | no_license | forverActiveBoy/design-pattern | ac7d2190b88d3fb73c949721d12e404dc493912f | a6e19ff4fba3dd605e2ed76613e739172de4718e | refs/heads/master | 2023-02-10T08:34:53.527086 | 2020-12-26T11:49:41 | 2020-12-26T11:49:41 | 319,291,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package com.yunkan.pattern.factory;
/**
* @author foreverActiveBoy
* @date 2020/12/26 16:10
* @apiNote 苹果类
*/
public class Apple implements Fruit {
}
| [
"extends_zkx0924@163.com"
] | extends_zkx0924@163.com |
a513c5064441311e1ad7900043f8826e3bf21717 | 77afb97ec149e3e4cd6fafde67a266ef2c4895d2 | /app/src/main/java/example/com/radiobuttontest/discoverActivity.java | bec3f938d6997d26a0ba4be6254ad2e6bc9403b1 | [] | no_license | gaojuxin/RadioButtonTest | b3cbe265184049d87f2f1bf951e0a1c2efc894b4 | 858493acd7eedf0bbb39b5774af7268ab4a6548d | refs/heads/master | 2020-04-17T20:23:41.838049 | 2016-08-23T07:30:05 | 2016-08-23T07:30:05 | 66,343,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package example.com.radiobuttontest;
import android.app.Activity;
import android.os.Bundle;
/**
* Created by 1992g on 2016/8/23.
*/
public class discoverActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_discover);
}
}
| [
"1992gaojx@sina.com"
] | 1992gaojx@sina.com |
ba4efb7aba063e780761cf251c168041b222c6c3 | 8ec39fde916306478190f9c9a06cb6962a2bab1a | /AnithaDama/com/collections/Emp.java | 10773aa86e3ff56fd4b5f49481b3a7655d6213c3 | [] | no_license | priyanka079/JavaBasics | 1ec3c9302f6d764821964bc4292cfdce7033124a | 9d5801ac04528c2c613dccf2e5a01d1e2a182bc7 | refs/heads/main | 2023-06-17T01:22:46.622915 | 2021-06-29T23:22:54 | 2021-06-29T23:22:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package com.collections;
public class Emp implements Comparable<Emp>
{
int eno;
String ename;
public Emp(int eno, String ename) {
this.eno = eno;
this.ename = ename;
}
public int getEno() {
return eno;
}
public void setEno(int eno) {
this.eno = eno;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
@Override
public int compareTo(Emp emp) {
/* if(this.eno>emp.getEno()) //based on eno
return 1;
else if(this.eno<emp.getEno())
return -1;
else
return 0;*/
//return this.ename.compareTo(emp.getEname()); //based on ename
return emp.getEname().compareTo(this.ename); // Descending order
}
public String toString() {
return eno +" "+ename;
}
}
| [
"damaanitha@gmail.com"
] | damaanitha@gmail.com |
6eb079483efca96b893cac34c73c20b65931a1f2 | 315fbe78c412d9fd50b1c6ae14e7c3d7ebf2fae3 | /src/main/java/io/zuppelli/contentservice/repository/NodeRepository.java | d4641871ad65b909149aadbe41855362bf09d6fa | [] | no_license | aoxa/eduportal-content-service | eaa6126ca8bc997ec6452627e7d61768b9c9dfb0 | 9b3aa2facc45cf12a144bd16bc7ce12b33ce67b5 | refs/heads/master | 2020-12-10T20:25:13.671619 | 2020-01-29T18:10:11 | 2020-01-29T18:10:11 | 233,701,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package io.zuppelli.contentservice.repository;
import io.zuppelli.contentservice.model.Node;
import io.zuppelli.contentservice.model.NodeReply;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import java.util.List;
import java.util.UUID;
public interface NodeRepository extends MongoRepository<Node<? extends NodeReply>, UUID> {
Node<?> findByTitle(String Title);
@Query("{'children.user': ?0 }")
List<Node> findAllByChildrenAuthor(UUID user);
List<Node<?>> findAllByType(String type);
}
| [
"pedro.zuppelli@gmail.com"
] | pedro.zuppelli@gmail.com |
f9cd094471aaa916d4444a769e15077e45698d83 | 3175539bd7d07215a00e7e307a5690ac8cfe6ea5 | /backend/4CustomerService/src/main/java/aos/customers/repository/CustomerRepository.java | cf8040e18e728e77bb8025c60184f7e13f0c98b7 | [] | no_license | alexradu95/magazinMicroservicii | 6850c92ff91f49b9978ac4ddc3f3386f945ee34f | ba525c130fb77c98d81cf6ffa6e760d04fa63dca | refs/heads/master | 2021-10-10T14:04:57.178724 | 2019-01-11T13:47:23 | 2019-01-11T13:47:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package aos.customers.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import aos.customers.domain.Customer;
public interface CustomerRepository extends JpaRepository<Customer, Long> {
Boolean existsByEmail(String email);
Customer findByEmail(String email);
Customer findByCustomerId(Long id);
}
| [
"radualexandrucosmin@gmail.com"
] | radualexandrucosmin@gmail.com |
be8f8a55f0ea79abd1ce46a2b37b19c83d6f4b11 | ac77f004ed25892fc1a4836896cbbb9fae4e3c8b | /lzh-bigdata/src/main/java/com/lzhsite/spark/streaming/WindowHotWord.java | 02726f48406eba801a3dbc5450cdd37497f938f9 | [] | no_license | jbzhang99/collection | 3a869e04b36481ba1d6aa386e5c9ee131313aadc | c0785083538b51a681f3f695f8d90a48d95c2245 | refs/heads/master | 2020-09-12T15:50:29.529192 | 2019-06-05T23:40:49 | 2019-06-05T23:40:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,827 | java | package com.lzhsite.spark.streaming;
import java.util.List;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.function.Function;
import org.apache.spark.api.java.function.Function2;
import org.apache.spark.api.java.function.PairFunction;
import org.apache.spark.streaming.Durations;
import org.apache.spark.streaming.api.java.JavaDStream;
import org.apache.spark.streaming.api.java.JavaPairDStream;
import org.apache.spark.streaming.api.java.JavaReceiverInputDStream;
import org.apache.spark.streaming.api.java.JavaStreamingContext;
import scala.Tuple2;
/**
* 基于滑动窗口的热点搜索词实时统计
* @author Administrator
*
*/
public class WindowHotWord {
public static void main(String[] args) {
SparkConf conf = new SparkConf()
.setMaster("local[2]")
.setAppName("WindowHotWord");
JavaStreamingContext jssc = new JavaStreamingContext(conf, Durations.seconds(1));
// 说明一下,这里的搜索日志的格式
// leo hello
// tom world
JavaReceiverInputDStream<String> searchLogsDStream = jssc.socketTextStream("spark1", 9999);
// 将搜索日志给转换成,只有一个搜索词,即可
JavaDStream<String> searchWordsDStream = searchLogsDStream.map(new Function<String, String>() {
private static final long serialVersionUID = 1L;
@Override
public String call(String searchLog) throws Exception {
return searchLog.split(" ")[1];
}
});
// 将搜索词映射为(searchWord, 1)的tuple格式
JavaPairDStream<String, Integer> searchWordPairDStream = searchWordsDStream.mapToPair(
new PairFunction<String, String, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<String, Integer> call(String searchWord)
throws Exception {
return new Tuple2<String, Integer>(searchWord, 1);
}
});
// 针对(searchWord, 1)的tuple格式的DStream,执行reduceByKeyAndWindow,滑动窗口操作
// 第二个参数,是窗口长度,这里是60秒
// 第三个参数,是滑动间隔,这里是10秒
// 也就是说,每隔10秒钟,将最近60秒的数据,作为一个窗口,进行内部的RDD的聚合,然后统一对一个RDD进行后续
// 计算
// 所以说,这里的意思,就是,之前的searchWordPairDStream为止,其实,都是不会立即进行计算的
// 而是只是放在那里
// 然后,等待我们的滑动间隔到了以后,10秒钟到了,会将之前60秒的RDD,因为一个batch间隔是,5秒,所以之前
// 60秒,就有12个RDD,给聚合起来,然后,统一执行redcueByKey操作
// 所以这里的reduceByKeyAndWindow,是针对每个窗口执行计算的,而不是针对某个DStream中的RDD
JavaPairDStream<String, Integer> searchWordCountsDStream =
searchWordPairDStream.reduceByKeyAndWindow(new Function2<Integer, Integer, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public Integer call(Integer v1, Integer v2) throws Exception {
return v1 + v2;
}
}, Durations.seconds(60), Durations.seconds(10));
// 到这里为止,就已经可以做到,每隔10秒钟,出来,之前60秒的收集到的单词的统计次数
// 执行transform操作,因为,一个窗口,就是一个60秒钟的数据,会变成一个RDD,然后,对这一个RDD
// 根据每个搜索词出现的频率进行排序,然后获取排名前3的热点搜索词
JavaPairDStream<String, Integer> finalDStream = searchWordCountsDStream.transformToPair(
new Function<JavaPairRDD<String,Integer>, JavaPairRDD<String,Integer>>() {
private static final long serialVersionUID = 1L;
@Override
public JavaPairRDD<String, Integer> call(
JavaPairRDD<String, Integer> searchWordCountsRDD) throws Exception {
// 执行搜索词和出现频率的反转
JavaPairRDD<Integer, String> countSearchWordsRDD = searchWordCountsRDD
.mapToPair(new PairFunction<Tuple2<String,Integer>, Integer, String>() {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<Integer, String> call(
Tuple2<String, Integer> tuple)
throws Exception {
return new Tuple2<Integer, String>(tuple._2, tuple._1);
}
});
// 然后执行降序排序
JavaPairRDD<Integer, String> sortedCountSearchWordsRDD = countSearchWordsRDD
.sortByKey(false);
// 然后再次执行反转,变成(searchWord, count)的这种格式
JavaPairRDD<String, Integer> sortedSearchWordCountsRDD = sortedCountSearchWordsRDD
.mapToPair(new PairFunction<Tuple2<Integer,String>, String, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<String, Integer> call(
Tuple2<Integer, String> tuple)
throws Exception {
return new Tuple2<String, Integer>(tuple._2, tuple._1);
}
});
// 然后用take(),获取排名前3的热点搜索词
List<Tuple2<String, Integer>> hogSearchWordCounts =
sortedSearchWordCountsRDD.take(3);
for(Tuple2<String, Integer> wordCount : hogSearchWordCounts) {
System.out.println(wordCount._1 + ": " + wordCount._2);
}
return searchWordCountsRDD;
}
});
// 这个无关紧要,只是为了触发job的执行,所以必须有output操作
finalDStream.print();
jssc.start();
jssc.awaitTermination();
jssc.close();
}
}
| [
"6231969242@qq.com"
] | 6231969242@qq.com |
2a6a806ca59a6ec04d8794935c7242f62b4a80e0 | d2f384d3ee46f13968eb78dde4fab858435107c8 | /app/src/main/java/com/example/snd/Fragment_livingRoom.java | 4042d3577c781b73f724e388a2294c1b0aee7f8b | [] | no_license | shakti051/SND | 7026313c5971b970524af58e62f03b3f46dd8d31 | 3cb552bb252e15c17ae529c3e7c9955db4de8ad6 | refs/heads/master | 2020-09-12T22:54:34.519929 | 2019-11-19T01:52:03 | 2019-11-19T01:52:03 | 222,584,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package com.example.snd;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public class Fragment_livingRoom extends Fragment {
View view;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.livingroom_fragment,container,false);
return view;
}
}
| [
"shaktithemastermind@gmail.com"
] | shaktithemastermind@gmail.com |
8b3dc0e68c6379a01aa60e8bd43a29b182054603 | 03d6f1c706592d25704995221c442fb0917657d5 | /ged-mobile/android/app/src/main/java/com/fegoldenexpedition/MainActivity.java | 80a144a48986304e1974ba4a7326deff9f33fe07 | [] | no_license | siamsubekti/-Final---project- | 6bcae1254efb585152e1b6f4e9210288fecce666 | af9c27611ed9f3b51aea26712d2d17994c91d1ca | refs/heads/master | 2022-04-08T14:28:30.111708 | 2020-02-20T14:50:36 | 2020-02-20T14:50:36 | 241,874,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.fegoldenexpedition;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "FEGoldenExpedition";
}
}
| [
"trisiam4@gmail.com"
] | trisiam4@gmail.com |
aaf690ce2e089addd642b76ec950bc6fff6d2ce1 | 3626ca56020ebca876161552f3dd6bc83f4e48a6 | /midterm/src/part2/Arizona.java | d503475116f76bf7ff8929d6ee2ce0d39ea5b094 | [] | no_license | antonioi520/DesignPatterns-17- | 56ffea4201459634a0f95c74b58907b66d932ec6 | 564c8007a16950a351c65cd1f522b32c640845b7 | refs/heads/master | 2021-05-19T14:21:10.961468 | 2020-03-31T22:19:24 | 2020-03-31T22:19:24 | 251,753,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package part2;
public class Arizona implements TaxBehavior {
@Override
public double tax() {
double tax = 5.6;
return tax;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
1a63a080efc250e9237603b27c11a8df298ff47e | 87808b7b48022dc04a0adbe4df30699575bdbb3d | /Proj1/AmazingChatServer/src/com/unioeste/sd/facade/MessageInterface.java | 0610104bd8e48afa84fc970454d1226c557f1432 | [] | no_license | lucasnathan/SD | e88f0035060e53b908dc9c6999f266edfd544538 | 3bedd218fd5bcca38b59fd1bc36d9bad9c97f7bb | refs/heads/master | 2020-04-20T06:39:34.536567 | 2015-12-21T20:49:27 | 2015-12-21T20:49:27 | 39,395,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package com.unioeste.sd.facade;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.sql.Date;
import com.unioeste.sd.implement.Message.Type;
public interface MessageInterface extends Remote{
public void setUser(UserInterface user) throws RemoteException;
public UserInterface getUser() throws RemoteException;
public String getMessage() throws RemoteException;
public void setMessage(String message) throws RemoteException;
public Date getDate() throws RemoteException;
public void setDate(Date date) throws RemoteException;
public Type getType() throws RemoteException;
public void setType(Type type) throws RemoteException;
}
| [
"lucas.nathan80@hotmail.com"
] | lucas.nathan80@hotmail.com |
fd58b173fd3d9fd2ce0938c2969dd70988235b7f | 9c93d0c5305aa63869a41a8f455123300b97be56 | /web-application/src/java/supply/medium/home/database/DashboardCompanyReportMaster.java | 1eb362e1909045e11e94a84d67ebfe1115516f9a | [] | no_license | fbion/SupplyMedium | 0016198017e17c6f049b05f5cc0ab7e9506d787d | 6d9ba342d6dc8bfa168d1a776ff98f5eb63e9830 | refs/heads/main | 2023-08-21T23:37:29.446148 | 2021-10-04T09:14:23 | 2021-10-04T09:14:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,990 | 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 supply.medium.home.database;
import java.sql.*;
import java.util.ArrayList;
import supply.medium.home.bean.DashboardCompanyReportBean;
import supply.medium.utility.ErrorMaster;
import supply.medium.utility.MyConnection;
/**
*
* @author Vic
*/
public class DashboardCompanyReportMaster {
public static ArrayList showReport(String date1, String date2, String companyKey)
{
Connection con=null;
Statement st=null;
ResultSet rs=null;
DashboardCompanyReportBean cb=null;
ArrayList al=null;
try
{
con=MyConnection.connect();
st=con.createStatement();
String query="select company_key_from,sum(inv_total_billing_amount) "
+ "from transaction_master "
+ "where company_key_to='"+companyKey+"' "
+ "and inv_created_on between '"+date1+"' and '"+date2+"' "
+ "group by company_key_from";
rs=st.executeQuery(query);
al=new ArrayList();
while(rs.next())
{
cb=new DashboardCompanyReportBean();
cb.setCompany(rs.getString(1));
cb.setAmount(rs.getString(2));
al.add(cb);
}
}
catch(Exception ex)
{
ErrorMaster.insert("Exception at showAll in CurrencyMaster : "+ex.getMessage());
}
finally
{
try
{
rs.close();
st.close();
con.close();
}
catch(Exception ex)
{
ErrorMaster.insert("Exception at closing showAll in CurrencyMaster : "+ex.getMessage());
}
}
return al;
}
}
| [
"vpit71089@gmail.com"
] | vpit71089@gmail.com |
8091c991549fd16371e6be5642225c4768ec9a57 | ccb4b74af0e5f5c39101d71e47a9e0c9ee947da2 | /src/org/tarena/dang/action/user/CheckVerifyCodeAction.java | fdd83ebb14e3ce649ca7741edbf8597edcc96a7c | [] | no_license | sinaill/DANG | 8d0f230486181df794f1bbfce418290a6af71a04 | 9f7df1f6c23cbd7d3f78366d612f9b71948344a0 | refs/heads/master | 2020-12-23T22:35:09.816067 | 2017-05-27T03:50:56 | 2017-05-27T03:50:56 | 92,568,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | package org.tarena.dang.action.user;
import org.tarena.dang.action.BaseAction;
/*
* Ajax ��ͼƬ��֤�������֤����������true
* ����ȷ���false��
*/
public class CheckVerifyCodeAction extends BaseAction{
private String VerifyCode;
private boolean ok = false;
public String execute(){
String code = (String) session.get("code");
if(code.equalsIgnoreCase(VerifyCode)){
ok=true;
}
return "success";
}
public String getVerifyCode() {
return VerifyCode;
}
public void setVerifyCode(String verifyCode) {
VerifyCode = verifyCode;
}
public boolean isOk() {
return ok;
}
public void setOk(boolean ok) {
this.ok = ok;
}
}
| [
"980195840@qq.com"
] | 980195840@qq.com |
4a3bf61b38fe0fcb2cd346e162576aa986d1b7bd | d5fd0aa50b61e0665550725be1afae1eb8e6f87d | /Main.java | 886623101e1a1c7fa6fe28fd48e4860f0b710de5 | [] | no_license | FoxITeam/Level2-Lesson1 | 02610efdcf6ba1c465bde9ae0a31d069b480e72f | bf5f55ad4a34f4f163a6204c94b03f1b452da776 | refs/heads/master | 2020-03-13T12:10:22.065254 | 2018-04-26T07:00:56 | 2018-04-26T07:00:56 | 131,113,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,464 | java | package ru.foxit.grayfox;
/*1. Есть строка вида: "1 3 1 2\n2 3 2 2\n5 6 7 1\n3 3 1 0"; (другими словами матрица 4x4)
1 3 1 2
2 3 2 2
5 6 7 1
3 3 1 0
Написать метод, на вход которого подаётся такая строка, метод должен преобразовать строку в двумерный массив
типа String[][];
2. Преобразовать все элементы массива в числа типа int, просуммировать, поделить полученную сумму на 2, и
вернуть результат;
3. Ваш метод должен бросить исключения в случаях:
Если размер матрицы, полученной из строки, не равен 4x4;
Если в одной из ячеек полученной матрицы не число; (например символ или слово)
4. В методе main необходимо вызвать полученный метод, обработать возможные исключения и вывести результат расчета.
*/
import static ru.foxit.grayfox.Main.stringToArray;
public class Main {
public static void main(String[] args) {
String strings = new String("1 3 1 2\n2 3 2 2\n5 6 7 1\n3 3 1 0"); //нужный вид строки
String stringsOne = new String("1 3 1 2\n2 3 G b\n5 6 7 1\n3 3 1 0"); //MyArrayDataException
String stringsTwo = new String ("1 3 1 2\n2 3 2 2\n5 6 7 1\n3 3 1 0\n2 3 2 2"); //MyArraySizeException
try {
System.out.println(stringToArray(strings));}
catch (RuntimeException rune){
rune.printStackTrace();
}
}
public static int stringToArray(String string) {//task1
String[] arrays = string.split("\n");
if (arrays.length != 4) throw new MyArraySizeException("Кол-во строк в матрице не равно 4x4");
String[][] matrixArrays = {
arrays[0].split(" "),
arrays[1].split(" "),
arrays[2].split(" "),
arrays[3].split(" "),
};
int[][] intArrays = new int[4][4]; //task2
for (int i = 0; i < matrixArrays.length; i++) {
for (int j = 0; j < matrixArrays[i].length; j++) {
try {
intArrays[i][j] = Integer.parseInt(matrixArrays[i][j]);
} catch (NumberFormatException e) {
throw new MyArrayDataException("В матрице,в строке "+i+" столбце "+j+" не число (символ/слово)"
);
}
}
}for (int i = 0; i < matrixArrays.length; i++) {
for (int j = 0; j < matrixArrays.length; j++) {
System.out.print(intArrays[i][j] + " ");
}System.out.println(" ");
}System.out.println("=======");
int sum = 0;
int div;
for (int i = 0; i < intArrays.length; i++) {
for (int j = 0; j < intArrays[i].length; j++) {
sum += intArrays[i][j];
}
}div = sum / 2;
System.out.print("Сумма нашей матрицы, деленная на 2, равна ");
return div;
}
}
| [
"admin@bukkit-minecraft.ru"
] | admin@bukkit-minecraft.ru |
a6696dbb8b8b4d36b7fe52f113e0ea9d29f4a73e | b674871bacfc7b111f9331ba20d5c6cabc57df47 | /src/SimpleGA/Population.java | 214711363a31f0337c2252dcee246998f8964436 | [] | no_license | bingxuan3133/SimpleGA | 115dff3c3a66e116ed76ed9be6a734bdbb4c715f | 9039981b1e512422593cc302798dab307e19cfd8 | refs/heads/master | 2020-03-30T15:04:31.654027 | 2018-10-03T01:42:50 | 2018-10-03T01:42:50 | 151,347,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,497 | java | package SimpleGA;
public class Population {
Individual[] individuals;
/*
* Constructors
*/
// Create a population
public Population(int populationSize, boolean initialise) {
individuals = new Individual[populationSize];
// Initialise population
if (initialise) {
// Loop and create individuals
for (int i = 0; i < size(); i++) {
Individual newIndividual = new Individual();
newIndividual.generateIndividual();
saveIndividual(i, newIndividual);
}
}
}
/* Getters */
public Individual getIndividual(int index) {
return individuals[index];
}
public Individual getFittest() {
Individual fittest = individuals[0];
// Loop through individuals to find fittest
for (int i = 0; i < size(); i++) {
if (fittest.getFitness() <= getIndividual(i).getFitness()) {
fittest = getIndividual(i);
}
}
return fittest;
}
/* Public methods */
// Get population size
public int size() {
return individuals.length;
}
// Save individual
public void saveIndividual(int index, Individual indiv) {
individuals[index] = indiv;
}
public int getTotalFitness() {
int fitness = 0;
for (Individual individual: this.individuals)
fitness =+ individual.getFitness();
return fitness;
}
} | [
"bensoncbx@gmail.com"
] | bensoncbx@gmail.com |
d6e0c0607326823126a6b9c921882943bd8535c6 | 1b6f63b377819014c8d956f8de4cd7342720df20 | /app/src/androidTest/java/com/facturasmanzanillo/memory/ExampleInstrumentedTest.java | 067aab8d66da4d984d02bce3ce95a754e3faf02d | [] | no_license | chucoyos/Memory | e7aab951cd18885473453887c3b8a0d78308a2b4 | 3901d0d8c94c2e48df7b372c90fa561091d1fb5b | refs/heads/master | 2022-10-15T12:33:24.135733 | 2020-06-11T22:02:12 | 2020-06-11T22:02:12 | 271,654,772 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package com.facturasmanzanillo.memory;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.facturasmanzanillo.memory", appContext.getPackageName());
}
}
| [
"manzanillo91@hotmail.com"
] | manzanillo91@hotmail.com |
fad715f32ab1d3c8eff85dfdb2c160d3c3be8b2d | 4743b4022b82a70f9ed967f1d025adea30b455c5 | /src/main/java/com/spring/community2/entity/LoginTicket.java | 553affb8ffeb866b8e0fda278f620754b004a17c | [] | no_license | xiaorui2/comunity | 5339bca95200ed65f00272c2d1d8fcbdd903f159 | c0ef39dc41717eac15ca3bfaa9e1a5e86770431a | refs/heads/master | 2022-09-26T11:21:07.553739 | 2020-05-31T08:28:46 | 2020-05-31T08:28:46 | 264,187,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,262 | java | package com.spring.community2.entity;
import java.util.Date;
/**
* @ClassName LoginTicket
* @Author ruizhou
* @Date 2020/5/22 20:57
**/
public class LoginTicket {
private int id;
private int userId;
private String ticket;
private int status;
private Date expired;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getTicket() {
return ticket;
}
public void setTicket(String ticket) {
this.ticket = ticket;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getExpired() {
return expired;
}
public void setExpired(Date expired) {
this.expired = expired;
}
@Override
public String toString() {
return "LoginTicket{" +
"id=" + id +
", userId=" + userId +
", ticket='" + ticket + '\'' +
", status=" + status +
", expired=" + expired +
'}';
}
}
| [
"838567391@qq.com"
] | 838567391@qq.com |
85e709e2eaafe88617926915134dc667cdcbacbe | 03c9cdec2c2e03d64cde754aece004469a22e3cf | /campFifthDay/core/concretes/EmailCheck.java | e1d4c7edd46cf973a83616a1c82395d83be2f9f1 | [] | no_license | ogztg/campfifthday | a84cdd2b29206d5fb468a9a147773081ae45e0ea | effc69904b5ad9b1af2d883baabf76036e5737dd | refs/heads/main | 2023-04-19T19:19:38.402262 | 2021-05-12T16:54:12 | 2021-05-12T16:54:12 | 366,787,745 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package campFifthDay.core.concretes;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import campFifthDay.core.abstracts.VerificationService;
import campFifthDay.entities.concretes.User;
public class EmailCheck implements VerificationService {
String emailRegex = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";
Pattern emailPattern = Pattern.compile(emailRegex,Pattern.CASE_INSENSITIVE);
@Override
public boolean check(User user) {
Matcher matcher = emailPattern.matcher(user.getEmail());
if(matcher.matches()) {
return true;
}else {
System.out.println("Gecersiz Email.");
return false;
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
10d27a078235006e27bb923baca249b7eadb1255 | d695389fc7ae600d10ccde12a5be9ba991d11efa | /app/src/main/java/com/example/uks/testtutorial/MainActivity.java | ea3cf319aae5637d2aa4941c8f475b404e1698a2 | [] | no_license | UttamKumarSingh/TestTutorial | 9944f2bc74bf6f63ec759a717e2ef50a2d846032 | 436a4c4042f4db507e7bb015f0fcc0380126a331 | refs/heads/master | 2020-03-26T13:42:17.514630 | 2018-08-16T07:47:17 | 2018-08-16T07:47:17 | 144,952,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.example.uks.testtutorial;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//This is for Test
}
}
| [
"gksinghatsugi@gmail.com"
] | gksinghatsugi@gmail.com |
c028bb9fd07925c8c36dbe75de2fc540e5dc919a | 5b6a2c15258e55680d2410cbe0ff548fb4e6e7ad | /app/src/main/java/com/huisu/iyoox/adapter/StudentTaskListAdapter.java | 6d0d52a9ff36cb739ed0dec0b74ecdc69b8a6124 | [] | no_license | mucll/IyooxTask | 763772131d0621e8a97df602fd2fe07357516f79 | 4bf912f32896021a36cb11bd34a4f74ea923cc7f | refs/heads/master | 2020-03-23T07:52:17.161450 | 2018-09-10T07:50:15 | 2018-09-10T07:50:15 | 141,294,349 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,565 | java | package com.huisu.iyoox.adapter;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.huisu.iyoox.Interface.TaskStatus;
import com.huisu.iyoox.R;
import com.huisu.iyoox.entity.TaskStudentListModel;
import com.huisu.iyoox.util.DateUtils;
import com.huisu.iyoox.util.StringUtils;
import java.util.ArrayList;
/**
* 学生作业列表adapter
*/
public class StudentTaskListAdapter extends BaseAdapter {
private Context context;
private String taskType;
private ArrayList<TaskStudentListModel> listModels;
public StudentTaskListAdapter(Context context, ArrayList<TaskStudentListModel> listModels, String taskType) {
this.context = context;
this.taskType = taskType;
this.listModels = listModels;
}
@Override
public int getCount() {
return listModels == null ? 0 : listModels.size();
}
@Override
public TaskStudentListModel getItem(int position) {
return listModels.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_student_task_list_layout, null);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
TaskStudentListModel model = getItem(position);
switch (taskType) {
case TaskStatus.UNFINISH:
if (!TextUtils.isEmpty(model.getXueke_name())) {
holder.subjectIcon.setImageResource(getImgResId(model.getXueke_name()));
holder.taskName.setText(model.getWork_name());
}
holder.startIconTV.setImageResource(R.drawable.homework_icon_time);
holder.endIcon.setVisibility(View.GONE);
holder.endIcon.setVisibility(View.GONE);
holder.startTime.setText(StringUtils.getTimeString(model.getStart_time()) + "-" + StringUtils.getTimeString(model.getEnd_time()));
break;
case TaskStatus.FINISH:
if (!TextUtils.isEmpty(model.getXueke_name())) {
holder.subjectIcon.setImageResource(getImgResId(model.getXueke_name()));
holder.taskName.setText(model.getWork_name());
}
holder.startIconTV.setImageResource(R.drawable.homework_icon_finished);
holder.endIcon.setVisibility(View.VISIBLE);
holder.endIcon.setVisibility(View.VISIBLE);
holder.startTime.setText(StringUtils.getTimeString(model.getEnd_time()));
break;
case TaskStatus.YUQI:
if (!TextUtils.isEmpty(model.getXueke_name())) {
holder.subjectIcon.setImageResource(getUnImgResId(model.getXueke_name()));
holder.taskName.setText(model.getWork_name());
}
holder.startIconTV.setImageResource(R.drawable.homework_icon_time);
holder.endIcon.setVisibility(View.GONE);
holder.endIcon.setVisibility(View.GONE);
holder.startTime.setText(StringUtils.getTimeString(model.getStart_time()) + "-" + StringUtils.getTimeString(model.getEnd_time()));
break;
default:
break;
}
return convertView;
}
private int getImgResId(String subjectName) {
switch (subjectName) {
case "语文":
return R.drawable.homework_yu;
case "数学":
return R.drawable.homework_math;
case "英语":
return R.drawable.homework_eng;
case "物理":
return R.drawable.homework_physics;
case "化学":
return R.drawable.homework_chemistry;
default:
return R.drawable.homework_yu;
}
}
private int getUnImgResId(String subjectName) {
switch (subjectName) {
case "语文":
return R.drawable.homework_overdue_yu;
case "数学":
return R.drawable.homework_overdue_math;
case "英语":
return R.drawable.homework_overdue_eng;
case "物理":
return R.drawable.homework_overdue_physics;
case "化学":
return R.drawable.homework_overdue_chemistry;
default:
return R.drawable.homework_overdue_yu;
}
}
static class ViewHolder {
TextView taskName;
TextView classId;
ImageView startIconTV;
TextView startTime;
ImageView endIcon;
ImageView subjectIcon;
public ViewHolder(View view) {
taskName = view.findViewById(R.id.item_task_subject_text_tv);
classId = view.findViewById(R.id.item_task_student_classId);
startIconTV = view.findViewById(R.id.task_start_iv);
startTime = view.findViewById(R.id.task_start_time_iv);
endIcon = view.findViewById(R.id.task_finished_icon_iv);
subjectIcon = view.findViewById(R.id.item_task_subject_icon_iv);
}
}
}
| [
"351371167@qq.com"
] | 351371167@qq.com |
322e567e44b2dcd663f9820c2ccb0f7d971e9401 | 824e1edd82c71252edb64000062f17314b4d9fe1 | /Econ.Calendar/app/src/main/java/com/econcalendar/econcalendar/BindingData.java | eb5b8795c59c4f4347dd7daba56d4e5be7c4c6cb | [
"Apache-2.0"
] | permissive | KarsekaVladimir/ANDROID_SocialSample | b4126a7b29694b6a93db5ac28464d3d3604c8ec1 | 92b7c584b84362c82fe2ca14b03fa41b7f5faaae | refs/heads/master | 2021-01-11T06:18:39.136671 | 2016-10-21T10:27:06 | 2016-10-21T10:27:06 | 70,054,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,179 | java | package com.econcalendar.econcalendar;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
//Adapter Class For Binding data to ListView
public class BindingData extends BaseAdapter {
ArrayList<String> title;
ArrayList<String> country;
ArrayList<String> date;
LayoutInflater inflater;
public BindingData() {
}
public BindingData(Activity act, ArrayList<String> title,
ArrayList<String> country, ArrayList<String> date) {
this.title = title;
this.country = country;
this.date = date;
inflater = (LayoutInflater) act
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return title.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
if (convertView == null) {
holder = new Holder();
convertView = inflater.inflate(R.layout.listrow, null);
holder.txtTitle = (TextView) convertView.findViewById(R.id.title);
holder.txtCountry = (TextView) convertView
.findViewById(R.id.country);
holder.txtDate = (TextView) convertView.findViewById(R.id.date);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.txtTitle.setText(Html.fromHtml("" + title.get(position)));
holder.txtCountry.setText(Html.fromHtml("<b>Country : </b>"
+ country.get(position)));
holder.txtDate.setText(Html.fromHtml("<b>Date : </b>"
+ date.get(position)));
return convertView;
}
private class Holder {
TextView txtTitle, txtCountry, txtDate;
}
} | [
"karsekavl@gmail.com"
] | karsekavl@gmail.com |
97fb294c807a3dfb0fc0662bc25bac3f71e09533 | a9b3380ea955738378cbfeaf4f6e827be19cf862 | /src/main/java/de/micromata/confluence/rest/core/ContentClientImpl.java | 8976f68530cae647a5cf077306e24ce122de92fe | [] | no_license | Bramix/ConfluenceRestClient | 92bd95c5d4166c9aea9b1140bddded324a0cf9b3 | 8f58274aa0d6fe39bd5b0cabcb3a9b666ba9ae3c | refs/heads/master | 2022-12-23T11:47:42.055114 | 2020-09-30T08:40:47 | 2020-09-30T08:40:47 | 293,906,258 | 0 | 0 | null | 2020-09-08T19:21:28 | 2020-09-08T19:21:28 | null | UTF-8 | Java | false | false | 5,614 | java | package de.micromata.confluence.rest.core;
import com.google.gson.stream.JsonReader;
import de.micromata.confluence.rest.ConfluenceRestClient;
import de.micromata.confluence.rest.client.ContentClient;
import de.micromata.confluence.rest.core.domain.content.ContentBean;
import de.micromata.confluence.rest.core.domain.content.ContentResultsBean;
import de.micromata.confluence.rest.core.misc.ContentStatus;
import de.micromata.confluence.rest.core.misc.ContentType;
import de.micromata.confluence.rest.core.misc.RestException;
import de.micromata.confluence.rest.core.util.HttpMethodFactory;
import de.micromata.confluence.rest.core.util.URIHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.message.BasicNameValuePair;
import java.net.HttpURLConnection;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
/**
* Author: Christian Schulze (c.schulze@micromata.de)
* Date: 04.07.2016
* Project: ConfluenceTransferPlugin
*/
public class ContentClientImpl extends BaseClient implements ContentClient {
public SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
public ContentClientImpl(ConfluenceRestClient confluenceRestClient, ExecutorService executorService) {
super(confluenceRestClient, executorService);
}
@Override
public Future<ContentBean> getContentById(String id, int version, List<String> expand) {
return executorService.submit(() -> {
URIBuilder uriBuilder = URIHelper.buildPath(baseUri, CONTENT, id);
if(version > 0){
uriBuilder.addParameter(VERSION, String.valueOf(version));
}
if(CollectionUtils.isNotEmpty(expand) == true){
String join = StringUtils.join(expand, ",");
uriBuilder.addParameter(EXPAND, join);
}
HttpGet method = HttpMethodFactory.createGetMethod(uriBuilder.build());
CloseableHttpResponse response = client.execute(method, clientContext);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpURLConnection.HTTP_OK) {
JsonReader jsonReader = getJsonReader(response);
ContentBean result = gson.fromJson(jsonReader, ContentBean.class);
method.releaseConnection();
return result;
} else if (statusCode == HttpURLConnection.HTTP_UNAUTHORIZED || statusCode == HttpURLConnection.HTTP_FORBIDDEN) {
return null;
} else {
RestException restException = new RestException(response);
response.close();
method.releaseConnection();
throw restException;
}
});
}
@Override
public Future<ContentResultsBean> getContent(ContentType type, String spacekey, String title, ContentStatus status, Date postingDay, List<String> expand, int start, int limit) throws URISyntaxException {
URIBuilder uriBuilder = URIHelper.buildPath(baseUri, CONTENT);
List<NameValuePair> nameValuePairs = new ArrayList<>();
if(type != null){
nameValuePairs.add(new BasicNameValuePair(TYPE, type.getName()));
}
if(StringUtils.trimToNull(spacekey) != null){
nameValuePairs.add(new BasicNameValuePair(SPACEKEY, spacekey));
}
if(StringUtils.trimToNull(title) != null){
nameValuePairs.add(new BasicNameValuePair(TITLE, title));
}
if(status != null){
nameValuePairs.add(new BasicNameValuePair(STATUS, status.getName()));
}
if(postingDay != null){
nameValuePairs.add(new BasicNameValuePair(POSTING_DAY, sdf.format(postingDay)));
}
if(expand != null && expand.isEmpty() == false){
String join = StringUtils.join(expand, ",");
nameValuePairs.add(new BasicNameValuePair(EXPAND, join));
}
if(start > 0){
nameValuePairs.add(new BasicNameValuePair(START, String.valueOf(start)));
}
if(limit > 0){
nameValuePairs.add(new BasicNameValuePair(LIMIT, String.valueOf(limit)));
}
uriBuilder.addParameters(nameValuePairs);
return executorService.submit(() -> {
HttpGet method = HttpMethodFactory.createGetMethod(uriBuilder.build());
CloseableHttpResponse response = client.execute(method, clientContext);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpURLConnection.HTTP_OK) {
JsonReader jsonReader = getJsonReader(response);
ContentResultsBean result = gson.fromJson(jsonReader, ContentResultsBean.class);
method.releaseConnection();
return result;
} else if (statusCode == HttpURLConnection.HTTP_UNAUTHORIZED || statusCode == HttpURLConnection.HTTP_FORBIDDEN) {
return null;
} else {
RestException restException = new RestException(response);
response.close();
method.releaseConnection();
throw restException;
}
});
}
}
| [
"c.schulze@micromata.de"
] | c.schulze@micromata.de |
f285f6483dcd2d2bf4e12ce166ba1d50ccb9be4c | 5907f32add464845cd67270d38d1b8881b46a3a1 | /src/main/java/com/example/demo/infraestructura/dto/ItemDto.java | fa0474d71b4f783a29164da5e5ae01aff874b958 | [] | no_license | raycu03/GrudJava | 0ae2aeeb086e6dd29b246269d41e5122f53c79fd | daebe07cb97901ea1c2b8489976a2f889df375f2 | refs/heads/master | 2020-10-01T06:22:24.111470 | 2019-12-18T23:10:13 | 2019-12-18T23:10:13 | 227,476,737 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java | package com.example.demo.infraestructura.dto;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name="items")
public class ItemDto extends BaseEntity{
private Float cantidad;
private Float valor_total;
public ItemDto() {
// TODO Auto-generated constructor stub
}
public ItemDto(Float cantidad, Float valor_total, ProductoDto producto) {
super();
this.cantidad = cantidad;
this.valor_total = valor_total;
this.producto = producto;
}
@OneToOne(targetEntity = ProductoDto.class)
private ProductoDto producto;
public Float getCantidad() {
return cantidad;
}
public void setCantidad(Float cantidad) {
this.cantidad = cantidad;
}
public Float getValor_total() {
return valor_total;
}
public void setValor_total(Float valor_total) {
this.valor_total = valor_total;
}
public ProductoDto getProducto() {
return producto;
}
public void setProducto(ProductoDto producto) {
this.producto = producto;
}
}
| [
"antonito1998@hotmail.com"
] | antonito1998@hotmail.com |
9a2fb2591fc22ce9de1788df94a7ab9654cb462b | 584d7f2d9ba48eb6f855757206ad8127eb1681ec | /Android/src/com/socratica/mobile/BigImage.java | 5bb457fd3218b1fa184bcdc4ed07afbf76c1423b | [] | no_license | yosuawilly/j-r | 7aaeda8256a077f0bc9f1da244e864b57fe5904c | 354b614b3da64affcb797f39a3fbf96ccb685f51 | refs/heads/master | 2020-04-05T19:58:23.109047 | 2014-02-28T07:13:09 | 2014-02-28T07:13:09 | 14,065,000 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,523 | java | package com.socratica.mobile;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.Map;
import android.content.Context;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;
/**
* Just like image view, but with scrolling and scale abilities.
*
* TODO write better description with usage examples.
*
* @author Konstantin Burov (aectann@gmail.com)
*
*/
public class BigImage extends ImageView implements OnGestureListener,
OnTouchListener {
private static final String ATTR_SRC = "src";
private static final Map<String, SoftReference<Drawable>> DRAWABLE_CACHE = new HashMap<String, SoftReference<Drawable>>();
protected float scale;
protected float viewWidth;
protected float viewHeight;
protected float dx;
protected float dy;
protected boolean boundsInitialized;
private GestureDetector gestureDetector;
private float initScale;
private int imageWidth;
private int imageHeight;
private int bitmapResource;
private double scaleFactor;
private String file;
public BigImage(Context context, AttributeSet attrs) {
super(context, attrs);
bitmapResource = attrs.getAttributeResourceValue(null, ATTR_SRC, 0);
setFocusable(true);
setFocusableInTouchMode(true);
gestureDetector = new GestureDetector(context, this);
this.setOnTouchListener(this);
if (file != null || bitmapResource > 0) {
setImageDrawable(getImage());
}
}
private void updateMatrix() {
Matrix m = getImageMatrix();
m.reset();
m.postScale(scale, scale);
m.postTranslate(dx, dy);
}
public Drawable getImage() {
String drawableKey = getDrawableKey();
Drawable result = DRAWABLE_CACHE.containsKey(drawableKey) ? DRAWABLE_CACHE.get(drawableKey).get() : null;
if (result == null) {
Options options = new Options();
options.inInputShareable = true;
options.inPurgeable = true;
options.inPreferredConfig = Config.RGB_565;
options.inDither = true;
if (bitmapResource > 0) {
result = new BitmapDrawable(getResources(), BitmapFactory.decodeStream(getResources().openRawResource(bitmapResource), null, options));
} else {
try {
InputStream stream = new BufferedInputStream(new FileInputStream(file), 4096);
result = new BitmapDrawable(getResources(), BitmapFactory.decodeStream(stream, null, options));
stream.close();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
result.setBounds(0, 0, imageWidth, imageHeight);
DRAWABLE_CACHE.put(drawableKey, new SoftReference<Drawable>(result));
}
return result;
}
private String getDrawableKey() {
return file == null ? String.valueOf(bitmapResource) : file;
}
protected synchronized void initBounds() {
if (viewWidth > 0 && viewHeight > 0 && (bitmapResource > 0 || file != null)) {
BitmapFactory.Options opt = loadBitmapOpts();
imageWidth = opt.outWidth;
imageHeight = opt.outHeight;
float[] f = new float[9];
getImageMatrix().getValues(f);
initScale = f[0];
dx = 0;
dy = 0;
scale = initScale;
scaleFactor = 1 / initScale;
this.boundsInitialized = true;
notify();
} else {
this.boundsInitialized = false;
}
if (!isLayoutRequested()) {
invalidate();
}
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
initBounds();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int measuredWidth = getMeasuredWidth();
int measuredHeight = getMeasuredHeight();
if (measuredHeight != viewHeight || measuredWidth != viewWidth) {
viewWidth = measuredWidth;
viewHeight = measuredHeight;
initBounds();
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
initBounds();
}
public void setImageFile(String file) {
setImageFile(file, null);
}
public void setImageFile(String file, Drawable drawable) {
this.file = file;
this.bitmapResource = 0;
if (drawable != null) {
DRAWABLE_CACHE.put(getDrawableKey(),
new SoftReference<Drawable>(drawable));
}
setImageDrawable(getImage());
}
public void setImageResource(int drawable) {
this.file = null;
this.bitmapResource = drawable;
setImageDrawable(getImage());
}
private BitmapFactory.Options loadBitmapOpts() {
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inJustDecodeBounds = true;
InputStream stream;
if (bitmapResource > 0) {
stream = getResources().openRawResource(bitmapResource);
} else {
try {
stream = new BufferedInputStream(new FileInputStream(file));
} catch (FileNotFoundException e) {
throw new IllegalStateException(e);
}
}
BitmapFactory.decodeStream(stream, null, opts);
return opts;
}
private void ajustDeltas() {
if (dx > 0) {
dx = 0;
}
if (dy > 0) {
dy = 0;
}
float minDx = 0;
if (imageWidth * scale < viewWidth) {
minDx = (viewWidth - imageWidth * scale) / 2;
} else {
minDx = -imageWidth * scale + viewWidth;
}
if (scale == initScale && viewWidth > viewHeight) {
dx = (viewWidth - imageWidth * scale) / 2;
} else if (dx < minDx) {
dx = minDx;
}
float minDy = 0;
if (imageHeight * scale < viewHeight) {
minDy = (viewHeight - imageHeight * scale) / 2;
} else {
minDy = -imageHeight * scale + viewHeight;
}
if (scale == initScale && viewHeight > viewWidth) {
dy = (viewHeight - imageHeight * scale) / 2;
} else if (dy < minDy) {
dy = minDy;
}
}
/**
* Restores the map state to the initial.
*/
public void reset() {
if (!boundsInitialized) {
return;
}
scale = initScale;
dx = 0;
dy = 0;
invalidate();
}
/**
* Zooms map in, preserving currently centered point at the center of the
* view.
*/
public void scaleOut() {
scale(1 / scaleFactor);
}
/**
* Zooms map out, preserving currently centered point at the center of the
* view.
*/
public void scaleIn() {
scale(scaleFactor);
}
protected void scale(double scaleFactor) {
float prevDx = dx + (imageWidth * scale - viewWidth) / 2;
prevDx *= scaleFactor;
float prevDy = dy + (imageHeight * scale - viewHeight) / 2;
prevDy *= scaleFactor;
scale *= scaleFactor;
if (scale < initScale) {
scale = initScale;
}
dx = prevDx - (imageWidth * scale - viewWidth) / 2;
dy = prevDy - (imageHeight * scale - viewHeight) / 2;
invalidate();
}
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
return true;
}
@Override
public void onLongPress(MotionEvent e) {
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
float distanceY) {
dx -= distanceX;
dy -= distanceY;
invalidate();
return true;
}
@Override
public void onShowPress(MotionEvent e) {
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
if (scale < 0.7) {
dx += viewWidth / 2 - e.getX();
dy += viewHeight / 2 - e.getY();
scaleIn();
return true;
}
return false;
}
double prevDelta = 0;
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getPointerCount() == 1) {
gestureDetector.onTouchEvent(event);
} else {
float x = event.getX(0);
float y = event.getY(0);
float prevX = event.getX(1);
float prevY = event.getY(1);
int action = event.getAction();
int actionCode = action & MotionEvent.ACTION_MASK;
if (actionCode == MotionEvent.ACTION_DOWN
|| actionCode == MotionEvent.ACTION_POINTER_DOWN) {
prevDelta = 0;
dx += viewWidth / 2 - (x + prevX) / 2;
dy += viewHeight / 2 - (y + prevY) / 2;
} else {
double currentDelta = getDelta(x, y, prevX, prevY);
if (prevDelta != 0) {
double dd = currentDelta - prevDelta;
float abs = (float) Math.abs(dd);
if (abs > 2) {
double scaleFactor = scale * (1 + (float) dd / 200);
scaleFactor = scaleFactor / scale;
scale(scaleFactor);
}
}
prevDelta = currentDelta;
}
}
ajustDeltas();
updateMatrix();
return true;
}
protected double getDelta(float x, float y, float prevX, float prevY) {
return Math.sqrt((x - prevX) * (x - prevX) + (y - prevY) * (y - prevY));
}
} | [
"handikayosuawilly@yahoo.co.id"
] | handikayosuawilly@yahoo.co.id |
2838e8f85c7e28305bf431ffb082ac66ffa8836d | ed1870c165a59a5ccc33c6a86cbd42e53c6e756c | /edap-protobuf/src/test/java/io/edap/protobuf/test/message/v3/ListInt64.java | 865beddc894f6f33cf2508ca1443c87fe68044bc | [] | no_license | edap-io/edap | 37370c9f694f007f112f8c0531455fb8e600debe | 2ff70acbbe4fe02ff128ef9e233bb88331506ab0 | refs/heads/master | 2022-12-11T00:56:49.925812 | 2022-12-07T12:02:27 | 2022-12-07T12:02:27 | 234,559,596 | 32 | 6 | null | 2022-11-09T16:19:05 | 2020-01-17T14:00:07 | Java | UTF-8 | Java | false | false | 790 | java | /*
* Copyright 2020 The edap Project
*
* The Netty Project 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 io.edap.protobuf.test.message.v3;
import java.util.List;
/**
* int64的list对象
*/
public class ListInt64 {
public List<Long> list;
}
| [
"louis@easyea.com"
] | louis@easyea.com |
fbff5692018d8702c831bc335822dc6172989c0e | 0d1b13165ab58691ced6468a4270dee204a69a76 | /src/main/java/com/astefanski/service/RoleService.java | eaf2db1c65f693a1f28bffdf6475d8ac9e8d6a9d | [] | no_license | astefanski1/SpringFrameworkSecurity | 027173025817fafed593bdb4ceba370ee1fa3d26 | 6a4a419fe0c7baa385fdc7ed264130ad630c1f59 | refs/heads/master | 2020-05-29T11:09:39.778225 | 2019-06-06T10:27:32 | 2019-06-06T10:27:32 | 189,107,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | package com.astefanski.service;
import com.astefanski.exceptions.RoleDoesNotExistsException;
import com.astefanski.model.Role;
import com.astefanski.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RoleService {
@Autowired
private RoleRepository roleRepository;
public Role findByName(String name) {
return roleRepository.findByName(name).orElseThrow(RoleDoesNotExistsException::new);
}
public List<Role> getAll() {
return roleRepository.findAll();
}
public Role save(Role role) {
return roleRepository.save(role);
}
} | [
"aleksander.stefanski@outlook.com"
] | aleksander.stefanski@outlook.com |
3445152983c533de1bfd9cb65e38502591beb3cd | 1f024c9b03f0a762c278a0b718f0eaebb1a32c17 | /app/src/main/java/com/example/administrator/chuanmei/adapter/MyAdapter.java | 29badd875913f4a3585b432436c2ed9e92024f1d | [] | no_license | TFHtian/ChuanMei | c90d84b27256538fb99434b22c2a40cade9d51ba | 9573840b3961d1275533f44c9005bd1ae4f9e579 | refs/heads/master | 2021-06-11T04:48:44.101150 | 2017-03-04T13:36:09 | 2017-03-04T13:36:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,520 | java | package com.example.administrator.chuanmei.adapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.example.administrator.chuanmei.R;
import java.util.List;
public class MyAdapter extends BaseAdapter {
PopupWindow popupWindow;
private List<String> datas;
private Context mContext;
public MyAdapter(Context mContext, List<String> datas, PopupWindow popupWindow) {
this.mContext = mContext;
this.datas = datas;
this.popupWindow = popupWindow;
}
@Override
public int getCount() {
return datas != null ? datas.size() : 0;
}
@Override
public Object getItem(int position) {
return datas.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
final ViewHolder viewHolder;
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.lv_item_gouxuan, null); // item 的布局文件
viewHolder = new ViewHolder();
viewHolder.linearLayout = (RelativeLayout) convertView.findViewById(R.id.rel_xuan);
viewHolder.textView = (TextView) convertView.findViewById(R.id.tv_gx);
viewHolder.imageView = (ImageView) convertView.findViewById(R.id.im_gx);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.textView.setText(datas.get(position)); // 给item设置值
// 相当于是 item的点击事件,这样在Activity中就不用写ListView.setOnItemClickListener()了
// 主要用于点击的时候显示ImageView,注意开始先得隐藏掉其他的
hintImageView(viewHolder);
final View finalConvertView = convertView;
viewHolder.linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i("TAG", "onClick: " + getItem(position).toString());
v.setVisibility(View.VISIBLE);
if (v.getVisibility() == View.VISIBLE) {
// 明明表示显示了,为什么界面上不显示呢??
Log.i("TAG", "onClick: 可见啊; current location:" + position);
}
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
popupWindow.setFocusable(false);
popupWindow.dismiss(); // 点击完item后让popupWindow消失
viewHolder.imageView.setVisibility(View.VISIBLE); // popupWindow消失了,重新隐藏掉勾选
}
});
return convertView;
}
private void hintImageView(ViewHolder viewHolder) {
viewHolder.imageView.setVisibility(View.GONE );
}
class ViewHolder {
RelativeLayout linearLayout; // 相当于是Item
TextView textView; // item中的TextView
ImageView imageView; // 用于显示勾选的ImageView
}
}
| [
"1779460473@qq.com"
] | 1779460473@qq.com |
c62a96315d707d5c2de604e1cb4c983c0fbecf55 | 25231aeaa49f189ed6fcdab6458774259e57882c | /TrainTicketSpring/src/main/java/com/trainticket/Train.java | 75449f2000b083cbec38c912e85b9f97e81c2e8f | [] | no_license | voyagerA/Train-Ticket-Project | 3139f1d30693bdc82d66b3ccaaff372aabd269c8 | 0fb7f61acd9e7fd0624fa7e4af1b6591e1c6bcbc | refs/heads/main | 2023-09-02T15:38:08.502864 | 2021-11-07T14:11:56 | 2021-11-07T14:11:56 | 425,519,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java | package com.trainticket;
public class Train {
private Integer train_no;
private String train_name;
private String source1;
private String destination;
private double ticket_price;
public Train(Integer train_no, String train_name, String source1, String destination, double ticket_price) {
this.train_no = train_no;
this.train_name = train_name;
this.source1 = source1;
this.destination = destination;
this.ticket_price = ticket_price;
}
public Train() {
}
public Integer getTrain_no() {
return train_no;
}
public void setTrain_no(Integer train_no) {
this.train_no = train_no;
}
public String getTrain_name() {
return train_name;
}
public void setTrain_name(String train_name) {
this.train_name = train_name;
}
public String getSource1() {
return source1;
}
public void setSource(String source) {
this.source1 = source1;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public double getTicket_price() {
return ticket_price;
}
public void setTicket_price(double ticket_price) {
this.ticket_price = ticket_price;
}
@Override
public String toString() {
return "Train{" +
"train_no=" + train_no +
", train_name='" + train_name + '\'' +
", source1='" + source1 + '\'' +
", destination='" + destination + '\'' +
", ticket_price=" + ticket_price +
'}';
}
}
| [
"noreply@github.com"
] | noreply@github.com |
5defd481d22ae0a0049485951664cc6259a2de60 | 503ac56dd431ade3bbb8c72f7e14667117069155 | /CCBench/src/essential/BCloudNode.java | 511bcc55f98ab4cbaa911a71493eaf9fb6cee2f1 | [] | no_license | akysettouti/CCBench | 6b43db468d191fc1d0c88b3ad9e08e063dfd942f | e4aa5a0366bd6a4004c17b8cad0b02a47e19f6dd | refs/heads/master | 2021-09-19T15:00:34.237588 | 2018-07-28T15:43:56 | 2018-07-28T15:43:56 | 85,871,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package essential;
/**
* AVL Tree Node representing a IaaS Public Cloud Computing Service.
* @author A.K.Y. SETTOUTI.
*/
public class BCloudNode extends CCService implements Comparable {
private long zCurveValue;
public BCloudNode(CCService other, long zCurveValue) {
super(other);
this.zCurveValue = zCurveValue;
}
@Override
public int compareTo(Object t) {
if (t == null) {
throw new NullPointerException("Paramètre nul.");
} else if (getClass() != t.getClass()) {
throw new ClassCastException("Classe incompatible");
} else {
BCloudNode obj = (BCloudNode) t;
if (zCurveValue == obj.zCurveValue) return super.hashCode() - ((CCService) obj).hashCode();
else return Long.compare(zCurveValue, obj.zCurveValue);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
7ef4999e40b18109a853c1bbbe5c18f50c35e9a1 | c00d0d7101789a200c58cc4b80bb78a40d20f096 | /src/main/java/br/com/lvdc/core/modelo/Perfil.java | c8fcd12b43c476dd2de4f37534a2e1df89bccf92 | [] | no_license | danielcorreaa/lvdc-java-core | 436895f6207754add87bf557ccaf4eefe85e4337 | bc198542396992d7506270cae79d6a86b1d05174 | refs/heads/master | 2020-05-05T09:13:13.343162 | 2019-04-06T23:01:37 | 2019-04-06T23:01:37 | 179,894,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package br.com.lvdc.core.modelo;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.springframework.security.core.GrantedAuthority;
import lombok.Data;
@SuppressWarnings("serial")
@Entity
@Data
public class Perfil implements GrantedAuthority{
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private String nome;
@ManyToOne
@JoinColumn(name="usuario_id")
private Usuario usuario;
@Override
public String getAuthority() {
return nome;
}
}
| [
"daniel.cor@outlook.com"
] | daniel.cor@outlook.com |
607ce4c201be6353e94bda7ff91fc8bc4fe23066 | 62e8843e19c6013a121ddd59b4ef11fb1cafbc13 | /src/main/java/com/codeclan/example/WhiskyTracker/repositories/DistilleryRepository/DistilleryRepositoryCustom.java | 5913754fcf1044ba1d286c5671cd6280db8abcde | [] | no_license | keithallan01/Java-wk13-d3-homework | 0ecc9f5fb4140b9096041af7bf5f2edc7ff2cc3e | 08fb3e29c13648ffaa4bb5c097a1ae6f7d8bf092 | refs/heads/master | 2020-04-25T17:54:25.563029 | 2019-02-27T18:09:17 | 2019-02-27T18:09:17 | 172,965,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package com.codeclan.example.WhiskyTracker.repositories.DistilleryRepository;
import com.codeclan.example.WhiskyTracker.models.Whisky;
import java.util.List;
public interface DistilleryRepositoryCustom {
// List<Whisky> findWhiskyOfACertainAgeFromDistillery(int age);
}
| [
"keithallan01@gmail.com"
] | keithallan01@gmail.com |
088b9e40d79bc5bed0783476fa67b519e81204b0 | 8024a3469a5e190dae2e59f897a8c97a44b97719 | /src/test/java/com/upload/tests/UploadFilesTest.java | 8ad77757428089e94d1cd106ff15b0479de5b142 | [] | no_license | charlyibarram/apirest-swagger-junit | e8808305c19475bb1373a3f09549de5878cfd7d5 | 9a46e79f8cb1918e86d78d9eec4c88cdcd1c6b42 | refs/heads/master | 2020-07-04T08:58:03.716898 | 2020-05-20T21:51:10 | 2020-05-20T21:51:10 | 202,231,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,240 | 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.upload.tests;
import com.upload.controller.UploadFileController;
import com.upload.service.RepositoryFile;
import java.io.InputStream;
import java.util.ArrayList;
import javax.ws.rs.core.MediaType;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
/**
*
* @author cibarra
*/
@RunWith(MockitoJUnitRunner.class)
public class UploadFilesTest {
private InputStream is;
private MockMvc mockMvc;
@Mock
private RepositoryFile repositoryFile;
@Spy
@InjectMocks
private UploadFileController controller = new UploadFileController();
@Before
public void init() {
mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
is = controller.getClass().getClassLoader().getResourceAsStream("test.txt");
}
@Test
public void testUploadFile() throws Exception {
Mockito.when(repositoryFile.findAll()).thenReturn(new ArrayList<>());
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get("/getMetaData").contentType(MediaType.APPLICATION_XML)).andExpect(MockMvcResultMatchers.status().is(200)).andReturn();
Assert.assertEquals(200, result.getResponse().getStatus());
Assert.assertEquals("application/xml;charset=UTF-8", result.getResponse().getContentType());
}
}
| [
"root@localhost.localdomain"
] | root@localhost.localdomain |
c6c0db5b8b965ec2230a965a5cd674881d16eebd | caf7a419ba131638cd88fc702ae8277194b667b3 | /src/test/java/tallerD2/ConversorEurosPesetasTest.java | 61513d897dd4ca8912d58634c572b9e380fd862d | [] | no_license | domiospina/Tallerd2 | 81627d08ed01a4d7ed80428ce66f57887a629aca | 01a8157a9aec755aa2f887aa9dc0d433c12a3627 | refs/heads/master | 2021-01-01T17:52:43.077157 | 2013-08-11T00:06:21 | 2013-08-11T00:06:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package tallerD2;
import org.junit.Test;
/**
* Created with IntelliJ IDEA.
* User: Usuario
* Date: 3/08/13
* Time: 05:48 PM
* To change this template use File | Settings | File Templates.
*/
public class ConversorEurosPesetasTest {
@Test
public void testEurosApesetas() throws Exception {
}
@Test
public void testPesetasAeuros() throws Exception {
}
}
| [
"domio9510@gmail.com"
] | domio9510@gmail.com |
4a237891261413c2681d64c3868387bf9af97075 | 2dea350eec1b396712510f9e7b1a1257f92f0d69 | /src/main/java/cn/cmcc/diseasemonitor/DiseasemonitorApplication.java | 0479ebb8cb560309b97a53ce7e98e7ce97752c2b | [] | no_license | qkmc-rk/diseasemonitor | 1ea429f0f4d7db843a849f179683523becd86967 | 3ac77d913e43ace6a588f4d1c3a6359b16e220fa | refs/heads/master | 2021-01-07T08:25:24.125490 | 2020-04-22T08:06:38 | 2020-04-22T08:06:38 | 241,633,497 | 0 | 1 | null | 2020-04-22T08:06:39 | 2020-02-19T13:50:42 | Java | UTF-8 | Java | false | false | 1,002 | java | package cn.cmcc.diseasemonitor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
@Slf4j
public class DiseasemonitorApplication implements ApplicationRunner {
@Value("${server.port}")
public int port;
@Value("${server.servlet.context-path}")
public String context;
public static void main(String[] args) {
SpringApplication.run(DiseasemonitorApplication.class, args);
}
@Override
public void run(ApplicationArguments args) throws Exception {
log.info("Tomcat服务启动完成: http://localhost:{}{}", port,context);
log.info("Swagger2 API文档: http://localhost:{}{}/swagger-ui.html", port,context);
}
}
| [
"qkmc@outlook.com"
] | qkmc@outlook.com |
d4d0f40b256aef7a60fc49d7a97b3976c648344a | fe4085f5ae85e18dddb4840ca1d0e19337718922 | /app/src/main/java/com/example/ukasz/erecepta/model/Patient.java | 70b5eb86b7621e96183424f6cfab194c5e77d0b0 | [] | no_license | liza-panineyeva/Erecepta | d0d99381ea0303cc7a3f6699d1725f6d95e69de0 | 8f0012f73d8310df9c57255dc3e736434e6247a3 | refs/heads/master | 2021-05-11T02:33:23.132067 | 2018-01-21T19:35:05 | 2018-01-21T19:35:05 | 118,366,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,737 | java | package com.example.ukasz.erecepta.model;
import java.util.UUID;
import java.util.regex.Pattern;
import io.realm.RealmList;
import io.realm.RealmObject;
/**
* Created by Agnieszka on 2018-01-06.
*/
public class Patient extends RealmObject {
private String id = UUID.randomUUID().toString();
private User user;
private String insuranceState;
private String street;
private String buildingNumber;
private String city;
private String voivodeship;
private String gmina;
private RealmAdditionalIssueKey issueKey;
//for queries
private long costOfDrugs = 0;
//optional
private RealmList<Prescription> prescriptions;
private String PhoneNumber;
private String LocalNumber;
public Patient () {}
public Patient(User user, String insuranceState, String street, String buildingNumber, String city, String voivodeship, String gmina) {
this.user = user;
this.insuranceState = insuranceState;
this.street = street;
this.buildingNumber = buildingNumber;
this.city = city;
this.voivodeship = voivodeship;
this.gmina = gmina;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public long getCostOfDrugs() {
return costOfDrugs;
}
public void setCostOfDrugs(long costOfDrugs) {
this.costOfDrugs = costOfDrugs;
}
public User getUser() {
return user;
}
public void setUser(User user) throws Exception {
if(user.getUserType().getEnum() == UserType.PATIENT)
this.user = user;
else throw new Exception("Podany typ uzytkownika jest nieprawidłowy:!");
}
public String getInsuranceState() {
return insuranceState;
}
public void setInsuranceState(String insuranceState) throws Exception{
if(insuranceState.length() <= 50)
this.insuranceState = insuranceState;
else throw new Exception("Nazwa uzbezpieczenia musi być mniejsza niż 50 znaków:!");
}
public String getStreet() {
return street;
}
public void setStreet(String street) throws Exception {
if(street.length() <= 50)
this.street = street;
else throw new Exception("Podana nazwa ulicy jest zbyt długa!");
}
public String getBuildingNumber(){
return buildingNumber;
}
public void setBuildingNumber(String buildingNumber) throws Exception{
if(buildingNumber.length() <= 5)
this.buildingNumber = buildingNumber;
else throw new Exception("Podany number budynku jest zbyt długi");
}
public String getCity() {
return city;
}
public void setCity(String city) throws Exception {
if(city.length() <= 50)
this.city = city;
else throw new Exception("Podana nazwa ulicy jest zbyt długa!");
}
public String getVoivodeship() {
return voivodeship;
}
public void setVoivodeship(String voivodeship) throws Exception{
if(voivodeship.length() <= 50)
this.voivodeship = voivodeship;
else throw new Exception("Podana nazwa województwa jest zbyt długa!");
}
public String getGmina() {
return gmina;
}
public void setGmina(String gmina) throws Exception{
if(gmina.length() <= 50)
this.gmina = gmina;
else throw new Exception("Podana nazwa gminy jest zbyt długa!");
}
public String getPhoneNumber() {
return PhoneNumber;
}
public void setPhoneNumber(String phoneNumber) throws Exception{
if(Pattern.matches("\\d{9}|\\d{3} \\d{3} \\d{3}", phoneNumber))
PhoneNumber = phoneNumber;
else throw new Exception("Podana numer telefonu jest niepoprawny!");
}
public String getLocalNumber() {
return LocalNumber;
}
public void setLocalNumber(String localNumber) throws Exception{
LocalNumber = localNumber;
}
public RealmAdditionalIssueKey getIssueKey() {
return issueKey;
}
public void setIssueKey(RealmAdditionalIssueKey issueKey) throws Exception{
this.issueKey = issueKey;
}
public RealmList<Prescription> getPrescriptions() {
return prescriptions;
}
public void setPrescriptions(RealmList<Prescription> prescriptions) {
this.prescriptions = prescriptions;
}
public boolean checkIfHavePrescription(Prescription prescription){
return this.prescriptions.contains(prescription);
}
public boolean prescribePrescription(Prescription prescription){
getPrescriptions().add(prescription);
prescription.setPatient(this);
return true;
}
} | [
"liza.panineyeva@gmail.com"
] | liza.panineyeva@gmail.com |
b9abdc9f959c60611c96eb5f22f3c30f6bd94e85 | 43ea91f3ca050380e4c163129e92b771d7bf144a | /services/eip/src/main/java/com/huaweicloud/sdk/eip/v2/model/NeutronDeleteFloatingIpResponse.java | c18bf4efa5eff88cce3797f798ebbdf51b3c1a91 | [
"Apache-2.0"
] | permissive | wxgsdwl/huaweicloud-sdk-java-v3 | 660602ca08f32dc897d3770995b496a82a1cc72d | ee001d706568fdc7b852792d2e9aefeb9d13fb1e | refs/heads/master | 2023-02-27T14:20:54.774327 | 2021-02-07T11:48:35 | 2021-02-07T11:48:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package com.huaweicloud.sdk.eip.v2.model;
import com.huaweicloud.sdk.core.SdkResponse;
import java.util.function.Consumer;
import java.util.Objects;
/**
* Response Object
*/
public class NeutronDeleteFloatingIpResponse extends SdkResponse {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class NeutronDeleteFloatingIpResponse {\n");
sb.append("}");
return sb.toString();
}
}
| [
"hwcloudsdk@huawei.com"
] | hwcloudsdk@huawei.com |
83606cffa63a3b27f4338e03d1cad646fc283f17 | 010af329f73332ff36476c38f749fd6805086acc | /app/src/main/java/com/ruanjie/donkey/ui/main/MainActivity.java | 19069bdd9b31f6247431e2279782545863f4941f | [] | no_license | Superingxz/YellowDonkey | f577feed32485b49ccab06660121af6a43a37320 | a47691c815d4f25d1298f2f3b68f17f8961d4ad5 | refs/heads/master | 2023-02-01T10:03:38.011876 | 2020-12-18T09:07:53 | 2020-12-18T09:07:53 | 322,543,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59,071 | java | package com.ruanjie.donkey.ui.main;
import android.Manifest;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.location.Location;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.AppCompatButton;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.allen.library.SuperTextView;
import com.flyco.tablayout.SegmentTabLayout;
import com.flyco.tablayout.listener.OnTabSelectListener;
import com.mirkowu.statusbarutil.StatusBarUtil;
import com.ruanjie.donkey.R;
import com.ruanjie.donkey.api.RetrofitClient;
import com.ruanjie.donkey.bean.FenceListBean;
import com.ruanjie.donkey.bean.IndexBean;
import com.ruanjie.donkey.bean.LoginBean;
import com.ruanjie.donkey.bean.MarkerDataBean;
import com.ruanjie.donkey.bean.NotifyMessageBean;
import com.ruanjie.donkey.bean.ParkingListBean;
import com.ruanjie.donkey.bean.UnReadBean;
import com.ruanjie.donkey.bean.VehicleDetailBean;
import com.ruanjie.donkey.ui.billing.BillingModeActivity;
import com.ruanjie.donkey.ui.billing.PayArrearsActivity;
import com.ruanjie.donkey.ui.billing.UseTimingActivity;
import com.ruanjie.donkey.ui.drawer.EXRealNameApplyActivity;
import com.ruanjie.donkey.ui.drawer.ExChangeActivity;
import com.ruanjie.donkey.ui.drawer.InviteFriendsActivity;
import com.ruanjie.donkey.ui.drawer.JoinSelectActivity;
import com.ruanjie.donkey.ui.drawer.MainTainActivity;
import com.ruanjie.donkey.ui.drawer.MyCouponsActivity;
import com.ruanjie.donkey.ui.drawer.MyTravelActivity;
import com.ruanjie.donkey.ui.drawer.MyWalletActivity;
import com.ruanjie.donkey.ui.drawer.PayDepositActivity;
import com.ruanjie.donkey.ui.drawer.RechargeActivity;
import com.ruanjie.donkey.ui.drawer.SettingActivity;
import com.ruanjie.donkey.ui.drawer.UserInfoActivity;
import com.ruanjie.donkey.ui.help.HelpListActivity;
import com.ruanjie.donkey.ui.main.contract.MainContract;
import com.ruanjie.donkey.ui.main.presenter.MainPresenter;
import com.ruanjie.donkey.ui.message.MyMessageActivity;
import com.ruanjie.donkey.ui.scanner.ScanUnlockActivity;
import com.ruanjie.donkey.ui.shop.ShopActivity;
import com.ruanjie.donkey.ui.sign.LoginActivity;
import com.ruanjie.donkey.ui.upload.FaultUploadActivity;
import com.ruanjie.donkey.ui.upload.IllegalUploadActivity;
import com.ruanjie.donkey.ui.webView.WebViewActivity;
import com.ruanjie.donkey.utils.DiaLogUtils;
import com.ruanjie.donkey.utils.ImageUtil;
import com.ruanjie.donkey.utils.LogUtils;
import com.ruanjie.donkey.utils.MEventBus;
import com.ruanjie.donkey.utils.MRxPermissionsUtil;
import com.ruanjie.donkey.utils.SPManager;
import com.ruanjie.donkey.utils.TimeUtils;
import com.ruanjie.toolsdk.config.ToolSdk;
import com.softgarden.baselibrary.base.BaseActivity;
import com.softgarden.baselibrary.base.EventBusBean;
import com.softgarden.baselibrary.dialog.PromptDialog;
import com.softgarden.baselibrary.network.NetworkTransformer;
import com.softgarden.baselibrary.network.RxCallback;
import com.softgarden.baselibrary.utils.BaseSPManager;
import com.softgarden.baselibrary.utils.ContextUtil;
import com.softgarden.baselibrary.utils.EmptyUtil;
import com.softgarden.baselibrary.utils.L;
import com.softgarden.baselibrary.utils.RxPermissionsUtil;
import com.softgarden.baselibrary.utils.SPUtil;
import com.softgarden.baselibrary.utils.ToastUtil;
import com.softgarden.baselibrary.widget.NoScrollViewPager;
import com.superluo.textbannerlibrary.ITextBannerItemClickListener;
import com.superluo.textbannerlibrary.TextBannerView;
import com.tencent.lbssearch.TencentSearch;
import com.tencent.lbssearch.httpresponse.HttpResponseListener;
import com.tencent.lbssearch.object.param.WalkingParam;
import com.tencent.lbssearch.object.result.WalkingResultObject;
import com.tencent.map.geolocation.TencentLocation;
import com.tencent.map.geolocation.TencentLocationListener;
import com.tencent.map.geolocation.TencentLocationManager;
import com.tencent.map.geolocation.TencentLocationRequest;
import com.tencent.map.sdk.compat.SupportMapFragmentCompat;
import com.tencent.map.sdk.compat.TencentMapCompat;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
import com.tencent.tencentmap.mapsdk.maps.model.Polygon;
import com.tencent.tencentmap.mapsdk.maps.model.PolygonOptions;
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
import com.tencent.tencentmap.mapsdk.maps.model.ScaleAnimation;
import com.vondear.rxtool.RxActivityTool;
import com.vondear.rxtool.RxDeviceTool;
import com.vondear.rxtool.RxLocationTool;
import com.vondear.rxtool.RxPermissionsTool;
import com.vondear.rxtool.view.RxToast;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import de.hdodenhof.circleimageview.CircleImageView;
import me.jessyan.autosize.AutoSizeConfig;
import q.rorbin.badgeview.Badge;
import q.rorbin.badgeview.QBadgeView;
public class MainActivity extends BaseActivity<MainPresenter> implements MainContract.View, OnTabSelectListener,
TencentMap.OnMapLoadedCallback, TencentMap.OnCameraChangeListener, TencentMap.OnMapClickListener,
TencentMap.OnMarkerClickListener {
@BindView(R.id.civHead)
CircleImageView civHead;
@BindView(R.id.tvName)
AppCompatTextView tvName;
@BindView(R.id.tvIsAuth)
AppCompatTextView tvIsAuth;
@BindView(R.id.stvWallet)
SuperTextView stvWallet;
@BindView(R.id.stvTravel)
SuperTextView stvTravel;
@BindView(R.id.stvCoupon)
SuperTextView stvCoupon;
@BindView(R.id.stvJoin)
SuperTextView stvJoin;
@BindView(R.id.stvMaintain)
SuperTextView stvMaintain;
@BindView(R.id.stvInvite)
SuperTextView stvInvite;
@BindView(R.id.stvExchange)
SuperTextView stvExchange;
@BindView(R.id.stvShop)
SuperTextView stvShop;
@BindView(R.id.stvSetting)
SuperTextView stvSetting;
@BindView(R.id.rlTopLayout)
RelativeLayout rlTopLayout;
@BindView(R.id.mViewPager)
NoScrollViewPager mViewPager;
@BindView(R.id.mDrawerLayout)
DrawerLayout mDrawerLayout;
@BindView(R.id.customer_service_layout)
RelativeLayout customerServiceLayout;
@BindView(R.id.tv_notify_message)
TextBannerView mNotifyMessage;
@BindView(R.id.tv_useing_vehicle_code)
AppCompatTextView tvUseingVehicleCode;
@BindView(R.id.bt_scan_unlock)
AppCompatButton btScanUnlock;
@BindView(R.id.image_toolbar)
Toolbar imageToolbar;
@BindView(R.id.iv_logo)
AppCompatImageView ivLogo;
@BindView(R.id.iv_yellow_donkey)
AppCompatImageView ivYellowDonkey;
@BindView(R.id.iv_message)
AppCompatImageView ivMessage;
@BindView(R.id.tv_vehicle_fault)
AppCompatTextView tvVehicleFault;
@BindView(R.id.tv_illegal_declaration)
AppCompatTextView tvIllegalDeclaration;
@BindView(R.id.tv_online_service)
AppCompatTextView tvOnlineService;
@BindView(R.id.tv_user_guide)
AppCompatTextView tvUserGuide;
@BindView(R.id.iv_location)
AppCompatImageView ivLocation;
@BindView(R.id.iv_customer_service)
AppCompatImageView ivCustomerService;
@BindView(R.id.tab_layout)
SegmentTabLayout mTabLayout;
private boolean click = true;
private boolean status = false;
private double latitude;
private double longitude;
private List<String> messages = new ArrayList<>();
private List<String> messagesUrl = new ArrayList<>();
private List<Integer> messagesId = new ArrayList<>();
private List<Integer> couponsId = new ArrayList<>();
private int isUnPay;
private int isNeedDeposit;
private int isNeedRecharge;
private String orderPrice;
private String useingVehicleCode;
private TencentMapCompat tencentMap;
private MapLocationSource locationSource;
private BitmapDescriptor myLocationBitmap;
private BitmapDescriptor locationTagBitmap;
private BitmapDescriptor electricBikeLocationBitmap;
private BitmapDescriptor electricBikeSelectBitmap;
private LatLng mStartPoint = null;
private LatLng mEndPoint = null;
private Polyline mCurPolyline;
private IndexBean.ListBean mCurTag;
private SupportMapFragmentCompat mapFragment;
private int time = 0;
private TimeRunnable mTimeRunnable;
private LoginBean mLoginBean = SPManager.getLoginBean();
;
private int isUseingVehicle;
private BitmapDescriptor parkingBitmap, parking2Bitmap, parking3Bitmap;
private Polygon polygon;
private int isFirstUseVehicle;
// private int couponId;
// private int messageId;
private String[] mTitles = {"找驴(车)", "还驴(车)"};
private Marker parkingMarker;
private Marker electricBikeMarker;
private WalkingResultObject.Route route;
private Marker mMarker;
private List<IndexBean.ListBean> list;
private String dir = "";
private String tip = "";
private boolean isFirstLocation = true;
private int isInside;
private ValueAnimator animator = null;
private LatLng mCurrentPosition = null;
private LatLng mMarkerPositon = null;
private RequestRunnable mRequestRunnable;
private String vehicleCode;
private TencentSearch tencentSearch;
private List<Marker> electricBikeMarkers = new ArrayList<>();
private List<Marker> parkingMarkers = new ArrayList<>();
private LatLng[] latLngs;
private Location location;
private Polygon mPolygon;
private List<LatLng> polylines;
private List<ParkingListBean.PointsBean> parkingPointsList;
private ArrayList<Polygon> parkingPolygons = new ArrayList<>();
private int enegy;
private IndexBean indexBean;
private Marker mMyLocationMarker;
@OnClick({R.id.rlTopLayout, R.id.stvWallet, R.id.stvTravel
, R.id.stvCoupon, R.id.stvJoin, R.id.stvMaintain
, R.id.stvInvite, R.id.stvExchange, R.id.stvShop
, R.id.stvSetting, R.id.iv_logo, R.id.iv_message,
R.id.iv_location, R.id.bt_scan_unlock, R.id.iv_customer_service,
R.id.tv_vehicle_fault, R.id.tv_illegal_declaration, R.id.tv_online_service,
R.id.tv_user_guide, R.id.tv_useing_vehicle_code})
public void onClick(View v) {
switch (v.getId()) {
case R.id.rlTopLayout:
//个人信息编辑
UserInfoActivity.start(getContext());
break;
case R.id.stvWallet:
MyWalletActivity.start(getContext());
break;
case R.id.stvTravel:
MyTravelActivity.start(getContext());
break;
case R.id.stvCoupon:
MyCouponsActivity.start(getContext());
break;
case R.id.stvJoin:
JoinSelectActivity.start(getContext());
break;
case R.id.stvMaintain:
MainTainActivity.start(getContext());
break;
case R.id.stvInvite:
InviteFriendsActivity.start(getContext());
break;
case R.id.stvExchange:
//获取用户信息,判断是否通过外协换电实名认证
RetrofitClient.getService()
.getUserInfo()
.compose(new NetworkTransformer<>(this))
.subscribe(new RxCallback<LoginBean>() {
@Override
public void onSuccess(LoginBean data) {
SPManager.setLoginBean(data);
//0=未认证,1=已审核,2=不通过
int assist_status = data.getAssist_status();
if (assist_status != 1) {
EXRealNameApplyActivity.start(getContext(), assist_status);
} else {
ExChangeActivity.start(getContext());
}
}
});
break;
case R.id.stvShop://驴币商城
ShopActivity.start(getContext());
break;
case R.id.stvSetting:
SettingActivity.start(getContext());
break;
case R.id.iv_logo:
if (mLoginBean == null || mLoginBean.getId() <= 0) {
showLoginDialog();
} else {
openDrawer();
}
break;
case R.id.iv_message:
if (mLoginBean == null || mLoginBean.getId() <= 0) {
showLoginDialog();
} else {
MyMessageActivity.start(getContext());
}
break;
case R.id.iv_location:
if (MRxPermissionsUtil.isHasAll(getActivity(), RxPermissionsUtil.FINE_LOCATION_STORAGE)) {
mCurrentPosition = new LatLng(latitude, longitude);
if (mCurrentPosition != null) {
tencentMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mCurrentPosition, 16));
getPresenter().index(String.valueOf(mCurrentPosition.longitude), String.valueOf(mCurrentPosition.latitude), 800);
}
} else {
initGpsAndPermissions();
}
break;
case R.id.bt_scan_unlock:
if (mLoginBean == null || mLoginBean.getId() <= 0) {
showLoginDialog();
} else if (isFirstUseVehicle == 1) {
getPresenter().showPrice();
} else if (isNeedDeposit == 1) {
PayDepositActivity.start(getContext(), mLoginBean.getDeposit());
} else if (isUnPay == 1) {
PayArrearsActivity.start(getContext(), orderPrice);
finish();
} else if (isNeedRecharge == 1) {
RechargeActivity.start(getContext());
finish();
} else {
ScanUnlockActivity.start(getContext());
}
break;
case R.id.iv_customer_service:
if (mLoginBean == null || mLoginBean.getId() <= 0) {
showLoginDialog();
} else if (click) {
customerServiceLayout.setVisibility(View.VISIBLE);
click = false;
} else {
customerServiceLayout.setVisibility(View.GONE);
click = true;
}
break;
case R.id.tv_vehicle_fault:
FaultUploadActivity.start(getContext());
break;
case R.id.tv_illegal_declaration:
IllegalUploadActivity.start(getContext());
break;
case R.id.tv_online_service:
DiaLogUtils.showTipDialog(getContext(), "即将拨通客服电话"
, "020-12580580"
, "取消"
, "立即拨打"
, new PromptDialog.OnButtonClickListener() {
@Override
public void onButtonClick(PromptDialog dialog, boolean isPositiveClick) {
if (isPositiveClick) {
RxDeviceTool.callPhone(getActivity(), String.valueOf(020 - 12580580));
}
}
});
break;
case R.id.tv_user_guide:
HelpListActivity.start(getContext());
break;
case R.id.tv_useing_vehicle_code:
UseTimingActivity.start(getActivity(), useingVehicleCode);
break;
default:
break;
}
}
@Override
public MainPresenter createPresenter() {
return new MainPresenter(this);
}
public static void start(Context context) {
// starter.putExtra(F);
context.startActivity(new Intent(context, MainActivity.class));
}
public static void start(Context context, boolean status, boolean isCloseActs) {
// starter.putExtra(F);
Intent starter = new Intent(context, MainActivity.class).putExtra("status", status);
if (isCloseActs) {
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
starter.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
context.startActivity(starter);
}
public static void start(Context context, boolean isCloseActs) {
Intent starter = new Intent(context, MainActivity.class);
// mIsCloseActs = isCloseActs;
// starter.putExtra();
if (isCloseActs) {
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
starter.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
context.startActivity(starter);
}
private void initGpsAndPermissions() {
if (RxPermissionsUtil.checkGPSEnable(getContext())) {
RxPermissionsTool.with(getActivity())
.addPermission(Manifest.permission.ACCESS_FINE_LOCATION)
.addPermission(Manifest.permission.READ_PHONE_STATE)
.addPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
.addPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.initPermission();
// RxPermissionsUtil.request(getActivity(),RxPermissionsUtil.FINE_LOCATION_STORAGE);
if (RxLocationTool.isLocationEnabled(getContext())) {
initLocation();
}
} else {
DiaLogUtils.showTipDialog(getContext(), "检测到GPS/位置服务\n功能未开启,请开启~", null,
getString(R.string.base_cancel), getString(R.string.open), new PromptDialog.OnButtonClickListener() {
@Override
public void onButtonClick(PromptDialog dialog, boolean isPositiveClick) {
if (isPositiveClick) {
RxLocationTool.openGpsSettings(getContext());
} else {
RxPermissionsTool.with(getActivity())
.addPermission(Manifest.permission.ACCESS_COARSE_LOCATION)
.addPermission(Manifest.permission.READ_PHONE_STATE)
.addPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
.addPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.initPermission();
// RxPermissionsUtil.request(getActivity(),RxPermissionsUtil.COARSE_LOCATION_STORAGE);
if (RxLocationTool.isLocationEnabled(getContext())) {
initLocation();
}
}
}
});
}
}
private void initDrawerViews() {
StatusBarUtil.setTransparentForDrawerLayout(this, mDrawerLayout);
StatusBarUtil.setStatusBarLightMode(getActivity());
//禁止侧边栏滑动
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
// mLoginBean = SPManager.getLoginBean();
if (mLoginBean != null) {
ImageUtil.loadImage(civHead, mLoginBean.getAvatar(), R.mipmap.userinfo_head);
tvName.setText(mLoginBean.getNickname());
// tvIsAuth.setVisibility(mLoginBean.getIs_realname() == 1 ? View.VISIBLE : View.INVISIBLE);
tvIsAuth.setText(mLoginBean.getIs_realname() == 1 ? getString(R.string.userinfo_has_real_name)
: mLoginBean.getIs_realname() == 2 ? getString(R.string.userinfo_no_real_name)
: mLoginBean.getIs_realname() == 3 ? getString(R.string.userinfo_real_name_ing)
: getString(R.string.userinfo_no_apply)
);
if (mLoginBean.getIs_realname() == 1) {
tvIsAuth.setCompoundDrawablesWithIntrinsicBounds(R.mipmap.drawer_auth, 0, 0, 0);
} else {
tvIsAuth.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
}
if (mLoginBean.getIs_maintenance() == 1) {
stvMaintain.setVisibility(View.VISIBLE);
} else {
stvMaintain.setVisibility(View.GONE);
}
}
}
@Override
public void initNotifyMessage(List<NotifyMessageBean> beans) {
if (EmptyUtil.isNotEmpty(beans) || beans.size() != 0) {
mNotifyMessage.setVisibility(View.VISIBLE);
for (int i = 0; i < beans.size(); i++) {
messages.add(beans.get(i).getTitle());
messagesUrl.add(beans.get(i).getContent_url());
messagesId.add(beans.get(i).getId());
couponsId.add(beans.get(i).getCoupon_id());
// messageId = beans.get(i).getId();
// couponId = beans.get(i).getCoupon_id();
}
mNotifyMessage.setDatasWithDrawableIcon(messages, ContextCompat.getDrawable(getContext(), R.mipmap.gift_icon), 18, Gravity.LEFT);
mNotifyMessage.setItemOnClickListener(new ITextBannerItemClickListener() {
@Override
public void onItemClick(String data, int position) {
WebViewActivity.start(getContext(), data, messagesUrl.get(position), messagesId.get(position), couponsId.get(position));
}
});
}
}
@Override
public void initIndex(IndexBean bean) {
if (electricBikeMarkers != null && electricBikeMarkers.size() > 0) {
for (Marker electricBikeMarker : electricBikeMarkers) {
electricBikeMarker.remove();
}
}
if (bean != null) {
isFirstUseVehicle = bean.getIs_first();
isUnPay = bean.getIs_unpay();
isNeedDeposit = bean.getNeed_deposit();
isNeedRecharge = bean.getNeed_recharge();
orderPrice = String.valueOf(bean.getOrder_price());
isUseingVehicle = bean.getIs_using();
useingVehicleCode = bean.getUsing_car();
time = bean.getUsing_car_duration();
isInside = bean.getIs_inside();
if (isInside == 0) {
RxToast.showToast(getContext(), "该区域暂未开通服务,敬请期待", Toast.LENGTH_LONG);
}
// List<IndexBean.ListBean> list = bean.getList();
list = bean.getList();
if (EmptyUtil.isNotEmpty(list) && list.size() > 0) {
// if (electricBikeMarker == null){
for (IndexBean.ListBean listBean : list) {
MarkerDataBean markerDataBean = new MarkerDataBean();
markerDataBean.setIndexBean(bean);
markerDataBean.setListBean(listBean);
electricBikeMarker = tencentMap.addMarker(
new MarkerOptions(new LatLng(Double.parseDouble(listBean.getLat()), Double.parseDouble(listBean.getLng())))
.icon(electricBikeLocationBitmap)
.fastLoad(true)
.tag(markerDataBean));
electricBikeMarkers.add(electricBikeMarker);
enegy = listBean.getEnegy();
vehicleCode = listBean.getCode();
}
// }
}
}
if (status || isUseingVehicle == 1) {
if (isUseingVehicle == 0 && EmptyUtil.isNotEmpty(messagesId) && messagesId.size() > 0) {
tvUseingVehicleCode.setVisibility(View.GONE);
mNotifyMessage.setVisibility(View.VISIBLE);
btScanUnlock.setText("扫码解锁");
if (mTimeRunnable != null) {
ToolSdk.getHandler().removeCallbacks(mTimeRunnable);
mTimeRunnable = null;
}
} else {
tvUseingVehicleCode.setVisibility(View.VISIBLE);
mNotifyMessage.setVisibility(View.GONE);
tvUseingVehicleCode.setText("正在使用编号" + useingVehicleCode + "的电动车");
if (mTimeRunnable == null) {
mTimeRunnable = new TimeRunnable();
ToolSdk.getHandler().postDelayed(mTimeRunnable, 0);
}
btScanUnlock.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_radius_yellow));
btScanUnlock.setOnClickListener(v ->
UseTimingActivity.start(getContext(), useingVehicleCode));
// getPresenter().vehicleDetail(useingVehicleCode);
}
} else {
if (EmptyUtil.isNotEmpty(messagesId) && messagesId.size() > 0) {
tvUseingVehicleCode.setVisibility(View.GONE);
mNotifyMessage.setVisibility(View.VISIBLE);
btScanUnlock.setText("扫码解锁");
// getPresenter().vehicleDetail(vehicleCode);
}
}
}
@Override
public void initParkingList(List<ParkingListBean> beans) {
//这里再加一个type=3时候的停车图标
parkingBitmap = BitmapDescriptorFactory.fromResource(R.mipmap.parking_icon);
parking2Bitmap = BitmapDescriptorFactory.fromResource(R.mipmap.type2);
parking3Bitmap = BitmapDescriptorFactory.fromResource(R.mipmap.type3);
if (EmptyUtil.isNotEmpty(parkingMarkers) && parkingMarkers.size() > 0) {
for (Marker parkingMarker : parkingMarkers) {
parkingMarker.remove();
}
}
if (EmptyUtil.isNotEmpty(parkingPolygons) && parkingPolygons.size() > 0) {
for (Polygon parkingPolygon : parkingPolygons) {
parkingPolygon.remove();
}
}
if (EmptyUtil.isNotEmpty(beans) && beans.size() > 0) {
// if (parkingMarker == null){
for (ParkingListBean bean : beans) {
parkingPointsList = bean.getPoints();
if (EmptyUtil.isEmpty(parkingPointsList)) {
continue;
}
parkingMarker = tencentMap.addMarker(new MarkerOptions(
new LatLng(Double.parseDouble(bean.getLat()),
Double.parseDouble(bean.getLng())))
.icon(bean.getType() == 2 ? parking2Bitmap
: bean.getType() == 3 ? parking3Bitmap
: parkingBitmap)
.fastLoad(true));
parkingMarkers.add(parkingMarker);
addPolygon(parkingPointsList, bean.getType());
/*for (ParkingListBean.PointsBean pointsBean : pointsList) {
}*/
}
// }
}
}
protected void addPolygon(List<ParkingListBean.PointsBean> pointsBeans, int type) {
for (int i = 0; i < pointsBeans.size(); i++) {
LatLng latLngs[] = new LatLng[pointsBeans.size()];
for (int j = 0; j < pointsBeans.size(); j++) {
ParkingListBean.PointsBean pointsBean = pointsBeans.get(j);
try {
latLngs[j] = new LatLng(Double.valueOf(pointsBean.getLat()), Double.valueOf(pointsBean.getLng()));
} catch (Exception e) {
LogUtils.d("error", e.getMessage());
}
}
//根据type=3变化停车点颜色
polygon = tencentMap.addPolygon(new PolygonOptions().
add(latLngs).
fillColor(ContextCompat.getColor(getContext(), type == 2 ? R.color.color_inner_2
: type == 3 ? R.color.color_inner_3
: R.color.color_inner_1)).
strokeColor(ContextCompat.getColor(getContext(),
type == 2 ? R.color.color_type_2
: type == 3 ? R.color.color_type_3
: R.color.color_type_1))
.strokeWidth(5).clickable(false));
parkingPolygons.add(polygon);
}
}
@Override
public void initFenceList(List<FenceListBean> beans) {
if (EmptyUtil.isNotEmpty(beans) && beans.size() > 0) {
for (FenceListBean bean : beans) {
List<FenceListBean.PointsBean> pointsList = bean.getPoints();
if (EmptyUtil.isEmpty(pointsList)) {
continue;
}
for (int i = 0; i < pointsList.size(); i++) {
LatLng latLngs[] = new LatLng[pointsList.size()];
for (int j = 0; j < pointsList.size(); j++) {
FenceListBean.PointsBean pointsBean = pointsList.get(j);
try {
latLngs[j] = new LatLng(Double.parseDouble(pointsBean.getLat()), Double.parseDouble(pointsBean.getLng()));
} catch (Exception e) {
LogUtils.d("error", e.getMessage());
}
}
mPolygon = tencentMap.addPolygon(new PolygonOptions().
add(latLngs).
fillColor(ContextUtil.getColor(R.color.inner_blue)).
strokeColor(ContextUtil.getColor(R.color.outer_blue)).
strokeWidth(5).clickable(false));
}
}
}
}
@Override
public void isShowPrice() {
BillingModeActivity.start(getContext());
// finish();
}
@Override
public void vehicleDetail(VehicleDetailBean bean) {
if (bean.getUser_id() != mLoginBean.getId()) {
tvUseingVehicleCode.setVisibility(View.GONE);
mNotifyMessage.setVisibility(View.VISIBLE);
btScanUnlock.setText("扫码解锁");
}
}
@Override
public void getUnReadCount(UnReadBean data) {
int num = data.getNum();
if (num <= 0) {//隐藏红点
mMsgBadge.setBadgeText("");
} else if (num > 99) {//显示99+
mMsgBadge.setBadgeText("99+");
} else {
mMsgBadge.setBadgeNumber(num);
}
}
@Override
public void initBitmap() {
myLocationBitmap = BitmapDescriptorFactory.fromResource(R.mipmap.yellow_dot_icon);
locationTagBitmap = BitmapDescriptorFactory.fromResource(R.mipmap.location_tag_icon);
electricBikeLocationBitmap = BitmapDescriptorFactory.fromResource(R.mipmap.electric_bike_location_icon);
electricBikeSelectBitmap = BitmapDescriptorFactory.fromResource(R.mipmap.electric_bike_location_select_icon);
}
@Override
public void initMap() {
FragmentManager fm = getSupportFragmentManager();
mapFragment = (SupportMapFragmentCompat) fm.findFragmentById(R.id.fragment_map);
if (mapFragment != null) {
if (tencentMap == null) {
tencentMap = mapFragment.getMap();
tencentSearch = new TencentSearch(getContext());
// tencentMap.getUiSettings().setZoomControlsEnabled(false);
tencentMap.getUiSettings().setGestureScaleByMapCenter(true);
tencentMap.setOnMapLoadedCallback(this);
tencentMap.setOnMarkerClickListener(this);
tencentMap.setOnMapClickListener(this);
tencentMap.setOnCameraChangeListener(this);
// tencentMap.setOnMarkerDragListener(this);
}
}
}
@Override
public void initLocation() {
locationSource = new MapLocationSource(getContext());
// tencentMap.setLocationSource(locationSource);
tencentMap.setMyLocationEnabled(true);
}
@Override
public void initMyLocationMarker() {
mMyLocationMarker = tencentMap.addMarker(new MarkerOptions(new LatLng(latitude, longitude))
.icon(myLocationBitmap).fastLoad(true));
mMyLocationMarker.setClickable(false);
}
/*@Override
public void initLocationStyle() {
MyLocationStyle myLocationStyle = new MyLocationStyle();
myLocationStyle.anchor(0.5f, 0.5f);
myLocationStyle.icon(myLocationBitmap);
myLocationStyle.fillColor(0);
myLocationStyle.strokeColor(0);
myLocationStyle.strokeWidth(0);
myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);
tencentMap.setMyLocationStyle(myLocationStyle);
}*/
@Override
public void initMarker() {
if (mMarker == null) {
mMarker = tencentMap.addMarker(new MarkerOptions(new LatLng(latitude, longitude))
.icon(locationTagBitmap).fastLoad(true));
mMarker.setFixingPoint(tencentMap.getMapWidth() / 2, tencentMap.getMapHeight() / 2 - 200);
animMarker();
}
/* else {
mMarker.setFixingPoint(tencentMap.getMapWidth() / 2,tencentMap.getMapHeight() / 2 + 100);
mMarker.setFastLoad(true);
animMarker();
}*/
mMarker.setClickable(false);
}
@Override
protected Object getLayoutId() {
return R.layout.activity_main;
}
@Override
protected void initialize() {
L.i("onCreate");
StatusBarUtil.setStatusBarPadding(getContext(), imageToolbar);
// isLogin();
initDrawerViews();
status = getIntent().getBooleanExtra("status", false);
getPresenter().notifyMessage();
mMsgBadge = new QBadgeView(getContext())
.bindTarget(ivMessage)
.setBadgeTextSize(10, true)
.setBadgePadding(1, true)
.setBadgePadding(1, true);
mTabLayout.setTabData(mTitles);
mTabLayout.setCurrentTab(0);
initBitmap();
initMap();
initGpsAndPermissions();
mTabLayout.setOnTabSelectListener(this);
//clustering
/* mClusterManager = new ClusterManager<TencentMapItem>(this, tencentMap);
//设置聚合渲染器, 默认 cluster manager 使用的就是 DefaultClusterRenderer 可以不调用下列代码
renderer = new DefaultClusterRenderer<>(this, tencentMap, mClusterManager);
//如果需要修改聚合点生效阈值,需要调用这个方法,这里指定聚合中的点大于1个时才开始聚合,否则显示单个 marekr
renderer.setMinClusterSize(1);
mClusterManager.setRenderer(renderer);
//添加聚合
tencentMap.setOnCameraChangeListener(mClusterManager);*/
}
Badge mMsgBadge;
private void isLogin() {
if (mLoginBean == null || TextUtils.isEmpty(String.valueOf(mLoginBean.getId()))) {
DiaLogUtils.showTipDialog(getContext(), "你还没登录呢!"
, "注册登录后才可扫码用车哦~"
, "取消"
, "去登录"
, new PromptDialog.OnButtonClickListener() {
@Override
public void onButtonClick(PromptDialog dialog, boolean isPositiveClick) {
if (isPositiveClick) {
LoginActivity.start(getContext());
finish();
}
}
});
} else {
Log.d("lh", String.valueOf(mLoginBean.getUser_id() + " " + String.valueOf(mLoginBean.getToken())));
}
}
private void showLoginDialog() {
DiaLogUtils.showTipDialog(getContext(), "你还没登录呢!"
, "注册登录后才可扫码用车哦~"
, "取消"
, "去登录"
, new PromptDialog.OnButtonClickListener() {
@Override
public void onButtonClick(PromptDialog dialog, boolean isPositiveClick) {
if (isPositiveClick) {
RxActivityTool.skipActivityAndFinishAll(getContext(), LoginActivity.class);
}
}
});
}
public void setStatusBarLightMode() {
if (!BaseSPManager.isNightMode()) {
StatusBarUtil.setStatusBarLightModeWithNoSupport(getActivity(), true);
}
}
@Override
public void onTabSelect(int position) {
switch (position) {
case 0:
if (EmptyUtil.isNotEmpty(parkingMarkers) && parkingMarkers.size() > 0) {
for (Marker parkingMarker : parkingMarkers) {
parkingMarker.remove();
}
}
if (EmptyUtil.isNotEmpty(parkingPolygons) && parkingPolygons.size() > 0) {
for (Polygon parkingPolygon : parkingPolygons) {
parkingPolygon.remove();
}
}
if (mCurrentPosition != null) {
getPresenter().index(String.valueOf(mCurrentPosition.longitude), String.valueOf(mCurrentPosition.latitude), 800);
}
break;
case 1:
if (EmptyUtil.isNotEmpty(electricBikeMarkers) && electricBikeMarkers.size() > 0) {
for (Marker electricBikeMarker : electricBikeMarkers) {
electricBikeMarker.remove();
}
}
if (mCurrentPosition != null) {
getPresenter().parikingList(mCurrentPosition.longitude, mCurrentPosition.latitude, 800);
}
break;
default:
break;
}
}
@Override
public void onTabReselect(int position) {
}
@Override
public void onMapLoaded() {
// initMarker();
if (mRequestRunnable == null) {
mRequestRunnable = new RequestRunnable();
ToolSdk.getHandler().postDelayed(mRequestRunnable, 0);
}
}
@Override
public boolean onMarkerClick(Marker marker) {
// electricBikeMarker = marker;
mMarkerPositon = marker.getPosition();
/* if (latLngs == null) {
latLngs = getCoords();
if (latLngs[0] == null) {
RxToast.showToast("起点坐标不合规则");
return false;
}
if (latLngs[1] == null) {
RxToast.showToast("终点坐标不合规则");
return false;
}
}*/
if (mCurPolyline != null) {
mCurPolyline.remove();
mCurPolyline = null;
}
if (electricBikeMarker != null) {
electricBikeMarker.setIcon(electricBikeLocationBitmap);
electricBikeMarker = null;
}
if (mCurTag != null) {
// IndexBean.ListBean tag = (IndexBean.ListBean) marker.getTag();
MarkerDataBean markerTag = (MarkerDataBean) marker.getTag();
if (markerTag != null) {
IndexBean.ListBean listBean = markerTag.getListBean();
if (listBean != null && listBean.getId() == mCurTag.getId()) {
mCurTag = null;
mMarkerPositon = null;
return true;
}
}
}
startAnim(marker);
electricBikeMarker = marker;
marker.setIcon(electricBikeSelectBitmap);
if (mCurrentPosition != null && mMarkerPositon != null) {
getWalkPlan(marker, mCurrentPosition, mMarkerPositon);
}
/* new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(300);
electricBikeMarker = marker;
// mStartPoint = new LatLng(mCurrentPosition.latitude, mCurrentPosition.longitude);
// mMarker.setPosition(mStartPoint);
// mEndPoint =new LatLng(marker.getPosition().latitude,marker.getPosition().longitude);
marker.setIcon(electricBikeSelectBitmap);
// marker.setPosition(marker.getPosition());
if (mCurrentPosition != null && mMarkerPositon != null) {
getWalkPlan(marker,mCurrentPosition, mMarkerPositon);
}
}catch (Exception e){
e.printStackTrace();
}
}
}).start();*/
MarkerDataBean tag = (MarkerDataBean) marker.getTag();
indexBean = tag.getIndexBean();
mCurTag = tag.getListBean();
return true;
}
@Override
public void onCameraChange(CameraPosition cameraPosition) {
mCurrentPosition = cameraPosition.target;
// getPresenter().index(String.valueOf(mCurrentPosition.longitude), String.valueOf(mCurrentPosition.latitude), 10000);
}
@Override
public void onCameraChangeFinished(CameraPosition cameraPosition) {
mCurrentPosition = cameraPosition.target;
// mStartPosition = cameraPosition.target;
// LatLng target = cameraPosition.target;
if (mCurPolyline != null) {
mCurPolyline.remove();
mCurPolyline = null;
}
if (mMarker != null) {
animMarker();
}
/*if (mCurrentPosition != null && mMarkerPositon != null) {
getWalkPlan(mCurrentPosition, mMarkerPositon);
}*/
if (mTabLayout.getCurrentTab() == 0) {
if (mCurrentPosition != null) {
getPresenter().index(String.valueOf(mCurrentPosition.longitude), String.valueOf(mCurrentPosition.latitude), 800);
}
} else if (mTabLayout.getCurrentTab() == 1) {
if (mCurrentPosition != null) {
getPresenter().parikingList(mCurrentPosition.longitude, mCurrentPosition.latitude, 800);
}
}
}
@Override
public void onMapClick(LatLng latlng) {
if (electricBikeMarker != null) {
electricBikeMarker.setIcon(electricBikeLocationBitmap);
electricBikeMarker.hideInfoWindow();
electricBikeMarker = null;
}
if (mCurPolyline != null) {
mCurPolyline.remove();
mCurPolyline = null;
}
/* if(mCurrentPosition != null) {
CameraUpdate cameraUpate = CameraUpdateFactory.newLatLngZoom(
mCurrentPosition, 17f);
tencentMap.animateCamera(cameraUpate);
}*/
}
/*protected LatLng[] getCoords() {
LatLng start = new LatLng(mCurrentPosition.latitude,mCurrentPosition.longitude);
LatLng destination = new LatLng(mMarkerPositon.latitude,mMarkerPositon.longitude);
LatLng[] latLngs = {start, destination};
return latLngs;
}*/
private class TimeRunnable implements Runnable {
@Override
public void run() {
btScanUnlock.setText("正在用车中\n" + TimeUtils.formattedTime(time++));
ToolSdk.getHandler().postDelayed(this, 1000);
}
}
private class RequestRunnable implements Runnable {
@Override
public void run() {
if (mCurrentPosition != null) {
getPresenter().index(String.valueOf(mCurrentPosition.longitude), String.valueOf(mCurrentPosition.latitude), 800);
} else {
getPresenter().index(String.valueOf(longitude), String.valueOf(latitude), 800);
}
ToolSdk.getHandler().postDelayed(this, 30000);
}
}
private void startAnim(Marker marker) {
ScaleAnimation anim = new ScaleAnimation(1.0f, 1.3f, 1.0f, 1.3f);
anim.setDuration(300);
marker.setAnimation(anim);
marker.startAnimation();
}
private void animMarker() {
if (animator != null) {
animator.start();
return;
}
animator = ValueAnimator.ofFloat(tencentMap.getMapHeight() / 2, tencentMap.getMapHeight() / 2 - 30);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(150);
animator.setRepeatCount(1);
animator.setRepeatMode(ValueAnimator.REVERSE);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
Float value = (Float) animation.getAnimatedValue();
mMarker.setFixingPoint(tencentMap.getMapWidth() / 2, Math.round(value));
}
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mMarker.setIcon(locationTagBitmap);
}
});
animator.start();
}
private void endAnim() {
if (animator != null && animator.isRunning())
animator.end();
}
/**
* 步行规划,只能设置起点和终点
*/
protected void getWalkPlan(Marker marker, LatLng start, LatLng end) {
WalkingParam walkingParam = new WalkingParam();
walkingParam.from(start);
walkingParam.to(end);
tencentSearch.getRoutePlan(walkingParam, new HttpResponseListener<WalkingResultObject>() {
@Override
public void onSuccess(int statusCode, WalkingResultObject object) {
// route = object.result.routes.get(0);
if (object == null) {
return;
}
List<WalkingResultObject.Route> routes = object.result.routes;
for (WalkingResultObject.Route route : routes) {
dir = getDistance(route.distance);
tip = getDuration(route.duration);
polylines = route.polyline;
mCurPolyline = drawSolidLine(polylines);
}
if (indexBean != null) {
List<IndexBean.ListBean> list = indexBean.getList();
MarkerDataBean tag = (MarkerDataBean) marker.getTag();
if (tag != null) {
IndexBean.ListBean mListBean = tag.getListBean();
marker.setTitle("电量:" + mListBean.getEnegy() + "%"
+ "距离:" + dir
+ "时间:" + tip);
marker.setSnippet("编号:" + mListBean.getCode());
marker.showInfoWindow();
}
}
/*for (int i = 0; i < list.size(); i++) {
if (marker != null){
marker.setTitle("电量:" + list.get(i).getEnegy() + "%"
+ "距离:" + dir
+ "时间:" + tip);
marker.setSnippet("编号:" + list.get(i).getCode());
marker.showInfoWindow();
}
}*/
L.e("searchdemo", "plan success");
}
@Override
public void onFailure(int statusCode, String responseString, Throwable throwable) {
}
});
}
/**
* 将路线以实线画到地图上
*
* @param latLngs
*/
protected Polyline drawSolidLine(List<LatLng> latLngs) {
return tencentMap.addPolyline(new PolylineOptions().
addAll(latLngs).
width(20).lineCap(true).
color(0xff24CC80));
}
/**
* 将距离转换成米或千米
*
* @param distance
* @return
*/
protected String getDistance(float distance) {
if (distance < 1000) {
return Integer.toString((int) distance) + "米";
} else {
return Float.toString((float) ((int) (distance / 10)) / 100) + "千米";
}
}
/**
* 将时间转换成小时+分钟
*
* @param duration
* @return
*/
protected String getDuration(float duration) {
if (duration < 60) {
return Integer.toString((int) duration) + "分";
} else {
return Integer.toString((int) (duration / 60)) + "小时"
+ Integer.toString((int) (duration % 60)) + "分";
}
}
@Override
protected void onStart() {
super.onStart();
L.i("onStart");
mapFragment.onStart();
}
@Override
protected void onResume() {
super.onResume();
L.i("onResume");
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
mapFragment.onResume();
locationSource.onResume();
// initLocationStyle();
getPresenter().fenceList();
/*if (status) {
if (mRunnable == null) {
mRunnable = new TimeRunnable();
ToolSdk.getHandler().postDelayed(mRunnable, 0);
}
}*/
//获取未读消息数量
getPresenter().getUnReadCount();
// getPresenter().index(String.valueOf(longitude),String.valueOf(latitude),10000);
}
@Override
protected void onPause() {
super.onPause();
L.i("onPause");
mapFragment.onPause();
locationSource.onPause();
if (mTimeRunnable != null) {
ToolSdk.getHandler().removeCallbacks(mTimeRunnable);
mTimeRunnable = null;
}
if (mRequestRunnable != null) {
ToolSdk.getHandler().removeCallbacks(mRequestRunnable);
mRequestRunnable = null;
}
}
@Override
protected void onStop() {
super.onStop();
L.i("onStop");
mapFragment.onStop();
}
@Override
protected void onRestart() {
L.i("onRestart");
super.onRestart();
}
@Override
protected void onDestroy() {
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
if (tencentMap.isMyLocationEnabled()) {
tencentMap.setMyLocationEnabled(false);
}
if (!tencentMap.isDestroyed()) {
tencentMap.clearAllOverlays();
mapFragment.onDestroyView();
}
super.onDestroy();
L.i("onDestory");
}
/**
* 检查是否为竖屏
*/
public void checkScreenOrientation() {
if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
AutoSizeConfig.getInstance().setDesignWidthInDp(360).setDesignHeightInDp(640);
} else {
AutoSizeConfig.getInstance().setDesignWidthInDp(640).setDesignHeightInDp(360);
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
L.d("onConfigurationChanged调用了");
checkScreenOrientation();
}
public void openDrawer() {
if (!mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
mDrawerLayout.openDrawer(GravityCompat.START);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void mEventBus(EventBusBean busBean) {
switch (busBean.getCode()) {
case MEventBus.REFRESH_USERINFO:
initDrawerViews();
break;
}
}
/**
* 再按一次退出程序
*/
private long currentBackPressedTime = 0;
private static int BACK_PRESSED_INTERVAL = 5000;
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN
&& event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
if (System.currentTimeMillis() - currentBackPressedTime > BACK_PRESSED_INTERVAL) {
currentBackPressedTime = System.currentTimeMillis();
ToastUtil.s("再按一次,退出应用!");
return true;
} else {
finish(); // 退出
}
return false;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_MENU) {
return true;
}
return super.dispatchKeyEvent(event);
}
public class MapLocationSource implements TencentLocationListener {
private Context mContext;
private TencentLocationManager locationManager;
private TencentLocationRequest locationRequest;
// private OnLocationChangedListener mChangedListener;
public MapLocationSource(Context context) {
mContext = context;
locationManager = TencentLocationManager.getInstance(mContext);
locationRequest = TencentLocationRequest.create();
locationRequest.setInterval(3000);
// locationManager.requestLocationUpdates(locationRequest, this);
}
@Override
public void onLocationChanged(TencentLocation tencentLocation, int error, String reason) {
if (error == TencentLocation.ERROR_OK /*&& mChangedListener != null*/) {
L.e("maplocation", "location: " + tencentLocation.getCity()
+ " " + tencentLocation.getProvider() + " " + tencentLocation.getBearing());
latitude = tencentLocation.getLatitude();
longitude = tencentLocation.getLongitude();
LogUtils.i("地图定位", "latitude = " + latitude
+ "\nlongitude = " + longitude);
SPUtil.put("latitude",latitude+","+longitude);
if (mMyLocationMarker != null) {
mMyLocationMarker.remove();
}
initMyLocationMarker();
if (isFirstLocation) {
isFirstLocation = false;
location = new Location(tencentLocation.getProvider());
location.setLatitude(tencentLocation.getLatitude());
location.setLongitude(tencentLocation.getLongitude());
location.setAccuracy(tencentLocation.getAccuracy());
// 定位 sdk 只有 gps 返回的值才有可能获取到偏向角
location.setBearing(tencentLocation.getBearing());
tencentMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 16));
getPresenter().fenceList();
initMarker();
if (location.getLongitude() != 0 && location.getLatitude() != 0) {
getPresenter().index(String.valueOf(location.getLongitude()), String.valueOf(location.getLatitude()), 800);
}
// mChangedListener.onLocationChanged(location);
}
// L.i("MapFragmentTag:" + longitude + "+" + latitude);
}
}
@Override
public void onStatusUpdate(String name, int status, String desc) {
}
/*@Override
public void activate(OnLocationChangedListener onLocationChangedListener) {
mChangedListener = onLocationChangedListener;
int error = locationManager.requestLocationUpdates(locationRequest, this);
switch (error) {
case 1:
L.i("设备缺少使用腾讯定位服务需要的基本条件");
break;
case 2:
L.i("manifest 中配置的 key 不正确");
break;
case 3:
L.i("自动加载libtencentloc.so失败");
break;
default:
break;
}
}*/
public void onResume() {
locationManager.requestLocationUpdates(locationRequest, this);
}
public void onPause() {
locationManager.removeUpdates(this);
}
public void onDestory() {
locationManager.removeUpdates(this);
}
/* @Override
public void deactivate() {
locationManager.removeUpdates(this);
mContext = null;
locationManager = null;
locationRequest = null;
mChangedListener = null;
}*/
}
/* @Override
public void showError(Throwable t) {
super.showError(t);
if(t.getMessage().equals("请先注册或重新登录") && mLoginBean == null){
DiaLogUtils.showTipDialog(getContext(), "你还没登录呢!"
, "注册登录后才可扫码用车哦~"
, "取消"
, "去登录"
, new PromptDialog.OnButtonClickListener() {
@Override
public void onButtonClick(PromptDialog dialog, boolean isPositiveClick) {
if (isPositiveClick) {
LoginActivity.start(getContext());
finish();
}
}
});
}
}
*/
}
| [
"moyaozhi@anjiu-tech.com"
] | moyaozhi@anjiu-tech.com |
c2c6e5030a14ff3cd28431dfb42cd4277a0a3a39 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Lang-1/org.apache.commons.lang3.math.NumberUtils/BBC-F0-opt-60/tests/10/org/apache/commons/lang3/math/NumberUtils_ESTest.java | 39ba22f6288402e5cbdf9e6eaa394da0bfd35674 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 52,911 | java | /*
* This file was automatically generated by EvoSuite
* Mon Oct 18 23:38:59 GMT 2021
*/
package org.apache.commons.lang3.math;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.commons.lang3.math.NumberUtils;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class NumberUtils_ESTest extends NumberUtils_ESTest_scaffolding {
@Test(timeout = 4000)
public void test000() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0x9f");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test001() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("-0x0");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test002() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0{kS(IboC:O]c");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test003() throws Throwable {
byte byte0 = NumberUtils.max((byte)11, (byte)8, (byte)11);
assertEquals((byte)11, byte0);
}
@Test(timeout = 4000)
public void test004() throws Throwable {
short short0 = NumberUtils.max((short)56, (short)56, (short)56);
assertEquals((short)56, short0);
}
@Test(timeout = 4000)
public void test005() throws Throwable {
int int0 = NumberUtils.max((int) (byte) (-39), (int) (byte) (-41), 43);
assertEquals(43, int0);
}
@Test(timeout = 4000)
public void test006() throws Throwable {
long long0 = NumberUtils.max((-1L), (-1L), 485L);
assertEquals(485L, long0);
}
@Test(timeout = 4000)
public void test007() throws Throwable {
byte byte0 = NumberUtils.min((byte)5, (byte)12, (byte)69);
assertEquals((byte)5, byte0);
}
@Test(timeout = 4000)
public void test008() throws Throwable {
int int0 = NumberUtils.min((int) (short)983, 2146000602, (int) (short)983);
assertEquals(983, int0);
}
@Test(timeout = 4000)
public void test009() throws Throwable {
int[] intArray0 = new int[4];
intArray0[1] = 2;
int int0 = NumberUtils.max(intArray0);
assertEquals(2, int0);
}
@Test(timeout = 4000)
public void test010() throws Throwable {
long[] longArray0 = new long[2];
longArray0[1] = (-650L);
long long0 = NumberUtils.max(longArray0);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test011() throws Throwable {
double[] doubleArray0 = new double[4];
doubleArray0[1] = 1.0;
double double0 = NumberUtils.min(doubleArray0);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test012() throws Throwable {
short short0 = NumberUtils.toShort("*A56H=2I3$\" ^F?@", (short)8);
assertEquals((short)8, short0);
}
@Test(timeout = 4000)
public void test013() throws Throwable {
short short0 = NumberUtils.toShort("2");
assertEquals((short)2, short0);
}
@Test(timeout = 4000)
public void test014() throws Throwable {
short short0 = NumberUtils.toShort("-06");
assertEquals((short) (-6), short0);
}
@Test(timeout = 4000)
public void test015() throws Throwable {
long long0 = NumberUtils.toLong("--", (-650L));
assertEquals((-650L), long0);
}
@Test(timeout = 4000)
public void test016() throws Throwable {
long long0 = NumberUtils.toLong("9");
assertEquals(9L, long0);
}
@Test(timeout = 4000)
public void test017() throws Throwable {
long long0 = NumberUtils.toLong("-06");
assertEquals((-6L), long0);
}
@Test(timeout = 4000)
public void test018() throws Throwable {
int int0 = NumberUtils.toInt("2rG", (-490));
assertEquals((-490), int0);
}
@Test(timeout = 4000)
public void test019() throws Throwable {
int int0 = NumberUtils.toInt("1");
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test020() throws Throwable {
float float0 = NumberUtils.toFloat("", (-74.397F));
assertEquals((-74.397F), float0, 0.01F);
}
@Test(timeout = 4000)
public void test021() throws Throwable {
float float0 = NumberUtils.toFloat("8");
assertEquals(8.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test022() throws Throwable {
float float0 = NumberUtils.toFloat("-08");
assertEquals((-8.0F), float0, 0.01F);
}
@Test(timeout = 4000)
public void test023() throws Throwable {
double double0 = NumberUtils.toDouble("", 0.0);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test024() throws Throwable {
double double0 = NumberUtils.toDouble("5");
assertEquals(5.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test025() throws Throwable {
double double0 = NumberUtils.toDouble("-06");
assertEquals((-6.0), double0, 0.01);
}
@Test(timeout = 4000)
public void test026() throws Throwable {
byte byte0 = NumberUtils.toByte("A blank string is not a valid number", (byte)0);
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test027() throws Throwable {
byte byte0 = NumberUtils.toByte("1");
assertEquals((byte)1, byte0);
}
@Test(timeout = 4000)
public void test028() throws Throwable {
byte byte0 = NumberUtils.toByte("-1");
assertEquals((byte) (-1), byte0);
}
@Test(timeout = 4000)
public void test029() throws Throwable {
short[] shortArray0 = new short[3];
shortArray0[0] = (short)48;
shortArray0[1] = (short)8;
shortArray0[2] = (short)143;
short short0 = NumberUtils.min(shortArray0);
assertEquals((short)8, short0);
}
@Test(timeout = 4000)
public void test030() throws Throwable {
short[] shortArray0 = new short[8];
shortArray0[0] = (short) (-990);
short short0 = NumberUtils.min(shortArray0);
assertEquals((short) (-990), short0);
}
@Test(timeout = 4000)
public void test031() throws Throwable {
long[] longArray0 = new long[4];
longArray0[0] = 1L;
longArray0[1] = 740L;
longArray0[2] = 5002L;
longArray0[3] = 1728L;
long long0 = NumberUtils.min(longArray0);
assertEquals(1L, long0);
}
@Test(timeout = 4000)
public void test032() throws Throwable {
int[] intArray0 = new int[2];
intArray0[0] = 71;
intArray0[1] = 2;
int int0 = NumberUtils.min(intArray0);
assertEquals(2, int0);
}
@Test(timeout = 4000)
public void test033() throws Throwable {
int[] intArray0 = new int[2];
intArray0[0] = (int) (short) (-6);
int int0 = NumberUtils.min(intArray0);
assertEquals((-6), int0);
}
@Test(timeout = 4000)
public void test034() throws Throwable {
float[] floatArray0 = new float[4];
floatArray0[0] = (float) (short)56;
floatArray0[1] = (float) (short)56;
floatArray0[2] = 608.55F;
floatArray0[3] = 1668.0F;
float float0 = NumberUtils.min(floatArray0);
assertEquals(56.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test035() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
double[] doubleArray0 = new double[1];
doubleArray0[0] = (double) (byte)numberUtils0.BYTE_ONE;
double double0 = NumberUtils.min(doubleArray0);
assertEquals(1.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test036() throws Throwable {
byte[] byteArray0 = new byte[1];
byteArray0[0] = (byte)7;
byte byte0 = NumberUtils.min(byteArray0);
assertEquals((byte)7, byte0);
}
@Test(timeout = 4000)
public void test037() throws Throwable {
byte[] byteArray0 = new byte[2];
byteArray0[0] = (byte) (-30);
byte byte0 = NumberUtils.min(byteArray0);
assertEquals((byte) (-30), byte0);
}
@Test(timeout = 4000)
public void test038() throws Throwable {
short short0 = NumberUtils.min((short)0, (short)0, (short)0);
assertEquals((short)0, short0);
}
@Test(timeout = 4000)
public void test039() throws Throwable {
long long0 = NumberUtils.min((long) (byte)0, 2566L, (long) 0);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test040() throws Throwable {
long long0 = NumberUtils.min(181L, 181L, 181L);
assertEquals(181L, long0);
}
@Test(timeout = 4000)
public void test041() throws Throwable {
float float0 = NumberUtils.min((float) (byte)10, 0.0F, (float) (byte)48);
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test042() throws Throwable {
float float0 = NumberUtils.min(56.0F, (float) (-1L), (float) 2869);
assertEquals((-1.0F), float0, 0.01F);
}
@Test(timeout = 4000)
public void test043() throws Throwable {
double double0 = NumberUtils.min((double) 0L, (double) 0L, 0.0);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test044() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
double double0 = NumberUtils.min((double) (short)1, 656.96426232022, (double) numberUtils0.INTEGER_ONE);
assertEquals(1.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test045() throws Throwable {
double double0 = NumberUtils.min(404.94, (double) (byte)0, (double) (-1L));
assertEquals((-1.0), double0, 0.01);
}
@Test(timeout = 4000)
public void test046() throws Throwable {
byte byte0 = NumberUtils.min((byte)13, (byte)67, (byte)4);
assertEquals((byte)4, byte0);
}
@Test(timeout = 4000)
public void test047() throws Throwable {
short[] shortArray0 = new short[2];
shortArray0[0] = (short)3;
short short0 = NumberUtils.max(shortArray0);
assertEquals((short)3, short0);
}
@Test(timeout = 4000)
public void test048() throws Throwable {
short[] shortArray0 = new short[2];
shortArray0[0] = (short) (-1762);
shortArray0[1] = (short) (-1627);
short short0 = NumberUtils.max(shortArray0);
assertEquals((short) (-1627), short0);
}
@Test(timeout = 4000)
public void test049() throws Throwable {
long[] longArray0 = new long[2];
longArray0[1] = 1L;
long long0 = NumberUtils.max(longArray0);
assertEquals(1L, long0);
}
@Test(timeout = 4000)
public void test050() throws Throwable {
long[] longArray0 = new long[2];
longArray0[0] = (-1L);
longArray0[1] = (-1L);
long long0 = NumberUtils.max(longArray0);
assertEquals((-1L), long0);
}
@Test(timeout = 4000)
public void test051() throws Throwable {
int[] intArray0 = new int[9];
intArray0[0] = (int) (byte) (-76);
intArray0[1] = (int) (byte) (-76);
intArray0[2] = (int) (byte) (-76);
intArray0[3] = (int) (byte) (-76);
intArray0[4] = (int) (byte) (-76);
intArray0[5] = (int) (byte) (-76);
intArray0[6] = (int) (byte) (-76);
intArray0[7] = (int) (byte) (-76);
intArray0[8] = (int) (byte) (-76);
int int0 = NumberUtils.max(intArray0);
assertEquals((-76), int0);
}
@Test(timeout = 4000)
public void test052() throws Throwable {
float[] floatArray0 = new float[7];
floatArray0[0] = (float) (byte) (-76);
floatArray0[1] = (float) (-650L);
floatArray0[2] = (-650.0F);
floatArray0[3] = (-1.0F);
floatArray0[4] = (float) (byte) (-76);
floatArray0[5] = (-1896.0168F);
floatArray0[6] = (float) (byte) (-76);
float float0 = NumberUtils.max(floatArray0);
assertEquals((-1.0F), float0, 0.01F);
}
@Test(timeout = 4000)
public void test053() throws Throwable {
double[] doubleArray0 = new double[1];
doubleArray0[0] = (double) (-3050);
double double0 = NumberUtils.max(doubleArray0);
assertEquals((-3050.0), double0, 0.01);
}
@Test(timeout = 4000)
public void test054() throws Throwable {
byte[] byteArray0 = new byte[1];
byteArray0[0] = (byte) (-23);
byte byte0 = NumberUtils.max(byteArray0);
assertEquals((byte) (-23), byte0);
}
@Test(timeout = 4000)
public void test055() throws Throwable {
short short0 = NumberUtils.max((short)0, (short) (byte)0, (short) (-3952));
assertEquals((short)0, short0);
}
@Test(timeout = 4000)
public void test056() throws Throwable {
long long0 = NumberUtils.max((-1138L), (-1L), (-1138L));
assertEquals((-1L), long0);
}
@Test(timeout = 4000)
public void test057() throws Throwable {
int int0 = NumberUtils.max((-1065), (-1065), (-1065));
assertEquals((-1065), int0);
}
@Test(timeout = 4000)
public void test058() throws Throwable {
float float0 = NumberUtils.max((float) 0L, (float) 0L, (-1607.0F));
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test059() throws Throwable {
float float0 = NumberUtils.max(3.0F, (-1.0F), (float) (byte)4);
assertEquals(4.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test060() throws Throwable {
double double0 = NumberUtils.max((double) (short)0, (-3390.556254), (-561.4726018));
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test061() throws Throwable {
double double0 = NumberUtils.max((-1575.589), (double) (byte) (-94), (double) (byte) (-29));
assertEquals((-29.0), double0, 0.01);
}
@Test(timeout = 4000)
public void test062() throws Throwable {
Long long0 = NumberUtils.createLong("0");
assertEquals(0L, (long)long0);
}
@Test(timeout = 4000)
public void test063() throws Throwable {
Long long0 = NumberUtils.createLong("5");
assertEquals(5L, (long)long0);
}
@Test(timeout = 4000)
public void test064() throws Throwable {
Integer integer0 = NumberUtils.createInteger("0");
assertEquals(0, (int)integer0);
}
@Test(timeout = 4000)
public void test065() throws Throwable {
Integer integer0 = NumberUtils.createInteger("0xb");
assertEquals(11, (int)integer0);
}
@Test(timeout = 4000)
public void test066() throws Throwable {
Integer integer0 = NumberUtils.createInteger("-#4");
assertEquals((-4), (int)integer0);
}
@Test(timeout = 4000)
public void test067() throws Throwable {
Float float0 = NumberUtils.createFloat("0");
assertEquals(0.0F, (float)float0, 0.01F);
}
@Test(timeout = 4000)
public void test068() throws Throwable {
Float float0 = NumberUtils.createFloat("1");
assertEquals(1.0F, (float)float0, 0.01F);
}
@Test(timeout = 4000)
public void test069() throws Throwable {
Double double0 = NumberUtils.createDouble("0");
assertEquals(0.0, (double)double0, 0.01);
}
@Test(timeout = 4000)
public void test070() throws Throwable {
Double double0 = NumberUtils.createDouble("1");
assertEquals(1.0, (double)double0, 0.01);
}
@Test(timeout = 4000)
public void test071() throws Throwable {
Double double0 = NumberUtils.createDouble("-08");
assertEquals((-8.0), (double)double0, 0.01);
}
@Test(timeout = 4000)
public void test072() throws Throwable {
BigDecimal bigDecimal0 = NumberUtils.createBigDecimal("0");
assertEquals((byte)0, bigDecimal0.byteValue());
}
@Test(timeout = 4000)
public void test073() throws Throwable {
BigDecimal bigDecimal0 = NumberUtils.createBigDecimal("1");
assertEquals((short)1, bigDecimal0.shortValue());
}
@Test(timeout = 4000)
public void test074() throws Throwable {
short[] shortArray0 = new short[0];
// Undeclared exception!
try {
NumberUtils.min(shortArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test075() throws Throwable {
long[] longArray0 = new long[0];
// Undeclared exception!
try {
NumberUtils.min(longArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test076() throws Throwable {
// Undeclared exception!
try {
NumberUtils.min((int[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test077() throws Throwable {
float[] floatArray0 = new float[0];
// Undeclared exception!
try {
NumberUtils.min(floatArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test078() throws Throwable {
double[] doubleArray0 = new double[0];
// Undeclared exception!
try {
NumberUtils.min(doubleArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test079() throws Throwable {
short[] shortArray0 = new short[0];
// Undeclared exception!
try {
NumberUtils.max(shortArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test080() throws Throwable {
int[] intArray0 = new int[0];
// Undeclared exception!
try {
NumberUtils.max(intArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test081() throws Throwable {
// Undeclared exception!
try {
NumberUtils.max((float[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test082() throws Throwable {
double[] doubleArray0 = new double[0];
// Undeclared exception!
try {
NumberUtils.max(doubleArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test083() throws Throwable {
byte[] byteArray0 = new byte[0];
// Undeclared exception!
try {
NumberUtils.max(byteArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test084() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createLong("d");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// For input string: \"d\"
//
verifyException("java.lang.NumberFormatException", e);
}
}
@Test(timeout = 4000)
public void test085() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createFloat("vEcwPJVu0Uh6F");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
}
}
@Test(timeout = 4000)
public void test086() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createBigDecimal("P\"V3I>X<9G.ve");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.math.BigDecimal", e);
}
}
@Test(timeout = 4000)
public void test087() throws Throwable {
boolean boolean0 = NumberUtils.isDigits("0");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test088() throws Throwable {
boolean boolean0 = NumberUtils.isDigits("-08");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test089() throws Throwable {
boolean boolean0 = NumberUtils.isDigits("");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test090() throws Throwable {
BigDecimal bigDecimal0 = NumberUtils.createBigDecimal("-1");
assertEquals((short) (-1), bigDecimal0.shortValue());
}
@Test(timeout = 4000)
public void test091() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createBigDecimal("--");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// -- is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test092() throws Throwable {
BigInteger bigInteger0 = NumberUtils.createBigInteger("2");
assertEquals((byte)2, bigInteger0.byteValue());
}
@Test(timeout = 4000)
public void test093() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createBigInteger("0X-0X");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// Illegal embedded sign character
//
verifyException("java.math.BigInteger", e);
}
}
@Test(timeout = 4000)
public void test094() throws Throwable {
BigInteger bigInteger0 = NumberUtils.createBigInteger("-#4");
assertEquals((byte) (-4), bigInteger0.byteValue());
}
@Test(timeout = 4000)
public void test095() throws Throwable {
Long long0 = NumberUtils.createLong("-0X9f");
assertEquals((-159L), (long)long0);
}
@Test(timeout = 4000)
public void test096() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createInteger("f(\"O^xzj0=");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// For input string: \"f(\"O^xzj0=\"
//
verifyException("java.lang.NumberFormatException", e);
}
}
@Test(timeout = 4000)
public void test097() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createDouble("0E-j");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
}
}
@Test(timeout = 4000)
public void test098() throws Throwable {
Float float0 = NumberUtils.createFloat("-1");
assertEquals((-1.0F), (float)float0, 0.01F);
}
@Test(timeout = 4000)
public void test099() throws Throwable {
short short0 = NumberUtils.toShort((String) null, (short) (-1368));
assertEquals((short) (-1368), short0);
}
@Test(timeout = 4000)
public void test100() throws Throwable {
short short0 = NumberUtils.toShort("}TA=|h=?R", (short)0);
assertEquals((short)0, short0);
}
@Test(timeout = 4000)
public void test101() throws Throwable {
byte byte0 = NumberUtils.toByte("+kX1^l&U}@{j", (byte) (-29));
assertEquals((byte) (-29), byte0);
}
@Test(timeout = 4000)
public void test102() throws Throwable {
double double0 = NumberUtils.toDouble("--", (double) (-650L));
assertEquals((-650.0), double0, 0.01);
}
@Test(timeout = 4000)
public void test103() throws Throwable {
float float0 = NumberUtils.toFloat((String) null, 1997.052F);
assertEquals(1997.052F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test104() throws Throwable {
float float0 = NumberUtils.toFloat("#IzKyk$QaUQy'g?", (float) 0L);
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test105() throws Throwable {
long long0 = NumberUtils.toLong((String) null, 1L);
assertEquals(1L, long0);
}
@Test(timeout = 4000)
public void test106() throws Throwable {
String string0 = "EW|QQ\\u";
long long0 = NumberUtils.toLong(string0, 0L);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test107() throws Throwable {
int int0 = NumberUtils.toInt("emh bz#Q]eqN", 0);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test108() throws Throwable {
int int0 = NumberUtils.toInt((String) null, 10);
assertEquals(10, int0);
}
@Test(timeout = 4000)
public void test109() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("l");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test110() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0l");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test111() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("F");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test112() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("f");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test113() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("D");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test114() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("d");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test115() throws Throwable {
boolean boolean0 = NumberUtils.isNumber(".");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test116() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("E");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test117() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0e");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test118() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("+{Hu1IN0r0z;m_");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test119() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("E//m]P]5?\"{Krg");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test120() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("005EEj");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test121() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0E-j");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test122() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("...");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test123() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("..");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test124() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("2eL");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test125() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("-");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test126() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("-0xAborting to protect against StackOverflowError - output of one loop is the input of another");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test127() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0xE8*#No<.d'`H$?h");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test128() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0xa");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test129() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("-0x");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test130() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test131() throws Throwable {
boolean boolean0 = NumberUtils.isNumber((String) null);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test132() throws Throwable {
byte byte0 = NumberUtils.max((byte) (-1), (byte) (-1), (byte)0);
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test133() throws Throwable {
byte byte0 = NumberUtils.max((byte)4, (byte)68, (byte)4);
assertEquals((byte)68, byte0);
}
@Test(timeout = 4000)
public void test134() throws Throwable {
byte byte0 = NumberUtils.max((byte) (-23), (byte) (-23), (byte) (-23));
assertEquals((byte) (-23), byte0);
}
@Test(timeout = 4000)
public void test135() throws Throwable {
short short0 = NumberUtils.max((short) (-2903), (short)0, (short)1335);
assertEquals((short)1335, short0);
}
@Test(timeout = 4000)
public void test136() throws Throwable {
short short0 = NumberUtils.max((short) (-350), (short) (-3113), (short) (-3113));
assertEquals((short) (-350), short0);
}
@Test(timeout = 4000)
public void test137() throws Throwable {
int int0 = NumberUtils.max((int) (short)0, 749, 5446);
assertEquals(5446, int0);
}
@Test(timeout = 4000)
public void test138() throws Throwable {
int int0 = NumberUtils.max(0, 0, (-488));
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test139() throws Throwable {
long long0 = NumberUtils.max((-666L), 0L, 0L);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test140() throws Throwable {
long long0 = NumberUtils.max(1L, (-1268L), 2830L);
assertEquals(2830L, long0);
}
@Test(timeout = 4000)
public void test141() throws Throwable {
byte byte0 = NumberUtils.min((byte)63, (byte)48, (byte) (-9));
assertEquals((byte) (-9), byte0);
}
@Test(timeout = 4000)
public void test142() throws Throwable {
byte byte0 = NumberUtils.min((byte)0, (byte)0, (byte)0);
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test143() throws Throwable {
short short0 = NumberUtils.min((short)10, (short) (-3457), (short)10);
assertEquals((short) (-3457), short0);
}
@Test(timeout = 4000)
public void test144() throws Throwable {
short short0 = NumberUtils.min((short)68, (short)727, (short)13);
assertEquals((short)13, short0);
}
@Test(timeout = 4000)
public void test145() throws Throwable {
int int0 = NumberUtils.min(2328, 2328, (-718));
assertEquals((-718), int0);
}
@Test(timeout = 4000)
public void test146() throws Throwable {
int int0 = NumberUtils.min(1186, (int) (short)68, 88);
assertEquals(68, int0);
}
@Test(timeout = 4000)
public void test147() throws Throwable {
int int0 = NumberUtils.min(0, 419, 749);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test148() throws Throwable {
long long0 = NumberUtils.min(73L, (-10L), 10L);
assertEquals((-10L), long0);
}
@Test(timeout = 4000)
public void test149() throws Throwable {
long long0 = NumberUtils.min(0L, 73L, (-1L));
assertEquals((-1L), long0);
}
@Test(timeout = 4000)
public void test150() throws Throwable {
byte[] byteArray0 = new byte[0];
// Undeclared exception!
try {
NumberUtils.min(byteArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test151() throws Throwable {
// Undeclared exception!
try {
NumberUtils.max((long[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test152() throws Throwable {
float[] floatArray0 = new float[8];
floatArray0[1] = 1233.946F;
float float0 = NumberUtils.max(floatArray0);
assertEquals(1233.946F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test153() throws Throwable {
float[] floatArray0 = new float[8];
floatArray0[3] = Float.NaN;
float float0 = NumberUtils.max(floatArray0);
assertEquals(Float.NaN, float0, 0.01F);
}
@Test(timeout = 4000)
public void test154() throws Throwable {
float[] floatArray0 = new float[8];
float float0 = NumberUtils.max(floatArray0);
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test155() throws Throwable {
double[] doubleArray0 = new double[5];
doubleArray0[3] = 1236.033191375662;
double double0 = NumberUtils.max(doubleArray0);
assertEquals(1236.033191375662, double0, 0.01);
}
@Test(timeout = 4000)
public void test156() throws Throwable {
double[] doubleArray0 = new double[6];
doubleArray0[4] = (double) Float.NaN;
double double0 = NumberUtils.max(doubleArray0);
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test157() throws Throwable {
double[] doubleArray0 = new double[5];
double double0 = NumberUtils.max(doubleArray0);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test158() throws Throwable {
byte[] byteArray0 = new byte[6];
byteArray0[0] = (byte) (-123);
byte byte0 = NumberUtils.max(byteArray0);
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test159() throws Throwable {
short[] shortArray0 = new short[2];
shortArray0[0] = (short) (-1762);
short short0 = NumberUtils.max(shortArray0);
assertEquals((short)0, short0);
}
@Test(timeout = 4000)
public void test160() throws Throwable {
short[] shortArray0 = new short[15];
short short0 = NumberUtils.max(shortArray0);
assertEquals((short)0, short0);
}
@Test(timeout = 4000)
public void test161() throws Throwable {
int[] intArray0 = new int[8];
intArray0[0] = (-2409);
int int0 = NumberUtils.max(intArray0);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test162() throws Throwable {
float[] floatArray0 = new float[2];
floatArray0[1] = (-1660.3F);
float float0 = NumberUtils.min(floatArray0);
assertEquals((-1660.3F), float0, 0.01F);
}
@Test(timeout = 4000)
public void test163() throws Throwable {
float[] floatArray0 = new float[6];
floatArray0[1] = Float.NaN;
float float0 = NumberUtils.min(floatArray0);
assertEquals(Float.NaN, float0, 0.01F);
}
@Test(timeout = 4000)
public void test164() throws Throwable {
float[] floatArray0 = new float[2];
float float0 = NumberUtils.min(floatArray0);
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test165() throws Throwable {
double[] doubleArray0 = new double[4];
doubleArray0[3] = (-491.417042603);
double double0 = NumberUtils.min(doubleArray0);
assertEquals((-491.417042603), double0, 0.01);
}
@Test(timeout = 4000)
public void test166() throws Throwable {
double[] doubleArray0 = new double[4];
doubleArray0[2] = Double.NaN;
double double0 = NumberUtils.min(doubleArray0);
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test167() throws Throwable {
byte[] byteArray0 = new byte[6];
byteArray0[0] = (byte)45;
byte byte0 = NumberUtils.min(byteArray0);
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test168() throws Throwable {
short[] shortArray0 = new short[7];
shortArray0[0] = (short) (byte)2;
short short0 = NumberUtils.min(shortArray0);
assertEquals((short)0, short0);
}
@Test(timeout = 4000)
public void test169() throws Throwable {
int[] intArray0 = new int[2];
intArray0[0] = 63;
int int0 = NumberUtils.min(intArray0);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test170() throws Throwable {
int[] intArray0 = new int[2];
int int0 = NumberUtils.min(intArray0);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test171() throws Throwable {
long[] longArray0 = new long[4];
longArray0[2] = (long) (short) (-824);
long long0 = NumberUtils.min(longArray0);
assertEquals((-824L), long0);
}
@Test(timeout = 4000)
public void test172() throws Throwable {
long[] longArray0 = new long[9];
long long0 = NumberUtils.min(longArray0);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test173() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createBigDecimal("");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// A blank string is not a valid number
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test174() throws Throwable {
BigDecimal bigDecimal0 = NumberUtils.createBigDecimal((String) null);
assertNull(bigDecimal0);
}
@Test(timeout = 4000)
public void test175() throws Throwable {
BigInteger bigInteger0 = NumberUtils.createBigInteger("0");
assertEquals((byte)0, bigInteger0.byteValue());
}
@Test(timeout = 4000)
public void test176() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createBigInteger("-0x");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// Zero length BigInteger
//
verifyException("java.math.BigInteger", e);
}
}
@Test(timeout = 4000)
public void test177() throws Throwable {
Number number0 = NumberUtils.createNumber("--1");
assertEquals((short)1, number0.shortValue());
}
@Test(timeout = 4000)
public void test178() throws Throwable {
BigInteger bigInteger0 = NumberUtils.createBigInteger((String) null);
assertNull(bigInteger0);
}
@Test(timeout = 4000)
public void test179() throws Throwable {
Long long0 = NumberUtils.createLong((String) null);
assertNull(long0);
}
@Test(timeout = 4000)
public void test180() throws Throwable {
Integer integer0 = NumberUtils.createInteger((String) null);
assertNull(integer0);
}
@Test(timeout = 4000)
public void test181() throws Throwable {
Double double0 = NumberUtils.createDouble((String) null);
assertNull(double0);
}
@Test(timeout = 4000)
public void test182() throws Throwable {
Float float0 = NumberUtils.createFloat((String) null);
assertNull(float0);
}
@Test(timeout = 4000)
public void test183() throws Throwable {
Number number0 = NumberUtils.createNumber("0.");
assertEquals(0.0F, number0);
}
@Test(timeout = 4000)
public void test184() throws Throwable {
Number number0 = NumberUtils.createNumber(".6");
assertEquals(0.6F, number0);
}
@Test(timeout = 4000)
public void test185() throws Throwable {
Number number0 = NumberUtils.createNumber("-0.");
assertEquals((short)0, number0.shortValue());
}
@Test(timeout = 4000)
public void test186() throws Throwable {
try {
NumberUtils.createNumber(".{R70;9kdk9,dS;=q1");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.math.BigDecimal", e);
}
}
@Test(timeout = 4000)
public void test187() throws Throwable {
try {
NumberUtils.createNumber("0...");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.math.BigDecimal", e);
}
}
@Test(timeout = 4000)
public void test188() throws Throwable {
try {
NumberUtils.createNumber("--Minimum abbreviation width is 4");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// --Minimum abbreviation width is 4 is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test189() throws Throwable {
try {
NumberUtils.createNumber("Ieke4~_yEj6");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// For input string: \"Ie\"
//
verifyException("java.lang.NumberFormatException", e);
}
}
@Test(timeout = 4000)
public void test190() throws Throwable {
Number number0 = NumberUtils.createNumber("9f");
assertEquals(9.0F, number0);
}
@Test(timeout = 4000)
public void test191() throws Throwable {
try {
NumberUtils.createNumber("-l");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// -l is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test192() throws Throwable {
Number number0 = NumberUtils.createNumber("-0l");
assertEquals(0L, number0);
}
@Test(timeout = 4000)
public void test193() throws Throwable {
try {
NumberUtils.createNumber("008l");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// For input string: \"8\"
//
verifyException("java.lang.NumberFormatException", e);
}
}
@Test(timeout = 4000)
public void test194() throws Throwable {
try {
NumberUtils.createNumber("ZzowB.=l");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// ZzowB.=l is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test195() throws Throwable {
// Undeclared exception!
try {
NumberUtils.createNumber("l");
fail("Expecting exception: StringIndexOutOfBoundsException");
} catch(StringIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test196() throws Throwable {
Number number0 = NumberUtils.createNumber("0f");
assertEquals((short)0, number0.shortValue());
}
@Test(timeout = 4000)
public void test197() throws Throwable {
try {
NumberUtils.createNumber("-.+RO5hd");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// -.+RO5hd is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test198() throws Throwable {
try {
NumberUtils.createNumber("M9$<LeOL");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// M9$<LeOL is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test199() throws Throwable {
try {
NumberUtils.createNumber("!F");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// !F is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test200() throws Throwable {
Number number0 = NumberUtils.createNumber("6D");
assertEquals(6.0, number0);
}
@Test(timeout = 4000)
public void test201() throws Throwable {
try {
NumberUtils.createNumber("0eN;69P=z6S=");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// 0eN;69P=z6S= is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test202() throws Throwable {
try {
NumberUtils.createNumber("V5+6R`Bc4^mC=ex$EH");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// V5+6R`Bc4^mC=ex$EH is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test203() throws Throwable {
try {
NumberUtils.createNumber(":73](#lxcHW.7Ep[Vge");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// :73](#lxcHW.7Ep[Vge is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test204() throws Throwable {
try {
NumberUtils.createNumber("Array cannot be empty.");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// Array cannot be empty. is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test205() throws Throwable {
try {
NumberUtils.createNumber("0.E.");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.math.BigDecimal", e);
}
}
@Test(timeout = 4000)
public void test206() throws Throwable {
try {
NumberUtils.createNumber("0X-0X");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// Sign character in wrong position
//
verifyException("java.lang.Integer", e);
}
}
@Test(timeout = 4000)
public void test207() throws Throwable {
try {
NumberUtils.createNumber("-#{e*kQ^=_-tF`@GG");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// For input string: \"-{e*kQ^=_-tF`@GG\"
//
verifyException("java.lang.NumberFormatException", e);
}
}
@Test(timeout = 4000)
public void test208() throws Throwable {
try {
NumberUtils.createNumber("#Aborting to protect against StackOverflowError - output of one loop is the input of another");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// Illegal embedded sign character
//
verifyException("java.math.BigInteger", e);
}
}
@Test(timeout = 4000)
public void test209() throws Throwable {
try {
NumberUtils.createNumber("");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// A blank string is not a valid number
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test210() throws Throwable {
Number number0 = NumberUtils.createNumber((String) null);
assertNull(number0);
}
@Test(timeout = 4000)
public void test211() throws Throwable {
try {
NumberUtils.createNumber("0e");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// 0e is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test212() throws Throwable {
short short0 = NumberUtils.toShort((String) null);
assertEquals((short)0, short0);
}
@Test(timeout = 4000)
public void test213() throws Throwable {
byte byte0 = NumberUtils.toByte((String) null, (byte)5);
assertEquals((byte)5, byte0);
}
@Test(timeout = 4000)
public void test214() throws Throwable {
double double0 = NumberUtils.toDouble((String) null, 1061.83158);
assertEquals(1061.83158, double0, 0.01);
}
@Test(timeout = 4000)
public void test215() throws Throwable {
float float0 = NumberUtils.toFloat((String) null);
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test216() throws Throwable {
long long0 = NumberUtils.toLong((String) null);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test217() throws Throwable {
int int0 = NumberUtils.toInt((String) null);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test218() throws Throwable {
int int0 = NumberUtils.toInt("-06");
assertEquals((-6), int0);
}
@Test(timeout = 4000)
public void test219() throws Throwable {
double double0 = NumberUtils.max(2001.31585256, 0.0, 0.0);
assertEquals(2001.31585256, double0, 0.01);
}
@Test(timeout = 4000)
public void test220() throws Throwable {
byte byte0 = NumberUtils.toByte("n cTjH]QS}m");
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test221() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
byte[] byteArray0 = new byte[3];
byteArray0[0] = (byte) numberUtils0.BYTE_ONE;
byte byte0 = NumberUtils.max(byteArray0);
assertEquals((byte)1, byte0);
}
@Test(timeout = 4000)
public void test222() throws Throwable {
double double0 = NumberUtils.toDouble("0.");
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test223() throws Throwable {
float float0 = NumberUtils.min(1865.3866F, 1865.3866F, 1865.3866F);
assertEquals(1865.3866F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test224() throws Throwable {
float float0 = NumberUtils.max((-1.0F), (-1.0F), (-1.0F));
assertEquals((-1.0F), float0, 0.01F);
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
2f079c6bcf4561edbf5911b4a8e39b7edcac4e65 | 1db3c0981b761b556eea7cc959c1a692d5bfb3b4 | /csc413-tankgame-luengpaul/src/TRE.java | 99e6cac2dcf8525b35e0e448744b42ae76b7e9b7 | [
"MIT"
] | permissive | luengpaul/TankGame | 2fb3bf20dbaa0d78e4c02ebfe81303839861a10c | c97229fa1b96bc85329da20b6593d1eca9f8e579 | refs/heads/master | 2021-06-24T18:22:24.979832 | 2021-03-17T05:43:18 | 2021-03-17T05:43:18 | 211,984,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,922 | 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.
*/
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
public class TRE extends JPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final int WORLD_WIDTH=1980;
public static final int WORLD_HEIGHT=1080;
public static final int SCREEN_WIDTH = 1024;
public static final int SCREEN_HEIGHT = 768;
private BufferedImage world;
private Graphics2D buffer;
private JFrame jf;
public static Tank t1;
public static Tank t2;
private Image background;
private Image lefthalf;
private Image righthalf;
private Image minimap;
private Image wall;
private Image breakableWallimg;
public static ArrayList<BreakableWall> breakableWalls= new ArrayList<BreakableWall>();
public static Bullet bullet1;
public static boolean twcollision=false;
public Image bulletimg;
public static boolean gameOver=false;
public static boolean gameOver2=false;
public Image gameOverImg;
public static ArrayList<UnBreakableWall> unBreakableWalls= new ArrayList<UnBreakableWall>();
public static ArrayList<PowerUp> powerUps= new ArrayList<PowerUp>();
public static int oldxT1;
public static int oldyT1;
public static int oldxT2;
public static int oldyT2;
public static void main(String[] args) {
Thread x;
TRE trex = new TRE();
trex.init();
try {
while (true) {
oldxT1=trex.t1.getx();
oldyT1=trex.t1.gety();
oldxT2=trex.t2.getx();
oldyT2=trex.t2.gety();
trex.t1.update();
trex.t2.update();
mapCollision(t1,oldxT1, oldyT1);
tbWCollision(t1, oldxT1, oldyT1);
tbWCollision(t2, oldxT2, oldyT2);
tubWCollision(t1, oldxT1, oldyT1);
tubWCollision(t2, oldxT2, oldyT2);
ubwCollision(t1);
ubwCollision(t2);
tPCollision(t1);
tPCollision(t2);
bwCollision(trex.t1);
bwCollision(trex.t2);
tbCollision(trex.t1,trex.t2);
tbCollision(trex.t2,trex.t1);
gameOver=trex.t1.gameOverSet();
gameOver2=trex.t2.gameOverSet();
trex.repaint();
System.out.println(trex.t1);
System.out.println(trex.t2);
Thread.sleep(1000 / 144);
if(gameOver){
return;
}
if(gameOver2){
return;
}
}
} catch (InterruptedException ignored) {
}
}
private void init() {
this.jf = new JFrame("Tank Rotation");
this.world = new BufferedImage(TRE.SCREEN_WIDTH, TRE.SCREEN_HEIGHT, BufferedImage.TYPE_INT_RGB);
Image t1img = null;
Image t2img = null;
System.out.println(System.getProperty("user.dir"));
/*
* note class loaders read files from the out folder (build folder in netbeans) and not the
* current working directory.
*/
//tank image set and bullet
t1img = ResourceLoader.getImage("tank1.png");
t2img= ResourceLoader.getImage("tank1.png");
breakableWallimg=ResourceLoader.getImage("wall2.png");
bulletimg=ResourceLoader.getImage("new_bullet.png");
wall= ResourceLoader.getImage("wall.png");
gameOverImg= ResourceLoader.getImage("new_bullet.png");
//background load
background = ResourceLoader.getImage("Background.png");
powerUps.add(new PowerUp(800,200));
powerUps.add(new PowerUp(800,600));
powerUps.add(new PowerUp(200,600));
powerUps.add(new PowerUp(200,400));
//wall load
//unbreakable walls
int i=0;
while( i<TRE.SCREEN_WIDTH){
unBreakableWalls.add(new UnBreakableWall(i,0));
i=i+30;
}
i=0;
while( i<TRE.SCREEN_HEIGHT){
unBreakableWalls.add(new UnBreakableWall(0,i));
i=i+30;
}
i=0;
while( i<TRE.SCREEN_HEIGHT){
unBreakableWalls.add(new UnBreakableWall(TRE.SCREEN_WIDTH-30,i));
i=i+30;
}
i=0;
while( i<TRE.SCREEN_WIDTH){
unBreakableWalls.add(new UnBreakableWall(i,TRE.SCREEN_HEIGHT-30));
i=i+30;
}
i=0;
while(i<300){
unBreakableWalls.add(new UnBreakableWall(400,470+i));
i=i+30;
}
i=0;
while(i<300){
unBreakableWalls.add(new UnBreakableWall(700,470+i));
i=i+30;
}
i=0;
while(i<300){
unBreakableWalls.add(new UnBreakableWall(500,i));
i=i+30;
}
//breakable walls
int p=0;
while( p<TRE.SCREEN_HEIGHT/2){
breakableWalls.add(new BreakableWall(400,p));
p=p+30;
}
p=0;
while( p<TRE.SCREEN_WIDTH-720){
breakableWalls.add(new BreakableWall(p,300));
p=p+30;
}
p=0;
while( p<TRE.SCREEN_WIDTH-720){
breakableWalls.add(new BreakableWall(p,500));
p=p+30;
}
p=0;
while( p<TRE.SCREEN_HEIGHT/2){
breakableWalls.add(new BreakableWall(600,p));
p=p+30;
}
p=0;
while( p<TRE.SCREEN_HEIGHT/2){
breakableWalls.add(new BreakableWall(500,400+p));
p=p+30;
}
p=0;
while( p<390){
breakableWalls.add(new BreakableWall(650+p,400));
p=p+30;
}
//tank1 position
t1 = new Tank(240, 200, 0, 0, 0, t1img);
TankControl tc1 = new TankControl(t1, KeyEvent.VK_UP, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT, KeyEvent.VK_ENTER);
//tank2 position
t2 = new Tank(740, 200, 0, 0, 0, t2img);
TankControl tc2 = new TankControl(t2, KeyEvent.VK_W, KeyEvent.VK_S, KeyEvent.VK_A, KeyEvent.VK_D, KeyEvent.VK_SPACE);
//wall
this.jf.setLayout(new BorderLayout());
this.jf.add(this);
this.jf.addKeyListener(tc1);
this.jf.addKeyListener(tc2);
this.jf.setSize(TRE.SCREEN_WIDTH, TRE.SCREEN_HEIGHT + 30);
this.jf.setResizable(false);
jf.setLocationRelativeTo(null);
this.jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.jf.setVisible(true);
}
public static void bwCollision(Tank aTank){
for(int g=0; g<aTank.getBullets().size(); g++){
Rectangle rectangle1=aTank.getBullets().get(g).bounds();
for(int t=0; t<breakableWalls.size(); t++){
Rectangle rectangle2=breakableWalls.get(t).bounds();
if(rectangle1.intersects(rectangle2)){
breakableWalls.get(t).getsHit();
aTank.getBullets().remove(g);
if(breakableWalls.get(t).healthZero()){
breakableWalls.remove(t);
}
break;
}
}
}
}
public static void ubwCollision(Tank aTank){
for(int g=0; g<aTank.getBullets().size(); g++){
aTank.getBullets().get(g).update();
Rectangle rectangle1=aTank.getBullets().get(g).bounds();
for(int t=0; t<unBreakableWalls.size(); t++){
Rectangle rectangle2=unBreakableWalls.get(t).bounds();
if(rectangle1.intersects(rectangle2)){
aTank.getBullets().remove(g);
break;
}
}
}
}
public static void tPCollision(Tank aTank){
Rectangle rectangle1= aTank.bounds();
for(int c=0; c<powerUps.size(); c++){
Rectangle rectangle2= powerUps.get(c).bounds();
if(rectangle1.intersects(rectangle2)){
powerUps.get(c).getPowerUp(aTank);
powerUps.remove(c);
}
}
}
public static void tbCollision(Tank aTank, Tank aTank2){
Rectangle rectangle2 =aTank2.bounds();
for(int q=0; q< aTank.getBullets().size(); q++ ){
Rectangle rectangle1=aTank.getBullets().get(q).bounds();
if(rectangle2.intersects(rectangle1)){
aTank2.getsHit();
aTank.getBullets().get(q).setExplosion();
aTank.getBullets().remove(q);
}
}
}
public static void tbWCollision(Tank aTank,int x, int y) {
Rectangle rectangle1= aTank.bounds();
for(int q=0; q<breakableWalls.size();q++) {
Rectangle rectangle2= breakableWalls.get(q).bounds();
if(rectangle1.intersects(rectangle2)) {
breakableWalls.get(q).setTank(aTank,x, y);
}
}
}
public static void tubWCollision(Tank aTank,int x, int y) {
Rectangle rectangle1= aTank.bounds();
for(int q=0; q<unBreakableWalls.size();q++) {
Rectangle rectangle2= unBreakableWalls.get(q).bounds();
if(rectangle1.intersects(rectangle2)) {
unBreakableWalls.get(q).setTank(aTank,x, y);
}
}
}
public static void mapCollision(Tank aTank,int x, int y) {
Rectangle rectangle1= aTank.bounds();
Rectangle rectangle2= new Rectangle(TRE.SCREEN_WIDTH/2-125,TRE.SCREEN_HEIGHT-200,250,200);
if(rectangle1.intersects(rectangle2)) {
aTank.setx(x);
aTank.sety(y);
}
}
@Override
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
buffer = world.createGraphics();
// draw map background set
buffer.drawImage(background,0,0,TRE.SCREEN_WIDTH,TRE.SCREEN_HEIGHT,null);
g2.setColor(Color.WHITE);
g2.fillRect(0, 0, TRE.SCREEN_WIDTH, TRE.SCREEN_HEIGHT);
//draw tanks
this.t1.drawImage(buffer);
this.t2.drawImage(buffer);
lefthalf=loadScreen(0,0,t1,world);
for(int b=0; b<powerUps.size();b++){
powerUps.get(b).render(buffer);
}
for(int e=0; e<unBreakableWalls.size(); e++){
unBreakableWalls.get(e).render(buffer);
}
for(int n=0; n< breakableWalls.size();n++){
breakableWalls.get(n).render(buffer);
}
// t1 bullet render
for(int b=0; b<t1.getBullets().size();b++){
t1.getBullets().get(b).render(buffer);
System.out.println(t1.getBullets().size());
}
//t2 bullet render
for(int b=0; b<t2.getBullets().size();b++){
t2.getBullets().get(b).render(buffer);
}
minimap=world.getScaledInstance(TRE.SCREEN_WIDTH,TRE.SCREEN_HEIGHT,1);
//draw screens player one screen
//lefthalf=loadScreen(0,0,t1,world);
//righthalf=loadScreen(0,0,t2,world);
buffer.drawImage(minimap,TRE.SCREEN_WIDTH/2-125,TRE.SCREEN_HEIGHT-200,250,200,null);
//buffer.drawImage(lefthalf,0,0,TRE.SCREEN_WIDTH/2,TRE.SCREEN_HEIGHT,null);
// buffer.drawImage(righthalf,TRE.SCREEN_WIDTH/2,0,TRE.SCREEN_WIDTH/2,TRE.SCREEN_HEIGHT,null);
//\minimap
if(gameOver==true){
buffer.drawImage(gameOverImg,100,50,800,700,null);
}
if(gameOver2==true){
buffer.drawImage(gameOverImg,100,50,800,700,null);
}
//lefthalf=world.getSubimage(0,0,TRE.SCREEN_WIDTH/2,TRE.SCREEN_HEIGHT/2);
// g2.drawImage(lefthalf,0,0,null);
g2.drawImage(world,0,0,null);
}
public BufferedImage loadScreen(int x, int y, Tank aTank,BufferedImage camera){
if(aTank.getx()-240<0) {
camera=world.getSubimage(0, 0, TRE.SCREEN_WIDTH/2, TRE.SCREEN_HEIGHT);
}
else if(aTank.getx()+270>TRE.SCREEN_WIDTH) {
camera=world.getSubimage(TRE.SCREEN_WIDTH/2, 0, TRE.SCREEN_WIDTH/2, TRE.SCREEN_HEIGHT);
}
else {
camera=world.getSubimage(aTank.getx()-240,0,TRE.SCREEN_WIDTH/2,TRE.SCREEN_HEIGHT);
}
return camera;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
95b8abcdc7089baeb1b55a0d986a00ae03dc9b92 | 2f380a1462a94886807a6c4747e5765cb8f5549c | /src/main/java/xyz/frt/govern/service/impl/BaseServiceImpl.java | 6236e9e9b5055274df7d127c4d91cf46678f9f1a | [] | no_license | agangdundan/govern | 64d5d0cb86d60f5abb409824b50654e42c8dc8b6 | 3a7810c0239b8fac8c421696221c8cf896c05ead | refs/heads/master | 2020-03-22T21:15:50.505863 | 2018-06-05T15:51:57 | 2018-06-05T15:51:57 | 140,672,221 | 1 | 0 | null | 2018-07-12T06:41:40 | 2018-07-12T06:41:40 | null | UTF-8 | Java | false | false | 8,453 | java | package xyz.frt.govern.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.web.multipart.MultipartFile;
import xyz.frt.govern.common.BaseUtils;
import xyz.frt.govern.common.PageInfo;
import xyz.frt.govern.dao.BaseMapper;
import xyz.frt.govern.dao.UserMapper;
import xyz.frt.govern.model.BaseEntity;
import xyz.frt.govern.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* @author phw
* @date Created in 04-19-2018
* @description
*/
@CacheConfig(cacheNames = "redis.server")
public abstract class BaseServiceImpl<T extends BaseEntity> implements BaseService<T> {
@Autowired
private UserMapper userMapper;
public abstract BaseMapper<T> getMapper();
@Override
@CacheEvict
public Integer deleteByPrimaryKey(Integer id) {
return getMapper().deleteByPrimaryKey(id);
}
@Override
public Integer insert(T item) {
return getMapper().insert(item);
}
@Override
public Integer insertSelective(T item) {
return getMapper().insertSelective(item);
}
@Override
public Integer insertItems(List<T> items) {
if (BaseUtils.isNullOrEmpty(items)) {
return 0;
}
Integer result = 0;
for (T item: items) {
getMapper().insertSelective(item);
result++;
}
return result;
}
@Override
@Cacheable
public T selectByPrimaryKey(Integer id) {
return getMapper().selectByPrimaryKey(id);
}
@Override
@CachePut
public T updateByPrimaryKeySelective(T item) {
if (BaseUtils.isNullOrEmpty(item)) {
return null;
}
if (BaseUtils.isNullOrEmpty(item.getId())) {
return null;
}
if (getMapper().updateByPrimaryKeySelective(item) == 0) {
return null;
}
return getMapper().selectByPrimaryKey(item.getId());
}
@Override
@CachePut
public T updateByPrimaryKey(T item) {
if (BaseUtils.isNullOrEmpty(item)) {
return null;
}
if (getMapper().updateByPrimaryKey(item) == 0) {
return null;
}
return getMapper().selectByPrimaryKey(item.getId());
}
@Override
@Cacheable
public List<T> selectAll() {
List<T> items = getMapper().selectAll();
if (BaseUtils.isNullOrEmpty(items)) {
return null;
}
return items;
}
@Override
@Cacheable
public List<T> selectAll(String orderBy) {
List<T> items = getMapper().selectAllOrderBy(orderBy);
if (BaseUtils.isNullOrEmpty(items)) {
return null;
}
return items;
}
@Override
@Cacheable
public PageInfo<T> selectAllPage(Integer page, Integer limit) {
if (BaseUtils.isNullOrEmpty(page) || BaseUtils.isNullOrEmpty(limit)) {
return null;
}
Page<T> tPage = PageHelper.startPage(page, limit);
List<T> data = getMapper().selectAll();
Integer totalCount = getMapper().selectCount();
Integer totalPage = totalCount / limit;
return new PageInfo<>(page, totalPage, limit, totalCount, data);
}
@Override
@Cacheable
public PageInfo<T> selectAllPage(Integer page, Integer limit, String orderBy) {
if (BaseUtils.isNullOrEmpty(page) || BaseUtils.isNullOrEmpty(limit) || BaseUtils.isNullOrEmpty(orderBy)) {
return null;
}
Page<T> tPage = PageHelper.startPage(page, limit);
List<T> data = getMapper().selectAllOrderBy(orderBy);
Integer totalCount = getMapper().selectCount();
Integer totalPage = totalCount / limit;
return new PageInfo<>(page, totalPage, limit, totalCount, data);
}
@Override
@Cacheable
public List<T> selectByConditions(Map<String, Object> map) {
List<T> items = getMapper().selectByConditions(map);
if (BaseUtils.isNullOrEmpty(items)) {
return null;
}
return items;
}
@Override
@Cacheable
public List<T> selectByConditions(Map<String, Object> map, String orderBy) {
List<T> items = getMapper().selectByConditionsOrderBy(map, orderBy);
if (BaseUtils.isNullOrEmpty(items)) {
return null;
}
return items;
}
@Override
@CachePut
public List<T> updateByConditions(Map<String, Object> map) {
if (BaseUtils.isNullOrEmpty(map)) {
return null;
}
Integer result = getMapper().updateByConditions(map);
if (result == 0) {
return null;
}
List<T> items = getMapper().selectByConditions(map);
if (BaseUtils.isNullOrEmpty(items)) {
return null;
}
return items;
}
@Override
@Cacheable
public T selectByUnique(String col, Object value) {
Map<String, Object> conditions = new HashMap<>();
conditions.put(col, value);
List<T> items = selectByConditions(conditions);
if (BaseUtils.isNullOrEmpty(items)) {
return null;
}
return items.get(0);
}
@Override
@Cacheable
public Integer selectCount() {
return getMapper().selectCount();
}
@Override
@Cacheable
public Integer selectCountByConditions(Map<String, Object> map) {
return getMapper().selectCountByConditions(map);
}
@Override
@Cacheable
public PageInfo<T> selectByConditionsPage(Map<String, Object> map, Integer page, Integer limit) {
if (BaseUtils.isNullOrEmpty(map) || BaseUtils.isNullOrEmpty(page) || BaseUtils.isNullOrEmpty(limit)) {
return null;
}
Integer totalCount = getMapper().selectCountByConditions(map);
if (totalCount == 0) {
return null;
}
Integer totalPage = totalCount / limit;
Page<T> tPage = PageHelper.startPage(page, limit);
List<T> data = getMapper().selectByConditions(map);
return new PageInfo<>(page, totalPage, limit, totalCount, data);
}
@Override
@Cacheable
public PageInfo<T> selectByConditionsPage(Map<String, Object> map, String orderBy, Integer page, Integer limit) {
if (BaseUtils.isNullOrEmpty(map) || BaseUtils.isNullOrEmpty(page) || BaseUtils.isNullOrEmpty(limit)) {
return null;
}
if (BaseUtils.isNullOrEmpty(orderBy)) {
return null;
}
Integer totalCount = getMapper().selectCountByConditions(map);
if (totalCount == 0) {
return null;
}
Integer totalPage = totalCount / limit;
Page<T> tPage = PageHelper.startPage(page, limit);
List<T> data = getMapper().selectByConditionsOrderBy(map, orderBy);
return new PageInfo<>(page, totalPage, limit, totalCount, data);
}
@Override
public String[] filesUpload(String path, List<MultipartFile> files) {
if (BaseUtils.isNullOrEmpty(files)) {
return null;
}
String[] filesPath = new String[files.size() + 1];
for (int i = 0; i < files.size(); i++) {
filesPath[i] = fileUpload(path, files.get(i));
}
return filesPath;
}
@Override
public String fileUpload(String path, MultipartFile file) {
if (BaseUtils.isNullOrEmpty(file)) {
return null;
}
String originalName = file.getOriginalFilename();
String fileName = UUID.randomUUID().toString() + originalName.substring(originalName.lastIndexOf("."), originalName.length());
try {
File uploadFile = new File(path, fileName);
if (!uploadFile.getParentFile().exists()) {
if (uploadFile.getParentFile().mkdirs()) {
return null;
}
}
file.transferTo(uploadFile);
} catch (IOException e) {
e.printStackTrace();
}
return path + File.separator + fileName;
}
}
| [
"937855602@qq.com"
] | 937855602@qq.com |
e842d5b883f310883649fedcc8ec3557d6335d85 | a73e463ea985a1e677fa028bf107533f610f85e0 | /app/src/main/java/tk/dalpiazsolutions/fuelpricesurveillance/MainModel.java | 99224357edba3ead7aa177933f7f73de5071f747 | [] | no_license | bIosCrYsisX/FuelPriceSurveillance | c2c83ff427f03009896a4c3ecf7fe0dc0bb64aff | d7932a1e94eba1c34ae0e78ff7c60520d397a071 | refs/heads/master | 2020-03-19T16:14:02.396027 | 2019-07-22T07:49:35 | 2019-07-22T07:49:35 | 136,706,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package tk.dalpiazsolutions.fuelpricesurveillance;
/**
* Created by Christoph on 08.06.2018.
*/
public class MainModel {
private FuelService fuelService;
private MainActivity mainActivity;
private String completeSite;
private float price;
private int counter;
public MainModel(FuelService fuelService)
{
this.fuelService = fuelService;
}
public MainModel(MainActivity mainActivity)
{
this.mainActivity = mainActivity;
}
public String getCompleteSite() {
return completeSite;
}
public void setCompleteSite(String completeSite) {
this.completeSite = completeSite;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public int getCounter() {
return counter;
}
public void setCounter(int counter) {
this.counter = counter;
}
}
| [
"christoph.dalpiaz@gmail.com"
] | christoph.dalpiaz@gmail.com |
fb5c2b00a0984125e74685f8cd45f989ffd4371d | dfb1c7cf76f52974c61910ad8edc7951f3df0a2c | /app/src/main/java/com/example/lawrence/flagquizapp/SettingsActivity.java | a327ff376f339c9d287220fa4af607397535453f | [] | no_license | LawrenceELee/FlagQuizApp | 1576b39a6847cbfeced34fc69aec76f64f16c9b5 | 89289957f5360d36092274ea46535add394e1656 | refs/heads/master | 2021-01-10T16:51:48.517919 | 2016-04-09T01:08:44 | 2016-04-09T01:08:44 | 55,577,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package com.example.lawrence.flagquizapp;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class SettingsActivity extends AppCompatActivity {
// inflates GUI, displays Toolbar and "up" button to go to previous activity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
| [
"Lawrence.Lee@alumni.ucsd.edu"
] | Lawrence.Lee@alumni.ucsd.edu |
a1647bc4b8d0450b39dff5b3b09b70a93cf03140 | 6c84fd0667232660cea4ea5a16651b6a62d3dae8 | /zlibrary/src/main/java/com/nxt/zyl/ui/notification/effects/Standard.java | e9cb263b29a677d81ea676e3bcc856620a8b3b27 | [] | no_license | huqiangqaq/AgriculturalSupervision | 8cc8f2d8078c5e118349c56339072e36a7131797 | b0948680fe2120f6bdee94dc401274a0688a2936 | refs/heads/master | 2020-06-12T04:58:12.610180 | 2017-02-04T09:11:22 | 2017-02-04T09:11:22 | 75,604,073 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,310 | java | package com.nxt.zyl.ui.notification.effects;
/*
* Copyright 2014 gitonway
*
* 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.
*/
import android.view.View;
import com.nineoldandroids.animation.ObjectAnimator;
public class Standard extends BaseEffect{
@Override
protected void setInAnimation(View view) {
getAnimatorSet().playTogether(
ObjectAnimator.ofFloat(view, "translationY", -view.getHeight(), 0).setDuration(mDuration)
);
}
@Override
protected void setOutAnimation(View view) {
getAnimatorSet().playTogether(
ObjectAnimator.ofFloat(view, "translationY",0, -view.getHeight()).setDuration(mDuration)
);
}
@Override
protected long getAnimDuration(long duration) {
return duration;
}
}
| [
"839168655@qq.com"
] | 839168655@qq.com |
98b06b863d1c3185e1374d8584cb84e47bd677b5 | 8e9bfccd720613ab3390b8b938ab8161ac013bd3 | /src/main/java/org/d2rq/cli/generate_mapping.java | a6b8372b1ae504d768d2d2a90670a9521fad12f3 | [
"Apache-2.0"
] | permissive | d2rq/r2rml-kit | a8beab16e60bcb135d5c0ec7c77ccecb17a6c85a | a4f9121a3bf4596384ea6cc6f4025326233bba2d | refs/heads/master | 2021-01-21T14:04:53.268142 | 2019-01-19T14:13:30 | 2019-01-19T14:13:30 | 54,291,027 | 10 | 6 | Apache-2.0 | 2020-10-12T20:37:09 | 2016-03-19T23:03:31 | Java | UTF-8 | Java | false | false | 2,452 | java | package org.d2rq.cli;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import jena.cmdline.ArgDecl;
import jena.cmdline.CommandLine;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.d2rq.SystemLoader;
import org.d2rq.mapgen.MappingGenerator;
import org.d2rq.mapgen.OntologyTarget;
/**
* Command line interface for {@link MappingGenerator}.
*
* @author Richard Cyganiak (richard@cyganiak.de)
*/
public class generate_mapping extends CommandLineTool {
private final static Log log = LogFactory.getLog(generate_mapping.class);
public static void main(String[] args) {
new generate_mapping().process(args);
}
public void usage() {
System.err.println("usage: generate-mapping [options] jdbcURL");
System.err.println();
printStandardArguments(false, false);
System.err.println(" Options:");
printConnectionOptions(true);
System.err.println(" -o outfile.ttl Output file name (default: stdout)");
System.err.println(" --r2rml Generate R2RML mapping file");
System.err.println(" -v Generate RDFS+OWL vocabulary instead of mapping file");
System.err.println(" --verbose Print debug information");
System.err.println();
System.exit(1);
}
private ArgDecl outfileArg = new ArgDecl(true, "o", "out", "outfile");
private ArgDecl r2rmlArg = new ArgDecl(false, "r2rml");
private ArgDecl vocabAsOutput = new ArgDecl(false, "v", "vocab");
public void initArgs(CommandLine cmd) {
cmd.add(r2rmlArg);
cmd.add(outfileArg);
cmd.add(vocabAsOutput);
}
public void run(CommandLine cmd, SystemLoader loader) throws IOException {
if (cmd.numItems() == 1) {
loader.setJdbcURL(cmd.getItem(0));
}
if (cmd.contains(r2rmlArg)) {
loader.setGenerateR2RML(true);
}
PrintStream out;
if (cmd.contains(outfileArg)) {
File f = new File(cmd.getArg(outfileArg).getValue());
log.info("Writing to " + f);
out = new PrintStream(new FileOutputStream(f));
} else {
log.info("Writing to stdout");
out = System.out;
}
MappingGenerator generator = loader.getMappingGenerator();
try {
if (cmd.contains(vocabAsOutput)) {
OntologyTarget target = new OntologyTarget();
generator.generate(target);
target.getOntologyModel().write(out, "TURTLE");
} else {
loader.getWriter().write(out);
}
} finally {
loader.close();
}
}
}
| [
"richard@cyganiak.de"
] | richard@cyganiak.de |
34ed27daa54bd01c938577ce3ed1fa399d6e23c7 | a0c750f0ec36a4dbca4d7ab7cd3a476008e6f474 | /src/main/java/com/alibaba/com/caucho/hessian/io/ArrayDeserializer.java | 3a17e0b004781acff9494c7f964809e321734e02 | [] | no_license | Fyypumpkin/dubbo-decompile-source | dc7251f6db19e6f8134ed49360add502a71f698b | 2510460f89dec2d7bc11769507cc37882f9b7ba7 | refs/heads/master | 2020-06-10T10:25:00.460681 | 2019-06-25T04:26:55 | 2019-06-25T04:26:55 | 193,633,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,981 | java | /*
* Decompiled with CFR 0.139.
*/
package com.alibaba.com.caucho.hessian.io;
import com.alibaba.com.caucho.hessian.io.AbstractHessianInput;
import com.alibaba.com.caucho.hessian.io.AbstractListDeserializer;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
public class ArrayDeserializer
extends AbstractListDeserializer {
private Class _componentType;
private Class _type;
public ArrayDeserializer(Class componentType) {
this._componentType = componentType;
if (this._componentType != null) {
try {
this._type = Array.newInstance(this._componentType, 0).getClass();
}
catch (Exception exception) {
// empty catch block
}
}
if (this._type == null) {
this._type = Object[].class;
}
}
@Override
public Class getType() {
return this._type;
}
@Override
public Object readList(AbstractHessianInput in, int length) throws IOException {
if (length >= 0) {
Object[] data = this.createArray(length);
in.addRef(data);
if (this._componentType != null) {
for (int i = 0; i < data.length; ++i) {
data[i] = in.readObject(this._componentType);
}
} else {
for (int i = 0; i < data.length; ++i) {
data[i] = in.readObject();
}
}
in.readListEnd();
return data;
}
ArrayList<Object> list = new ArrayList<Object>();
in.addRef(list);
if (this._componentType != null) {
while (!in.isEnd()) {
list.add(in.readObject(this._componentType));
}
} else {
while (!in.isEnd()) {
list.add(in.readObject());
}
}
in.readListEnd();
Object[] data = this.createArray(list.size());
for (int i = 0; i < data.length; ++i) {
data[i] = list.get(i);
}
return data;
}
@Override
public Object readLengthList(AbstractHessianInput in, int length) throws IOException {
Object[] data;
data = this.createArray(length);
in.addRef(data);
if (this._componentType != null) {
for (int i = 0; i < data.length; ++i) {
data[i] = in.readObject(this._componentType);
}
} else {
for (int i = 0; i < data.length; ++i) {
data[i] = in.readObject();
}
}
return data;
}
protected Object[] createArray(int length) {
if (this._componentType != null) {
return (Object[])Array.newInstance(this._componentType, length);
}
return new Object[length];
}
public String toString() {
return "ArrayDeserializer[" + this._componentType + "]";
}
}
| [
"fyypumpkin@gmail.com"
] | fyypumpkin@gmail.com |
1f4694bcb4e5bed95e85c9686dcade1298029541 | 2ee2e59ef1bf89330b11bc4e5c2455f604dde2a6 | /modules/notifications_api/src/main/java/com/ibm/cloud/securityadvisor/notifications_api/v1/model/DeleteChannelResponse.java | 7cd69e8811385d727fe3dd88a8e9333f04ffefb6 | [
"Apache-2.0"
] | permissive | gary1998/security-advisor-sdk-java | a9134c418830c4e778533dab5b01d903fc27e6db | ea7e9b8ca3b5d695bdd7aeaebece7c33cd5e23c2 | refs/heads/master | 2023-05-10T18:36:51.758920 | 2021-04-06T07:02:16 | 2021-04-06T07:02:16 | 342,146,482 | 0 | 0 | Apache-2.0 | 2021-03-01T18:55:57 | 2021-02-25T06:31:16 | null | UTF-8 | Java | false | false | 1,269 | java | /*
* (C) Copyright IBM Corp. 2020.
*
* 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.ibm.cloud.securityadvisor.notifications_api.v1.model;
import com.google.gson.annotations.SerializedName;
import com.ibm.cloud.sdk.core.service.model.GenericModel;
/**
* Response of deleted channel.
*/
public class DeleteChannelResponse extends GenericModel {
@SerializedName("channel_id")
protected String channelId;
protected String message;
/**
* Gets the channelId.
*
* id of the created channel.
*
* @return the channelId
*/
public String getChannelId() {
return channelId;
}
/**
* Gets the message.
*
* response message.
*
* @return the message
*/
public String getMessage() {
return message;
}
}
| [
"skairali@in.ibm.com"
] | skairali@in.ibm.com |
cc8bedd465a6e6d7c0317e4fb5c9aeb3aed03548 | d5d1161239510eb9ba230f497b0e792dc24debcb | /usian_cart_web/src/main/java/com/usian/CartWebApp.java | da208cfc4736615f1c97269f5f4ed566432c3843 | [] | no_license | mao-di/usian_parent | 525eaff2750af42de61fb9c1fa55796f550f7106 | aad5b95754d0eba800e8d121bf3680b6dc039493 | refs/heads/master | 2023-04-03T09:36:57.105094 | 2021-04-05T12:08:33 | 2021-04-05T12:08:33 | 353,874,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package com.usian;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* ClassName:CartWebApp
* Author:maodi
* CreateTime:2021/03/29/08:39
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class CartWebApp {
public static void main(String[] args) {
SpringApplication.run(CartWebApp.class, args);
}
}
| [
"1425757628@qq.com"
] | 1425757628@qq.com |
74df0f33c77c4102901d523ca933be3d75356ad4 | ed074648167e9fc4b375d4c1a094199cb4a0a2de | /app/src/main/java/app/wenya/sketchbookpro/utils/Interface/ImagesStorage.java | 40605b27fdb8033482c95ca2c858044ae926cbe8 | [] | no_license | 765947965/SketchBookPro | 1805176c9faef11f21f1cb14171e032b4a7ccafb | ec87ff76d29922c324572ac0f6d0abb9b17ee1e7 | refs/heads/master | 2021-04-29T06:29:54.182934 | 2017-01-17T08:13:36 | 2017-01-17T08:13:36 | 77,966,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package app.wenya.sketchbookpro.utils.Interface;
import android.app.Activity;
import java.util.List;
import app.wenya.sketchbookpro.model.DrawingImage;
/**
* @author: xiewenliang
* @Filename:
* @Description:
* @Copyright: Copyright (c) 2017 Tuandai Inc. All rights reserved.
* @date: 2017/1/3 16:51
*/
public interface ImagesStorage {
List<DrawingImage> getAllDrawingImage(Activity mActivity, String fileName);
void setAllDrawingImage(Activity mActivity, List<DrawingImage> mDrawingImages, String fileName);
}
| [
"765947965@qq.com"
] | 765947965@qq.com |
a63b3341b5595edb1e5261f81770963ad5f3c939 | ac4bd7fec612b76694735aa20b361515789568a4 | /src/main/java/goodwill/rest/resources/asm/BlogEntryListResourceAsm.java | 07c57c45026e3007df070f2ff1242c09c6206da6 | [] | no_license | tapsZ/angular-spring | 151488e8f92edaec3693823b5a55a75102652a2a | fc352094d73f525027e4ffad49e57a8b6508613a | refs/heads/master | 2021-01-10T02:53:31.320217 | 2018-10-19T05:54:09 | 2018-10-19T05:54:09 | 54,200,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,075 | java | package goodwill.rest.resources.asm;
import goodwill.core.services.util.BlogEntryList;
import goodwill.rest.mvc.BlogController;
import goodwill.rest.resources.BlogEntryListResource;
import goodwill.rest.resources.BlogEntryResource;
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
import java.util.List;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.*;
public class BlogEntryListResourceAsm extends ResourceAssemblerSupport<BlogEntryList, BlogEntryListResource> {
public BlogEntryListResourceAsm() {
super(BlogController.class, BlogEntryListResource.class);
}
@Override
public BlogEntryListResource toResource(BlogEntryList list) {
List<BlogEntryResource> resources = new BlogEntryResourceAsm().toResources(list.getEntries());
BlogEntryListResource listResource = new BlogEntryListResource();
listResource.setEntries(resources);
listResource.add(linkTo(methodOn(BlogController.class).findAllBlogEntries(list.getBlogId())).withSelfRel());
return listResource;
}
}
| [
"tapiwazireva@gmail.com"
] | tapiwazireva@gmail.com |
8168b9606a51b70e71770e86147e1796fc1572c7 | 0b9db90f958bdb1a0a7d10775cf66c6f78704059 | /src/test/java/demo/Questapp.java | e3be4a0ba8a29674dbd27a1ba06a0f4f31d09291 | [] | no_license | naveenrachakonda6569/Questdemo | 3649c954b6d0fa30ea7d112b8a4c255f3e4c570d | 17dce713d1a7178f701491f3c697503251caabbe | refs/heads/master | 2020-03-19T10:59:48.705798 | 2018-06-07T04:23:38 | 2018-06-07T04:23:38 | 136,419,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package demo;
import static org.junit.Assert.*;
import org.junit.Test;
public class Questapp {
@Test
public void test() {
}
}
| [
"navin6569r@gmail.com"
] | navin6569r@gmail.com |
b668a94534ea48a49970bf7cc8ea9bbbfc66bf1e | a7f2d6ab342bb6779c72b009b2d5c6e10dee7db6 | /tib/Info.java | cf777ef8d2042c256fc38ce608e6f219b28c7934 | [] | no_license | gi-web/java | af39672fae86944f69fa991e3458a2bd537187cc | 30519bd9d94b62328f6082ff553bf31b4c3ea42c | refs/heads/main | 2023-03-28T20:38:34.406554 | 2021-03-29T06:12:01 | 2021-03-29T06:12:01 | 352,534,633 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 8,006 | java | package tib;
import java.awt.Button;
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.List;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
public class Info extends JFrame implements ActionListener {
JLabel lab1, lab2, lab3, lab4, lab5, lab6, lab7, lab8;
ImageIcon busan, background, background2, bts, bts1, map, site1,site2,site3;
JButton btn1, btfn, btna, btnb, btnmap, btnLogout, btnLogo;
TextField fi, fi2, fi3, fi4, fi5, fi6, fi7, fi8, fi9,fi0;
TextArea ta1, ta2, ta3, ta4, ta5, ta6;
List list;
String food[] = { "짜장면", "짬뽕", "우동" };
Button logoutBtn;
Place place;
Choose choose;
Login login;
TibMap tibMap;
int UC_SEQ;
URL url = null;
TibMapMgr mgr = null;
int position = 1;
Vector<TravelBean> vlist = null;
TravelBean bean;
WeatherBean wbean;
RssReadMgr mgr1;
Image skyImg, ptyImg;
public Info(int UC_SEQ) {
try {
mgr = new TibMapMgr();
mgr1 = new RssReadMgr();
wbean = mgr1.getTownForecast(UC_SEQ);
this.UC_SEQ = UC_SEQ;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
setTitle("Travle in Busan");
busan = new ImageIcon("tib/busanwhite157.png");
JPanel panelLogo = new JPanel() {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(busan.getImage(), 0, 0, null);
setOpaque(false);
}
};
map = new ImageIcon("tib/map.png");
JPanel panelMap = new JPanel() {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(busan.getImage(), 0, 0, null);
setOpaque(false);
}
};
background2 = new ImageIcon("tib/background2.png");
JPanel panelBackground2 = new JPanel() {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(background2.getImage(), 0, 0, null);
setOpaque(false);// 안배경
}
};
background = new ImageIcon("tib/background1100.jpg");
JPanel panelBackground = new JPanel() {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(background.getImage(), 0, 0, null);
setOpaque(false);// 바깥배경
}
};
///////////////////////////여기추가//////////////////////////////////////////////////////////////////////////////
bean = mgr.getTravel(UC_SEQ);
url = new URL("https://www.visitbusan.net/" + bean.getMAIN_IMG_THUMB());
site1 = new ImageIcon(url);
JPanel panelSite1 = new JPanel() {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(site1.getImage(), 0, 0, null);
setOpaque(false);// 바깥배경
}
};
panelSite1.setLayout(null);
panelSite1.setBounds(220, 120, 417, 320);
add(panelSite1);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//소개글이 안나온다...
panelBackground2.add(ta1 = new TextArea(bean.getITEMCNTNTS(), 5, 5, TextArea.SCROLLBARS_VERTICAL_ONLY));
ta1.setBounds(40, 390, 1020, 330);
///////// 지도버튼
panelBackground2.add(btnmap = new JButton(map));
btnmap.setBounds(1010, 40, 45, 45);
btnmap.setBackground(new Color(251, 246, 240));
btnmap.addActionListener(this);
panelBackground2.add(btna = new JButton("이전"));
btna.setBounds(500, 750, 100, 30);
btna.addActionListener(this);
panelBackground2.add(fi0 = new TextField("264",15));
fi0.setBounds(530, 40, 500, 30);
panelBackground2.add(ta6 = new TextArea(fi0.getText()));
ta6.setBounds(530, 70, 300, 200);
panelLogo.setLayout(null);
panelLogo.setBounds(180, 20, 180, 50);
add(panelLogo);
add(panelLogo);
btnLogo = new JButton(busan);
btnLogo.setBounds(180, 20, 180, 50);
btnLogo.setBackground(new Color(0, 0, 0));
panelBackground.add(btnLogo);
btnLogo.addActionListener(this);
btnLogout = new JButton("Logout");
btnLogout.setBounds(1190, 30, 90, 30);
btnLogout.setBackground(new Color(0, 0, 0));
panelBackground.add(btnLogout);
btnLogout.addActionListener(this);
panelBackground2.setLayout(null);
panelBackground2.setBounds(180, 80, 1100, 800);
panelBackground2.setBorder(new TitledBorder(new LineBorder(Color.BLACK, 5), "★"));
panelBackground2.setBackground(new Color(0, 0, 0, 50));
add(panelBackground2);
panelBackground.setLayout(null);
panelBackground.setBounds(0, 0, 1500, 1000);
add(panelBackground);
Font title = new Font("맑은고딕", Font.BOLD, 30);
Font list = new Font("맑은고딕", Font.BOLD, 15);
Font top = new Font("맑은고딕", Font.BOLD, 12);
ta1.setFont(list);
fi0.setForeground(Color.BLACK);
btna.setBackground(Color.WHITE);
btnLogout.setFont(top);
btnLogout.setForeground(Color.WHITE);
setSize(1500, 1000);
setVisible(true);
validate();
setLocationRelativeTo(null);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void actionPerformed(ActionEvent e) {
Object obj = e.getSource();
if (btna == obj) {
new MBack(this, "알림", "", true);
this.setVisible(false);
place = new Place();
place.setVisible(true);
} else if (btnmap == obj) {
tibMap = new TibMap(UC_SEQ);
} else if (btnLogout == obj) {
this.setVisible(false);
login = new Login();
login.setVisible(true);
}
}
@Override
public void paint(Graphics g) {
super.paint(g);
if(wbean!=null) {
g.setColor(Color.WHITE);
g.drawString("여행정보 : " + wbean.getMAIN_TITLE(), 20, 100);
g.drawString("현재기온 : " + wbean.getTemp(), 20, 120);
g.drawString("현재날씨 : " + wbean.getWfKor(), 20, 140);
String sky = wbean.getSky();
if (sky.equals("1")) {
sky = "sunshine.png";
} else if(sky.equals("2")) {
sky = "sunny_cloudy1.png";
}else if(sky.equals("3")) {
sky = "sunny_cloudy2.png";
}else if(sky.equals("4")) {
sky = "over_cloudy.png";
}
//System.out.println(sky);
skyImg = Toolkit.getDefaultToolkit().getImage("tib/"+sky);
g.drawString("하늘날씨 : ", 20, 180);
g.drawImage(skyImg, 80, 160 ,this);
String pty = wbean.getPty();
if (pty.equals("0")) {
pty = "no_rain.png";
} else if(pty.equals("1")) {
pty = "rain.png";
}else if(pty.equals("2")) {
pty = "rain_snow.png";
}else if(pty.equals("3")) {
pty = "snow.png";
}
//System.out.println(pty);
ptyImg = Toolkit.getDefaultToolkit().getImage("tib/"+pty);
g.drawString("강수상태 : ",120, 180);
g.drawImage(ptyImg, 180, 160 ,this);
}
}
class MBack extends JDialog implements ActionListener {
int width = 200;
int height = 145;
JButton btnu;
JLabel msg1L;
Frame f;
int xmsg;
public MBack(Frame f, String title, String msg, boolean flag) {
super(f, title, flag);
this.f = f;
xmsg = msg.length();
setLayout(null);
add(msg1L = new JLabel("뒤로 가겠습니까?"));
add(btnu = new JButton("yes"));
msg1L.setBounds(40, 20, 150, 25);
Font top = new Font("맑은고딕", Font.BOLD, 13);
msg1L.setFont(new Font("맑은고딕", Font.BOLD, 13));
btnu.setBackground(Color.WHITE);
btnu.setBounds(60, 65, 60, 30);
btnu.addActionListener(this);
layset();
}
public void layset() {
int px = f.getX();
int py = f.getY();
int x = px + f.getWidth() / 2;
int y = py + f.getHeight() / 2;
setBounds(x, y, width, height);
setVisible(true);
// validate();
}
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
}
} | [
"phok75@naver.com"
] | phok75@naver.com |
3dd35d8958fbda0905d6471e26686ae93578f809 | 2f94e3a39c6ae17b63d79499b64780449b1323d0 | /ex4/src/info/ex4/HelloWorld.java | 249c0f4d0f146b85eb398c04f4635f653ef36339 | [] | no_license | 201703344/ex4 | 4ae72ede21d2d855f67d93d43267ae6f75dd7f3c | 631b86782abf9609d88d42dc6181b428b6338d56 | refs/heads/master | 2023-02-16T11:40:57.294266 | 2021-01-12T05:54:40 | 2021-01-12T05:54:40 | 328,874,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package info.ex4;
public class HelloWorld {
public static void main(String args[]){
System.out.println("HelloWorld");
}
} | [
"r201703344bn@jindai.jp"
] | r201703344bn@jindai.jp |
4c82680a4d1f5dead97be9f7d1bf9f40a21d3e9f | 69d23caaa6604e16020d76b75c441f532292b5b2 | /src/main/java/io/github/plindzek/FuelCostApplication.java | 640278c5bf4e2d5e054668cc96a3b10d39e3598c | [] | no_license | aplen/FuelCostGoogleCloud | 737c069917bcbd87092ad68dac53e0da38228b88 | 14a3a704b34259dcbb1559ee0c6d439c54d7cec2 | refs/heads/master | 2022-10-01T15:52:16.793183 | 2021-04-10T10:45:10 | 2021-04-10T10:45:10 | 246,594,559 | 0 | 0 | null | 2022-09-01T23:21:21 | 2020-03-11T14:33:08 | Java | UTF-8 | Java | false | false | 739 | java | package io.github.plindzek;
import org.h2.server.web.WebServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class FuelCostApplication {
public static void main(String[] args) {
SpringApplication.run(FuelCostApplication.class, args);
}
/*needed for working h2 console*/
@Bean
ServletRegistrationBean h2servletRegistration(){
ServletRegistrationBean registrationBean = new ServletRegistrationBean( new WebServlet());
registrationBean.addUrlMappings("/console/*");
return registrationBean;
}
}
| [
"Plindzek@users.noreply.github.com"
] | Plindzek@users.noreply.github.com |
6a3db3d1fb2d59f8ef94add250e02f255f625e82 | 9c7e4866992f3406809ff8f548d5724a2378c300 | /TestUrm8/src/main/java/com/ericsson/communication/responsetype/ReadResetLenntsListResponseType.java | d320bb3c5a612aabed4941d9f19ad12cf3abfd4b | [] | no_license | Ersabba/LorenzoStudio | eb623ee50f3a6163e7a1be980ab846167653c3ab | f76cafb96bb2de928cb0236bb11a6e578344058a | refs/heads/master | 2022-12-23T05:57:15.833188 | 2020-05-19T16:39:02 | 2020-05-19T16:39:02 | 157,240,224 | 0 | 0 | null | 2022-12-15T23:31:51 | 2018-11-12T16:07:45 | Java | UTF-8 | Java | false | false | 1,476 | java | package com.ericsson.communication.responsetype;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import com.ericsson.communication.CommandResponseType;
import com.ericsson.communication.CommandResponseTypeEnumeration;
import com.ericsson.communication.UrmCommunicationException;
public class ReadResetLenntsListResponseType extends CommandResponseType implements Serializable {
private static final long serialVersionUID = 1L;
public static final String idRequest = "ID_REQUEST";
public static final String resetResults = "RESET_RESULTS";
public static enum ResetResult {
NOT_EXISTS,
SUCCESS,
FAILED,
IP_ADDRESS_NULL,
ANTI_TAMPER_OFF,
MISSING_STATUS_WORD,
NOT_EXECUTED,
UNREACHABLE,
FEW_DAYS_RESETTED,
GENERIC_ERROR;
}
public CommandResponseTypeEnumeration getCommandResponseType() {
return CommandResponseTypeEnumeration.RES_RESET_LENNTS_LIST;
}
public boolean isValid() {
return true;
}
public String getIdRequest() throws UrmCommunicationException {
return (String) getResponseTypeBody().getResult(idRequest);
}
/**
* Metodo che restituisce il risultato del reset per ciascun lennt della lista
*
*
*/
public Map<String, ResetResult> getResetResults() throws UrmCommunicationException {
Map<String, ResetResult> results = (HashMap<String,ResetResult>) getResponseTypeBody().getResult(resetResults);
return results;
}
}
| [
"lorenzo.sabbatini@exprivia.com"
] | lorenzo.sabbatini@exprivia.com |
94510b6b2ef1a21a99775d64714f1b198cf40551 | 3c68e79723bb6669c0340d70591fd2fb4643efe0 | /src/controllori/actions/LayoutProperties.java | 1c034d0623a4aa00de92aba83361f6418d950a81 | [] | no_license | hilsonls/gui_mpxmvx | 652fc345982ecffb5041ad05627373280fb70b47 | 27c29980a9670d931fc1fdc642840d24aff6a66a | refs/heads/master | 2021-01-11T12:03:58.922982 | 2017-01-19T16:35:58 | 2017-01-19T16:35:58 | 79,471,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 659 | java |
package controllori.actions;
import controllori.Action;
import dialogs.layout.LayoutDialog;
import eccezioni.MVException;
import gui.CtrlActions;
import java.awt.Frame;
import javax.swing.JOptionPane;
/**
*
* @author antonio
*/
public class LayoutProperties extends Action {
public LayoutProperties(){
this.actionStringId = "Layout";
this.isLongOp = false;
}
@Override
public void doAction() throws MVException {
Frame frame = JOptionPane.getFrameForComponent(CtrlActions.getInstance().getTilesWorkspace());
new LayoutDialog(frame, CtrlActions.getInstance().getIdModulo(), LayoutDialog.SETUP);
}
}
| [
"michael@chromatec.com"
] | michael@chromatec.com |
ac1c22a0859ed46dfb258132f9cd42dfe2bda423 | 04df008b293fbbb238d191b256c33e9a55d18e34 | /src/com/example/gametry/framework/impl/AccelerometerHandler.java | fc3cff40f48aa7d7475232951932aac757edb47f | [] | no_license | Vincent34/AndroidGameFrame | 89d46277bf21c7330b982e15ed388b576ef8d5b3 | b2525173ed3f6cc04df5ce5545d6c350ca489256 | refs/heads/master | 2021-01-01T09:46:23.002438 | 2014-07-11T11:44:00 | 2014-07-11T11:44:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,082 | java | package com.example.gametry.framework.impl;
import android.hardware.SensorEventListener;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorManager;
public class AccelerometerHandler implements SensorEventListener {
float accelX, accelY, accelZ;
public AccelerometerHandler(Context context) {
SensorManager manager = (SensorManager) context
.getSystemService(Context.SENSOR_SERVICE);
if (manager.getSensorList(Sensor.TYPE_ACCELEROMETER).size() != 0) {
Sensor accelerometer = manager.getSensorList(
Sensor.TYPE_ACCELEROMETER).get(0);
manager.registerListener(this, accelerometer,
SensorManager.SENSOR_DELAY_GAME);
}
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
public void onSensorChanged(SensorEvent event) {
accelX = event.values[0];
accelY = event.values[1];
accelZ = event.values[2];
}
public float getAccelX() {
return accelX;
}
public float getAccelY() {
return accelY;
}
public float getAccelZ() {
return accelZ;
}
}
| [
"vincent007x@gmail.com"
] | vincent007x@gmail.com |
1ff5026d0fa3d83a6c88c07f4c1de914d54892d6 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/MATH-31b-1-17-NSGA_II-WeightedSum:TestLen:CallDiversity/org/apache/commons/math3/util/ContinuedFraction_ESTest_scaffolding.java | 65093499d27911fb555ecd4049ffd6dbe503b0bc | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Jan 18 21:09:14 UTC 2020
*/
package org.apache.commons.math3.util;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class ContinuedFraction_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
aa7e568fa5d90a588829b699fb39069e3827b5be | 08be78ee28957fe393bea727228fbe13e5c00df1 | /modules/dataaccess/modules/dataaccess-hibernate/src/main/java/com/hibernate/pseudocode/core/Interceptor.java | d833b45a54c0e2f3ecc5f54708f7e58c4fed0e37 | [] | no_license | javachengwc/java-apply | 432259eadfca88c6f3f2b80aae8e1e8a93df5159 | 98a45c716f18657f0e4181d0c125a73feb402b16 | refs/heads/master | 2023-08-22T12:30:05.708710 | 2023-08-15T08:21:15 | 2023-08-15T08:21:15 | 54,971,501 | 10 | 4 | null | 2022-12-16T11:03:56 | 2016-03-29T11:50:21 | Java | UTF-8 | Java | false | false | 2,200 | java | package com.hibernate.pseudocode.core;
import com.hibernate.pseudocode.core.type.Type;
import java.io.Serializable;
import java.util.Iterator;
public abstract interface Interceptor
{
public abstract boolean onLoad(Object object, Serializable serializable, Object[] arrayObject, String[] arrayStr, Type[] arrayType) throws CallbackException;
public abstract boolean onFlushDirty(Object object, Serializable serializable, Object[] arrayObject1, Object[] arrayObject2, String[] arrayStr, Type[] arrayType) throws CallbackException;
public abstract boolean onSave(Object object, Serializable serializable, Object[] arrayObject, String[] arrayStr, Type[] arrayType) throws CallbackException;
public abstract void onDelete(Object object, Serializable serializable, Object[] arrayObject, String[] arrayStr, Type[] arrayType) throws CallbackException;
public abstract void onCollectionRecreate(Object object, Serializable serializable) throws CallbackException;
public abstract void onCollectionRemove(Object object, Serializable serializable) throws CallbackException;
public abstract void onCollectionUpdate(Object object, Serializable serializable) throws CallbackException;
public abstract void preFlush(Iterator iterator) throws CallbackException;
public abstract void postFlush(Iterator iterator) throws CallbackException;
public abstract Boolean isTransient(Object object);
public abstract int[] findDirty(Object object, Serializable serializable, Object[] array1, Object[] array2, String[] arrayStr, Type[] arrayType);
public abstract Object instantiate(String paramString, EntityMode entityMode, Serializable serializable) throws CallbackException;
public abstract String getEntityName(Object object) throws CallbackException;
public abstract Object getEntity(String param, Serializable serializable) throws CallbackException;
public abstract void afterTransactionBegin(Transaction transaction);
public abstract void beforeTransactionCompletion(Transaction transaction);
public abstract void afterTransactionCompletion(Transaction transaction);
public abstract String onPrepareStatement(String param);
}
| [
"ccc@ccc.com"
] | ccc@ccc.com |
aae88467f24cbfb2372b4b8bc21ab32ec7989c51 | d28614de0d2c74c9bb93ec99c684cc69d66d6d86 | /com.cash.spring.common/cash.springMvc/src/main/java/cash/springMvc/xx/Something.java | 658b7b5a6df9d76007bc3b47dc49676fa4c1e4c1 | [] | no_license | shouyinsun/aop-plugin | 4567bb099f8b58b825e0d3b55a60df525ffa53bb | 9a63f7d0824d9a4526b60611fc2a39b5f082a6b3 | refs/heads/master | 2021-09-16T11:08:58.111847 | 2018-06-20T02:41:11 | 2018-06-20T02:41:11 | 106,697,212 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package cash.springMvc.xx;
public class Something {
private String traceId;
public String getTraceId() {
return traceId;
}
public void setTraceId(String traceId) {
this.traceId = traceId;
}
}
| [
"442620332@qq.com"
] | 442620332@qq.com |
e08d54ad2aa716b0f8368776cfde085fb562a330 | cf5ff8e0bbd93e0d3110169bc7f89e2a2b2be60d | /app/src/main/java/com/thinkcoo/mobile/model/exception/trade/GoodsSearchResultEmptyException.java | 6ca8788a280a6381e82afab03ede667f1132792e | [] | no_license | yaolu0311/ThinkcooRefactor-2016526 | 993c09b50719322d9d89621f2d991e4687ab81f8 | bfe011a0650ca0c80932dc45c2e60868966afda6 | refs/heads/master | 2020-09-26T05:30:24.155465 | 2016-09-05T07:12:13 | 2016-09-05T07:12:13 | 67,396,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | package com.thinkcoo.mobile.model.exception.trade;
import android.text.TextUtils;
/**
* Created by Robert.yao on 2016/8/4.
*/
public class GoodsSearchResultEmptyException extends Throwable {
public GoodsSearchResultEmptyException(String keyWord) {
super(createMsg(keyWord));
}
private static String createMsg(String keyWord) {
if (TextUtils.isEmpty(keyWord)){
return "没有搜索到相关商品";
}
return ("没有搜索到与\"" + keyWord + "\"相关的商品");
}
}
| [
"yaolu0311@163.com"
] | yaolu0311@163.com |
786e718229cdd648670398609b219be46f3a41e1 | 2125762ecfbb7beae3be9a645fe32c5a42ed0422 | /books-api/src/main/java/com/kobo/books/api/dto/BookDtoV2.java | 2907df73ef113683923272669cfe967965bddff8 | [] | no_license | slobodator/bookshelf | a612024dabf1421a58b3b43acb8762b2904fd8f5 | e990c124481d442f0dde7f434650251ffb5b3814 | refs/heads/master | 2022-07-22T20:20:23.407192 | 2020-05-09T17:59:16 | 2020-05-10T19:19:58 | 262,627,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package com.kobo.books.api.dto;
import lombok.Data;
@Data
public class BookDtoV2 {
private String isbn;
private String title;
private String author;
private String description;
}
| [
"aslobodyanyk@luxoft.com"
] | aslobodyanyk@luxoft.com |
ded97e10a8d0835ca38ec1ebf6ebf62ae335b5ac | caf5dd848c3bc006457dc91d173f847bee356ace | /src/com/company/RoundNegatives.java | 33b16ea960a0c7a3eed772bd11e2306d33a671e8 | [] | no_license | ZihengXin/unit_one | 5419fad8655640cbb46bff94b66140c2cf7bbef5 | b6478e24fadc67ceb234c71a4deb9f9af5859582 | refs/heads/master | 2020-07-22T23:37:18.592696 | 2019-09-23T12:40:12 | 2019-09-23T12:40:12 | 207,369,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.company;
import java.util.Scanner;
public class RoundNegatives {
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("Enter a negative decimal number: ");
double input_number= input.nextDouble();
int result=(int)(input_number-0.5);
System.out.println(input_number+" rounded to a whole number is "+result);
}
}
| [
"ziheng.xin@ssfs.org"
] | ziheng.xin@ssfs.org |
a1163afb2dfbd2a7fa8397fa93e52ba06070d272 | f37a6564e1642c79926be69c7fee13f43b4df76a | /halcon/capa-halcon-portlet/WEB-INF/service/com/exp/portlet/halcon/jaxb/RootCredito.java | 7ae2158bc1b630bbce9f6020a35f32c8e608abab | [] | no_license | mshelzr/portlets-business | edc75e3bd5afbf7f51d9df58799bdd4ad4b7be36 | 9cf59a531524d8cafeb415bc6f711db5c4304aae | refs/heads/master | 2021-01-01T06:32:43.719845 | 2014-09-10T06:04:23 | 2014-09-10T06:04:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package com.exp.portlet.halcon.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class RootCredito {
@XmlElement(name = "data", namespace = "urn:schemas-microsoft-com:rowset")
private DataCredito data;
@XmlElement(name = "Schema", namespace = "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882")
private Schema schema;
public DataCredito getData() {
return data;
}
public void setData(DataCredito data) {
this.data = data;
}
public Schema getSchema() {
return schema;
}
public void setSchema(Schema schema) {
this.schema = schema;
}
public RootCredito() {
}
}
| [
"mshelzr@gmail.com"
] | mshelzr@gmail.com |
61deeb0b9fd907879c8e9457cbd9ca864de95d68 | b26676176c587f6f8e65bd59f831244d819b3139 | /src/com/gmail/olgabovkaniuk/app/servlets/commands/impl/DeleteUserOrderCommand.java | beaed068a0839e01ee04b2bfab983ceaf92bba6e | [] | no_license | olgaBovkaniuk/store | 86ab6006ac313268fb7396158cafce24c76876d3 | eabffd803c5be6278891a47c31ead8b37e12e21d | refs/heads/master | 2020-03-26T02:45:32.110344 | 2018-08-12T23:14:27 | 2018-08-12T23:14:27 | 144,422,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,409 | java | package com.gmail.olgabovkaniuk.app.servlets.commands.impl;
import com.gmail.olgabovkaniuk.app.config.ConfigurationManager;
import com.gmail.olgabovkaniuk.app.dao.model.Order;
import com.gmail.olgabovkaniuk.app.services.OrderService;
import com.gmail.olgabovkaniuk.app.services.UserService;
import com.gmail.olgabovkaniuk.app.services.impl.OrderServiceImpl;
import com.gmail.olgabovkaniuk.app.services.impl.UserServiceImpl;
import com.gmail.olgabovkaniuk.app.servlets.commands.Command;
import com.gmail.olgabovkaniuk.app.servlets.model.UserPrincipal;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.List;
import static com.gmail.olgabovkaniuk.app.config.ConfigurationManager.USER_ORDERS_CMD_URL;
public class DeleteUserOrderCommand implements Command {
private OrderService orderService = new OrderServiceImpl();
@Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String orderId = request.getParameter("order_id");
boolean deleted = orderService.delete(Long.valueOf(orderId));
if (!deleted) {
System.out.println("Order cannot be deleted by id, order id = " + orderId);
}
response.sendRedirect(ConfigurationManager.getInstance().getProperty(USER_ORDERS_CMD_URL));
return null;
}
}
| [
"olgabovkaniuk@gmail.com"
] | olgabovkaniuk@gmail.com |
3b9115551c416f02595a9be32b59e59c27db6e2f | 223b98a9b9078234f5d879300aaea96c91a1e0ac | /src/views/ModernUi.java | acc382222afa17f32a15c90a2dc49ec5a0aab5d6 | [] | no_license | simon376/PhoneAssignment | 51b50118d19eb0f855e5762ad85b812566266f61 | cbb340ff2b3f3352f493724c9487193ca04223d9 | refs/heads/master | 2020-06-02T10:54:25.850825 | 2019-06-21T16:46:33 | 2019-06-21T16:46:33 | 191,132,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,200 | java | package views;
import code.ButtonClickListener;
import code.KeyboardType;
import code.interfaces.IController;
import code.interfaces.IModel;
import code.interfaces.IView;
import javax.swing.*;
import java.awt.*;
public class ModernUi implements IView {
private JPanel panelPhone;
private JPanel panelKeyboard;
private JPanel panelKeyBoardQwerty;
private JPanel panelKeyboardNumerical;
private JPanel panelScreen;
private JButton Button1;
private JButton Button2;
private JButton Button3;
private JButton Button4;
private JButton Button5;
private JButton Button6;
private JButton Button7;
private JButton Button8;
private JButton Button9;
private JButton ButtonStar;
private JButton Button0;
private JButton ButtonPound;
private JTextArea textScreen;
private JButton ButtonPhone;
private JButton ButtonAction;
private JButton qButton;
private JButton wButton;
private JButton eButton;
private JButton rButton;
private JButton tButton;
private JButton yButton;
private JButton uButton;
private JButton iButton;
private JButton oButton;
private JButton pButton;
private JButton aButton;
private JButton dButton;
private JButton fButton;
private JButton lButton;
private JButton kButton;
private JButton sButton;
private JButton gButton;
private JButton hButton;
private JButton jButton;
private JButton vButton;
private JButton cButton;
private JButton bButton;
private JButton SHIFTButton;
private JButton mButton;
private JButton zButton;
private JButton xButton;
private JButton nButton;
private JButton SPACEButton;
private JButton DRAFTButton;
private JButton SENDButton;
private JPanel panelAction;
private JPanel panelKeyboardHidden;
public JPanel getPhonePanel() {
return panelPhone;
}
private final IController theController;
private final static String NUM_PANEL = "Card with Numbers";
private final static String QWERTY_PANEL = "Card with Qwerty";
private final static String HIDDEN_PANEL = "Card with nothing";
private Color phoneButtonGreen = new Color(0x15B405);
private Color phoneButtonRed = new Color(0xB40504);
public ModernUi(IModel theModel, IController theController)
{
theModel.RegisterView(this);
this.theController = theController;
initializeNumericalKeyboard();
initializeQwertyKeyboard();
panelKeyboard.add(panelKeyboardHidden, HIDDEN_PANEL);
panelKeyboard.add(panelKeyboardNumerical, NUM_PANEL);
panelKeyboard.add(panelKeyBoardQwerty, QWERTY_PANEL);
}
private void initializeQwertyKeyboard() {
qButton.addActionListener(new ButtonClickListener(theController, "q"));
wButton.addActionListener(new ButtonClickListener(theController, "w"));
eButton.addActionListener(new ButtonClickListener(theController, "e"));
rButton.addActionListener(new ButtonClickListener(theController, "r"));
tButton.addActionListener(new ButtonClickListener(theController, "t"));
yButton.addActionListener(new ButtonClickListener(theController, "y"));
uButton.addActionListener(new ButtonClickListener(theController, "u"));
iButton.addActionListener(new ButtonClickListener(theController, "i"));
oButton.addActionListener(new ButtonClickListener(theController, "o"));
pButton.addActionListener(new ButtonClickListener(theController, "p"));
aButton.addActionListener(new ButtonClickListener(theController, "a"));
dButton.addActionListener(new ButtonClickListener(theController, "d"));
fButton.addActionListener(new ButtonClickListener(theController, "f"));
lButton.addActionListener(new ButtonClickListener(theController, "l"));
kButton.addActionListener(new ButtonClickListener(theController, "k"));
sButton.addActionListener(new ButtonClickListener(theController, "s"));
gButton.addActionListener(new ButtonClickListener(theController, "g"));
hButton.addActionListener(new ButtonClickListener(theController, "h"));
jButton.addActionListener(new ButtonClickListener(theController, "j"));
vButton.addActionListener(new ButtonClickListener(theController, "v"));
cButton.addActionListener(new ButtonClickListener(theController, "c"));
bButton.addActionListener(new ButtonClickListener(theController, "b"));
SHIFTButton.addActionListener(new ButtonClickListener(theController, "shift"));
mButton.addActionListener(new ButtonClickListener(theController, "m"));
zButton.addActionListener(new ButtonClickListener(theController, "z"));
xButton.addActionListener(new ButtonClickListener(theController, "x"));
nButton.addActionListener(new ButtonClickListener(theController, "n"));
SPACEButton.addActionListener(new ButtonClickListener(theController, " "));
DRAFTButton.addActionListener(new ButtonClickListener(theController, "draft"));
SENDButton.addActionListener(new ButtonClickListener(theController, "send"));
}
private void initializeNumericalKeyboard() {
Button0.addActionListener(new ButtonClickListener(theController, "0"));
Button1.addActionListener(new ButtonClickListener(theController, "1"));
Button2.addActionListener(new ButtonClickListener(theController, "2"));
Button3.addActionListener(new ButtonClickListener(theController, "3"));
Button4.addActionListener(new ButtonClickListener(theController, "4"));
Button5.addActionListener(new ButtonClickListener(theController, "5"));
Button6.addActionListener(new ButtonClickListener(theController, "6"));
Button7.addActionListener(new ButtonClickListener(theController, "7"));
Button8.addActionListener(new ButtonClickListener(theController, "8"));
Button9.addActionListener(new ButtonClickListener(theController, "9"));
ButtonStar.addActionListener(new ButtonClickListener(theController, "*"));
ButtonPound.addActionListener(new ButtonClickListener(theController, "#"));
ButtonPhone.addActionListener(new ButtonClickListener(theController, "phone"));
ButtonAction.addActionListener(new ButtonClickListener(theController, "action"));
}
@Override
public void UpdateText(String newText) {
textScreen.setText(newText);
}
@Override
public void UpdateKeyboard(KeyboardType type) {
CardLayout layout = (CardLayout) panelKeyboard.getLayout();
switch(type){
case HIDDEN:
layout.show(panelKeyboard, HIDDEN_PANEL);
break;
case DIALING:
ButtonPhone.setBackground(phoneButtonGreen);
layout.show(panelKeyboard, NUM_PANEL);
break;
case CALLING:
ButtonPhone.setBackground(phoneButtonRed);
layout.show(panelKeyboard, NUM_PANEL);
break;
case QWERTY:
layout.show(panelKeyboard, QWERTY_PANEL);
break;
}
}
}
| [
"simon.mueller@st.oth-regensburg.de"
] | simon.mueller@st.oth-regensburg.de |
8b317e63beedafc3e5bd6c97f08d30c201843baa | 7e41614c9e3ddf095e57ae55ae3a84e2bdcc2844 | /development/workspace(helios)/metamodel/src/com/gentleware/poseidon/model/wrapper/WrappedVariable.java | 428092930cfb7b17c0be56bf12a9022fee87aa89 | [] | no_license | ygarba/mde4wsn | 4aaba2fe410563f291312ffeb40837041fb143ff | a05188b316cc05923bf9dee9acdde15534a4961a | refs/heads/master | 2021-08-14T09:52:35.948868 | 2017-11-15T08:02:31 | 2017-11-15T08:02:31 | 109,995,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | // DO NOT MODIFY THIS FILE! This code is generated.
package com.gentleware.poseidon.model.wrapper;
import com.gentleware.poseidon.dsl.MetamodelElementWrapper;
import com.gentleware.poseidon.dsl.wsn.Variable;
public interface WrappedVariable extends Variable, MetamodelElementWrapper {
}
| [
"ygarba@gmail.com"
] | ygarba@gmail.com |
d0f8618c653bba9cbbc53ea542ee5340d0e0fb75 | c54c08394c2a5f63a464a74bde73c4a564028b98 | /WorkSpace/JavaTutorial/src/JavaString.java | dd8c7c14e400abcdab509ca55c60c4d2bc62d6ba | [] | no_license | rabdhir/automation | c686d7c60a874da1f12782b1d36c398134b2af48 | f66e0ab7051e218c3762db5e5fa5680255d703ec | refs/heads/master | 2021-01-18T02:21:43.913727 | 2016-11-27T21:55:28 | 2016-11-27T21:55:28 | 68,474,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,131 | java |
public class JavaString {
public static void main(String[] args) {
int numDays = numOfDays(2000, 2);
System.out.println("Number of days in a given year and days are " + numDays);
}
static int numOfDays(int year, int month) {
int numDays = 0;
switch(month) {
case 1:
numDays = 31;
break;
case 2:
if (year % 400 == 0) {
numDays = 29;
}
else {
numDays = 28;
}
case 3:
numDays = 31;
break;
case 4:
numDays = 30;
break;
case 5:
numDays = 31;
break;
case 6:
numDays = 30;
break;
case 7:
numDays = 31;
break;
case 8:
numDays = 31;
break;
case 9:
numDays = 31;
break;
case 10:
numDays = 31;
break;
case 11:
numDays = 30;
break;
case 12:
numDays = 31;
break;
case 13:
numDays = 31;
break;
case 14:
numDays = 31;
break;
case 15:
numDays = 31;
break;
case 16:
numDays = 31;
break;
case 17:
numDays = 31;
break;
case 18:
numDays = 31;
break;
case 19:
numDays = 31;
break;
default:
System.out.println("Invalid month");
}
return numDays;
}
}
| [
"rahmat.abdhir@gmail.com"
] | rahmat.abdhir@gmail.com |
68b056ce5767d2c2fc884ecc670b44d231a347f8 | 18bda8c95b4408e533bc5d64344010e28ea5f4fb | /src/main/java/com/bspdev/workshopmongo/repositories/PostRepository.java | 4b4a1983a0c1de8e566c72944a4b3d586d3406bd | [] | no_license | brunosp1024/worksho-spring-boot-mongodb | c05626479b148936ad8dd73da0f20f4aaf9559d9 | 4d92412ea0eec6b063f6d9508887f42fbd33e841 | refs/heads/master | 2023-01-18T15:06:58.894356 | 2020-11-21T06:23:28 | 2020-11-21T06:23:28 | 314,389,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.bspdev.workshopmongo.repositories;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import com.bspdev.workshopmongo.domain.Post;
import com.bspdev.workshopmongo.domain.User;
@Repository
public interface PostRepository extends MongoRepository<Post, String> {
}
| [
"brunosalvador145@gmail.com"
] | brunosalvador145@gmail.com |
fb7184d218bafeacdfb09e051b5a893f67bea174 | a4314bfaffbcf8ca3f20b39d2e8d55d7c56ecf77 | /dmuser/src/main/java/com/example/dmuser/model/LoginModel.java | da320616bad1bf034615067a601c5dc6fcd5123a | [] | no_license | wrrgit/DomeUtlis | 1959dd4cbfbc967e81aecd336719b4655108b7ff | 7b9f8ba961ea1673f971147efd2917dacef70882 | refs/heads/master | 2021-09-28T17:03:41.870425 | 2017-12-11T09:46:08 | 2017-12-11T09:46:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | package com.example.dmuser.model;
public class LoginModel {
/**
* randomStr : fb0-b195bdf7471a
* encToken : mHkiLgm0jbDPxLw8aZhhMN6Pfvhys2dBNQr8WF9Ja/w=
* user : {"id":63,"userName":"100100"}
*/
private String randomStr;
private String encToken;
private UserVo user;
public String getRandomStr() {
return randomStr;
}
public void setRandomStr(String randomStr) {
this.randomStr = randomStr;
}
public String getEncToken() {
return encToken;
}
public void setEncToken(String encToken) {
this.encToken = encToken;
}
public UserVo getUser() {
return user;
}
public void setUserVo(UserVo user) {
this.user = user;
}
}
| [
"597471205@qq.com"
] | 597471205@qq.com |
a52c6a6e69f122ba9665ca8c0406a38debebf78e | 0a6a832a563db9bc00ecc7f02ae6e3ac83ca70f9 | /Stanislav_Bondar_spring/src/main/java/web/login/LoginServlet.java | 35cb0a4b51ca22b2dd1fa0544986480bacc44bd5 | [] | no_license | sergiifedotov/OOP | bfba5d6d216825922fc16cdc9bf7c772f084e543 | 0b5a65dd531f1f11ef961bf83b2ecff9f8281e54 | refs/heads/master | 2016-09-06T19:05:24.644211 | 2015-03-21T16:01:27 | 2015-03-21T16:01:27 | 32,653,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | package web.login;
/**
* Created by stan on 15.03.15.
*/
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LoginServlet extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String uname= request.getParameter("username");
String psw= request.getParameter("password");
if(uname.equals("petiaPiyatochkin") && psw.equals("petiaPiyatochkin "))
{
out.println("You have successfully logged in");
}
else
out.println("either user name or password is invalid");
}
} | [
"berkut236466@gmail.com"
] | berkut236466@gmail.com |
8a6e3d6085b55d20215bb8dc0b217591b62284d1 | 3a76738e87b9620dab69da33a04b1e448448dbfd | /src/com/kosta/controller4/InitParamServlet.java | 25965653f3948054d404fcf9a65737f7fa328274 | [] | no_license | KwonOhTae/WebShop | a1f4d1e94d467d52201ff2ed1ca401f6b94af275 | bfb5da0dc9633f230a0676dbb37a1ac78d0fc717 | refs/heads/master | 2023-08-20T18:28:47.532494 | 2021-10-27T00:26:53 | 2021-10-27T00:26:53 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,428 | java | package com.kosta.controller4;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/InitParamServlet")
public class InitParamServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext app = getServletContext();
String driver = app.getInitParameter("driver");
String userid = app.getInitParameter("userid");
String userpass = app.getInitParameter("userpass");
System.out.println(driver);
System.out.println(userid);
System.out.println(userpass);
//ÆÄÀÏÀбâ
InputStream is = app.getResourceAsStream("/WEB-INF/dbinfo.properties");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String str;
while((str = br.readLine())!=null) {
System.out.println(str);
}
br.close();
is.close();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"quite84@gmail.com"
] | quite84@gmail.com |
5fb6aa9ff1059dee3f41a2835eb523584e0f14c8 | e2b70f33e6745a143edb849de9499965c273cb55 | /src/main/java/customer/service/CustomerService.java | aef7f8367551b2592d7642df06d3ae28dbb759a9 | [] | no_license | VadimNastoyashchy/Customer | bebf7ada2d192b39ddbd1b01320150ee223c3d47 | a697a52a4fa0b064b423e0c89682dedd8a6e9bc8 | refs/heads/master | 2022-12-05T17:48:26.552922 | 2020-08-25T12:34:39 | 2020-08-25T12:34:39 | 289,983,097 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package customer.service;
import customer.model.Customer;
import java.util.List;
/**
* @author Vadym Nastoiashchyi
*/
public interface CustomerService {
Customer getById(Long id);
void save(Customer customer);
void delete(Long id);
List<Customer> getAll();
}
| [
"vadim.89@ukr.net"
] | vadim.89@ukr.net |
e27ead404a406ff5f0457b15c0ed0bfdfee4cde0 | 376b72aec4d934fa568174846444c4ae5d19391b | /src/java/Servlet/AgregarImagenRestauranteServlet.java | 0f052915b9320ec80391d59863cd696e8e03c38a | [] | no_license | MarioHerrera06/Come-y-me-cuentas | 6ed69807584599ca09ed70d6e33346300252d655 | 5d7dd6d42015354e9dd8edc0d947a09a40bc2a72 | refs/heads/master | 2021-01-23T06:15:30.397420 | 2017-05-15T01:11:04 | 2017-05-15T01:11:04 | 86,348,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,696 | java | package Servlet;
import BaseDeDatos.Conexion;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
@WebServlet(urlPatterns = {"/AgregarImagenRestauranteServlet"})
public class AgregarImagenRestauranteServlet extends HttpServlet {
private ServletFileUpload ServletFileUpload;
private DiskFileItemFactory DiskFileItemFactory ;
private List<FileItem> listaItems;
public String imgUrl;
Conexion conexion = new Conexion();
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
RequestDispatcher dispacher = request.getRequestDispatcher("restaurantesNuevos.jsp");
dispacher.forward(request, response);
}
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
DiskFileItemFactory= new DiskFileItemFactory();
ServletFileUpload = new ServletFileUpload(DiskFileItemFactory);
try{
listaItems=ServletFileUpload.parseRequest(request);
}catch(FileUploadException ex){
System.out.println("error 1");
}
System.out.println(":)");
for(int i=0;i<listaItems.size();i++){
FileItem item = (FileItem)listaItems.get(i);
if(!item.isFormField()){
imgUrl="C:\\Users\\LauraValentina\\Videos\\Nuevas\\Come-y-me-cuentas\\web\\img\\"+item.getName();
File file = new File(imgUrl);
try{
item.write(file);
}catch(Exception ex){
System.out.println("error 2");
}
}
AgregarRestauranteServlet.restaurante.setImagen(item.getName());
conexion.agregarRestaurante(AgregarRestauranteServlet.restaurante);
processRequest(request, response);
}
}
@Override
public String getServletInfo() {
return "Short description";
}
}
| [
"vale.lindarte@gmail.com"
] | vale.lindarte@gmail.com |
10bdf543a4583ea8a13645c21ce20fa7bdf558a2 | 458843e7487052afeda60e6c0346db6146ccd710 | /JavaCurrent/GenericsChallenge/src/zeus/jim/League.java | b4eae452bdc681b00047e018f8dbb2dc99075dbd | [] | no_license | jimenez994/Java | 88f8cb53b6b48d39559e99e80b29dc37d1fe5961 | 257d3fed5ec5a4102305c22a87515f7523a07a52 | refs/heads/master | 2023-01-28T04:48:24.626515 | 2020-03-16T23:57:31 | 2020-03-16T23:57:31 | 116,172,487 | 2 | 0 | null | 2023-01-25T03:43:38 | 2018-01-03T19:12:24 | HTML | UTF-8 | Java | false | false | 914 | java | package zeus.jim;
import java.util.ArrayList;
import java.util.Collections;
public class League< T extends Team> {
private String name;
private ArrayList<T> league = new ArrayList<>();
public League(String name) {
this.name = name;
}
public String getName() {
return name;
}
public ArrayList<T> getLeague() {
return league;
}
public boolean add(T team){
if(league.contains(team)){
System.out.println("Team is already in league");
return false;
}else{
league.add(team);
System.out.println("Add to league");
return true;
}
}
public void showLeague(){
System.out.println(league.size());
Collections.sort(league);
for (T team: league){
System.out.println(team.getName() + " : " + team.ranking());
}
}
}
| [
"j.jimenez.994@hotmail.com"
] | j.jimenez.994@hotmail.com |
3f2861cdfabb65368887025a28d3a45758811349 | 04d34ea1b6a3c13f9923740c402ef988e1efa603 | /app/src/main/java/com/app/microyang/utils/RetrofitHelper.java | 7197ce94155801c8860b20c586d910db0a530993 | [
"Apache-2.0"
] | permissive | ZRaymonds/MicroYang | 671023744dec015a6e20255d3e50ebfb6350864b | 3681f654af2ed47012b06db628eb8c1d836487f2 | refs/heads/master | 2020-04-07T15:13:52.418271 | 2018-12-18T06:51:50 | 2018-12-18T06:51:50 | 158,476,683 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,973 | java | package com.app.microyang.utils;
import com.app.microyang.network.Api;
import com.app.microyang.network.ServerApi;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitHelper {
private static OkHttpClient client;
private static ServerApi serverApi;
static {
getClient();
}
public static OkHttpClient getClient() {
if (client == null) {
synchronized (OkHttpClient.class) {
if (client == null) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.getLevel();
client = new OkHttpClient.Builder()
.addInterceptor(logging)
.build();
}
}
}
return client;
}
public static ServerApi getServerApi() {
if (serverApi == null) {
synchronized (ServerApi.class) {
if (serverApi == null) {
serverApi = onCreate(ServerApi.class, Api.HOST);
}
}
}
return serverApi;
}
public static ServerApi getServerNews() {
if (serverApi == null) {
synchronized (ServerApi.class) {
if (serverApi == null) {
serverApi = onCreate(ServerApi.class, Api.NEWSHOST);
}
}
}
return serverApi;
}
public static <T> T onCreate(Class<T> tClass, String url) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(url)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
return retrofit.create(tClass);
}
}
| [
"1719763402@qq.com"
] | 1719763402@qq.com |
42888f8685590f4a10a0cec0043c1ab3d3f13967 | 196d7983e2920f05a16cf80d10101351c336ffcf | /Java/pacman-randori/src/main/java/main/GhostFactory.java | 86e04c9bf5508eae1d0ad1648824fc450c5a614b | [] | no_license | grzesiek-galezowski/TrainingExamples | 86456f449b8f50d1576077224f824aaf0b49d640 | 18bdd737816e20c1f2eb442fca52aacf9b64a07e | refs/heads/master | 2023-07-20T09:42:25.432066 | 2023-07-08T17:30:54 | 2023-07-08T17:30:54 | 26,960,459 | 13 | 7 | null | 2023-07-08T17:30:56 | 2014-11-21T13:08:26 | C# | UTF-8 | Java | false | false | 265 | java | package main;
import interfaces.GhostStates;
import other.AnimatedGhost;
/**
* Created by astral on 12.11.2015.
*/
public class GhostFactory {
public static Ghost createGhost(GhostStates states) {
return new AnimatedGhost(states.chasing());
}
}
| [
"grzesiek.galezowski@gmail.com"
] | grzesiek.galezowski@gmail.com |
340864014eb803d3922f34eab28f9d1b9dde6f2a | 159a33213bfb16d89d6e8aae8bd11ffe783cc605 | /src/tst/project/webservice/interfaces/SSPInterfaces.java | 555cce2bfc6a8f2b60745596c820896e401664bd | [] | no_license | sw0928/word | 999a4bdc321775dcd96c7a9e62482b093dfb1025 | 4a572c3aedf111f3b9cc42f1a483a5ab74b54aca | refs/heads/master | 2021-01-06T20:44:19.839442 | 2017-08-08T10:13:41 | 2017-08-08T10:13:41 | 99,550,516 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,209 | java | package tst.project.webservice.interfaces;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import tst.project.bean.goods.GoodsBean;
import tst.project.bean.goods.SSPClassBean;
import tst.project.page.PageBean;
import tst.project.service.interfaces.GoodsServiceI;
import tst.project.webservice.controller.BaseController;
/**
* 顺手拍特有的接口
* @author shenjiabo
*
*/
@Controller
@RequestMapping("/sspInterfaces.api")
public class SSPInterfaces extends BaseController{
@Resource
GoodsServiceI goodsServiceI;
/**
* 所有商品
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getAllGoods", method = RequestMethod.POST)
public void getAllGoods(GoodsBean goodsBean,PageBean pageBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getAllGoods(goodsBean,pageBean));
}
/**
* 促销
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getSSPGoodsClass", method = RequestMethod.POST)
public void getSSPGoodsClass(SSPClassBean sspClassBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getSSPGoodsClass(sspClassBean));
}
/**
* 促销
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getPromotionGoods", method = RequestMethod.POST)
public void getPromotionGoods(GoodsBean goodsBean,PageBean pageBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getPromotionGoods(goodsBean,pageBean));
}
/**
* 礼品
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getGiftGoods", method = RequestMethod.POST)
public void getGiftGoods(GoodsBean goodsBean,PageBean pageBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getGiftGoods(goodsBean,pageBean));
}
/**
* 生鲜
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getFreshGoods", method = RequestMethod.POST)
public void getFreshGoods(GoodsBean goodsBean,PageBean pageBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getFreshGoods(goodsBean,pageBean));
}
/**
* 母婴
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getBabyGoods", method = RequestMethod.POST)
public void getBabyGoods(GoodsBean goodsBean,PageBean pageBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getBabyGoods(goodsBean,pageBean));
}
/**
* 女士
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getLadyGoods", method = RequestMethod.POST)
public void getLadyGoods(GoodsBean goodsBean,PageBean pageBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getLadyGoods(goodsBean,pageBean));
}
/**
* 特色
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getFeatureGoods", method = RequestMethod.POST)
public void getFeatureGoods(GoodsBean goodsBean,PageBean pageBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getFeatureGoods(goodsBean,pageBean));
}
/**
* 进口
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(params = "getImportGoods", method = RequestMethod.POST)
public void getImportGoods(GoodsBean goodsBean,PageBean pageBean,HttpServletRequest request,
HttpServletResponse response) throws Exception{
WriteObject(response, goodsServiceI.getImportGoods(goodsBean,pageBean));
}
}
| [
"shiwei@163.com"
] | shiwei@163.com |
771b3e4b5449de738e17ce46576de5449758cd56 | 4f480d509ed8b6a29052b7dfdeebaa82450643e2 | /onlinebookstore/src/register/registerServlet.java | 06445239e248d1dc926b8524d0b1a53c91bdcd45 | [] | no_license | YangwoJian/javaweb_bookstore | 776538ee0789a5957a9ab96cc5a35d8562118ba0 | a71461faa6c8c6d0c8994fbfaed103e09d26bfac | refs/heads/master | 2021-06-19T16:41:47.585992 | 2017-07-15T12:50:44 | 2017-07-15T12:50:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,554 | java | package register;
import java.io.IOException;
import java.sql.ResultSet;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dao.dao;
public class registerServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
String toJSP = "";
String id = request.getParameter("id");
String pwd1 = request.getParameter("pwd1");
String name = request.getParameter("name");
String sex = request.getParameter("sex");
String phone = request.getParameter("phone");
String sql = "insert into user(id,pwd1,name,sex,phone) values('" + id + "','" + pwd1+
"','" + name + "','" + sex + "','" + phone + "')";
if(isExist(id)) {
toJSP = "user/register/iderror.jsp";
}
else {
try {
dao.update(sql);
} catch (Exception e) {
}
toJSP = "user/register/registersuccess.jsp";
}
RequestDispatcher rd = request.getRequestDispatcher(toJSP);
rd.forward(request, response);
}
public boolean isExist(String id) {
boolean b = false;
String sql = "select * from user where id = '" + id + "'";
try {
ResultSet rs = dao.query(sql);
if(rs.next()) {
b = true;
}
dao.close(dao.getConn(), dao.getSt(), rs);
}catch(Exception e) {
}
return b;
}
}
| [
"842835821@qq.com"
] | 842835821@qq.com |
fc3eaf1833749a05be70aa329c88e2c671d93354 | ed9561e5737b33c247dc6695cc01435071c4455b | /taotao-manager/taotao-manager-service/src/main/java/com/taotao/service/ItemParamService.java | 9d4729bf62e5e40be163763bbb0dc65ebeababfc | [] | no_license | xiaozefeng/taotao | 0fb559bc163b4793d7030f40811d4d22729da762 | 08e1ca113e8345bc3a7e9ac611770a91532b4d7b | refs/heads/master | 2021-01-21T04:55:34.099954 | 2016-07-16T02:27:27 | 2016-07-16T02:27:27 | 55,882,557 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package com.taotao.service;
import com.taotao.common.pojo.EUDataGridResult;
import com.taotao.common.pojo.TaotaoResult;
public interface ItemParamService {
/***
* 根据商品类目id查询规格参数
* @param cid
* @return
*/
TaotaoResult getItemParamByCid(long cid);
/**
* 查询规格参数列表
* @return
*/
EUDataGridResult getItemParamForPage(int page,int rows);
/**
* 保存规格参数模板
* @param cid
* @param paramData
* @return
*/
TaotaoResult saveItemParam(Long cid, String paramData);
}
| [
"qq523107430@163.com"
] | qq523107430@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.