blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
9ca58a83d2fcd3e6021a685cef9fc794477ab9f1
05d2a1e92090ec35b8be02f4b0fc7ac3695ad2f7
/src/test/java/com/baidu/unbiz/multiengine/transport/DistributedTaskTest.java
29f3bbcf79d323a21f9777516bc682c4a6df5513
[ "Apache-2.0" ]
permissive
lovehoroscoper/multi-engine
e1cec8f80ba9e0482fedd9b9cbbac863420f81e3
8ab36fda46662bf5c5130ec1530286ae756963b6
refs/heads/master
2021-01-11T14:25:39.896985
2017-02-04T03:13:36
2017-02-04T03:13:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,096
java
package com.baidu.unbiz.multiengine.transport; import java.util.List; import java.util.concurrent.CountDownLatch; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.Assert; import com.baidu.unbiz.multiengine.endpoint.HostConf; import com.baidu.unbiz.multiengine.task.TaskCommand; import com.baidu.unbiz.multiengine.transport.client.SendFuture; import com.baidu.unbiz.multiengine.transport.client.TaskClient; import com.baidu.unbiz.multiengine.transport.client.TaskClientFactory; import com.baidu.unbiz.multiengine.transport.server.TaskServer; import com.baidu.unbiz.multiengine.transport.server.TaskServerFactory; import com.baidu.unbiz.multiengine.vo.DeviceViewItem; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "/applicationContext-test.xml") public class DistributedTaskTest { @Test public void testRunDisTask() { HostConf hostConf = new HostConf(); TaskServer taskServer = TaskServerFactory.createTaskServer(hostConf); taskServer.start(); TaskClient taskClient = TaskClientFactory.createTaskClient(hostConf); taskClient.start(); TaskCommand command = new TaskCommand(); command.setTaskBean("deviceStatFetcher"); command.setParams(null); List<DeviceViewItem> result = taskClient.call(command); Assert.notNull(result); System.out.println(result); taskClient.stop(); taskServer.stop(); } @Test public void testAsynRunDisTask() { HostConf hostConf = new HostConf(); TaskServer taskServer = TaskServerFactory.createTaskServer(hostConf); taskServer.start(); TaskClient taskClient = TaskClientFactory.createTaskClient(hostConf); taskClient.start(); TaskCommand command = new TaskCommand(); command.setTaskBean("deviceStatFetcher"); command.setParams(null); SendFuture sendFuture = taskClient.asyncCall(command); List<DeviceViewItem> result = sendFuture.get(); Assert.notNull(result); System.out.println(result); taskClient.stop(); taskServer.stop(); } @Test public void testRunDisTaskByBigData() { HostConf hostConf = new HostConf(); TaskServer taskServer = TaskServerFactory.createTaskServer(hostConf); taskServer.start(); TaskClient taskClient = TaskClientFactory.createTaskClient(hostConf); taskClient.start(); TaskCommand command = new TaskCommand(); command.setTaskBean("deviceBigDataStatFetcher"); command.setParams(null); List<DeviceViewItem> result = taskClient.call(command); Assert.notNull(result); System.out.println(result); taskClient.stop(); taskServer.stop(); } @Test public void testRunDisTasksByBigResult() { HostConf hostConf = new HostConf(); TaskServer taskServer = TaskServerFactory.createTaskServer(hostConf); taskServer.start(); final TaskClient taskClient = TaskClientFactory.createTaskClient(hostConf); taskClient.start(); for (int i = 0; i < 10; i++) { TaskCommand command = new TaskCommand(); command.setTaskBean("deviceBigDataStatFetcher"); command.setParams(null); List<DeviceViewItem> result = taskClient.call(command); Assert.notNull(result); System.out.println(result); } taskClient.stop(); taskServer.stop(); } @Test public void testConcurrentRunDisTask() { HostConf hostConf = new HostConf(); TaskServer taskServer = TaskServerFactory.createTaskServer(hostConf); taskServer.start(); final TaskClient taskClient = TaskClientFactory.createTaskClient(hostConf); taskClient.start(); final CountDownLatch latch = new CountDownLatch(50); for (int i = 0; i < 50; i++) { new Thread() { @Override public void run() { TaskCommand command = new TaskCommand(); command.setTaskBean("deviceBigDataStatFetcher"); command.setParams(null); Object result = taskClient.call(command); Assert.notNull(result); System.out.println(result); latch.countDown(); } }.start(); } try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } taskClient.stop(); taskServer.stop(); } @Test public void testConcurrentRunDisTaskByBigResult() { HostConf hostConf = new HostConf(); TaskServer taskServer = TaskServerFactory.createTaskServer(hostConf); taskServer.start(); final TaskClient taskClient = TaskClientFactory.createTaskClient(hostConf); taskClient.start(); final int loopCnt = 50; final CountDownLatch latch = new CountDownLatch(loopCnt); for (int i = 0; i < loopCnt; i++) { new Thread() { @Override public void run() { TaskCommand command = new TaskCommand(); command.setTaskBean("deviceBigDataStatFetcher"); command.setParams(null); Object result = taskClient.call(command); Assert.notNull(result); System.out.println(result); latch.countDown(); } }.start(); } try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } taskClient.stop(); taskServer.stop(); } @Test public void testRunDisTaskByMultiClient() { HostConf hostConf = new HostConf(); TaskServer taskServer = TaskServerFactory.createTaskServer(hostConf); taskServer.start(); TaskClient taskClient1 = TaskClientFactory.createTaskClient(hostConf); taskClient1.start(); TaskClient taskClient2 = TaskClientFactory.createTaskClient(hostConf); taskClient2.start(); TaskCommand command = new TaskCommand(); command.setTaskBean("deviceStatFetcher"); command.setParams(null); Object result1 = taskClient1.call(command); Object result2 = taskClient2.call(command); for (int i = 0; i < 500; i++) { result1 = taskClient1.call(command); result2 = taskClient2.call(command); Assert.isTrue(result1.toString().equals(result2.toString())); } Assert.notNull(result1); Assert.notNull(result2); System.out.println(result1); System.out.println(result2); taskClient1.stop(); taskClient2.stop(); taskServer.stop(); } }
[ "wangchongjie@baidu.com" ]
wangchongjie@baidu.com
806b551c639506dc56f2860d7d10009c38034de5
27a5c14dc83b3f90ba1262b783d6cc8b01c62dfa
/src/main/java/com/DesignPattern/prototype/prototypeSolution/Client.java
7374ed022454ab32ab3a1bfc613e63db2cd3cf6b
[]
no_license
iadoy/Design-Pattern
5171449d749e26840d02d9129382365a6aa92344
382143a617191d4ec6943316c663bbdb279c83bd
refs/heads/master
2022-12-16T00:34:15.472550
2020-09-08T08:01:34
2020-09-08T08:01:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,879
java
package com.DesignPattern.prototype.prototypeSolution; /** * 原型模式复制对象 */ public class Client { public static void main(String[] args) { //原有的羊 Sheep sheep = new Sheep("lucy", "white"); //复制羊 Sheep sheep1 = sheep.clone(); Sheep sheep2 = sheep.clone(); Sheep sheep3 = sheep.clone(); System.out.println(sheep); System.out.println(sheep1); System.out.println(sheep2); System.out.println(sheep3); //false, 说明使用clone()复制的对象和原来的对象不是同一个 //但这不能说明clone()方法就是深复制, 继续往下看 System.out.println(sheep == sheep1); sheep.setFriend(new Sheep("lilei", "yellow")); Sheep sheep4 = sheep.clone(); //false, 说明使用clone()复制的对象和原来的对象不是同一个 System.out.println(sheep == sheep4); //true, 但是如果成员是引用数据类型, 则这些成员是浅复制 System.out.println(sheep.getFriend() == sheep4.getFriend()); //使用clone()方法实现完全的深复制, 内部的引用数据类型同样需要实现Cloneable接口和重写clone方法 //当类中的引用数据类型比较多时, 写起来就比较麻烦了, 不太推荐使用 Sheep sheep5 = sheep.deepClone(); // sheep5.setFriend(sheep.getFriend().clone()); System.out.println(sheep == sheep5);//false System.out.println(sheep.getFriend() == sheep5.getFriend());//false //使用序列化和反序列化实现深复制 //不管类中的成员如何复杂, 代码都是一样的, 推荐使用 Sheep sheep6 = sheep.serializeClone(); System.out.println(sheep == sheep6);//false System.out.println(sheep.getFriend() == sheep6.getFriend());//false } }
[ "xcw97@outlook.com" ]
xcw97@outlook.com
6351a25a9c65156f37491e4a43f633643287262e
ded702e7cee7d299e2fa5b009999fef48c0cbd35
/piggymetrics/account-service/src/main/java/com/jsd/piggymetrics/accountserver/account/account/controller/ErrorHandler.java
9315608a11cd538dd87f8fbb357147ca380c3c9f
[]
no_license
leiyu19940711/springcloudpiggymetrics
fc04a261a15aa4033e9f279307d5abc5857fc1cc
4a3f7feee429904e10fc2d1613dd589f86734a51
refs/heads/master
2020-05-28T01:25:44.803060
2019-05-27T12:49:36
2019-05-27T12:49:36
188,842,538
0
0
null
null
null
null
UTF-8
Java
false
false
782
java
package com.jsd.piggymetrics.accountserver.account.account.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; @ControllerAdvice public class ErrorHandler { private final Logger log = LoggerFactory.getLogger(getClass()); // TODO add MethodArgumentNotValidException handler // TODO remove such general handler @ExceptionHandler(IllegalArgumentException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public void processValidationError(IllegalArgumentException e) { log.info("Returning HTTP 400 Bad Request", e); } }
[ "171548730@qq.com" ]
171548730@qq.com
56f1c2227dcfdb47c0abc707aa865741d034a186
bc94646980c9196c81b770908414311f71255e5b
/src/main/java/com/elytradev/davincisvessels/common/network/HelmClientAction.java
029191ace62380332bda14e0477b0d5d2f5330f4
[ "Apache-2.0" ]
permissive
jeffreymeng/DavincisVessels
3a653b64449505a8523203e4f4efd3cc9ac93a09
75022af70b11452e6da6337f6aeabbb323cec9d0
refs/heads/1.12
2021-07-04T06:18:52.070957
2018-05-09T18:15:35
2018-05-09T18:15:35
151,132,148
0
0
Apache-2.0
2018-10-01T17:49:41
2018-10-01T17:49:41
null
UTF-8
Java
false
false
857
java
package com.elytradev.davincisvessels.common.network; public enum HelmClientAction { UNKNOWN, ASSEMBLE, MOUNT, UNDOCOMPILE; public static int toInt(HelmClientAction action) { switch (action) { case ASSEMBLE: return (byte) 1; case MOUNT: return (byte) 2; case UNDOCOMPILE: return (byte) 3; default: return (byte) 0; } } public static HelmClientAction fromInt(int actionInt) { switch (actionInt) { case 1: return ASSEMBLE; case 2: return MOUNT; case 3: return UNDOCOMPILE; default: return UNKNOWN; } } public int toInt() { return HelmClientAction.toInt(this); } }
[ "bk1325@gmail.com" ]
bk1325@gmail.com
0effad6aa32721bda71c985e7e216bd3d2a84de4
6106a672418cbfd8322c4e70a05c26d1379182ac
/src/wts-exam/src/main/java/com/wts/exam/controller/PaperController.java
0c0f0dced81fcbd995d80a2605bc74cf915af19e
[]
no_license
ljb2546313415/OnlineExamWTC
9adbd9e566fe6e3aead32019405764fd4891148b
b6181e41788ee265dbcca17915523e6137ac3f29
refs/heads/master
2023-03-27T06:28:01.394276
2021-03-24T10:02:11
2021-03-24T10:02:11
351,016,343
0
0
null
null
null
null
UTF-8
Java
false
false
18,935
java
package com.wts.exam.controller; import com.wts.exam.domain.ExamType; import com.wts.exam.domain.Paper; import com.wts.exam.domain.RandomStep; import com.wts.exam.domain.ex.WtsPaperBean; import com.wts.exam.domain.ex.PaperUnit; import com.wts.exam.service.ExamTypeServiceInter; import com.wts.exam.service.PaperServiceInter; import com.wts.exam.service.RandomItemServiceInter; import com.wts.exam.service.SubjectTypeServiceInter; import com.wts.exam.utils.WtsPaperBeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.annotation.Resource; import com.farm.web.easyui.EasyUiUtils; import com.farm.web.log.WcpLog; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import javax.servlet.http.HttpSession; import com.farm.core.page.RequestMode; import com.farm.core.page.OperateType; import com.farm.core.sql.query.DBRule; import com.farm.core.sql.query.DataQuery; import com.farm.core.sql.query.DataQuerys; import com.farm.core.sql.result.DataResult; import com.farm.core.time.TimeTool; import com.farm.doc.server.utils.FileDownloadUtils; import com.farm.parameter.service.AloneApplogServiceInter; import com.farm.core.page.ViewMode; import com.farm.web.WebUtils; /* * *功能:考卷控制层 *详细: * *版本:v0.1 *作者:FarmCode代码工程 *日期:20150707114057 *说明: */ @RequestMapping("/paper") @Controller public class PaperController extends WebUtils { private final static Logger log = Logger.getLogger(PaperController.class); @Resource private PaperServiceInter paperServiceImpl; @Resource private ExamTypeServiceInter examTypeServiceImpl; @Resource private AloneApplogServiceInter aloneApplogServiceImpl; @Resource private RandomItemServiceInter randomItemServiceImpl; @Resource private SubjectTypeServiceInter subjectTypeServiceImpl; /** * 查询结果集合 * * @return */ @RequestMapping("/query") @ResponseBody public Map<String, Object> queryall(DataQuery query, HttpServletRequest request, HttpSession session) { try { if (StringUtils.isNotBlank(query.getRule("B.TREECODE")) && query.getRule("B.TREECODE").equals("NONE")) { query.getAndRemoveRule("B.TREECODE"); } query = EasyUiUtils.formatGridQuery(request, query); { // 过滤权限 String typeids_Rule = DataQuerys .parseSqlValues(examTypeServiceImpl.getUserPopTypeids(getCurrentUser(session).getId(), "1")); if (typeids_Rule != null) { query.addSqlRule(" and b.id in (" + typeids_Rule + ")"); } else { query.addSqlRule(" and b.id ='NONE'"); } } DataResult result = paperServiceImpl.createPaperSimpleQuery(query).search(); result.runDictionary("1:新建,0:停用,2:发布", "PSTATE"); result.runformatTime("CTIME", "yyyy-MM-dd HH:mm"); return ViewMode.getInstance().putAttrs(EasyUiUtils.formatGridData(result)).returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } /** * 查询结果集合(考场选择试卷) * * @return */ @RequestMapping("/chooseQuery") @ResponseBody public Map<String, Object> chooseQuery(DataQuery query, HttpServletRequest request, HttpSession session) { try { if (StringUtils.isNotBlank(query.getRule("B.TREECODE")) && query.getRule("B.TREECODE").equals("NONE")) { query.getAndRemoveRule("B.TREECODE"); } query = EasyUiUtils.formatGridQuery(request, query); query.addRule(new DBRule("a.PSTATE", "2", "=")); { // 过滤权限 String typeids_Rule = DataQuerys .parseSqlValues(examTypeServiceImpl.getUserPopTypeids(getCurrentUser(session).getId(), "1")); if (typeids_Rule != null) { query.addSqlRule(" and b.id in (" + typeids_Rule + ")"); } } DataResult result = paperServiceImpl.createPaperSimpleQuery(query).search(); result.runDictionary("1:新建,0:停用,2:发布", "PSTATE"); result.runformatTime("CTIME", "yyyy-MM-dd HH:mm"); return ViewMode.getInstance().putAttrs(EasyUiUtils.formatGridData(result)).returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } /** * 提交修改数据 * * @return */ @RequestMapping("/edit") @ResponseBody public Map<String, Object> editSubmit(Paper entity, HttpSession session) { try { WcpLog.info("修改答卷[" + entity.getId() + "]:表单提交", getCurrentUser(session).getName(), getCurrentUser(session).getId()); entity = paperServiceImpl.editPaperEntity(entity, getCurrentUser(session)); return ViewMode.getInstance().setOperate(OperateType.UPDATE).putAttr("entity", entity).returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setOperate(OperateType.UPDATE).setError(e.getMessage(), e).returnObjMode(); } } /** * 下载word答卷 * * @return */ @RequestMapping("/exportWord") public void exportWord(String paperid, HttpServletRequest request, HttpServletResponse response, HttpSession session) { PaperUnit paper = paperServiceImpl.getPaperUnit(paperid); WcpLog.info("导出WORD答卷" + paperid + "/" + paper.getInfo().getName(), getCurrentUser(session).getName(), getCurrentUser(session).getId()); log.info(getCurrentUser(session).getLoginname() + "/" + getCurrentUser(session).getName() + "导出答卷" + paperid); File file = paperServiceImpl.exprotWord(paper, getCurrentUser(session)); FileDownloadUtils.simpleDownloadFile(file, "paper" + TimeTool.getTimeDate12() + ".docx", "application/octet-stream", response); } /** * 下载Json答卷 * * @return * @throws IOException */ @RequestMapping("/exportWtsp") public void exportWtsp(String paperid, HttpServletRequest request, HttpServletResponse response, HttpSession session) throws IOException { WcpLog.info("导出JSON.wtsp答卷" + paperid, getCurrentUser(session).getName(), getCurrentUser(session).getId()); log.info(getCurrentUser(session).getLoginname() + "/" + getCurrentUser(session).getName() + "导出答卷" + paperid); File file = paperServiceImpl.exprotWtsp(paperid, getCurrentUser(session)); FileDownloadUtils.simpleDownloadFile(file, "paper" + paperid + ".wtsp", "application/octet-stream", response); } /** * 进入随机出题界面 * * @return */ @RequestMapping("/addRandomSubjects") public ModelAndView addRandomSubjects(String paperids, HttpSession session) { try { List<Paper> papers = new ArrayList<>(); for (String id : parseIds(paperids)) { Paper paper = paperServiceImpl.getPaperEntity(id); if (paper != null) { papers.add(paper); } } return ViewMode.getInstance().putAttr("papers", papers).putAttr("paperids", paperids) .returnModelAndView("exam/PaperRandomSubjectsForm"); } catch (Exception e) { return ViewMode.getInstance().setError(e + e.getMessage(), e) .returnModelAndView("exam/PaperRandomSubjectsForm"); } } /** * 提交新增数据 * * @return */ @RequestMapping("/add") @ResponseBody public Map<String, Object> addSubmit(Paper entity, HttpSession session) { try { entity = paperServiceImpl.insertPaperEntity(entity, getCurrentUser(session)); WcpLog.info("创建答卷[" + entity.getId() + "]:表单创建", getCurrentUser(session).getName(), getCurrentUser(session).getId()); return ViewMode.getInstance().setOperate(OperateType.ADD).putAttr("entity", entity).returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setOperate(OperateType.ADD).setError(e.getMessage(), e).returnObjMode(); } } /** * 删除数据 * * @return */ @RequestMapping("/del") @ResponseBody public Map<String, Object> delSubmit(String ids, HttpSession session) { try { for (String id : parseIds(ids)) { WcpLog.info("刪除答卷[" + id + "]:表单刪除", getCurrentUser(session).getName(), getCurrentUser(session).getId()); paperServiceImpl.deletePaperEntity(id, getCurrentUser(session)); } return ViewMode.getInstance().returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } /** * 批量加载答卷信息 * * @return */ @RequestMapping("/loadPapersInfo") @ResponseBody public Map<String, Object> loadPapersInfo(String ids, HttpSession session) { try { List<PaperUnit> paperunits = new ArrayList<>(); for (String id : parseIds(ids)) { paperunits.add(paperServiceImpl.getPaperUnit(id)); } return ViewMode.getInstance().putAttr("papers", paperunits).returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } /** * 添加随机题到答卷中 * * @return */ @RequestMapping("/doAddRandomSubjects") @ResponseBody public Map<String, Object> doAddRandomSubjects(String ids, String typeid, String tiptype, Integer subnum, Integer point, HttpSession session) { try { String warn = ""; for (String paperid : parseIds(ids)) { warn = warn + paperServiceImpl.addRandomSubjects(paperid, typeid, tiptype, subnum, point, getCurrentUser(session)); paperServiceImpl.refreshSubjectNum(paperid); WcpLog.info("修改答卷[" + paperid + "]:添加随机题", getCurrentUser(session).getName(), getCurrentUser(session).getId()); } return ViewMode.getInstance().putAttr("warn", warn).returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } @RequestMapping("/doClearSubjects") @ResponseBody public Map<String, Object> doClearSubjects(String ids, HttpSession session) { try { String warn = ""; for (String paperid : parseIds(ids)) { WcpLog.info("修改答卷[" + paperid + "]:清空答卷所有题目", getCurrentUser(session).getName(), getCurrentUser(session).getId()); paperServiceImpl.clearPaper(paperid); paperServiceImpl.refreshSubjectNum(paperid); } return ViewMode.getInstance().putAttr("warn", warn).returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } /** * 进入 批量创建随机卷表单 * * @return */ @RequestMapping("/addRandomsPage") public ModelAndView addRandomsPage(String typeid, HttpSession session) { try { if (typeid == null || typeid.trim().equals("")) { throw new RuntimeException("业务分类不能为空!"); } ExamType type = examTypeServiceImpl.getExamtypeEntity(typeid); // 獲取隨機規則項 List<Map<String, Object>> items = randomItemServiceImpl .createRandomitemSimpleQuery( (new DataQuery()).setPagesize(100).addRule(new DBRule("PSTATE", "1", "="))) .search().getResultList(); return ViewMode.getInstance().putAttr("type", type).putAttr("items", items) .returnModelAndView("exam/PaperRandomsForm"); } catch (Exception e) { return ViewMode.getInstance().setError(e + e.getMessage(), e).returnModelAndView("exam/PaperRandomsForm"); } } /** * 執行批量随机卷生成 * * @param ids * @param session * @return */ @RequestMapping("/runRandomPapers") @ResponseBody public Map<String, Object> runRandomPapers(Paper entity, int num, String itemid, HttpSession session) { try { List<RandomStep> steps = randomItemServiceImpl.getSteps(itemid); if (StringUtils.isBlank(entity.getExamtypeid())) { throw new RuntimeException("业务分类ID不能为空!"); } String name = entity.getName(); for (int n = 0; n < num; n++) { try { entity.setPstate("1"); entity.setName(name + "-" + (n + 1)); entity = paperServiceImpl.insertPaperEntity(entity, getCurrentUser(session)); WcpLog.info("创建答卷[" + entity.getId() + "]:创建随机答卷[规则ITEMID" + itemid + "]", getCurrentUser(session).getName(), getCurrentUser(session).getId()); for (RandomStep step : steps) { String warnMessage = paperServiceImpl.addRandomSubjects(entity.getId(), step.getTypeid(), step.getTiptype(), step.getSubnum(), step.getSubpoint(), getCurrentUser(session)); if (StringUtils.isNotBlank(warnMessage)) { throw new RuntimeException(warnMessage); } } paperServiceImpl.refreshSubjectNum(entity.getId()); } catch (Exception e) { paperServiceImpl.deletePaperEntity(entity.getId(), getCurrentUser(session)); throw new RuntimeException(e); } } return ViewMode.getInstance().returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } @RequestMapping("/list") public ModelAndView index(HttpSession session) { return ViewMode.getInstance().returnModelAndView("exam/PaperResult"); } @RequestMapping("/view") public ModelAndView view(String paperId, HttpSession session) { PaperUnit paper = paperServiceImpl.getPaperUnit(paperId); return ViewMode.getInstance().putAttr("paper", paper).returnModelAndView("exam/PaperView"); } @RequestMapping("/chooselist") public ModelAndView chooselist(HttpSession session) { return ViewMode.getInstance().returnModelAndView("exam/PaperChooseResult"); } /** * 显示详细信息(修改或浏览时) * * @return */ @RequestMapping("/form") public ModelAndView view(RequestMode pageset, String ids) { try { ExamType examtype = null; Paper paper = null; if (StringUtils.isNotBlank(ids)) { paper = paperServiceImpl.getPaperEntity(ids); if (StringUtils.isNotBlank(paper.getExamtypeid())) { examtype = examTypeServiceImpl.getExamtypeEntity(paper.getExamtypeid()); } } switch (pageset.getOperateType()) { case (0): {// 查看 return ViewMode.getInstance().putAttr("pageset", pageset).putAttr("examType", examtype) .putAttr("entity", paper).returnModelAndView("exam/PaperForm"); } case (1): {// 新增 return ViewMode.getInstance().putAttr("pageset", pageset).returnModelAndView("exam/PaperForm"); } case (2): {// 修改 return ViewMode.getInstance().putAttr("pageset", pageset).putAttr("examType", examtype) .putAttr("entity", paper).returnModelAndView("exam/PaperForm"); } default: break; } return ViewMode.getInstance().returnModelAndView("exam/PaperForm"); } catch (Exception e) { return ViewMode.getInstance().setError(e + e.getMessage(), e).returnModelAndView("exam/PaperForm"); } } /** * 考试禁用 * * @return */ @RequestMapping("/examPrivate") @ResponseBody public Map<String, Object> examPrivate(String ids, HttpSession session) { try { for (String id : parseIds(ids)) { WcpLog.info("答卷状态变更[" + id + "]:禁用", getCurrentUser(session).getName(), getCurrentUser(session).getId()); paperServiceImpl.editState(id, "0", getCurrentUser(session)); } return ViewMode.getInstance().returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } /** * 考试发布 * * @return */ @RequestMapping("/examPublic") @ResponseBody public Map<String, Object> examPublic(String ids, HttpSession session) { try { for (String id : parseIds(ids)) { WcpLog.info("答卷状态变更[" + id + "]:发布", getCurrentUser(session).getName(), getCurrentUser(session).getId()); paperServiceImpl.editState(id, "2", getCurrentUser(session)); } return ViewMode.getInstance().returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } /** * 设置考试分类 * * @return */ @RequestMapping("/examtypeSetting") @ResponseBody public Map<String, Object> examtypeSetting(String ids, String examtypeId, HttpSession session) { try { for (String id : parseIds(ids)) { WcpLog.info("修改答卷[" + id + "]:修改分类", getCurrentUser(session).getName(), getCurrentUser(session).getId()); paperServiceImpl.examTypeSetting(id, examtypeId, getCurrentUser(session)); } return ViewMode.getInstance().returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } /** * 到达人员导入页面 * * @return ModelAndView */ @RequestMapping("/toWtspImport") public ModelAndView toUserImport() { try { return ViewMode.getInstance().returnModelAndView("exam/PaperWtspImport"); } catch (Exception e) { log.error(e.getMessage(), e); return ViewMode.getInstance().setError(e.getMessage(), e).returnModelAndView("exam/PaperWtspImport"); } } /** * 完成wtsp导入 * * @return Map<String,Object> */ @RequestMapping("/doWtspImport") @ResponseBody public Map<String, Object> doUserImport(@RequestParam(value = "file", required = false) MultipartFile file, String examType, String subjectType, HttpSession session) { try { if (examTypeServiceImpl.getExamtypeEntity(examType) == null || subjectTypeServiceImpl.getSubjecttypeEntity(subjectType) == null) { throw new RuntimeException("请选择有效的业务分类和题库分类 !"); } // 校验数据有效性 CommonsMultipartFile cmfile = (CommonsMultipartFile) file; if (cmfile.getSize() >= 10000000) { throw new RuntimeException("文件不能大于10M"); } if (cmfile.isEmpty()) { throw new RuntimeException("请上传有效文件!"); } InputStream is = cmfile.getInputStream(); try { WtsPaperBean bean = WtsPaperBeanUtils.readFromFile(is); String paperid = paperServiceImpl.importByWtsPaperBean(bean, examType, subjectType, getCurrentUser(session)); WcpLog.info("创建答卷[" + paperid + "]:wtsp文件导入", getCurrentUser(session).getName(), getCurrentUser(session).getId()); } finally { is.close(); } return ViewMode.getInstance().returnObjMode(); } catch (Exception e) { log.error(e.getMessage(), e); return ViewMode.getInstance().setError(e.getMessage(), e).returnObjMode(); } } }
[ "lijianbin1024@qq.com" ]
lijianbin1024@qq.com
7c7e651e42130b6ed75fee2bac378a17014f4a27
34c0d4baef12bf683a884d00ed82a2a05b605cf4
/addressbook/src/test/java/addressbook/tests/GroupModificationTests.java
f23df1015888944626ffcd6bae0a34216b0aa91d
[ "Apache-2.0" ]
permissive
Sviatlana-Pi/java_pft
0471b70db92f8cdbd108d5a2b260058b0f3df840
5a491cf124946d3f7c07f5b3acc1a98cbc11f722
refs/heads/main
2023-03-17T05:01:36.143833
2021-03-07T17:47:35
2021-03-07T17:47:35
343,521,397
0
0
null
null
null
null
UTF-8
Java
false
false
618
java
package addressbook.tests; import addressbook.model.GroupData; import org.testng.annotations.Test; public class GroupModificationTests extends TestBase { @Test public void testGroupModification(){ app.getNavigationHelper().gotoGroupPage(); app.getGroupHelper().selectGroup(); app.getGroupHelper().initGroupModification(); app.getGroupHelper().fillGroupForm(new GroupData("test_new_group_name","test_new_group_header","test_new_group_footer")); app.getGroupHelper().submitGroupModification(); app.getGroupHelper().returnToGroupPage(); } }
[ "sviatlana.pinchuk@fortnox.se" ]
sviatlana.pinchuk@fortnox.se
d95fca85d8c4f52eae35febf0d2cd761606a7cd0
53683df8b3f891046fb605dffbc667a038dcb2be
/Web/ProjetPLDL/src/java/entites/ListesdelectureMusiquesPK.java
d947e6842a1bb902cd193b51f1935c3dd1a3c9a6
[]
no_license
jodellevictoria/Projet_Final
7e821b0002b9a3e5063a4d854eb8630adfd9005d
552785ef6538c14bd475c2095ebe2aa7f890434a
refs/heads/master
2021-08-29T23:52:20.007503
2017-12-15T10:17:39
2017-12-15T10:17:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,088
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 entites; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.validation.constraints.NotNull; /** * * @author jodel */ @Embeddable public class ListesdelectureMusiquesPK implements Serializable { @Basic(optional = false) @NotNull @Column(name = "ListeDeLecture") private int listeDeLecture; @Basic(optional = false) @NotNull @Column(name = "Musique") private int musique; public ListesdelectureMusiquesPK() { } public ListesdelectureMusiquesPK(int listeDeLecture, int musique) { this.listeDeLecture = listeDeLecture; this.musique = musique; } public int getListeDeLecture() { return listeDeLecture; } public void setListeDeLecture(int listeDeLecture) { this.listeDeLecture = listeDeLecture; } public int getMusique() { return musique; } public void setMusique(int musique) { this.musique = musique; } @Override public int hashCode() { int hash = 0; hash += (int) listeDeLecture; hash += (int) musique; return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof ListesdelectureMusiquesPK)) { return false; } ListesdelectureMusiquesPK other = (ListesdelectureMusiquesPK) object; if (this.listeDeLecture != other.listeDeLecture) { return false; } if (this.musique != other.musique) { return false; } return true; } @Override public String toString() { return "entites.ListesdelectureMusiquesPK[ listeDeLecture=" + listeDeLecture + ", musique=" + musique + " ]"; } }
[ "jodelleperaltag@gmail.com" ]
jodelleperaltag@gmail.com
8cc91dcf37d2e9501c6bcedd5ded9b59918aff4d
cce05386a9bc9aee91a041cdb5c8144db3248dad
/Backend/src/main/java/com/devglan/assignment/QuestionRepository.java
3e193e804ae69f5e3e14f002565b1b28b853cd28
[]
no_license
spurthyPramod/Assignment
cd5487620be2c0fe78ed32e2257f12f18f559577
cbf70862f73632d3c0ea9c68b6c5fbdcf7706ab2
refs/heads/master
2020-05-05T02:23:48.238245
2019-04-05T07:34:43
2019-04-05T07:34:43
179,636,060
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package com.devglan.assignment; import java.util.List; import org.springframework.data.repository.Repository; public interface QuestionRepository extends Repository<Question, Integer> { void delete(Question question); List<Question> findAll(); Question findOne(int id); Question save(Question question); }
[ "" ]
225d4daab55ec7d8ad006bab652c454b4687b70d
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/aosp-mirror--platform_frameworks_base/0af6fa7015cd9da08bf52c1efb13641d30fd6bd7/before/VoiceInteractionSession.java
76962c5b607ae4282f9c77be5423daa4b8a3970d
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
63,575
java
/** * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.voice; import android.annotation.Nullable; import android.app.Dialog; import android.app.Instrumentation; import android.app.VoiceInteractor; import android.app.assist.AssistContent; import android.app.assist.AssistStructure; import android.content.ComponentCallbacks2; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Rect; import android.graphics.Region; import android.inputmethodservice.SoftInputWindow; import android.os.Binder; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.util.ArrayMap; import android.util.DebugUtils; import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.WindowManager; import android.widget.FrameLayout; import com.android.internal.app.IVoiceInteractionManagerService; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.internal.app.IVoiceInteractor; import com.android.internal.app.IVoiceInteractorCallback; import com.android.internal.app.IVoiceInteractorRequest; import com.android.internal.os.HandlerCaller; import com.android.internal.os.SomeArgs; import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.ref.WeakReference; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; /** * An active voice interaction session, providing a facility for the implementation * to interact with the user in the voice interaction layer. The user interface is * initially shown by default, and can be created be overriding {@link #onCreateContentView()} * in which the UI can be built. * * <p>A voice interaction session can be self-contained, ultimately calling {@link #finish} * when done. It can also initiate voice interactions with applications by calling * {@link #startVoiceActivity}</p>. */ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCallbacks2 { static final String TAG = "VoiceInteractionSession"; static final boolean DEBUG = false; /** * Flag received in {@link #onShow}: originator requested that the session be started with * assist data from the currently focused activity. */ public static final int SHOW_WITH_ASSIST = 1<<0; /** * Flag received in {@link #onShow}: originator requested that the session be started with * a screen shot of the currently focused activity. */ public static final int SHOW_WITH_SCREENSHOT = 1<<1; /** * Flag for use with {@link #onShow}: indicates that the session has been started from the * system assist gesture. */ public static final int SHOW_SOURCE_ASSIST_GESTURE = 1<<2; /** * Flag for use with {@link #onShow}: indicates that the application itself has invoked * the assistant. */ public static final int SHOW_SOURCE_APPLICATION = 1<<3; final Context mContext; final HandlerCaller mHandlerCaller; final KeyEvent.DispatcherState mDispatcherState = new KeyEvent.DispatcherState(); IVoiceInteractionManagerService mSystemService; IBinder mToken; int mTheme = 0; LayoutInflater mInflater; TypedArray mThemeAttrs; View mRootView; FrameLayout mContentFrame; SoftInputWindow mWindow; boolean mInitialized; boolean mWindowAdded; boolean mWindowVisible; boolean mWindowWasVisible; boolean mInShowWindow; final ArrayMap<IBinder, Request> mActiveRequests = new ArrayMap<IBinder, Request>(); final Insets mTmpInsets = new Insets(); final WeakReference<VoiceInteractionSession> mWeakRef = new WeakReference<VoiceInteractionSession>(this); final IVoiceInteractor mInteractor = new IVoiceInteractor.Stub() { @Override public IVoiceInteractorRequest startConfirmation(String callingPackage, IVoiceInteractorCallback callback, VoiceInteractor.Prompt prompt, Bundle extras) { ConfirmationRequest request = new ConfirmationRequest(callingPackage, Binder.getCallingUid(), callback, VoiceInteractionSession.this, prompt, extras); addRequest(request); mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_CONFIRMATION, request)); return request.mInterface; } @Override public IVoiceInteractorRequest startPickOption(String callingPackage, IVoiceInteractorCallback callback, VoiceInteractor.Prompt prompt, VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) { PickOptionRequest request = new PickOptionRequest(callingPackage, Binder.getCallingUid(), callback, VoiceInteractionSession.this, prompt, options, extras); addRequest(request); mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_PICK_OPTION, request)); return request.mInterface; } @Override public IVoiceInteractorRequest startCompleteVoice(String callingPackage, IVoiceInteractorCallback callback, VoiceInteractor.Prompt message, Bundle extras) { CompleteVoiceRequest request = new CompleteVoiceRequest(callingPackage, Binder.getCallingUid(), callback, VoiceInteractionSession.this, message, extras); addRequest(request); mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_COMPLETE_VOICE, request)); return request.mInterface; } @Override public IVoiceInteractorRequest startAbortVoice(String callingPackage, IVoiceInteractorCallback callback, VoiceInteractor.Prompt message, Bundle extras) { AbortVoiceRequest request = new AbortVoiceRequest(callingPackage, Binder.getCallingUid(), callback, VoiceInteractionSession.this, message, extras); addRequest(request); mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_ABORT_VOICE, request)); return request.mInterface; } @Override public IVoiceInteractorRequest startCommand(String callingPackage, IVoiceInteractorCallback callback, String command, Bundle extras) { CommandRequest request = new CommandRequest(callingPackage, Binder.getCallingUid(), callback, VoiceInteractionSession.this, command, extras); addRequest(request); mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_COMMAND, request)); return request.mInterface; } @Override public boolean[] supportsCommands(String callingPackage, String[] commands) { Message msg = mHandlerCaller.obtainMessageIOO(MSG_SUPPORTS_COMMANDS, 0, commands, null); SomeArgs args = mHandlerCaller.sendMessageAndWait(msg); if (args != null) { boolean[] res = (boolean[])args.arg1; args.recycle(); return res; } return new boolean[commands.length]; } }; final IVoiceInteractionSession mSession = new IVoiceInteractionSession.Stub() { @Override public void show(Bundle sessionArgs, int flags, IVoiceInteractionSessionShowCallback showCallback) { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageIOO(MSG_SHOW, flags, sessionArgs, showCallback)); } @Override public void hide() { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_HIDE)); } @Override public void handleAssist(final Bundle data, final AssistStructure structure, final AssistContent content) { // We want to pre-warm the AssistStructure before handing it off to the main // thread. We also want to do this on a separate thread, so that if the app // is for some reason slow (due to slow filling in of async children in the // structure), we don't block other incoming IPCs (such as the screenshot) to // us (since we are a oneway interface, they get serialized). (Okay?) Thread retriever = new Thread("AssistStructure retriever") { @Override public void run() { Throwable failure = null; if (structure != null) { try { structure.ensureData(); } catch (Throwable e) { Log.w(TAG, "Failure retrieving AssistStructure", e); failure = e; } } mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOOOO(MSG_HANDLE_ASSIST, data, failure == null ? structure : null, failure, content)); } }; retriever.start(); } @Override public void handleScreenshot(Bitmap screenshot) { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_HANDLE_SCREENSHOT, screenshot)); } @Override public void taskStarted(Intent intent, int taskId) { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageIO(MSG_TASK_STARTED, taskId, intent)); } @Override public void taskFinished(Intent intent, int taskId) { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageIO(MSG_TASK_FINISHED, taskId, intent)); } @Override public void closeSystemDialogs() { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_CLOSE_SYSTEM_DIALOGS)); } @Override public void onLockscreenShown() { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_ON_LOCKSCREEN_SHOWN)); } @Override public void destroy() { mHandlerCaller.sendMessage(mHandlerCaller.obtainMessage(MSG_DESTROY)); } }; /** * Base class representing a request from a voice-driver app to perform a particular * voice operation with the user. See related subclasses for the types of requests * that are possible. */ public static class Request { final IVoiceInteractorRequest mInterface = new IVoiceInteractorRequest.Stub() { @Override public void cancel() throws RemoteException { VoiceInteractionSession session = mSession.get(); if (session != null) { session.mHandlerCaller.sendMessage( session.mHandlerCaller.obtainMessageO(MSG_CANCEL, Request.this)); } } }; final String mCallingPackage; final int mCallingUid; final IVoiceInteractorCallback mCallback; final WeakReference<VoiceInteractionSession> mSession; final Bundle mExtras; Request(String packageName, int uid, IVoiceInteractorCallback callback, VoiceInteractionSession session, Bundle extras) { mCallingPackage = packageName; mCallingUid = uid; mCallback = callback; mSession = session.mWeakRef; mExtras = extras; } /** * Return the uid of the application that initiated the request. */ public int getCallingUid() { return mCallingUid; } /** * Return the package name of the application that initiated the request. */ public String getCallingPackage() { return mCallingPackage; } /** * Return any additional extra information that was supplied as part of the request. */ public Bundle getExtras() { return mExtras; } /** * Check whether this request is currently active. A request becomes inactive after * calling {@link #cancel} or a final result method that completes the request. After * this point, further interactions with the request will result in * {@link java.lang.IllegalStateException} errors; you should not catch these errors, * but can use this method if you need to determine the state of the request. Returns * true if the request is still active. */ public boolean isActive() { VoiceInteractionSession session = mSession.get(); if (session == null) { return false; } return session.isRequestActive(mInterface.asBinder()); } void finishRequest() { VoiceInteractionSession session = mSession.get(); if (session == null) { throw new IllegalStateException("VoiceInteractionSession has been destroyed"); } Request req = session.removeRequest(mInterface.asBinder()); if (req == null) { throw new IllegalStateException("Request not active: " + this); } else if (req != this) { throw new IllegalStateException("Current active request " + req + " not same as calling request " + this); } } /** * Ask the app to cancel this current request. * This also finishes the request (it is no longer active). */ public void cancel() { try { if (DEBUG) Log.d(TAG, "sendCancelResult: req=" + mInterface); finishRequest(); mCallback.deliverCancel(mInterface); } catch (RemoteException e) { } } @Override public String toString() { StringBuilder sb = new StringBuilder(128); DebugUtils.buildShortClassTag(this, sb); sb.append(" "); sb.append(mInterface.asBinder()); sb.append(" pkg="); sb.append(mCallingPackage); sb.append(" uid="); UserHandle.formatUid(sb, mCallingUid); sb.append('}'); return sb.toString(); } void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { writer.print(prefix); writer.print("mInterface="); writer.println(mInterface.asBinder()); writer.print(prefix); writer.print("mCallingPackage="); writer.print(mCallingPackage); writer.print(" mCallingUid="); UserHandle.formatUid(writer, mCallingUid); writer.println(); writer.print(prefix); writer.print("mCallback="); writer.println(mCallback.asBinder()); if (mExtras != null) { writer.print(prefix); writer.print("mExtras="); writer.println(mExtras); } } } /** * A request for confirmation from the user of an operation, as per * {@link android.app.VoiceInteractor.ConfirmationRequest * VoiceInteractor.ConfirmationRequest}. */ public static final class ConfirmationRequest extends Request { final VoiceInteractor.Prompt mPrompt; ConfirmationRequest(String packageName, int uid, IVoiceInteractorCallback callback, VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) { super(packageName, uid, callback, session, extras); mPrompt = prompt; } /** * Return the prompt informing the user of what will happen, as per * {@link android.app.VoiceInteractor.ConfirmationRequest * VoiceInteractor.ConfirmationRequest}. */ @Nullable public VoiceInteractor.Prompt getVoicePrompt() { return mPrompt; } /** * Return the prompt informing the user of what will happen, as per * {@link android.app.VoiceInteractor.ConfirmationRequest * VoiceInteractor.ConfirmationRequest}. * @deprecated Prefer {@link #getVoicePrompt()} which allows multiple voice prompts. */ @Nullable public CharSequence getPrompt() { return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null); } /** * Report that the voice interactor has confirmed the operation with the user, resulting * in a call to * {@link android.app.VoiceInteractor.ConfirmationRequest#onConfirmationResult * VoiceInteractor.ConfirmationRequest.onConfirmationResult}. * This finishes the request (it is no longer active). */ public void sendConfirmationResult(boolean confirmed, Bundle result) { try { if (DEBUG) Log.d(TAG, "sendConfirmationResult: req=" + mInterface + " confirmed=" + confirmed + " result=" + result); finishRequest(); mCallback.deliverConfirmationResult(mInterface, confirmed, result); } catch (RemoteException e) { } } void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { super.dump(prefix, fd, writer, args); writer.print(prefix); writer.print("mPrompt="); writer.println(mPrompt); } } /** * A request for the user to pick from a set of option, as per * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}. */ public static final class PickOptionRequest extends Request { final VoiceInteractor.Prompt mPrompt; final VoiceInteractor.PickOptionRequest.Option[] mOptions; PickOptionRequest(String packageName, int uid, IVoiceInteractorCallback callback, VoiceInteractionSession session, VoiceInteractor.Prompt prompt, VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) { super(packageName, uid, callback, session, extras); mPrompt = prompt; mOptions = options; } /** * Return the prompt informing the user of what they are picking, as per * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}. */ @Nullable public VoiceInteractor.Prompt getVoicePrompt() { return mPrompt; } /** * Return the prompt informing the user of what they are picking, as per * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}. * @deprecated Prefer {@link #getVoicePrompt()} which allows multiple voice prompts. */ @Nullable public CharSequence getPrompt() { return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null); } /** * Return the set of options the user is picking from, as per * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}. */ public VoiceInteractor.PickOptionRequest.Option[] getOptions() { return mOptions; } void sendPickOptionResult(boolean finished, VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) { try { if (DEBUG) Log.d(TAG, "sendPickOptionResult: req=" + mInterface + " finished=" + finished + " selections=" + selections + " result=" + result); if (finished) { finishRequest(); } mCallback.deliverPickOptionResult(mInterface, finished, selections, result); } catch (RemoteException e) { } } /** * Report an intermediate option selection from the request, without completing it (the * request is still active and the app is waiting for the final option selection), * resulting in a call to * {@link android.app.VoiceInteractor.PickOptionRequest#onPickOptionResult * VoiceInteractor.PickOptionRequest.onPickOptionResult} with false for finished. */ public void sendIntermediatePickOptionResult( VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) { sendPickOptionResult(false, selections, result); } /** * Report the final option selection for the request, completing the request * and resulting in a call to * {@link android.app.VoiceInteractor.PickOptionRequest#onPickOptionResult * VoiceInteractor.PickOptionRequest.onPickOptionResult} with false for finished. * This finishes the request (it is no longer active). */ public void sendPickOptionResult( VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) { sendPickOptionResult(true, selections, result); } void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { super.dump(prefix, fd, writer, args); writer.print(prefix); writer.print("mPrompt="); writer.println(mPrompt); if (mOptions != null) { writer.print(prefix); writer.println("Options:"); for (int i=0; i<mOptions.length; i++) { VoiceInteractor.PickOptionRequest.Option op = mOptions[i]; writer.print(prefix); writer.print(" #"); writer.print(i); writer.println(":"); writer.print(prefix); writer.print(" mLabel="); writer.println(op.getLabel()); writer.print(prefix); writer.print(" mIndex="); writer.println(op.getIndex()); if (op.countSynonyms() > 0) { writer.print(prefix); writer.println(" Synonyms:"); for (int j=0; j<op.countSynonyms(); j++) { writer.print(prefix); writer.print(" #"); writer.print(j); writer.print(": "); writer.println(op.getSynonymAt(j)); } } if (op.getExtras() != null) { writer.print(prefix); writer.print(" mExtras="); writer.println(op.getExtras()); } } } } } /** * A request to simply inform the user that the voice operation has completed, as per * {@link android.app.VoiceInteractor.CompleteVoiceRequest * VoiceInteractor.CompleteVoiceRequest}. */ public static final class CompleteVoiceRequest extends Request { final VoiceInteractor.Prompt mPrompt; CompleteVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback, VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) { super(packageName, uid, callback, session, extras); mPrompt = prompt; } /** * Return the message informing the user of the completion, as per * {@link android.app.VoiceInteractor.CompleteVoiceRequest * VoiceInteractor.CompleteVoiceRequest}. */ @Nullable public VoiceInteractor.Prompt getVoicePrompt() { return mPrompt; } /** * Return the message informing the user of the completion, as per * {@link android.app.VoiceInteractor.CompleteVoiceRequest * VoiceInteractor.CompleteVoiceRequest}. * @deprecated Prefer {@link #getVoicePrompt()} which allows a separate visual message. */ @Nullable public CharSequence getMessage() { return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null); } /** * Report that the voice interactor has finished completing the voice operation, resulting * in a call to * {@link android.app.VoiceInteractor.CompleteVoiceRequest#onCompleteResult * VoiceInteractor.CompleteVoiceRequest.onCompleteResult}. * This finishes the request (it is no longer active). */ public void sendCompleteResult(Bundle result) { try { if (DEBUG) Log.d(TAG, "sendCompleteVoiceResult: req=" + mInterface + " result=" + result); finishRequest(); mCallback.deliverCompleteVoiceResult(mInterface, result); } catch (RemoteException e) { } } void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { super.dump(prefix, fd, writer, args); writer.print(prefix); writer.print("mPrompt="); writer.println(mPrompt); } } /** * A request to report that the current user interaction can not be completed with voice, as per * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}. */ public static final class AbortVoiceRequest extends Request { final VoiceInteractor.Prompt mPrompt; AbortVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback, VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) { super(packageName, uid, callback, session, extras); mPrompt = prompt; } /** * Return the message informing the user of the problem, as per * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}. */ @Nullable public VoiceInteractor.Prompt getVoicePrompt() { return mPrompt; } /** * Return the message informing the user of the problem, as per * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}. * @deprecated Prefer {@link #getVoicePrompt()} which allows a separate visual message. */ @Nullable public CharSequence getMessage() { return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null); } /** * Report that the voice interactor has finished aborting the voice operation, resulting * in a call to * {@link android.app.VoiceInteractor.AbortVoiceRequest#onAbortResult * VoiceInteractor.AbortVoiceRequest.onAbortResult}. This finishes the request (it * is no longer active). */ public void sendAbortResult(Bundle result) { try { if (DEBUG) Log.d(TAG, "sendConfirmResult: req=" + mInterface + " result=" + result); finishRequest(); mCallback.deliverAbortVoiceResult(mInterface, result); } catch (RemoteException e) { } } void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { super.dump(prefix, fd, writer, args); writer.print(prefix); writer.print("mPrompt="); writer.println(mPrompt); } } /** * A generic vendor-specific request, as per * {@link android.app.VoiceInteractor.CommandRequest VoiceInteractor.CommandRequest}. */ public static final class CommandRequest extends Request { final String mCommand; CommandRequest(String packageName, int uid, IVoiceInteractorCallback callback, VoiceInteractionSession session, String command, Bundle extras) { super(packageName, uid, callback, session, extras); mCommand = command; } /** * Return the command that is being executed, as per * {@link android.app.VoiceInteractor.CommandRequest VoiceInteractor.CommandRequest}. */ public String getCommand() { return mCommand; } void sendCommandResult(boolean finished, Bundle result) { try { if (DEBUG) Log.d(TAG, "sendCommandResult: req=" + mInterface + " result=" + result); if (finished) { finishRequest(); } mCallback.deliverCommandResult(mInterface, finished, result); } catch (RemoteException e) { } } /** * Report an intermediate result of the request, without completing it (the request * is still active and the app is waiting for the final result), resulting in a call to * {@link android.app.VoiceInteractor.CommandRequest#onCommandResult * VoiceInteractor.CommandRequest.onCommandResult} with false for isCompleted. */ public void sendIntermediateResult(Bundle result) { sendCommandResult(false, result); } /** * Report the final result of the request, completing the request and resulting in a call to * {@link android.app.VoiceInteractor.CommandRequest#onCommandResult * VoiceInteractor.CommandRequest.onCommandResult} with true for isCompleted. * This finishes the request (it is no longer active). */ public void sendResult(Bundle result) { sendCommandResult(true, result); } void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { super.dump(prefix, fd, writer, args); writer.print(prefix); writer.print("mCommand="); writer.println(mCommand); } } static final int MSG_START_CONFIRMATION = 1; static final int MSG_START_PICK_OPTION = 2; static final int MSG_START_COMPLETE_VOICE = 3; static final int MSG_START_ABORT_VOICE = 4; static final int MSG_START_COMMAND = 5; static final int MSG_SUPPORTS_COMMANDS = 6; static final int MSG_CANCEL = 7; static final int MSG_TASK_STARTED = 100; static final int MSG_TASK_FINISHED = 101; static final int MSG_CLOSE_SYSTEM_DIALOGS = 102; static final int MSG_DESTROY = 103; static final int MSG_HANDLE_ASSIST = 104; static final int MSG_HANDLE_SCREENSHOT = 105; static final int MSG_SHOW = 106; static final int MSG_HIDE = 107; static final int MSG_ON_LOCKSCREEN_SHOWN = 108; class MyCallbacks implements HandlerCaller.Callback, SoftInputWindow.Callback { @Override public void executeMessage(Message msg) { SomeArgs args = null; switch (msg.what) { case MSG_START_CONFIRMATION: if (DEBUG) Log.d(TAG, "onConfirm: req=" + msg.obj); onRequestConfirmation((ConfirmationRequest) msg.obj); break; case MSG_START_PICK_OPTION: if (DEBUG) Log.d(TAG, "onPickOption: req=" + msg.obj); onRequestPickOption((PickOptionRequest) msg.obj); break; case MSG_START_COMPLETE_VOICE: if (DEBUG) Log.d(TAG, "onCompleteVoice: req=" + msg.obj); onRequestCompleteVoice((CompleteVoiceRequest) msg.obj); break; case MSG_START_ABORT_VOICE: if (DEBUG) Log.d(TAG, "onAbortVoice: req=" + msg.obj); onRequestAbortVoice((AbortVoiceRequest) msg.obj); break; case MSG_START_COMMAND: if (DEBUG) Log.d(TAG, "onCommand: req=" + msg.obj); onRequestCommand((CommandRequest) msg.obj); break; case MSG_SUPPORTS_COMMANDS: args = (SomeArgs)msg.obj; if (DEBUG) Log.d(TAG, "onGetSupportedCommands: cmds=" + args.arg1); args.arg1 = onGetSupportedCommands((String[]) args.arg1); args.complete(); args = null; break; case MSG_CANCEL: if (DEBUG) Log.d(TAG, "onCancel: req=" + ((Request)msg.obj)); onCancelRequest((Request) msg.obj); break; case MSG_TASK_STARTED: if (DEBUG) Log.d(TAG, "onTaskStarted: intent=" + msg.obj + " taskId=" + msg.arg1); onTaskStarted((Intent) msg.obj, msg.arg1); break; case MSG_TASK_FINISHED: if (DEBUG) Log.d(TAG, "onTaskFinished: intent=" + msg.obj + " taskId=" + msg.arg1); onTaskFinished((Intent) msg.obj, msg.arg1); break; case MSG_CLOSE_SYSTEM_DIALOGS: if (DEBUG) Log.d(TAG, "onCloseSystemDialogs"); onCloseSystemDialogs(); break; case MSG_DESTROY: if (DEBUG) Log.d(TAG, "doDestroy"); doDestroy(); break; case MSG_HANDLE_ASSIST: args = (SomeArgs)msg.obj; if (DEBUG) Log.d(TAG, "onHandleAssist: data=" + args.arg1 + " structure=" + args.arg2 + " content=" + args.arg3); doOnHandleAssist((Bundle) args.arg1, (AssistStructure) args.arg2, (Throwable) args.arg3, (AssistContent) args.arg4); break; case MSG_HANDLE_SCREENSHOT: if (DEBUG) Log.d(TAG, "onHandleScreenshot: " + msg.obj); onHandleScreenshot((Bitmap) msg.obj); break; case MSG_SHOW: args = (SomeArgs)msg.obj; if (DEBUG) Log.d(TAG, "doShow: args=" + args.arg1 + " flags=" + msg.arg1 + " showCallback=" + args.arg2); doShow((Bundle) args.arg1, msg.arg1, (IVoiceInteractionSessionShowCallback) args.arg2); break; case MSG_HIDE: if (DEBUG) Log.d(TAG, "doHide"); doHide(); break; case MSG_ON_LOCKSCREEN_SHOWN: if (DEBUG) Log.d(TAG, "onLockscreenShown"); onLockscreenShown(); break; } if (args != null) { args.recycle(); } } @Override public void onBackPressed() { VoiceInteractionSession.this.onBackPressed(); } } final MyCallbacks mCallbacks = new MyCallbacks(); /** * Information about where interesting parts of the input method UI appear. */ public static final class Insets { /** * This is the part of the UI that is the main content. It is * used to determine the basic space needed, to resize/pan the * application behind. It is assumed that this inset does not * change very much, since any change will cause a full resize/pan * of the application behind. This value is relative to the top edge * of the input method window. */ public final Rect contentInsets = new Rect(); /** * This is the region of the UI that is touchable. It is used when * {@link #touchableInsets} is set to {@link #TOUCHABLE_INSETS_REGION}. * The region should be specified relative to the origin of the window frame. */ public final Region touchableRegion = new Region(); /** * Option for {@link #touchableInsets}: the entire window frame * can be touched. */ public static final int TOUCHABLE_INSETS_FRAME = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME; /** * Option for {@link #touchableInsets}: the area inside of * the content insets can be touched. */ public static final int TOUCHABLE_INSETS_CONTENT = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT; /** * Option for {@link #touchableInsets}: the region specified by * {@link #touchableRegion} can be touched. */ public static final int TOUCHABLE_INSETS_REGION = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION; /** * Determine which area of the window is touchable by the user. May * be one of: {@link #TOUCHABLE_INSETS_FRAME}, * {@link #TOUCHABLE_INSETS_CONTENT}, or {@link #TOUCHABLE_INSETS_REGION}. */ public int touchableInsets; } final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = new ViewTreeObserver.OnComputeInternalInsetsListener() { public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) { onComputeInsets(mTmpInsets); info.contentInsets.set(mTmpInsets.contentInsets); info.visibleInsets.set(mTmpInsets.contentInsets); info.touchableRegion.set(mTmpInsets.touchableRegion); info.setTouchableInsets(mTmpInsets.touchableInsets); } }; public VoiceInteractionSession(Context context) { this(context, new Handler()); } public VoiceInteractionSession(Context context, Handler handler) { mContext = context; mHandlerCaller = new HandlerCaller(context, handler.getLooper(), mCallbacks, true); } public Context getContext() { return mContext; } void addRequest(Request req) { synchronized (this) { mActiveRequests.put(req.mInterface.asBinder(), req); } } boolean isRequestActive(IBinder reqInterface) { synchronized (this) { return mActiveRequests.containsKey(reqInterface); } } Request removeRequest(IBinder reqInterface) { synchronized (this) { return mActiveRequests.remove(reqInterface); } } void doCreate(IVoiceInteractionManagerService service, IBinder token) { mSystemService = service; mToken = token; onCreate(); } void doShow(Bundle args, int flags, final IVoiceInteractionSessionShowCallback showCallback) { if (DEBUG) Log.v(TAG, "Showing window: mWindowAdded=" + mWindowAdded + " mWindowVisible=" + mWindowVisible); if (mInShowWindow) { Log.w(TAG, "Re-entrance in to showWindow"); return; } try { mInShowWindow = true; if (!mWindowVisible) { if (!mWindowAdded) { mWindowAdded = true; View v = onCreateContentView(); if (v != null) { setContentView(v); } } } onShow(args, flags); if (!mWindowVisible) { mWindowVisible = true; mWindow.show(); } if (showCallback != null) { mRootView.invalidate(); mRootView.getViewTreeObserver().addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { mRootView.getViewTreeObserver().removeOnPreDrawListener(this); try { showCallback.onShown(); } catch (RemoteException e) { Log.w(TAG, "Error calling onShown", e); } return true; } }); } } finally { mWindowWasVisible = true; mInShowWindow = false; } } void doHide() { if (mWindowVisible) { mWindow.hide(); mWindowVisible = false; onHide(); } } void doDestroy() { onDestroy(); if (mInitialized) { mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener( mInsetsComputer); if (mWindowAdded) { mWindow.dismiss(); mWindowAdded = false; } mInitialized = false; } } void initViews() { mInitialized = true; mThemeAttrs = mContext.obtainStyledAttributes(android.R.styleable.VoiceInteractionSession); mRootView = mInflater.inflate( com.android.internal.R.layout.voice_interaction_session, null); mRootView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); mWindow.setContentView(mRootView); mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer); mContentFrame = (FrameLayout)mRootView.findViewById(android.R.id.content); } /** * Equivalent to {@link VoiceInteractionService#setDisabledShowContext * VoiceInteractionService.setDisabledShowContext(int)}. */ public void setDisabledShowContext(int flags) { try { mSystemService.setDisabledShowContext(flags); } catch (RemoteException e) { } } /** * Equivalent to {@link VoiceInteractionService#getDisabledShowContext * VoiceInteractionService.getDisabledShowContext}. */ public int getDisabledShowContext() { try { return mSystemService.getDisabledShowContext(); } catch (RemoteException e) { return 0; } } /** * Return which show context flags have been disabled by the user through the system * settings UI, so the session will never get this data. Returned flags are any combination of * {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} and * {@link VoiceInteractionSession#SHOW_WITH_SCREENSHOT * VoiceInteractionSession.SHOW_WITH_SCREENSHOT}. Note that this only tells you about * global user settings, not about restrictions that may be applied contextual based on * the current application the user is in or other transient states. */ public int getUserDisabledShowContext() { try { return mSystemService.getUserDisabledShowContext(); } catch (RemoteException e) { return 0; } } /** * Show the UI for this session. This asks the system to go through the process of showing * your UI, which will eventually culminate in {@link #onShow}. This is similar to calling * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}. * @param args Arbitrary arguments that will be propagated {@link #onShow}. * @param flags Indicates additional optional behavior that should be performed. May * be any combination of * {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} and * {@link VoiceInteractionSession#SHOW_WITH_SCREENSHOT * VoiceInteractionSession.SHOW_WITH_SCREENSHOT} * to request that the system generate and deliver assist data on the current foreground * app as part of showing the session UI. */ public void show(Bundle args, int flags) { if (mToken == null) { throw new IllegalStateException("Can't call before onCreate()"); } try { mSystemService.showSessionFromSession(mToken, args, flags); } catch (RemoteException e) { } } /** * Hide the session's UI, if currently shown. Call this when you are done with your * user interaction. */ public void hide() { if (mToken == null) { throw new IllegalStateException("Can't call before onCreate()"); } try { mSystemService.hideSessionFromSession(mToken); } catch (RemoteException e) { } } /** * You can call this to customize the theme used by your IME's window. * This must be set before {@link #onCreate}, so you * will typically call it in your constructor with the resource ID * of your custom theme. */ public void setTheme(int theme) { if (mWindow != null) { throw new IllegalStateException("Must be called before onCreate()"); } mTheme = theme; } /** * Ask that a new activity be started for voice interaction. This will create a * new dedicated task in the activity manager for this voice interaction session; * this means that {@link Intent#FLAG_ACTIVITY_NEW_TASK Intent.FLAG_ACTIVITY_NEW_TASK} * will be set for you to make it a new task. * * <p>The newly started activity will be displayed to the user in a special way, as * a layer under the voice interaction UI.</p> * * <p>As the voice activity runs, it can retrieve a {@link android.app.VoiceInteractor} * through which it can perform voice interactions through your session. These requests * for voice interactions will appear as callbacks on {@link #onGetSupportedCommands}, * {@link #onRequestConfirmation}, {@link #onRequestPickOption}, * {@link #onRequestCompleteVoice}, {@link #onRequestAbortVoice}, * or {@link #onRequestCommand} * * <p>You will receive a call to {@link #onTaskStarted} when the task starts up * and {@link #onTaskFinished} when the last activity has finished. * * @param intent The Intent to start this voice interaction. The given Intent will * always have {@link Intent#CATEGORY_VOICE Intent.CATEGORY_VOICE} added to it, since * this is part of a voice interaction. */ public void startVoiceActivity(Intent intent) { if (mToken == null) { throw new IllegalStateException("Can't call before onCreate()"); } try { intent.migrateExtraStreamToClipData(); intent.prepareToLeaveProcess(); int res = mSystemService.startVoiceActivity(mToken, intent, intent.resolveType(mContext.getContentResolver())); Instrumentation.checkStartActivityResult(res, intent); } catch (RemoteException e) { } } /** * Set whether this session will keep the device awake while it is running a voice * activity. By default, the system holds a wake lock for it while in this state, * so that it can work even if the screen is off. Setting this to false removes that * wake lock, allowing the CPU to go to sleep. This is typically used if the * session decides it has been waiting too long for a response from the user and * doesn't want to let this continue to drain the battery. * * <p>Passing false here will release the wake lock, and you can call later with * true to re-acquire it. It will also be automatically re-acquired for you each * time you start a new voice activity task -- that is when you call * {@link #startVoiceActivity}.</p> */ public void setKeepAwake(boolean keepAwake) { if (mToken == null) { throw new IllegalStateException("Can't call before onCreate()"); } try { mSystemService.setKeepAwake(mToken, keepAwake); } catch (RemoteException e) { } } /** * Request that all system dialogs (and status bar shade etc) be closed, allowing * access to the session's UI. This will <em>not</em> cause the lock screen to be * dismissed. */ public void closeSystemDialogs() { if (mToken == null) { throw new IllegalStateException("Can't call before onCreate()"); } try { mSystemService.closeSystemDialogs(mToken); } catch (RemoteException e) { } } /** * Convenience for inflating views. */ public LayoutInflater getLayoutInflater() { return mInflater; } /** * Retrieve the window being used to show the session's UI. */ public Dialog getWindow() { return mWindow; } /** * Finish the session. This completely destroys the session -- the next time it is shown, * an entirely new one will be created. You do not normally call this function; instead, * use {@link #hide} and allow the system to destroy your session if it needs its RAM. */ public void finish() { if (mToken == null) { throw new IllegalStateException("Can't call before onCreate()"); } try { mSystemService.finish(mToken); } catch (RemoteException e) { } } /** * Initiatize a new session. At this point you don't know exactly what this * session will be used for; you will find that out in {@link #onShow}. */ public void onCreate() { doOnCreate(); } private void doOnCreate() { mTheme = mTheme != 0 ? mTheme : com.android.internal.R.style.Theme_DeviceDefault_VoiceInteractionSession; mInflater = (LayoutInflater)mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE); mWindow = new SoftInputWindow(mContext, "VoiceInteractionSession", mTheme, mCallbacks, this, mDispatcherState, WindowManager.LayoutParams.TYPE_VOICE_INTERACTION, Gravity.BOTTOM, true); mWindow.getWindow().addFlags( WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR); initViews(); mWindow.getWindow().setLayout(MATCH_PARENT, MATCH_PARENT); mWindow.setToken(mToken); } /** * Called when the session UI is going to be shown. This is called after * {@link #onCreateContentView} (if the session's content UI needed to be created) and * immediately prior to the window being shown. This may be called while the window * is already shown, if a show request has come in while it is shown, to allow you to * update the UI to match the new show arguments. * * @param args The arguments that were supplied to * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}. * @param showFlags The show flags originally provided to * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}. */ public void onShow(Bundle args, int showFlags) { } /** * Called immediately after stopping to show the session UI. */ public void onHide() { } /** * Last callback to the session as it is being finished. */ public void onDestroy() { } /** * Hook in which to create the session's UI. */ public View onCreateContentView() { return null; } public void setContentView(View view) { mContentFrame.removeAllViews(); mContentFrame.addView(view, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mContentFrame.requestApplyInsets(); } void doOnHandleAssist(Bundle data, AssistStructure structure, Throwable failure, AssistContent content) { if (failure != null) { onAssistStructureFailure(failure); } onHandleAssist(data, structure, content); } /** * Called when there has been a failure transferring the {@link AssistStructure} to * the assistant. This may happen, for example, if the data is too large and results * in an out of memory exception, or the client has provided corrupt data. This will * be called immediately before {@link #onHandleAssist} and the AssistStructure supplied * there afterwards will be null. * * @param failure The failure exception that was thrown when building the * {@link AssistStructure}. */ public void onAssistStructureFailure(Throwable failure) { } /** * Called to receive data from the application that the user was currently viewing when * an assist session is started. If the original show request did not specify * {@link #SHOW_WITH_ASSIST}, this method will not be called. * * @param data Arbitrary data supplied by the app through * {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData}. * May be null if assist data has been disabled by the user or device policy. * @param structure If available, the structure definition of all windows currently * displayed by the app. May be null if assist data has been disabled by the user * or device policy; will be an empty stub if the application has disabled assist * by marking its window as secure. * @param content Additional content data supplied by the app through * {@link android.app.Activity#onProvideAssistContent Activity.onProvideAssistContent}. * May be null if assist data has been disabled by the user or device policy; will * not be automatically filled in with data from the app if the app has marked its * window as secure. */ public void onHandleAssist(@Nullable Bundle data, @Nullable AssistStructure structure, @Nullable AssistContent content) { } /** * Called to receive a screenshot of what the user was currently viewing when an assist * session is started. May be null if screenshots are disabled by the user, policy, * or application. If the original show request did not specify * {@link #SHOW_WITH_SCREENSHOT}, this method will not be called. */ public void onHandleScreenshot(@Nullable Bitmap screenshot) { } public boolean onKeyDown(int keyCode, KeyEvent event) { return false; } public boolean onKeyLongPress(int keyCode, KeyEvent event) { return false; } public boolean onKeyUp(int keyCode, KeyEvent event) { return false; } public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) { return false; } /** * Called when the user presses the back button while focus is in the session UI. Note * that this will only happen if the session UI has requested input focus in its window; * otherwise, the back key will go to whatever window has focus and do whatever behavior * it normally has there. The default implementation simply calls {@link #hide}. */ public void onBackPressed() { hide(); } /** * Sessions automatically watch for requests that all system UI be closed (such as when * the user presses HOME), which will appear here. The default implementation always * calls {@link #hide}. */ public void onCloseSystemDialogs() { hide(); } /** * Called when the lockscreen was shown. */ public void onLockscreenShown() { hide(); } @Override public void onConfigurationChanged(Configuration newConfig) { } @Override public void onLowMemory() { } @Override public void onTrimMemory(int level) { } /** * Compute the interesting insets into your UI. The default implementation * sets {@link Insets#contentInsets outInsets.contentInsets.top} to the height * of the window, meaning it should not adjust content underneath. The default touchable * insets are {@link Insets#TOUCHABLE_INSETS_FRAME}, meaning it consumes all touch * events within its window frame. * * @param outInsets Fill in with the current UI insets. */ public void onComputeInsets(Insets outInsets) { outInsets.contentInsets.left = 0; outInsets.contentInsets.bottom = 0; outInsets.contentInsets.right = 0; View decor = getWindow().getWindow().getDecorView(); outInsets.contentInsets.top = decor.getHeight(); outInsets.touchableInsets = Insets.TOUCHABLE_INSETS_FRAME; outInsets.touchableRegion.setEmpty(); } /** * Called when a task initiated by {@link #startVoiceActivity(android.content.Intent)} * has actually started. * * @param intent The original {@link Intent} supplied to * {@link #startVoiceActivity(android.content.Intent)}. * @param taskId Unique ID of the now running task. */ public void onTaskStarted(Intent intent, int taskId) { } /** * Called when the last activity of a task initiated by * {@link #startVoiceActivity(android.content.Intent)} has finished. The default * implementation calls {@link #finish()} on the assumption that this represents * the completion of a voice action. You can override the implementation if you would * like a different behavior. * * @param intent The original {@link Intent} supplied to * {@link #startVoiceActivity(android.content.Intent)}. * @param taskId Unique ID of the finished task. */ public void onTaskFinished(Intent intent, int taskId) { hide(); } /** * Request to query for what extended commands the session supports. * * @param commands An array of commands that are being queried. * @return Return an array of booleans indicating which of each entry in the * command array is supported. A true entry in the array indicates the command * is supported; false indicates it is not. The default implementation returns * an array of all false entries. */ public boolean[] onGetSupportedCommands(String[] commands) { return new boolean[commands.length]; } /** * Request to confirm with the user before proceeding with an unrecoverable operation, * corresponding to a {@link android.app.VoiceInteractor.ConfirmationRequest * VoiceInteractor.ConfirmationRequest}. * * @param request The active request. */ public void onRequestConfirmation(ConfirmationRequest request) { } /** * Request for the user to pick one of N options, corresponding to a * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}. * * @param request The active request. */ public void onRequestPickOption(PickOptionRequest request) { } /** * Request to complete the voice interaction session because the voice activity successfully * completed its interaction using voice. Corresponds to * {@link android.app.VoiceInteractor.CompleteVoiceRequest * VoiceInteractor.CompleteVoiceRequest}. The default implementation just sends an empty * confirmation back to allow the activity to exit. * * @param request The active request. */ public void onRequestCompleteVoice(CompleteVoiceRequest request) { } /** * Request to abort the voice interaction session because the voice activity can not * complete its interaction using voice. Corresponds to * {@link android.app.VoiceInteractor.AbortVoiceRequest * VoiceInteractor.AbortVoiceRequest}. The default implementation just sends an empty * confirmation back to allow the activity to exit. * * @param request The active request. */ public void onRequestAbortVoice(AbortVoiceRequest request) { } /** * Process an arbitrary extended command from the caller, * corresponding to a {@link android.app.VoiceInteractor.CommandRequest * VoiceInteractor.CommandRequest}. * * @param request The active request. */ public void onRequestCommand(CommandRequest request) { } /** * Called when the {@link android.app.VoiceInteractor} has asked to cancel a {@link Request} * that was previously delivered to {@link #onRequestConfirmation}, * {@link #onRequestPickOption}, {@link #onRequestCompleteVoice}, {@link #onRequestAbortVoice}, * or {@link #onRequestCommand}. * * @param request The request that is being canceled. */ public void onCancelRequest(Request request) { } /** * Print the Service's state into the given stream. This gets invoked by * {@link VoiceInteractionSessionService} when its Service * {@link android.app.Service#dump} method is called. * * @param prefix Text to print at the front of each line. * @param fd The raw file descriptor that the dump is being sent to. * @param writer The PrintWriter to which you should dump your state. This will be * closed for you after you return. * @param args additional arguments to the dump request. */ public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { writer.print(prefix); writer.print("mToken="); writer.println(mToken); writer.print(prefix); writer.print("mTheme=#"); writer.println(Integer.toHexString(mTheme)); writer.print(prefix); writer.print("mInitialized="); writer.println(mInitialized); writer.print(prefix); writer.print("mWindowAdded="); writer.print(mWindowAdded); writer.print(" mWindowVisible="); writer.println(mWindowVisible); writer.print(prefix); writer.print("mWindowWasVisible="); writer.print(mWindowWasVisible); writer.print(" mInShowWindow="); writer.println(mInShowWindow); if (mActiveRequests.size() > 0) { writer.print(prefix); writer.println("Active requests:"); String innerPrefix = prefix + " "; for (int i=0; i<mActiveRequests.size(); i++) { Request req = mActiveRequests.valueAt(i); writer.print(prefix); writer.print(" #"); writer.print(i); writer.print(": "); writer.println(req); req.dump(innerPrefix, fd, writer, args); } } } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
cccc787a4c46f6289b419e6a65478d1fe42015f8
f35284aaaa276db67690cba8e5bc7f88c3c7a084
/app/src/main/java/cloudchen/dodgeball/WorldRecord.java
2f9d7be967e1a20149a12b9c073bb769b491db46
[ "Apache-2.0" ]
permissive
nlrabbit/Dodgeball
43481d900da44bb6806658cbd7ab75740dc505a4
03175ab20f1a0723fe9df15d0a0c2462419bd2fd
refs/heads/master
2021-01-10T22:58:01.732745
2016-06-06T08:24:59
2016-06-06T08:24:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
530
java
package cloudchen.dodgeball; import cn.bmob.v3.BmobObject; public class WorldRecord extends BmobObject { private String deviceName; private long worldRecord; public String getDeviceName() { return deviceName; } public void setDeviceName(String deviceName) { this.deviceName = deviceName; } public long getWorldRecord() { return worldRecord; } public void setWorldRecord(long worldRecord) { this.worldRecord = worldRecord; } }
[ "im_sure@163.com" ]
im_sure@163.com
a9fb64c3242a63d03ed8f152a35b604c2836fbe0
e01767aab13e4a5239d39dc2837b4c5ad574870d
/user/src/main/java/com/tdzx/user/utils/ResultStatus.java
c00d37fb8d96039637116185871f4f6dd77febdd
[]
no_license
boom888/xinhualeyu-tdzx-user
6166ec66f008bf0fad75b2e74c15e33dc6dde25f
bb288afa0cc6f8352f4e0dd1cb3f66e9b4cf3e54
refs/heads/master
2022-11-11T17:23:56.370884
2019-12-02T04:59:50
2019-12-02T04:59:50
225,287,089
0
0
null
2022-10-12T20:34:33
2019-12-02T04:43:24
Java
UTF-8
Java
false
false
910
java
package com.tdzx.user.utils; /** * Author:Joker * Date:2018/7/19 * Description: */ public enum ResultStatus implements BaseEnum { /** * 成功 */ SUCCESS(200, "成功"), /** * 注册失败 */ REGFAILD(300, "注册失败"), /** * 错误 */ ERROR(500, "错误"), /** * 异常 */ EXCEPTION(400, "异常"), /** * 权限校验失败 */ INVALIDSESSION(403, "无权限"), /** * 权限校验失败 */ NOTFOUND(404, "Not Found"); /*NOMORETODAY=;*/ private ResultStatus(int value, String description) { this.value = value; this.description = description; } private int value; private String description; @Override public int getValue() { return value; } @Override public String getDescription() { return description; } }
[ "13065160327@163.com" ]
13065160327@163.com
fd87343d4077b50718dc65bf96fb2b448e9b123d
bc7370cfb5ccc61072444d1dde0701abb7640cb2
/lhitf/src/private/nc/bs/lhitf/bgtask/AutoTransBankAccBgTaskPlugin.java
ef98516f6e23f63438e60bdd5c5a607c48bbdce5
[]
no_license
guowj1/lhprj
a4cf6f715d864a17dcef656cee02965c223777f2
70b5e6fabddeaf1db026591d817f0eab91704b58
refs/heads/master
2021-01-01T19:53:53.324175
2017-09-25T09:14:17
2017-09-25T09:14:17
98,713,984
0
0
null
null
null
null
UTF-8
Java
false
false
1,456
java
package nc.bs.lhitf.bgtask; import nc.bs.lhitf.bgtask.pub.PostDataImp; import nc.bs.pub.pa.PreAlertObject; import nc.bs.pub.taskcenter.BgWorkingContext; import nc.bs.pub.taskcenter.IBackgroundWorkPlugin; import nc.md.persist.framework.IMDPersistenceQueryService; import nc.md.persist.framework.MDPersistenceService; import nc.vo.bd.bankaccount.BankAccbasVO; import nc.vo.pub.BusinessException; public class AutoTransBankAccBgTaskPlugin implements IBackgroundWorkPlugin { private IMDPersistenceQueryService mdQueryService; @Override public PreAlertObject executeTask(BgWorkingContext arg0) throws BusinessException { BankAccbasVO[] vos = null; vos = (BankAccbasVO[]) getMdQueryService().queryBillOfVOByCond( // BankAccbasVO.class, " (def2='~' or def2 is null or def2<ts) and def1='1001A6100000000000XU' ", BankAccbasVO.class, " (def2='~' or def2 is null) and def1='1001A6100000000000XU' ", false).toArray(new BankAccbasVO[0]); if (vos == null || vos.length < 1) { return null; } try { PostDataImp postServ = new PostDataImp(); postServ.sendDataByStr(vos, "bankaccbas"); } catch (Exception e) { throw new BusinessException(e.getMessage()); } return null; } private IMDPersistenceQueryService getMdQueryService() { if (mdQueryService == null) mdQueryService = MDPersistenceService .lookupPersistenceQueryService(); return mdQueryService; } }
[ "guowenjialy@163.com" ]
guowenjialy@163.com
2e323439c168d61ad2fbabae46c995f17ea01331
c8365237a15b7aa005ab75a0f07bd4b87b452692
/Quadratin/app/src/main/java/g4a/quadratin/mx/quadratin/SlidingTabLayout.java
f43ca589b400d6dd30c37b31e341d11d1788c888
[]
no_license
eduardobc88/AndroidStudio
99a6701edc1fdd1be4985c9cd1c0f0685832c712
2649e1aee8d719a96c9fa3dc955655b187ff53d2
refs/heads/master
2021-05-30T14:00:38.076786
2015-05-04T17:10:32
2015-05-04T17:10:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,637
java
package g4a.quadratin.mx.quadratin; /* * Copyright 2014 Google Inc. All rights reserved. * * 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.google.samples.apps.iosched.ui.widget; import android.content.Context; import android.graphics.Typeface; import android.os.Build; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.util.SparseArray; import android.util.TypedValue; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import android.widget.TextView; /** * To be used with ViewPager to provide a tab indicator component which give constant feedback as to * the user's scroll progress. * <p> * To use the component, simply add it to your view hierarchy. Then in your * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call * {@link #setViewPager(ViewPager)} providing it the ViewPager this layout is being used for. * <p> * The colors can be customized in two ways. The first and simplest is to provide an array of colors * via {@link #setSelectedIndicatorColors(int...)}. The * alternative is via the {@link TabColorizer} interface which provides you complete control over * which color is used for any individual position. * <p> * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)}, * providing the layout ID of your custom layout. */ public class SlidingTabLayout extends HorizontalScrollView { /** * Allows complete control over the colors drawn in the tab layout. Set with * {@link #setCustomTabColorizer(TabColorizer)}. */ public interface TabColorizer { /** * @return return the color of the indicator used when {@code position} is selected. */ int getIndicatorColor(int position); } private static final int TITLE_OFFSET_DIPS = 24; private static final int TAB_VIEW_PADDING_DIPS = 16; private static final int TAB_VIEW_TEXT_SIZE_SP = 12; private int mTitleOffset; private int mTabViewLayoutId; private int mTabViewTextViewId; private boolean mDistributeEvenly; private ViewPager mViewPager; private SparseArray<String> mContentDescriptions = new SparseArray<String>(); private ViewPager.OnPageChangeListener mViewPagerPageChangeListener; private final SlidingTabStrip mTabStrip; public SlidingTabLayout(Context context) { this(context, null); } public SlidingTabLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Disable the Scroll Bar setHorizontalScrollBarEnabled(false); // Make sure that the Tab Strips fills this View setFillViewport(true); mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density); mTabStrip = new SlidingTabStrip(context); addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); } /** * Set the custom {@link TabColorizer} to be used. * * If you only require simple custmisation then you can use * {@link #setSelectedIndicatorColors(int...)} to achieve * similar effects. */ public void setCustomTabColorizer(TabColorizer tabColorizer) { mTabStrip.setCustomTabColorizer(tabColorizer); } public void setDistributeEvenly(boolean distributeEvenly) { mDistributeEvenly = distributeEvenly; } /** * Sets the colors to be used for indicating the selected tab. These colors are treated as a * circular array. Providing one color will mean that all tabs are indicated with the same color. */ public void setSelectedIndicatorColors(int... colors) { mTabStrip.setSelectedIndicatorColors(colors); } /** * Set the {@link ViewPager.OnPageChangeListener}. When using {@link SlidingTabLayout} you are * required to set any {@link ViewPager.OnPageChangeListener} through this method. This is so * that the layout can update it's scroll position correctly. * * @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener) */ public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) { mViewPagerPageChangeListener = listener; } /** * Set the custom layout to be inflated for the tab views. * * @param layoutResId Layout id to be inflated * @param textViewId id of the {@link TextView} in the inflated view */ public void setCustomTabView(int layoutResId, int textViewId) { mTabViewLayoutId = layoutResId; mTabViewTextViewId = textViewId; } /** * Sets the associated view pager. Note that the assumption here is that the pager content * (number of tabs and tab titles) does not change after this call has been made. */ public void setViewPager(ViewPager viewPager) { mTabStrip.removeAllViews(); mViewPager = viewPager; if (viewPager != null) { viewPager.setOnPageChangeListener(new InternalViewPagerListener()); populateTabStrip(); } //set background color for the first tab when is running for first time setBackgroundTab(0, R.color.primary_dark); } private void setBackgroundTab(int tabId, int resId) { //set background textview color //((TextView)mTabStrip.getChildAt(tabId)).setBackgroundResource(resId); } /** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}. */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); textView.setAllCaps(true); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; } private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } tabTitleView.setTextColor(getResources().getColorStateList(R.color.selector)); //tabTitleView.setTextSize(14); } } public void setContentDescription(int i, String desc) { mContentDescriptions.put(i, desc); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); if (mViewPager != null) { scrollToTab(mViewPager.getCurrentItem(), 0); } } private void scrollToTab(int tabIndex, int positionOffset) { final int tabStripChildCount = mTabStrip.getChildCount(); if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { return; } View selectedChild = mTabStrip.getChildAt(tabIndex); if (selectedChild != null) { int targetScrollX = selectedChild.getLeft() + positionOffset; if (tabIndex > 0 || positionOffset > 0) { // If we're not at the first child and are mid-scroll, make sure we obey the offset targetScrollX -= mTitleOffset; } scrollTo(targetScrollX, 0); } } private class InternalViewPagerListener implements ViewPager.OnPageChangeListener { private int mScrollState; @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { int tabStripChildCount = mTabStrip.getChildCount(); if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) { return; } mTabStrip.onViewPagerPageChanged(position, positionOffset); View selectedTitle = mTabStrip.getChildAt(position); int extraOffset = (selectedTitle != null) ? (int) (positionOffset * selectedTitle.getWidth()) : 0; scrollToTab(position, extraOffset); if (mViewPagerPageChangeListener != null) { mViewPagerPageChangeListener.onPageScrolled(position, positionOffset, positionOffsetPixels); } } @Override public void onPageScrollStateChanged(int state) { mScrollState = state; if (mViewPagerPageChangeListener != null) { mViewPagerPageChangeListener.onPageScrollStateChanged(state); } } @Override public void onPageSelected(int position) { int positionId = -1; if (mScrollState == ViewPager.SCROLL_STATE_IDLE) { mTabStrip.onViewPagerPageChanged(position, 0f); scrollToTab(position, 0); } for (int i = 0; i < mTabStrip.getChildCount(); i++) { mTabStrip.getChildAt(i).setSelected(position == i); //set background textview color if(i == position) { setBackgroundTab(i,R.color.primary_dark); } else { setBackgroundTab(i,R.color.tabBarColor); } } if (mViewPagerPageChangeListener != null) { mViewPagerPageChangeListener.onPageSelected(position); } } } private class TabClickListener implements View.OnClickListener { @Override public void onClick(View v) { for (int i = 0; i < mTabStrip.getChildCount(); i++) { if (v == mTabStrip.getChildAt(i)) { mViewPager.setCurrentItem(i); return; } } } } }
[ "eduardobc.88@gmail.com" ]
eduardobc.88@gmail.com
5646cf23587f347c2f56112c9e1c93a8d4e7089e
6e5a270f4abade7c8f297a84cbfba8d6c8d197c7
/matrixMultiplication.java
e66709bc6405ba795e877433261e23ed12a7bad5
[]
no_license
Helloworldhehe/matrixAddition
f55e7f14eb4a4bf9afec6bddcbb3f66e8e934be7
a00cca38928feb528b3c804f6953f3b2b1a01e46
refs/heads/master
2020-04-03T09:56:26.166030
2016-08-11T01:45:33
2016-08-11T01:45:33
65,365,640
0
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
//Created by Robert Throne //Algorithm to compute multiplication of 2 matrices import java.util.*; public class matrixMultiplication{ public static void main(String[] args){ //Input from user int row1 = new Scanner(System.in).nextInt(); int row2 = new Scanner(System.in).nextInt(); int col1 = new Scanner(System.in).nextInt(); int col2 = new Scanner(System.in).nextInt(); Scanner input = new Scanner(System.in); int i,j,k,sum; //Initialize the array int a[][] = new int[row1][col1]; int b[][] = new int[row2][col2]; int c[][] = new int[row1][col2]; if(col1 != row2) throw new IllegalArgumentException("They must be equal"); //Matrix A for(i = 0; i < row1; i++){ for(j = 0; j < col1; j++){ a[i][j] = input.nextInt(); } } //Matrix B for(i = 0; i < row2; i++){ for(j = 0; j < col2; j++){ b[i][j] = input.nextInt(); } } //Algorithm to multiply 2 matrices for(i = 0; i < row1; i++){ for(j = 0; j < col2; j++){ sum = 0; for(k = 0; k < row2; k++){ sum = sum + (a[i][k] * b[k][j]); } c[i][j] = sum; System.out.println(c[i][j]); } } } }
[ "realisethink@yahoo.com" ]
realisethink@yahoo.com
3b5faa946d0d4129ce8463bfa35c11f80ceb2270
119c27c0ea3bdf54df8824e1054a55e5faa689ea
/src/main/java/part7/quicksort/QuickSorterMedianInsert.java
3bbd7c3bc596054edd997dbb4faf437f3ad34ba1
[]
no_license
malinovskiy-alex/algorithms-java
28a6de6c21a4d94cfc165daeda30d35ab9159d89
3b8fd04a57577e7cd0f97fc5323b837cfb7b4fd4
refs/heads/master
2021-01-23T01:01:20.778649
2017-09-25T07:32:00
2017-09-25T07:32:00
85,861,528
1
0
null
null
null
null
UTF-8
Java
false
false
1,895
java
package part7.quicksort; import array.BasicIntArray; import array.Sorter; public class QuickSorterMedianInsert extends BasicIntArray implements Sorter { public QuickSorterMedianInsert(int elementsCount) { super(elementsCount); } @Override public void sort() { recSort(0, getElementsCount() - 1); } private void recSort(int left, int right) { int size = right - left + 1; if (size < 10) { insertSort(left, right); } else { int median = getMedianOf3(left, right); int centerPoint = partitionIt(left, right, median); recSort(left, centerPoint - 1); recSort(centerPoint + 1, right); } } private int getMedianOf3(int left, int right) { int center = (right + left) / 2; if (getArray()[left] > getArray()[center]) { swap(left, center); } if (getArray()[center] > getArray()[right]) { swap(center, right); } if (getArray()[left] > getArray()[center]) { swap(left, center); } swap(center, right - 1); return getArray()[right - 1]; } private int partitionIt(int left, int right, int target) { int rightCorner = right - 1; while (rightCorner > left) { while (getArray()[++left] < target) { } while (getArray()[--rightCorner] > target) { } if (left >= rightCorner) { break; } else { swap(left, rightCorner); } } swap(left, right - 1); return left; } private void insertSort(int left, int right) { for (int start = left + 1; start <= right; start++) { int currentElement = getArray()[start]; int currentIndex = start; while (currentIndex > left && currentElement < getArray()[currentIndex - 1]) { swap(currentIndex, currentIndex - 1); currentIndex--; } } } }
[ "amalinovskiy@connecture.com" ]
amalinovskiy@connecture.com
ef3a527e22b4e09bd017c17d6a9a9cd2ec62ca59
ab6b8b220fdb131e5d04e1f358788338884127bf
/test1127-1/src/lzp/CollectionData.java
f1e3f2c98b6719b4e3e73579b33ec61d551fb404
[]
no_license
fadinglzp/java
72a3624a7479a5ebe31a967a28b08247a3fdf603
0a67febedcc87d05e9cbe5e205528afbabbe0cf3
refs/heads/master
2020-05-23T11:32:32.761098
2019-12-16T09:05:23
2019-12-16T09:05:23
186,737,635
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package lzp; import java.util.*; public class CollectionData<T> extends ArrayList<T> { public CollectionData(Generator<T> gen, int size) { for (; size-- > 0;) add(gen.next()); } public static <T> CollectionData<T> list(Generator<T> gen,int quantity){ return new CollectionData<T>(gen,quantity); } }
[ "lzp@LZP" ]
lzp@LZP
30e7fc97ccff4c60faca9d14c33cafc6f5854256
6252c165657baa6aa605337ebc38dd44b3f694e2
/org.eclipse.epsilon.egl.sync/Scalability-Tests/boiler-To-Generate-1000-Files/boiler-To-Generate-1000-Files/syncregions-1000Files/TemperatureController154.java
5d282cb13029bb642daf783a9b915265e10e20a3
[]
no_license
soha500/EglSync
00fc49bcc73f7f7f7fb7641d0561ca2b9a8ea638
55101bc781349bb14fefc178bf3486e2b778aed6
refs/heads/master
2021-06-23T02:55:13.464889
2020-12-11T19:10:01
2020-12-11T19:10:01
139,832,721
0
1
null
2019-05-31T11:34:02
2018-07-05T10:20:00
Java
UTF-8
Java
false
false
368
java
package syncregions; public class TemperatureController154 { public int execute(int temperature154, int targetTemperature154) { //sync _bfpnFUbFEeqXnfGWlV2154, behaviour 1-if(temperatureDifference > 0 && boilerStatus == true) { return 1; } else if (temperatureDifference < 0 && boilerStatus == false) { return 2; } else return 0; //endSync } }
[ "sultanalmutairi@172.20.10.2" ]
sultanalmutairi@172.20.10.2
b5ade7213008a1de5f26cc1becd4e4c8360b1afb
6cd8d2cf5e9547449a0bb4b5064e6b5e48bbfd05
/core/ui/src/main/java/org/netbeans/cubeon/ui/taskelemet/MoveToDefault.java
54f8ff55195240a2c535f5ec744180236a281121
[ "Apache-2.0" ]
permissive
theanuradha/cubeon
3a8ca9348f1e8733bfa4e46b2f7559cb613815fd
d55ea42a3cd6eb59884dd0b6f9620629395ee63d
refs/heads/master
2020-12-31T00:17:44.572464
2015-11-10T03:34:34
2015-11-10T03:34:34
45,884,253
0
0
null
null
null
null
UTF-8
Java
false
false
2,888
java
/* * Copyright 2008 Anuradha. * * 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. * under the License. */ package org.netbeans.cubeon.ui.taskelemet; import java.util.HashSet; import java.util.Set; import org.netbeans.cubeon.tasks.core.api.TaskFolder; import org.netbeans.cubeon.tasks.core.api.TaskFolderRefreshable; import org.netbeans.cubeon.tasks.core.api.TasksFileSystem; import org.netbeans.cubeon.tasks.spi.task.TaskElement; import org.openide.nodes.Node; import org.openide.util.HelpCtx; import org.openide.util.Lookup; import org.openide.util.actions.NodeAction; /** * * @author Anuradha G */ public class MoveToDefault extends NodeAction { private MoveToDefault() { putValue(NAME, "Remove Task"); } @Override protected void performAction(Node[] activatedNodes) { Set<TaskFolder> refreshFolders = new HashSet<TaskFolder>(activatedNodes.length); for (Node node : activatedNodes) { TaskElement element = node.getLookup().lookup(TaskElement.class); TaskFolder container = node.getLookup().lookup(TaskFolder.class); if (element != null && container != null) { TasksFileSystem fileSystem = Lookup.getDefault().lookup(TasksFileSystem.class); fileSystem.removeTaskElement(container, element); refreshFolders.add(container); } } for (TaskFolder container : refreshFolders) { TaskFolderRefreshable oldTfr = container.getLookup().lookup(TaskFolderRefreshable.class); if (oldTfr != null) { oldTfr.refreshNode(); } } } @Override protected boolean enable(Node[] activatedNodes) { for (Node node : activatedNodes) { if (node.getLookup().lookup(TaskElement.class) == null || node.getLookup().lookup(TaskFolder.class) == null) { return false; } } return true; } @Override public String getName() { return (String) getValue(NAME); } @Override public HelpCtx getHelpCtx() { return new HelpCtx(MoveToDefault.class); } @Override protected boolean asynchronous() { return false; } }
[ "theanuradha@users.noreply.github.com" ]
theanuradha@users.noreply.github.com
2fd8374b6e882cb26664df4c73656f4678ba4031
34f5ab7476ec9c3c1f1e6a8f8dc5efd018210742
/src/main/java/utils/RemoteWebDriverFactory.java
fbefccd83701af689a54dffb8aeb376dfcb2f523
[]
no_license
Starday2009/RCvsWebDriver
c79dc2fe017e2ef9d61e6d23a2318f16bf920a72
54d3d5ab742349f604f29f24172d5676924043ff
refs/heads/master
2021-01-18T12:58:22.866961
2017-08-15T11:20:13
2017-08-15T11:20:13
100,370,008
0
0
null
null
null
null
UTF-8
Java
false
false
1,432
java
package utils; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import java.net.MalformedURLException; import java.net.URL; public class RemoteWebDriverFactory { public static WebDriver createInstance(String browserName) { URL hostURL = null; try { hostURL = new URL("http://127.0.0.1:6666/wd/hub"); } catch (MalformedURLException e) { e.printStackTrace(); } DesiredCapabilities capability = null; if (browserName.toLowerCase().contains("firefox")) { capability = DesiredCapabilities.firefox(); capability.setBrowserName("firefox"); } if (browserName.toLowerCase().contains("internet")) { capability = DesiredCapabilities.internetExplorer(); } if (browserName.toLowerCase().contains("chrome")) { capability = DesiredCapabilities.chrome(); capability.setBrowserName("chrome"); } WebDriver driver = new RemoteWebDriver(hostURL, capability); // Если захотите локально один браузер запустить // WebDriver driver = new FirefoxDriver(); // System.setProperty("webdriver.gecko.driver", "C:\\Windows\\geckodriver.exe"); driver.manage().window().maximize(); return driver; } }
[ "starday2009@mail.ru" ]
starday2009@mail.ru
fb245c64afa79e4de7e8d827b8e2b96e510d1054
af49433ef9e00dfb2b36b19460264579dacd067f
/src/main/java/no/capraconsulting/endpoints/TimeslotEndpoint.java
a5dfe182e67d30116d76e79cc6ccc4c5fcc42be4
[ "Apache-2.0" ]
permissive
capraconsulting/redcross-digital-leksehjelp-backend
a0509abefea37d903cf465e17a554bb903bfdab9
e33712768190b77f15cf2f316fddd2362f4540ed
refs/heads/master
2020-07-25T08:22:20.937069
2020-05-30T20:02:07
2020-05-30T20:02:07
208,228,913
0
0
Apache-2.0
2020-04-29T08:59:16
2019-09-13T08:54:52
Java
UTF-8
Java
false
false
2,410
java
package no.capraconsulting.endpoints; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import no.capraconsulting.db.Database; import no.capraconsulting.utils.EndpointUtils; import no.capraconsulting.auth.JwtFilter; import javax.sql.RowSet; import java.sql.SQLException; import org.json.JSONArray; import org.json.JSONObject; import static no.capraconsulting.endpoints.TimeslotEndpoint.TIMESLOT_PATH; @Path(TIMESLOT_PATH) public final class TimeslotEndpoint { private static Logger LOG = LoggerFactory.getLogger(TimeslotEndpoint.class); public static final String TIMESLOT_PATH = "/timeslots"; @GET @Path("/subject/{subjectID}") @Produces({MediaType.APPLICATION_JSON}) public Response getTimeslots(@PathParam("subjectID")int subjectID) { String query = "" + "SELECT day, from_time, to_time FROM TIMESLOTS " + "WHERE subject_id = ?"; try { RowSet result = Database.INSTANCE.selectQuery(query, subjectID); JSONArray payload = EndpointUtils.buildPayload(result); return Response.ok(payload.toString()).build(); } catch (SQLException e) { LOG.error(e.getMessage()); return Response.status(422).build(); } } @POST @Path("/subject/{subjectID}") @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @JwtFilter public Response postTimeslots(String payload, @PathParam("subjectID")int subjectID){ JSONObject data = new JSONObject(payload); String query = "INSERT INTO " + "TIMESLOTS (day, from_time, to_time, subject_id) " + "VALUES (?,?,?,?)"; try { Database.INSTANCE.manipulateQuery( query, false, data.getInt("day"), data.getString("from_time"), data.getString("to_time"), subjectID ); return Response.status(200).build(); } catch (SQLException e) { LOG.error(e.getMessage()); return Response.status(422).build(); } } }
[ "sandraskarshaug@gmail.com" ]
sandraskarshaug@gmail.com
bcfcacf0ec8f91662520a61967991f7f46e043a5
f5a023db0eff197215b7a93795025bd463d95f3b
/src/main/java/com/edfer/repository/logistica/AjudanteRepository.java
2e1dc57d1b1e3d34672c9a6d05facbb42408a5f3
[]
no_license
sauloddiniz/edfer_api
25a8955960ce31aac8fdc99fecd40edc5b52d79d
e8ffb4a65aa8150d83b2212c0721bc30b1065410
refs/heads/master
2023-02-09T08:56:53.819303
2020-12-31T18:17:20
2020-12-31T18:17:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.edfer.repository.logistica; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.edfer.model.logistica.Ajudante; @Repository public interface AjudanteRepository extends JpaRepository<Ajudante, Long>{ List<Ajudante> findAllByIsAtivoTrue(); }
[ "tuyco10@hotmail.com" ]
tuyco10@hotmail.com
e2921b46b7cef0539208d8b54ec779f2a560f37f
83d6b92f2309c5f99ca17d1806e476bc5d8e8625
/src/main/java/org/demo/guicedemo/server/controller/SpringAwareServletModule.java
e16d8255f1f6f6c73f0dd846168994a8f07c7514
[]
no_license
LeoFaye/guicedemo-spring
3ea45e91918c8d2d770c7e0644baa91aa00945dc
e687ec6699817917bef797a47281d162a3ee4d72
refs/heads/master
2020-05-30T16:02:48.009317
2019-06-25T14:53:26
2019-06-25T14:53:26
189,834,032
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
package org.demo.guicedemo.server.controller; import org.demo.guicedemo.server.persistence.SampleDao; import org.springframework.context.ApplicationContext; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.servlet.ServletModule; public class SpringAwareServletModule extends AbstractModule { private final ApplicationContext context; public SpringAwareServletModule(ApplicationContext context) { this.context = context; } @Override protected void configure() { install(new ServletModule()); } @Provides SampleDao getSampleDao() { return context.getBean(SampleDao.class); } }
[ "czt_queent@163.com" ]
czt_queent@163.com
1775f8d2c1edbe9ab676b30b7b9cd104d8676e23
57e0bb6df155a54545d9cee8f645a95f3db58fd2
/src/by/it/tsyhanova/at21/beans/User.java
d916cd7a027061fb819f1262e128aca6812f969c
[]
no_license
VitaliShchur/AT2019-03-12
a73d3acd955bc08aac6ab609a7d40ad109edd4ef
3297882ea206173ed39bc496dec04431fa957d0d
refs/heads/master
2020-04-30T23:28:19.377985
2019-08-09T14:11:52
2019-08-09T14:11:52
177,144,769
0
0
null
2019-05-15T21:22:32
2019-03-22T13:26:43
Java
UTF-8
Java
false
false
1,698
java
package by.it.tsyhanova.at21.beans; import java.util.Date; public class User { private long id; private String username; private String password; private String email; private Date date; //we need empty constructor Code>Generate>Constructor>Select None public User() { } //we need constructors for all fields public User(long id, String username, String password, String email, Date date) { this.id = id; this.username = username; this.password = password; this.email = email; this.date = date; } //we need get & set //Code>Generate>Getter and Setter public long getId() { return id; } public void setId(long id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } //we need to String //Code>Generate>toString() @Override public String toString() { return "User{" + "id=" + id + ", username='" + username + '\'' + ", password='" + password + '\'' + ", email='" + email + '\'' + ", date=" + date + '}'; } }
[ "tatsianatsyhanova@yahoo.com" ]
tatsianatsyhanova@yahoo.com
480589185b9c94f00a26a0ed6c5ea4b45fe2c286
f6c08d25310e07cb163497123b00168773daf228
/direct/io-hbase-bindings/src/main/java/cz/o2/proxima/direct/io/hbase/InternalSerializers.java
be85ef9714f40874408b9fdd7a79c087cbc0882c
[ "Apache-2.0" ]
permissive
O2-Czech-Republic/proxima-platform
91b136865cc5aabd157d08d02045893d8e2e6a87
2d5edad54a200d1d77b9f74e02d1d973ccc51608
refs/heads/master
2023-08-19T00:13:47.760910
2023-08-16T13:53:03
2023-08-16T13:53:03
108,869,877
20
7
Apache-2.0
2023-08-01T14:19:51
2017-10-30T15:26:01
Java
UTF-8
Java
false
false
2,136
java
/* * Copyright 2017-2023 O2 Czech Republic, a.s. * * 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 cz.o2.proxima.direct.io.hbase; import cz.o2.proxima.core.repository.AttributeDescriptor; import cz.o2.proxima.core.repository.EntityDescriptor; import cz.o2.proxima.core.storage.StreamElement; import cz.o2.proxima.direct.core.randomaccess.KeyValue; import cz.o2.proxima.direct.core.randomaccess.RawOffset; import java.nio.charset.StandardCharsets; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.client.Put; class InternalSerializers { static Put toPut(byte[] family, byte[] keyAsBytes, StreamElement element, byte[] rawValue) { String column = element.getAttribute(); Put put = new Put(keyAsBytes, element.getStamp()); put.addColumn(family, column.getBytes(StandardCharsets.UTF_8), element.getStamp(), rawValue); return put; } static <V> KeyValue<V> toKeyValue( EntityDescriptor entity, AttributeDescriptor<V> attrDesc, Cell cell, long seqId, byte[] rawValue) { String key = new String(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()); String attribute = new String(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); if (seqId > 0) { return KeyValue.of( entity, attrDesc, seqId, key, attribute, new RawOffset(attribute), rawValue, cell.getTimestamp()); } return KeyValue.of( entity, attrDesc, key, attribute, new RawOffset(attribute), rawValue, cell.getTimestamp()); } }
[ "je.ik@seznam.cz" ]
je.ik@seznam.cz
7bcdba09c70e05c3ed42f2b2a5f73ab8444c8f94
7545a5c84d1edeb90dc636cfcb36e391794bf3ee
/src/test/java/com/revature/services/userFeatures/ProductSelectRunner.java
ffb00d2e3ff9e49e423b5a8e4ef0c72786cc23bc
[]
no_license
210712-Richard/team3.p2
c4b743c5f295190827e7dd7350e6cd5a44083dfb
6dd1ae64d4f33c5e4efdc406bca94ce7a16526ff
refs/heads/main
2023-07-24T02:59:33.862458
2021-09-07T01:43:54
2021-09-07T01:43:54
396,980,264
1
0
null
2021-08-30T00:09:31
2021-08-16T21:32:28
Java
UTF-8
Java
false
false
231
java
package com.revature.services.userFeatures; import com.intuit.karate.junit5.Karate; public class ProductSelectRunner { @Karate.Test Karate testProductSelect() { return Karate.run("ProductSelect").relativeTo(getClass()); } }
[ "siddhant_99@hotmail.com" ]
siddhant_99@hotmail.com
a01f8f14dfba124e32378932c6e26a638bbe7070
604ed3d26c3a501383dc0d3a6cd0db756c7cff7e
/mall-coupon/src/main/java/com/cloud/mall/coupon/service/impl/HomeAdvServiceImpl.java
f027dd96f3575b7d0cc677ceee2d8cf360253889
[ "Apache-2.0" ]
permissive
zhengwilken/mall2021
626ad333ed8697aad5dedbec1d90a7c72d40cf20
210f10c90827348000b586389be56ee11a1dbe9d
refs/heads/main
2023-04-03T15:30:23.888106
2021-04-04T14:25:11
2021-04-04T14:25:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
956
java
package com.cloud.mall.coupon.service.impl; import org.springframework.stereotype.Service; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.cloud.common.utils.PageUtils; import com.cloud.common.utils.Query; import com.cloud.mall.coupon.dao.HomeAdvDao; import com.cloud.mall.coupon.entity.HomeAdvEntity; import com.cloud.mall.coupon.service.HomeAdvService; @Service("homeAdvService") public class HomeAdvServiceImpl extends ServiceImpl<HomeAdvDao, HomeAdvEntity> implements HomeAdvService { @Override public PageUtils queryPage(Map<String, Object> params) { IPage<HomeAdvEntity> page = this.page( new Query<HomeAdvEntity>().getPage(params), new QueryWrapper<HomeAdvEntity>() ); return new PageUtils(page); } }
[ "56677272+2276089666@users.noreply.github.com" ]
56677272+2276089666@users.noreply.github.com
a8f0e5f3059846b7b2d5893f01a7a5a4eea851a9
27df5f2ae2a3f0d2ec2a1672f48fbacdd7efa888
/src/main/java/io/javavrains/springbootstarter/topic/Topic.java
a57e9f59288dc2e82d9aaafd15a00bf56f606245
[]
no_license
nikitarai1511/course-api
db0099f1635b465b6b9de0dbe26bb0946bf72086
cf08265d1414f44e56470767c8a8e9e234dcdfdc
refs/heads/master
2020-05-20T00:17:10.931355
2019-05-06T23:04:47
2019-05-06T23:04:47
185,283,020
0
0
null
null
null
null
UTF-8
Java
false
false
729
java
package io.javavrains.springbootstarter.topic; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Topic { @Id private String Id; private String name; private String description; public Topic() { } public Topic(String id, String name, String description) { super(); Id = id; this.name = name; this.description = description; } public String getId() { return Id; } public void setId(String id) { Id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "nikitarai1511@gmail.com" ]
nikitarai1511@gmail.com
ba9da2ee7cc5f2001bac035723bcd72fd92b9f34
9343ec1738f22cfae799e8f8bb5af6d482426c0e
/app/src/main/java/com/example/tm18app/viewModels/OtherUserProfileViewModel.java
d11b0243c7cdb91d739a8d9c467d4d4e63f5f7a1
[]
no_license
sebampuero/android
858114e031c8ad92e8d37e11c5b1594b0d8a03c7
cd5421d61680ca3b63ff78c33df80384736dfbea
refs/heads/master
2020-09-16T22:16:50.520961
2020-02-01T13:10:33
2020-02-01T13:10:33
223,902,095
0
0
null
null
null
null
UTF-8
Java
false
false
893
java
package com.example.tm18app.viewModels; import androidx.lifecycle.LiveData; import com.example.tm18app.constants.Constant; import com.example.tm18app.model.User; import com.example.tm18app.repository.UserRepository; /** * {@link androidx.lifecycle.ViewModel} class for other user's profile UI * * @author Sebastian Ampuero * @version 1.0 * @since 03.12.2019 */ public class OtherUserProfileViewModel extends ProfileViewModel { private LiveData<User> mUserLiveData; public LiveData<User> getUserLiveData() { return mUserLiveData; } /** * Calls the repository to fetch the user's details * @param userId {@link String} */ public void callRepositoryForUser(String userId) { UserRepository repository = new UserRepository(); this.mUserLiveData = repository.getUser(userId, mPrefs.getString(Constant.PUSHY_TOKEN, "")); } }
[ "sebatorin@hotmail.com" ]
sebatorin@hotmail.com
db145404113bd1cf2958b4cd62c4f7b5bb933bbf
f136701aa16b2cb33f226ea259c2b807c2dea99c
/src/arrays/reverseArray.java
f6f94f9661188c900904a2b8ac68d7931818fe7c
[ "MIT" ]
permissive
everythingProgrammer/Algorithms
4364de3f0c4bc61290e793bc58a44f9a31a1a2b9
1da043f8b194d487b365f3e247fea02e1e370540
refs/heads/main
2023-04-19T15:15:22.341166
2021-05-01T11:58:19
2021-05-01T11:58:19
315,209,392
0
0
null
null
null
null
UTF-8
Java
false
false
233
java
package arrays; /* https://www.geeksforgeeks.org/write-a-program-to-reverse-an-array-or-string/ */ public class reverseArray { /*Iterative way and recursive way * initialize loop from 0 to n-1 and keep reversing * */ }
[ "ranaabhinav50@gmail.com" ]
ranaabhinav50@gmail.com
a7b0b9cf58a852248e287c192ff9772a9931e099
c38b4a165e9d2d2099a4e0be252316f75ddfe242
/src/main/java/com/bootcamp/TP/entities/IndicateurPerformance.java
8704a42182919f624a487949bfdd87d51b842d8d
[]
no_license
kikigith/gestionProjetRest
247a77294a5c43e86f97c1049b323f6d750d52ce
06e8d73e6d1ea7ece50049fc5968ee2e3f259305
refs/heads/master
2021-07-20T05:56:46.714698
2017-10-28T14:05:20
2017-10-28T14:05:20
107,785,023
0
0
null
null
null
null
UTF-8
Java
false
false
1,563
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.bootcamp.TP.entities; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * * @author ARESKO */ @Entity @Table(name = "tp_indicateurperformance") public class IndicateurPerformance implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(nullable = false, length = 45) private String libelle; @Column(nullable = false, length = 45) private String nature; @Column(nullable = false, length = 45) private String valeur; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getLibelle() { return libelle; } public void setLibelle(String libelle) { this.libelle = libelle; } public String getNature() { return nature; } public void setNature(String nature) { this.nature = nature; } public String getValeur() { return valeur; } public void setValeur(String valeur) { this.valeur = valeur; } }
[ "aremou1010@gmail.com" ]
aremou1010@gmail.com
d2259905a4238806c6b6a4c1f5e5fdc51e811a11
a472f2bbc57cfa8c07775434e950e3560707d924
/projeto/src/servers/FileServerClientSocket.java
e17cca95af1aa35ded27b92f9cb297bf4fdee449
[]
no_license
luizmoitinho/sistema-distribuido-arquivos
b13c66a194b665043d5dc6a82ae99f47b8ed26ca
4201d394b9a2fadcb76b051e70207f737a9b7c56
refs/heads/master
2023-07-02T02:49:16.864435
2021-07-17T03:23:36
2021-07-17T03:23:36
386,824,537
1
2
null
null
null
null
UTF-8
Java
false
false
1,674
java
package servers; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.Socket; import java.nio.file.Path; import java.nio.file.Paths; public class FileServerClientSocket extends Thread { private Socket s; private int folder; public FileServerClientSocket(Socket s) { this.s = s; } @Override public void run() { try { BufferedReader clientBuffer = new BufferedReader(new InputStreamReader(s.getInputStream())); String path = clientBuffer.readLine(); System.out.println(path); Path currentRelativePath = Paths.get(""); String url = currentRelativePath.toAbsolutePath().toString() + path; //File file = new File(url); //FileInputStream fileInputStream = new FileInputStream(file); FileInputStream fileIn = new FileInputStream(url); OutputStream socketOut = s.getOutputStream(); // Criando tamanho de leitura byte[] cbuffer = new byte[1024]; int bytesRead; // Lendo arquivo criado e enviado para o canal de transferencia while ((bytesRead = fileIn.read(cbuffer)) != -1) { socketOut.write(cbuffer, 0, bytesRead); socketOut.flush(); } fileIn.close(); s.close(); } catch (IOException ex) { System.out.println(ex); System.out.println("Erro"); } } }
[ "luizcarlos_costam@hotmail.com" ]
luizcarlos_costam@hotmail.com
9a08da59ecd3dce77ea409f541b73d1058878345
8f322f02a54dd5e012f901874a4e34c5a70f5775
/src/main/java/PTUCharacterCreator/Moves/Spike_Cannon.java
d6073c2c5480ebdd5db1d6b69c2de0a43d2020b6
[]
no_license
BMorgan460/PTUCharacterCreator
3514a4040eb264dec69aee90d95614cb83cb53d8
e55f159587f2cb8d6d7b456e706f910ba5707b14
refs/heads/main
2023-05-05T08:26:04.277356
2021-05-13T22:11:25
2021-05-13T22:11:25
348,419,608
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package PTUCharacterCreator.Moves; import PTUCharacterCreator.Move; public class Spike_Cannon extends Move { { name = "Spike Cannon"; effect = "--"; damageBase = 3; mDamageBase = 3; AC = 4; frequency = "EOT"; range = "6, 1 Target, Five Strike"; type = "Normal"; category = "Physical"; } public Spike_Cannon(){} }
[ "alaskablake460@gmail.com" ]
alaskablake460@gmail.com
f5b7c4cb4ec8fb074d5a165998fa9e541945d524
63ada9cff94f06a3131972a3f4f360d9fca95d7b
/BDD/src/test/java/com/epam/szte/bdd/runner/CucumberRunnerTest.java
6a7e1fe26a952eeaec2b8267162e851b57ab79f1
[]
no_license
Norbi1986/szte_university_bdd
42955b9122e7b5bbe32818e647e2052f9acf250e
0ff2552846dc68df47fb040fe0536300dcbee98f
refs/heads/master
2022-05-05T08:19:23.870683
2022-03-26T12:31:25
2022-03-26T12:31:25
177,166,426
0
0
null
2021-03-23T22:26:03
2019-03-22T15:34:54
Java
UTF-8
Java
false
false
447
java
package com.epam.szte.bdd.runner; import org.junit.runner.RunWith; import io.cucumber.junit.Cucumber; import io.cucumber.junit.CucumberOptions; @RunWith(Cucumber.class) @CucumberOptions( features = {"src/test/resources/features"}, glue = {"com.epam.szte.bdd.hooks", "com.epam.szte.bdd.steps"}, plugin = {"html:target/cucumber", "json:target/cucumber-json-report.json","pretty"} //tags = "@shop" ) public class CucumberRunnerTest { }
[ "norbert_fabian@epam.com" ]
norbert_fabian@epam.com
98a96f590bab0816f8d855ffb6de41dea18d82f2
6722478e2f6ffc34f4f17ac658e65e72840d2ded
/src/main/java/com/tnt/beer/order/repository/BeerOrderRepository.java
67c2411a91dd52154e2567cad5682b29047650f6
[]
no_license
somnath46/tnt-beer-order-service
a2d7a9946fccd585c7f8f212c504a839d6c176d2
363189d7c0a00f755cfb6e34c6451a1c69b76cf9
refs/heads/master
2022-12-27T19:46:04.421726
2020-10-10T15:10:58
2020-10-10T15:10:58
292,618,945
0
0
null
null
null
null
UTF-8
Java
false
false
788
java
package com.tnt.beer.order.repository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Lock; import com.tnt.beer.order.domain.BeerOrder; import com.tnt.beer.order.domain.Customer; import com.tnt.beer.order.domain.OrderStatusEnum; import javax.persistence.LockModeType; import java.util.List; import java.util.UUID; public interface BeerOrderRepository extends JpaRepository<BeerOrder, UUID> { Page<BeerOrder> findAllByCustomer(Customer customer, Pageable pageable); List<BeerOrder> findAllByOrderStatus(OrderStatusEnum orderStatusEnum); @Lock(LockModeType.PESSIMISTIC_WRITE) BeerOrder findOneById(UUID id); }
[ "4684.somnath@gmail.com" ]
4684.somnath@gmail.com
47f7e98ce6ab5b4ebcb1117d3a334947d051bad1
a8577246f305a4b62c04661b20280daf3eeebc7e
/src/main/java/com/cherrysoft/bugtracker/service/dto/PasswordChangeDTO.java
e6f78a7051931b81a4bb3affd96509cbb5f73def
[]
no_license
UKirsche/BugTrackerJHipster
317e4b04ead500964c5dd60aabc8e5706152c734
7adc1016cb87822291797dfae9a0eae7c221637d
refs/heads/master
2022-12-21T22:11:15.985835
2019-07-25T11:45:45
2019-07-25T11:45:45
198,821,978
0
1
null
2022-12-16T05:02:33
2019-07-25T11:52:47
Java
UTF-8
Java
false
false
869
java
package com.cherrysoft.bugtracker.service.dto; /** * A DTO representing a password change required data - current and new password. */ public class PasswordChangeDTO { private String currentPassword; private String newPassword; public PasswordChangeDTO() { // Empty constructor needed for Jackson. } public PasswordChangeDTO(String currentPassword, String newPassword) { this.currentPassword = currentPassword; this.newPassword = newPassword; } public String getCurrentPassword() { return currentPassword; } public void setCurrentPassword(String currentPassword) { this.currentPassword = currentPassword; } public String getNewPassword() { return newPassword; } public void setNewPassword(String newPassword) { this.newPassword = newPassword; } }
[ "ukirschenmann@gmx.de" ]
ukirschenmann@gmx.de
d23fbabd20ddd81aacf7ae9f13ca4f25843bd061
fbd8937cb8a8f83390b4ee94ca29724dc5699735
/src/main/java/com/example/d2z/entity/DataConsole.java
650b3fbe58ad34275f1d7e86cde83ae875507440
[]
no_license
rafikahamed/JpdGlobalService
681f1056c9d1bec31a0ab286a310d15e168840b7
70483827fb40bbd9ef8179f996364a6844853834
refs/heads/master
2020-03-26T19:54:33.906465
2019-01-14T04:17:08
2019-01-14T04:17:08
145,292,705
0
0
null
null
null
null
UTF-8
Java
false
false
3,990
java
package com.example.d2z.entity; import java.io.Serializable; import javax.persistence.*; import java.math.BigDecimal; import java.util.Date; /** * The persistent class for the data_console database table. * */ @Entity @Table(name="data_console") @NamedQuery(name="DataConsole.findAll", query="SELECT d FROM DataConsole d") @NamedStoredProcedureQueries({ @NamedStoredProcedureQuery(name = "delete_gst_data", procedureName = "deleteRecord", parameters = { @StoredProcedureParameter(mode = ParameterMode.IN, name = "reference_no", type = String.class) }) }) public class DataConsole implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; private BigDecimal amount; @Column(name="aud_converted_amount") private BigDecimal audConvertedAmount; @Column(name="currency_code") private String currencyCode; @Column(name="file_name") private String fileName; @Column(name="GST_eligible") private String gstEligible; @Column(name="GST_payable") private BigDecimal gstPayable; @Column(name="reference_no") private String referenceNo; @Column(name="report_indicator") private String reportIndicator; @Temporal( TemporalType.DATE ) @Column(name="sale_date") private java.util.Date saleDate; @Temporal( TemporalType.DATE ) @Column(name="txn_date") private Date txnDate; @Temporal( TemporalType.DATE ) @Column(name="upload_date") private Date uploadDate; @Column(name="user_code") private String userCode; @Column(name="company_name") private String companyName; private String username; private String isdeleted; public DataConsole() { } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public BigDecimal getAudConvertedAmount() { return audConvertedAmount; } public void setAudConvertedAmount(BigDecimal audConvertedAmount) { this.audConvertedAmount = audConvertedAmount; } public String getCurrencyCode() { return this.currencyCode; } public void setCurrencyCode(String currencyCode) { this.currencyCode = currencyCode; } public String getFileName() { return this.fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getGstEligible() { return this.gstEligible; } public void setGstEligible(String gstEligible) { this.gstEligible = gstEligible; } public BigDecimal getGstPayable() { return this.gstPayable; } public void setGstPayable(BigDecimal gstPayable) { this.gstPayable = gstPayable; } public String getReferenceNo() { return this.referenceNo; } public void setReferenceNo(String referenceNo) { this.referenceNo = referenceNo; } public String getReportIndicator() { return this.reportIndicator; } public void setReportIndicator(String reportIndicator) { this.reportIndicator = reportIndicator; } public Date getSaleDate() { return saleDate; } public void setSaleDate(Date saleDate) { this.saleDate = saleDate; } public Date getTxnDate() { return txnDate; } public void setTxnDate(Date txnDate) { this.txnDate = txnDate; } public Date getUploadDate() { return uploadDate; } public void setUploadDate(Date uploadDate) { this.uploadDate = uploadDate; } public String getUserCode() { return this.userCode; } public void setUserCode(String userCode) { this.userCode = userCode; } public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getIsdeleted() { return this.isdeleted; } public void setIsdeleted(String isdeleted) { this.isdeleted = isdeleted; } }
[ "“rahameda@paypal.com git config --global user.email “rahameda@paypal.com" ]
“rahameda@paypal.com git config --global user.email “rahameda@paypal.com
cb6ad58a09555367df1ebbe444628fac20615a38
6a21ee4d759e1e224fe1c402368094423c7c77af
/pmp-domain/src/main/java/com/shenxin/core/control/Enum/StatisticalGradEnum.java
595665a974ddfc6f74acf9958605248500d25024
[]
no_license
baozong-gao/bjui_control_template-
19edff3cbdddd316db3a68fbd9b0680df7696311
9ebe4436b2b7c80a36f7499ad634658e12ad2c3f
refs/heads/master
2021-08-31T17:38:41.621556
2017-12-22T08:05:59
2017-12-22T08:05:59
115,091,944
0
0
null
null
null
null
UTF-8
Java
false
false
590
java
package com.shenxin.core.control.Enum; import java.util.Calendar; //0:日 , 1:月 ,2:all(所有) public enum StatisticalGradEnum { DAY(0,"当天"),MONTH(1,"当月"),ALL(2,"全部"); private int grad; private Calendar time; private String legendName; StatisticalGradEnum(int grad,String legendName){ this.grad = grad; this.legendName = legendName; } public int getGrad() { return grad; } public Calendar getTime() { return time; } public void setTime(Calendar time) { this.time = time; } public String getLegendName() { return legendName; } }
[ "gaobaozong@77pay.com.cn" ]
gaobaozong@77pay.com.cn
abb1df0400bc6d44f616dd5dca392d3a740fe26a
722d4949660a79e9a58acb887e42908f418996d5
/zookeeper-action/src/main/java/com/chenxi/zookeeper/basic/zkclient/WriteData.java
4ec4005c136068ffe2fcbbf05d2466a29776f7c1
[]
no_license
chenxi-zhao/frameworks4j-maven
2e896c96008c2a12c1b80b863f10693552237357
0b36f5471698014e8063050ac193692abf93e3b5
refs/heads/master
2021-09-20T22:29:30.165580
2018-04-17T08:20:10
2018-04-17T08:20:10
82,508,655
0
0
null
2021-08-09T20:49:07
2017-02-20T02:35:44
JavaScript
UTF-8
Java
false
false
454
java
package com.chenxi.zookeeper.basic.zkclient; import org.I0Itec.zkclient.ZkClient; import org.I0Itec.zkclient.serialize.SerializableSerializer; public class WriteData { public static void main(String[] args) { ZkClient zc = new ZkClient("192.168.208.128:2181",10000,10000,new SerializableSerializer()); System.out.println("conneted ok!"); User u = new User(); u.setId(2); u.setName("test2"); zc.writeData("/node_1", u, 1); } }
[ "zhaochx1@yonyou.com" ]
zhaochx1@yonyou.com
15399474d4ea3a66f8f833966b235f9b61743ccb
bd0d51c6c6e88d39cbf38b7eeb9059632afe5161
/cars/src/main/java/com/lgz/cras/service/impl/UserServiceImpl.java
f353ce1fdb807c026bf6db448f9efb922b7753ab
[]
no_license
18168215586/zhou
c381d869bba85868ce5193a77a124f000f324e89
ce91f4720813dc87998c327a7ff12e092c924554
refs/heads/master
2022-12-24T00:32:15.633181
2019-06-14T09:09:24
2019-06-14T09:09:24
188,986,175
0
0
null
2022-12-16T07:13:59
2019-05-28T08:22:43
HTML
UTF-8
Java
false
false
2,953
java
package com.lgz.cras.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.lgz.cras.mapper.UserMapper; import com.lgz.cras.pojo.User; import com.lgz.cras.service.UserService; import com.lgz.cras.util.MD5Util; import com.lgz.cras.util.MyUtils; import com.lgz.cras.util.ResBean; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpSession; import java.util.HashMap; import java.util.List; import java.util.Map; @Service @Transactional public class UserServiceImpl implements UserService { @Autowired private UserMapper userMapper; @Override/*自动注入注解*/ public User getInfoByid(Integer id) { return userMapper.selectByPrimaryKey(id); } @Override public User login(User user) { return userMapper.login(user); } @Override public ResBean getPage(int page, int limit, User user) { Map<String,Object> map=new HashMap<>(); PageHelper.startPage(page,limit); List<User> list=userMapper.getPage(user); PageInfo<User> pageInfo=new PageInfo<>(list); return new ResBean(0,"暂无数据",pageInfo.getTotal(),list); } @Override public ResBean checkUname(String username) { User user=userMapper.checkUname(username); if (user==null){ return new ResBean(0); } return new ResBean(1); } @Override public ResBean update(User user, HttpSession session) { if (StringUtils.isNotEmpty(user.getPassword())){ user.setPassword(MD5Util.MD5(user.getPassword())); } int result=0; if (user.getId()==null){ user.setCreateDate(MyUtils.getNowTime()); user.setCreateAdmin(MyUtils.getLoginName(session)); result=userMapper.insertSelective(user); }else { user.setUpdateDate(MyUtils.getNowTime()); user.setCreateAdmin(MyUtils.getLoginName(session)); result=userMapper.updateByPrimaryKeySelective(user); } if (result>0){ return new ResBean(1,"更新成功"); }else { return new ResBean(0,"更新失败"); } } @Override public ResBean delete(Integer id) { if (userMapper.deleteByPrimaryKey(id)>0){ return new ResBean(1,"删除成功"); } return new ResBean(0,"删除失败"); } @Override public User getById(Integer id) { return userMapper.selectByPrimaryKey(id); } @Override public ResBean checkPwd(User user) { user.setPassword(MD5Util.MD5(user.getPassword())); if (userMapper.checkPwd(user)!=null){ return new ResBean(0); } return new ResBean(1); } }
[ "592058790@qq.com" ]
592058790@qq.com
1881d84870f5592d7991a0d5963fa5d0975b8ba2
875055e950b13244a6c624e13c2a9feb227f6695
/src/com/wyh/pattern/Customer.java
ee3c1042f117bd11bed53b39f5eb25eeb40c17bc
[]
no_license
wyhuiii/ChainOfResponsibility
e60d67cf32875c087601c1b7354c9eb3b580f102
7887d60a1c8b758f40055c4d42f42dec28450a0e
refs/heads/master
2020-06-16T06:42:50.910394
2019-07-06T09:38:45
2019-07-06T09:38:45
195,504,827
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
package com.wyh.pattern; /** * <p>Title: Customer</p> * <p>Description: 客户实体 * 属性:想要申请的折扣 * 方法:向审批人提出申请(客户不关心该申请经过了哪些级别,也不关心最后由谁批准了) * </p> * @author wyh * @date Jul 6, 2019 */ public class Customer { private float discount; public void setDiscount(float discount) { this.discount = discount; } //在传入审批人参数时,审批人直接由审批人工厂创建 public void request(PriceHandler proccessor) { //有了审批人之后,调用方法处理具体的审批流程 proccessor.proccessDiscount(discount); } }
[ "wyhuii@126.com" ]
wyhuii@126.com
a841eebcf906834fd8e36f7557f03511103dd15e
cd602223060180939d6eb2a02729f1bfa35a4fa5
/app/src/main/java/com/chunsun/redenvelope/app/MainApplication.java
c6a3de38b686b7d72df3834fb4bdb2fdfe47846d
[]
no_license
himon/ChunSunRE
25c351ea2385b9c7c0ef494e5604a09fa315c07e
44cfdec4ad97eaecc9913f48dcec278aba84f963
refs/heads/master
2021-01-18T22:09:20.095786
2016-04-28T14:25:01
2016-04-28T14:25:01
41,711,612
3
0
null
null
null
null
UTF-8
Java
false
false
11,610
java
package com.chunsun.redenvelope.app; import android.app.Application; import android.app.Service; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.os.Build; import android.os.Vibrator; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.chunsun.redenvelope.R; import com.chunsun.redenvelope.app.context.LoginContext; import com.chunsun.redenvelope.app.state.impl.LoginState; import com.chunsun.redenvelope.app.state.impl.LogoutState; import com.chunsun.redenvelope.constants.Constants; import com.chunsun.redenvelope.entities.json.UserInfoEntity; import com.chunsun.redenvelope.event.BaiduMapLocationEvent; import com.chunsun.redenvelope.preference.Preferences; import com.chunsun.redenvelope.utils.AppUtil; import com.chunsun.redenvelope.utils.helper.ImageLoaderHelper; import com.chunsun.redenvelope.utils.manager.AppManager; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; import org.json.JSONException; import org.json.JSONObject; import de.greenrobot.event.EventBus; /** * Created by Administrator on 2015/7/16. */ public class MainApplication extends Application { private static MainApplication instance; private UserInfoEntity mUserEntity; private String mImei; private DisplayImageOptions mHeadOptions; private String mShareHost; /** * 百度地图 */ private LocationClient mLocationClient; private MyLocationListener mMyLocationListener; private Vibrator mVibrator; private double mLatitude = 0; private double mLongitude = 0; private String mProvince = "不限"; private String mCity = "不限"; private Preferences mPreferences; /** * app当前版本号 */ private String mAppVersion; public LocationClient getLocationClient() { return mLocationClient; } public String getmShareHost() { return mShareHost; } public void setmShareHost(String mShareHost) { this.mShareHost = mShareHost; } /** * 获取用户信息 * * @return */ public UserInfoEntity getUserEntity() { return mUserEntity; } /** * 设置用户信息 * * @param entity */ public void setmUserEntity(UserInfoEntity entity) { this.mUserEntity = entity; } /** * 获取Imei码 * * @return */ public String getmImei() { return mImei; } public DisplayImageOptions getHeadOptions() { return mHeadOptions; } /** * 获取当前城市 * * @return */ public String getCity() { return mCity; } /** * 获取当前省份 * * @return */ public String getProvince() { return mProvince; } /** * 获取经度 * * @return */ public double getLongitude() { return mLongitude; } /** * 获取纬度 * * @return */ public double getLatitude() { return mLatitude; } public String getmAppVersion() { return mAppVersion; } public void setmAppVersion(String mAppVersion) { this.mAppVersion = mAppVersion; } /** * 获取MainApplication对象 * * @return */ public static MainApplication getContext() { return instance; } public MainApplication() { instance = this; } @Override public void onCreate() { super.onCreate(); initIMEI(); initHeadOptions(); initBaiduMap(); initUserState(); mAppVersion = AppUtil.getVersion(getContext()); ImageLoader.getInstance().init(ImageLoaderHelper.getInstance(this).getImageLoaderConfiguration(Constants.IMAGE_LOADER_CACHE_PATH)); mPreferences = new Preferences(getApplicationContext()); String province = mPreferences.getProvinceData(); String city = mPreferences.getCityData(); String longitude = mPreferences.getLongitude(); String latitude = mPreferences.getLatitude(); if (!TextUtils.isEmpty(province)) { mProvince = province; } if (!TextUtils.isEmpty(city)) { mCity = city; } if (!TextUtils.isEmpty(longitude)) { mLongitude = Double.parseDouble(longitude); } if (!TextUtils.isEmpty(latitude)) { mLatitude = Double.parseDouble(latitude); } // 全局捕获异常 //MyCrashHandler handler = MyCrashHandler.getInstance(); //Thread.currentThread().setUncaughtExceptionHandler(handler); } /** * 初始化登录状态 */ private void initUserState() { if(TextUtils.isEmpty(new Preferences(this).getToken())){ LoginContext.getLoginContext().setState(new LogoutState()); }else{ LoginContext.getLoginContext().setState(new LoginState()); } } private void initHeadOptions() { mHeadOptions = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.img_default_capture) .showImageForEmptyUri(R.drawable.img_default_head) .showImageOnFail(R.drawable.img_default_head) .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true).displayer(new RoundedBitmapDisplayer(20))//为图片添加圆角显示在ImageAware中 .bitmapConfig(Bitmap.Config.RGB_565).build(); } /** * 获取手机信息 * * @return */ public String getPhoneInfomation() { PackageManager manager = getPackageManager(); String systemVersion = Build.VERSION.RELEASE;//系统版本号 String version = "";//软件版本 String channelName = Constants.CHANNEL_PACKAGE_NAME;//渠道地址 String mobile = Build.MODEL;//手机型号 JSONObject jsonObject = new JSONObject(); try { PackageInfo info = manager.getPackageInfo(getPackageName(), 0); version = info.versionName; jsonObject.put("version", version); jsonObject.put("system_name", "android"); jsonObject.put("system_version", systemVersion); jsonObject.put("mobile_model", mobile); jsonObject.put("software_download_channel", channelName); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return jsonObject.toString(); } /** * 初始化IMEI码 */ public void initIMEI() { TelephonyManager telephonyManager = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE); mImei = telephonyManager.getDeviceId(); } public void exitApp() { AppManager.getAppManager().finishAllActivityAndExit(); System.gc(); android.os.Process.killProcess(android.os.Process.myPid()); } /*--------------------------------------------------- 百度地图 -----------------------------------------------------------*/ /** * 初始化百度地图所需的信息 */ public void initBaiduMap() { //声明LocationClient类 mLocationClient = new LocationClient(this.getApplicationContext()); mMyLocationListener = new MyLocationListener(); ////注册监听函数 mLocationClient.registerLocationListener(mMyLocationListener); mVibrator = (Vibrator) getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE); initLocation(); mLocationClient.start(); } /** * 实现实时位置回调监听 */ public class MyLocationListener implements BDLocationListener { @Override public void onReceiveLocation(BDLocation location) { mLatitude = location.getLatitude(); mLongitude = location.getLongitude(); mProvince = location.getProvince() == null ? "不限" : location.getProvince(); mCity = location.getCity() == null ? "不限" : location.getCity(); mPreferences.setProvinceData(mProvince); mPreferences.setCityData(mCity); mPreferences.setLatitude(mLatitude + ""); mPreferences.setLongitude(mLongitude + ""); if (location.getLocType() == BDLocation.TypeGpsLocation) {// GPS定位结果 System.out.println("GPS定位结果"); } else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {// 网络定位结果 System.out.println("网络定位结果"); } else if (location.getLocType() == BDLocation.TypeOffLineLocation) {// 离线定位结果 System.out.println("离线定位结果"); } else if (location.getLocType() == BDLocation.TypeServerError) { System.out.println("服务端网络定位失败,可以反馈IMEI号和大体定位时间到loc-bugs@baidu.com,会有人追查原因"); } else if (location.getLocType() == BDLocation.TypeNetWorkException) { System.out.println("网络不同导致定位失败,请检查网络是否通畅"); } else if (location.getLocType() == BDLocation.TypeCriteriaException) { System.out.println("无法获取有效定位依据导致定位失败,一般是由于手机的原因,处于飞行模式下一般会造成这种结果,可以试着重启手机"); } mLocationClient.stop(); EventBus.getDefault().post(new BaiduMapLocationEvent("")); } } private void initLocation() { LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系, int span = 0; option.setScanSpan(span);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的 option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要 option.setOpenGps(true);//可选,默认false,设置是否使用gps option.setLocationNotify(false);//可选,默认false,设置是否当gps有效时按照1S1次频率输出GPS结果 option.setIgnoreKillProcess(true);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死 option.setEnableSimulateGps(false);//可选,默认false,设置是否需要过滤gps仿真结果,默认需要 option.setIsNeedLocationDescribe(false);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近” option.setIsNeedLocationPoiList(false);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到 mLocationClient.setLocOption(option); } }
[ "258798596@qq.com" ]
258798596@qq.com
bd24bb293fc7b4f8f36a4a4b8625fb9862dff5f4
724dc8749fa3879be920934da8da4427ba2e8dea
/src/main/java/cn/edu/zzia/bookstore/service/IPrivilegeService.java
fdd6b707202903282a8d0d5cbef8e05f3edd73fb
[]
no_license
wangkai93/bookstore
af808a9725c8c47498b4e47c4db9b9a32966ad25
292d87ed014b0609f258e5c5fc19e825c4c54ac4
refs/heads/master
2020-05-24T23:21:19.448852
2017-03-20T07:00:28
2017-03-20T07:00:28
84,890,049
0
0
null
null
null
null
UTF-8
Java
false
false
602
java
package cn.edu.zzia.bookstore.service; import java.util.List; import cn.edu.zzia.bookstore.domain.Page; import cn.edu.zzia.bookstore.domain.Privilege; public interface IPrivilegeService { public static final String SERVICE_NAME = "cn.edu.zzia.bookstore.service.impl.PrivilegeServiceImpl"; /** * 分页查找权限信息 * @param pagenum * @return */ Page findPrivilegesByPage(String pagenum); /** * 保存权限信息 * @param privilege */ void savePrivilege(Privilege privilege); /** * 查找所有的权限信息 * @return */ List<Privilege> findAllPrivilege(); }
[ "carterwang@izmkh.com" ]
carterwang@izmkh.com
4e084d345eb273119b56f8ba70719c1d64065fc7
4353ca274ab5a587af3856d78fdfcba7d0b44bbb
/javatest/src/main/java/com/netty/Share/ReplyMsg.java
72b50454f68e389e9cfaedb4d68f80b0decd9475
[]
no_license
JackDong520/AndroidAppPro
e6aa165f2d9056dc2a311e0abb1c60f363ded3c7
9599a129210174417d88135490b33cbb1c2b767d
refs/heads/master
2022-01-17T06:04:01.774566
2019-07-23T07:33:57
2019-07-23T07:33:57
198,377,403
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package com.netty.Share; /** * Created by yaozb on 15-4-11. */ public class ReplyMsg extends BaseMsg { public ReplyMsg() { super(); setType(MsgType.REPLY); } private ReplyBody body; public ReplyBody getBody() { return body; } public void setBody(ReplyBody body) { this.body = body; } }
[ "724083996@qq.com" ]
724083996@qq.com
0b810595b21eefc410b2a52c851314b895a19829
db9dabca10a859af1930ce9aad733352502b4177
/app/src/main/java/com/centaurs/tmdbapp/util/NetworkConnectionUtil.java
dfdb3afdc79ac3191b2811f6033e0f92bc3b1730
[]
no_license
zaharij/TMDBApp
4ae4c4181ef4de78745fd72cf5332a0e09d899c1
edd07e14ed7e36389af9b832b4035de11755e08a
refs/heads/master
2021-08-19T21:54:31.312337
2017-11-13T13:45:07
2017-11-13T13:45:07
105,163,524
0
0
null
2017-11-13T13:45:57
2017-09-28T15:09:17
Java
UTF-8
Java
false
false
732
java
package com.centaurs.tmdbapp.util; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import javax.inject.Singleton; @Singleton public class NetworkConnectionUtil { private Context context; public NetworkConnectionUtil(Context context){ this.context = context; } public boolean isNetworkConnected(){ ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager != null ? connectivityManager.getActiveNetworkInfo() : null; return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } }
[ "zahar.yastrub@gmail.com" ]
zahar.yastrub@gmail.com
d25f9b6dc9c431990cecab4b4f05a0a124689b8d
d9d9d635f25c68cdfe28ee8bd21082b5975f2f61
/review_java/src/main/java/com/unknown/base/io/Practice.java
aed8c685d5b8c2a5f1405e0ca508c89f3a23c7b7
[]
no_license
ArchangelLiang/myHelloWorldProjects
f87b96f29a5b39367e7fb84671612f8bb81b7125
290cb82b417a695c514dfa360d9967400729b8e7
refs/heads/master
2022-12-26T07:03:15.478125
2020-01-30T11:24:58
2020-01-30T11:24:58
235,990,443
0
0
null
2022-12-16T14:52:36
2020-01-24T11:27:50
Java
UTF-8
Java
false
false
1,333
java
package com.unknown.base.io; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; public class Practice { public static void main(String[] args) { File file = new File("review_jdbc\\test_io\\zio.txt"); FileReader read = null; HashMap<String, Integer> map = new HashMap<>(); try { read = new FileReader(file); char[] chars = new char[5]; int data_num; while ((data_num = read.read(chars)) != -1) { for (int i = 0; i < data_num; i++) { String key = String.valueOf(chars[i]); if (map.containsKey(key)) { Integer num = map.get(key); num++; map.put(key, num); } else { if (!key.equals(" ")) map.put(key, 1); } } } } catch (Exception e) { e.printStackTrace(); } finally { if (read != null) { try { read.close(); } catch (IOException e) { e.printStackTrace(); } } } System.out.println(map); } }
[ "2320322504@qq.com" ]
2320322504@qq.com
19564ccd3386dbbfcea9328bbba9db60bc6cb586
e6f0df9c2e1f2d5eb020f75e160bd358933c923b
/homework7-car-database/src/main/java/com/springcourse/homework7cardatabase/model/Car.java
6673e3acfdfd28ecbd4f0dd82566284bbf0aa9f4
[]
no_license
marcinPluciennik/akademia-springa
6decb1a911bb60d7cd108aec2cf0939e08e583ac
8aca9b5a06d88f93ab55a6cc2b460d5657d48ba3
refs/heads/master
2023-04-02T02:50:42.228744
2021-04-15T12:15:39
2021-04-15T12:15:39
309,067,902
0
0
null
null
null
null
UTF-8
Java
false
false
1,259
java
package com.springcourse.homework7cardatabase.model; public class Car { private long carId; private String mark; private String model; private String color; private int year; public Car(long carId, String mark, String model, String color, int year) { this.carId = carId; this.mark = mark; this.model = model; this.color = color; this.year = year; } public Car() { } public long getCarId() { return carId; } public void setCarId(long carId) { this.carId = carId; } public String getMark() { return mark; } public void setMark(String mark) { this.mark = mark; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } @Override public String toString() { return "Car{" + "carId=" + carId + ", mark='" + mark + '\'' + ", model='" + model + '\'' + ", color='" + color + '\'' + ", year=" + year + '}'; } }
[ "marcinpluciennik76@gmail.com" ]
marcinpluciennik76@gmail.com
890de590f0b9b47002a586690f7652d824a5fb7c
7f300f813bc38d625e48ce03f7b695064a0bd116
/BBDJPA/src/javax/persistence/Entity.java
80521fc6cf3f8e36e14f5f88741d90b447465565
[ "Apache-2.0" ]
permissive
microneering/BBD
7c55c462d6df755d08b26c979051012b5ae74d5a
ead95375216eeab07be30d396eff136033603302
refs/heads/master
2020-03-26T22:38:55.753264
2018-09-01T05:02:40
2018-09-01T05:02:40
145,476,582
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javax.persistence; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * * @author James Gamber */ @Retention(RetentionPolicy.RUNTIME) public @interface Entity { String name() default ""; }
[ "MP2E@archlinux.us" ]
MP2E@archlinux.us
5c6110bd12e1a896581d9c46ad02a74545ca6e40
4f085cb2d1f56fb4b01a03efb13e4b36821e50b2
/src/main/java/ChefScheduler.java
34e1ea4bdde63b49afa3463ab9a21823db85bb65
[]
no_license
SankulGarg/Competetive
ed3b9351515bcc71b019a61ab99b438dc8371cd0
b9dcb4abd5d6b790cd90ca67865cd794f0a3df25
refs/heads/main
2023-07-27T11:36:57.896517
2021-09-09T10:22:55
2021-09-09T10:22:55
352,002,005
0
0
null
null
null
null
UTF-8
Java
false
false
2,380
java
import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; final public class ChefScheduler { public static boolean schedulable(HashMap<String, ArrayList<String>> requests) { System.out.println(requests); Map<String, List<String>> sorted = new LinkedHashMap<>(); for (Map.Entry<String, ArrayList<String>> entry : requests.entrySet()) { Set<String> allDays = new HashSet<String>(Set.of("mon", "tue", "wed", "thu", "fri", "sat", "sun")); for (String day : entry.getValue()) { allDays.remove(day); } sorted.put(entry.getKey(), allDays.stream().collect(Collectors.toList())); } sorted = sorted.entrySet().stream().sorted(Comparator.comparingInt(e -> e.getValue().size())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> { throw new AssertionError(); }, LinkedHashMap::new)); System.out.println(sorted); Map<String, Integer> days = new HashMap<>(); days.put("mon", 0); days.put("tue", 1); days.put("wed", 2); days.put("thu", 3); days.put("fri", 4); days.put("sat", 5); days.put("sun", 6); int[] chefCount = new int[7]; for (Map.Entry<String, List<String>> entry : sorted.entrySet()) { int employeeShiftCount = 0; for (String day : entry.getValue()) { if (days.size() == 0) return true; if (!days.containsKey(day)) continue; if (employeeShiftCount >= 5) break; chefCount[days.get(day)]++; employeeShiftCount++; if (chefCount[days.get(day)] == 2) days.remove(day); } } System.out.println(Arrays.toString(chefCount)); System.err.println(days); return days.size() == 0; } public static void main(String[] args) { HashMap<String, ArrayList<String>> requests = new HashMap<>(); requests.put("ada", new ArrayList<>(Arrays.asList(new String[] { "mon", "tue", "wed", "fri", "sat", "sun" }))); requests.put("emma", new ArrayList<>(Arrays.asList(new String[] { "mon", "tue", "wed", "thu", "sun" }))); requests.put("remy", new ArrayList<>(Arrays.asList(new String[] { "mon", "thu", "fri", "sat" }))); requests.put("zach", new ArrayList<>(Arrays.asList(new String[] {}))); ChefScheduler.schedulable(requests); } }
[ "sankulgarg93@gmail.com" ]
sankulgarg93@gmail.com
6ee9d8b3ab4e5957d20b3aa9128ae1eedb51731a
dd32e80952925832b417c5fb291d6b4c7c8e714d
/materialList/src/main/java/com/dexafree/materialList/view/WelcomeCardItemView.java
d573eaa3c0af0c692fb53a4aa6e76196c31b20e5
[]
no_license
giovannicolonna/PRIMETIME4U-client
eb7f0a6e502a1958d82edf6cbb1e89b2f421e62a
a55d4fa2bfc4187d4640745e9880afb35b28f330
refs/heads/master
2021-01-23T06:50:23.271083
2015-04-30T10:29:11
2015-04-30T10:29:11
27,669,519
0
1
null
null
null
null
UTF-8
Java
false
false
3,814
java
package com.dexafree.materialList.view; import android.content.Context; import android.graphics.PorterDuff; import android.os.Build; import android.support.v7.widget.CardView; import android.support.v7.widget.MyRoundRectDrawableWithShadow; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.dexafree.materialList.R; import com.dexafree.materialList.events.BusProvider; import com.dexafree.materialList.events.DismissEvent; import com.dexafree.materialList.model.WelcomeCard; public class WelcomeCardItemView extends GridItemView<WelcomeCard> { private TextView mTitle; private TextView mSubtitle; private TextView mDescription; private TextView mButton; private View mDivider; private RelativeLayout backgroundView; private ImageView checkMark; public WelcomeCardItemView(Context context) { super(context); } public WelcomeCardItemView(Context context, AttributeSet attrs) { super(context, attrs); } public WelcomeCardItemView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public void configureView(WelcomeCard card) { setTitle(card.getTitle()); setSubtitle(card.getSubtitle()); setDescription(card.getDescription()); setButton(card); setColors(card); } public void setTitle(String title){ mTitle = (TextView)findViewById(R.id.titleTextView); mTitle.setText(title); } public void setSubtitle(String subtitle){ mSubtitle = (TextView)findViewById(R.id.subtitleTextView); mSubtitle.setText(subtitle); } public void setDescription(String description){ mDescription = (TextView)findViewById(R.id.descriptionTextView); mDescription.setText(description); } public void setButton(final WelcomeCard card){ mButton = (TextView) findViewById(R.id.ok_button); mButton.setText(card.getButtonText()); mButton.setTextColor(card.getBackgroundColor()); final GridItemView<WelcomeCard> refView = this; mButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Log.d("CLICK", "Text clicked"); if(card.getOnButtonPressedListener() != null) { card.getOnButtonPressedListener().onButtonPressedListener(mButton); } BusProvider.getInstance().post(new DismissEvent(card)); } }); } private void setColors(WelcomeCard card){ CardView cardView = (CardView)findViewById(R.id.cardView); int textSize = pxToDp(36); if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { MyRoundRectDrawableWithShadow backgroundDrawable = new MyRoundRectDrawableWithShadow( getContext().getResources(), card.getBackgroundColor(), cardView.getRadius(), 6f, 6f ); cardView.setBackgroundDrawable(backgroundDrawable); } else { cardView.setBackgroundColor(card.getBackgroundColor()); cardView.setCardElevation(dpToPx(6)); } checkMark = (ImageView)findViewById(R.id.check_mark); mDivider = findViewById(R.id.cardDivider); mDivider.setBackgroundColor(card.getDividerColor()); mTitle.setTextColor(card.getTitleColor()); mSubtitle.setTextColor(card.getSubtitleColor()); mDescription.setTextColor(card.getDescriptionColor()); mButton.setTextColor(card.getButtonTextColor()); mButton.setTextSize((float) textSize); checkMark.setColorFilter(card.getButtonTextColor(), PorterDuff.Mode.SRC_IN); } }
[ "gc240790@gmail.com" ]
gc240790@gmail.com
61e5970820fbf813ee445402d41e6875b0fad23c
dc916f0e5579abfb4d6602d35f3d14cf459d3f6c
/src/main/java/com/volunteer/utils/ExcelUtil.java
3cd816ebde87a97d1e964e2dd6324b2830bd6ddb
[]
no_license
TOmANDJerryz/volunteer
a51264c7836b61b6b2746a6a6a363e64950ab847
ed9fa1aeb7c97d8de4bd6c3a8f4fa9158e41a6ec
refs/heads/master
2020-04-25T01:58:31.517153
2019-02-25T03:35:34
2019-02-25T03:35:34
172,423,811
1
0
null
null
null
null
UTF-8
Java
false
false
9,674
java
package com.volunteer.utils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.util.CellRangeAddress; import javax.servlet.http.HttpServletResponse; import java.io.FileOutputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; public class ExcelUtil { //显示的导出表的标题 private String title; //导出表的列名 private String[] rowName ; private List<Object[]> dataList = new ArrayList<Object[]>(); HttpServletResponse response; //构造方法,传入要导出的数据 public ExcelUtil(String title,String[] rowName,List<Object[]> dataList){ this.dataList = dataList; this.rowName = rowName; this.title = title; } /* * 导出数据 * */ public void export() throws Exception{ try{ HSSFWorkbook workbook = new HSSFWorkbook(); // 创建工作簿对象 HSSFSheet sheet = workbook.createSheet(title); // 创建工作表 // 产生表格标题行 HSSFRow rowm = sheet.createRow(0); HSSFCell cellTiltle = rowm.createCell(0); rowm.setHeight((short) (25 * 30)); //设置高度 //sheet样式定义【getColumnTopStyle()/getStyle()均为自定义方法 - 在下面 - 可扩展】 HSSFCellStyle columnTopStyle = this.getColumnTopStyle(workbook);//获取列头样式对象 HSSFCellStyle style = this.getStyle(workbook); //单元格样式对象 sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, (rowName.length-1))); cellTiltle.setCellStyle(columnTopStyle); cellTiltle.setCellValue(title); // 定义所需列数 int columnNum = rowName.length; HSSFRow rowRowName = sheet.createRow(2); // 在索引2的位置创建行(最顶端的行开始的第二行) rowRowName.setHeight((short) (25 * 30)); //设置高度 // 将列头设置到sheet的单元格中 for(int n=0;n<columnNum;n++){ HSSFCell cellRowName = rowRowName.createCell(n); //创建列头对应个数的单元格 cellRowName.setCellType(HSSFCell.CELL_TYPE_STRING); //设置列头单元格的数据类型 HSSFRichTextString text = new HSSFRichTextString(rowName[n]); cellRowName.setCellValue(text); //设置列头单元格的值 cellRowName.setCellStyle(columnTopStyle); //设置列头单元格样式 } //将查询出的数据设置到sheet对应的单元格中 for(int i=0;i<dataList.size();i++){ Object[] obj = dataList.get(i);//遍历每个对象 HSSFRow row = sheet.createRow(i+3);//创建所需的行数 row.setHeight((short) (25 * 20)); //设置高度 for(int j=0; j<obj.length; j++){ HSSFCell cell = null; //设置单元格的数据类型 if(j == 0){ cell = row.createCell(j,HSSFCell.CELL_TYPE_NUMERIC); cell.setCellValue(i+1); }else{ cell = row.createCell(j,HSSFCell.CELL_TYPE_STRING); if(!"".equals(obj[j]) && obj[j] != null){ cell.setCellValue(obj[j].toString()); //设置单元格的值 } } cell.setCellStyle(style); //设置单元格样式 } } //让列宽随着导出的列长自动适应 for (int colNum = 0; colNum < columnNum; colNum++) { int columnWidth = sheet.getColumnWidth(colNum) / 256; for (int rowNum = 0; rowNum < sheet.getLastRowNum(); rowNum++) { HSSFRow currentRow; //当前行未被使用过 if (sheet.getRow(rowNum) == null) { currentRow = sheet.createRow(rowNum); } else { currentRow = sheet.getRow(rowNum); } if (currentRow.getCell(colNum) != null) { HSSFCell currentCell = currentRow.getCell(colNum); if (currentCell.getCellType() == HSSFCell.CELL_TYPE_STRING) { int length = currentCell.getStringCellValue().getBytes().length; if (columnWidth < length) { columnWidth = length; } } } } if(colNum == 0){ sheet.setColumnWidth(colNum, (columnWidth-2) * 128); }else{ sheet.setColumnWidth(colNum, (columnWidth+4) * 256); } } if(workbook !=null){ try { // String fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls"; // String headStr = "attachment; filename=\"" + fileName + "\""; // response = getResponse(); // response.setContentType("APPLICATION/OCTET-STREAM"); // response.setHeader("Content-Disposition", headStr); // OutputStream out = response.getOutputStream(); // workbook.write(out); FileOutputStream out = new FileOutputStream("D:/" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()).toString() +".xls"); workbook.write(out); out.close(); } catch (IOException e) { e.printStackTrace(); } } }catch(Exception e){ e.printStackTrace(); } } /* * 列头单元格样式 */ public HSSFCellStyle getColumnTopStyle(HSSFWorkbook workbook) { // 设置字体 HSSFFont font = workbook.createFont(); //设置字体大小 font.setFontHeightInPoints((short)11); //字体加粗 font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); //设置字体名字 font.setFontName("Courier New"); //设置样式; HSSFCellStyle style = workbook.createCellStyle(); //设置底边框; style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //设置底边框颜色; style.setBottomBorderColor(HSSFColor.BLACK.index); //设置左边框; style.setBorderLeft(HSSFCellStyle.BORDER_THIN); //设置左边框颜色; style.setLeftBorderColor(HSSFColor.BLACK.index); //设置右边框; style.setBorderRight(HSSFCellStyle.BORDER_THIN); //设置右边框颜色; style.setRightBorderColor(HSSFColor.BLACK.index); //设置顶边框; style.setBorderTop(HSSFCellStyle.BORDER_THIN); //设置顶边框颜色; style.setTopBorderColor(HSSFColor.BLACK.index); //在样式用应用设置的字体; style.setFont(font); //设置自动换行; style.setWrapText(false); //设置水平对齐的样式为居中对齐; style.setAlignment(HSSFCellStyle.ALIGN_CENTER); //设置垂直对齐的样式为居中对齐; style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); //设置单元格背景颜色 style.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); return style; } /* * 列数据信息单元格样式 */ public HSSFCellStyle getStyle(HSSFWorkbook workbook) { // 设置字体 HSSFFont font = workbook.createFont(); //设置字体大小 //font.setFontHeightInPoints((short)10); //字体加粗 //font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); //设置字体名字 font.setFontName("Courier New"); //设置样式; HSSFCellStyle style = workbook.createCellStyle(); //设置底边框; style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //设置底边框颜色; style.setBottomBorderColor(HSSFColor.BLACK.index); //设置左边框; style.setBorderLeft(HSSFCellStyle.BORDER_THIN); //设置左边框颜色; style.setLeftBorderColor(HSSFColor.BLACK.index); //设置右边框; style.setBorderRight(HSSFCellStyle.BORDER_THIN); //设置右边框颜色; style.setRightBorderColor(HSSFColor.BLACK.index); //设置顶边框; style.setBorderTop(HSSFCellStyle.BORDER_THIN); //设置顶边框颜色; style.setTopBorderColor(HSSFColor.BLACK.index); //在样式用应用设置的字体; style.setFont(font); //设置自动换行; style.setWrapText(false); //设置水平对齐的样式为居中对齐; style.setAlignment(HSSFCellStyle.ALIGN_CENTER); //设置垂直对齐的样式为居中对齐; style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); return style; } }
[ "243661038@qq.com" ]
243661038@qq.com
cd221f09d206e8b70a14799a9de2e0d0c897c5f2
f1198aee5a975bed23255cf82120904bbd8c07ba
/src/test/java/seedu/address/testutil/DatabaseBuilder.java
a3046e7e3aa0fc4283f907199ed48f25cba2070e
[ "MIT" ]
permissive
duyson98/addressbook-level4
5201865b52d078155feedcf43b222f50dd27e884
2844c79056d7dc4eeca66cf6de01b0cc070bec92
refs/heads/master
2021-09-06T20:19:10.621167
2017-11-20T02:57:31
2017-11-20T02:57:31
105,089,282
0
0
null
2017-09-28T01:48:56
2017-09-28T01:48:56
null
UTF-8
Java
false
false
1,030
java
//@@author cqhchan package seedu.address.testutil; import seedu.address.model.Database; import seedu.address.model.account.ReadOnlyAccount; import seedu.address.model.account.exceptions.DuplicateAccountException; /** * */ public class DatabaseBuilder { private Database database; public DatabaseBuilder() { database = new Database(); } public DatabaseBuilder(Database database) { this.database = database; } /** * Adds a new {@code Account} to the {@code Database} that we are building. */ public DatabaseBuilder withAccount(ReadOnlyAccount account) { try { database.addAccount(account); } catch (DuplicateAccountException dpe) { throw new IllegalArgumentException("account is expected to be unique."); } return this; } /** * Parses {@code tagName} into a {@code Tag} and adds it to the {@code Database} that we are building. */ public Database build() { return database; } }
[ "cqhchan@gmail.com" ]
cqhchan@gmail.com
c85701054bf552566ff6b75b9e94b0789e45e041
a1e49f5edd122b211bace752b5fb1bd5c970696b
/projects/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java
7c979316666fbfbe276f7e9e63422bc13926702b
[ "Apache-2.0" ]
permissive
savster97/springframework-3.0.5
4f86467e2456e5e0652de9f846f0eaefc3214cfa
34cffc70e25233ed97e2ddd24265ea20f5f88957
refs/heads/master
2020-04-26T08:48:34.978350
2019-01-22T14:45:38
2019-01-22T14:45:38
173,434,995
0
0
Apache-2.0
2019-03-02T10:37:13
2019-03-02T10:37:12
null
UTF-8
Java
false
false
7,613
java
/* * Copyright 2002-2009 the original author or authors. * * 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 org.springframework.beans.factory.xml; import junit.framework.Assert; import junit.framework.TestCase; import test.beans.TestBean; import org.springframework.beans.factory.config.PropertiesFactoryBean; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.core.io.ClassPathResource; /** * @author Rob Harrop * @author Juergen Hoeller */ public class AutowireWithExclusionTests extends TestCase { public void testByTypeAutowireWithAutoSelfExclusion() throws Exception { CountingFactory.reset(); XmlBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml"); beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); TestBean sally = (TestBean) beanFactory.getBean("sally"); assertEquals(sally, rob.getSpouse()); Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithExclusion() throws Exception { CountingFactory.reset(); XmlBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml"); beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithExclusionInParentFactory() throws Exception { CountingFactory.reset(); XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); parent.preInstantiateSingletons(); DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent); RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally")); child.registerBeanDefinition("rob2", robDef); TestBean rob = (TestBean) child.getBean("rob2"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithPrimaryInParentFactory() throws Exception { CountingFactory.reset(); XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); parent.getBeanDefinition("props1").setPrimary(true); parent.preInstantiateSingletons(); DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent); RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally")); child.registerBeanDefinition("rob2", robDef); RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class); propsDef.getPropertyValues().add("properties", "name=props3"); child.registerBeanDefinition("props3", propsDef); TestBean rob = (TestBean) child.getBean("rob2"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithPrimaryOverridingParentFactory() throws Exception { CountingFactory.reset(); XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); parent.preInstantiateSingletons(); DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent); RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally")); child.registerBeanDefinition("rob2", robDef); RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class); propsDef.getPropertyValues().add("properties", "name=props3"); propsDef.setPrimary(true); child.registerBeanDefinition("props3", propsDef); TestBean rob = (TestBean) child.getBean("rob2"); assertEquals("props3", rob.getSomeProperties().getProperty("name")); Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithPrimaryInParentAndChild() throws Exception { CountingFactory.reset(); XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); parent.getBeanDefinition("props1").setPrimary(true); parent.preInstantiateSingletons(); DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent); RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally")); child.registerBeanDefinition("rob2", robDef); RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class); propsDef.getPropertyValues().add("properties", "name=props3"); propsDef.setPrimary(true); child.registerBeanDefinition("props3", propsDef); TestBean rob = (TestBean) child.getBean("rob2"); assertEquals("props3", rob.getSomeProperties().getProperty("name")); Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithInclusion() throws Exception { CountingFactory.reset(); XmlBeanFactory beanFactory = getBeanFactory("autowire-with-inclusion.xml"); beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithSelectiveInclusion() throws Exception { CountingFactory.reset(); XmlBeanFactory beanFactory = getBeanFactory("autowire-with-selective-inclusion.xml"); beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testConstructorAutowireWithAutoSelfExclusion() throws Exception { XmlBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml"); TestBean rob = (TestBean) beanFactory.getBean("rob"); TestBean sally = (TestBean) beanFactory.getBean("sally"); assertEquals(sally, rob.getSpouse()); TestBean rob2 = (TestBean) beanFactory.getBean("rob"); assertEquals(rob, rob2); assertNotSame(rob, rob2); assertEquals(rob.getSpouse(), rob2.getSpouse()); assertNotSame(rob.getSpouse(), rob2.getSpouse()); } public void testConstructorAutowireWithExclusion() throws Exception { XmlBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml"); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); } private XmlBeanFactory getBeanFactory(String configPath) { return new XmlBeanFactory(new ClassPathResource(configPath, getClass())); } }
[ "taibi@sonar-scheduler.rd.tut.fi" ]
taibi@sonar-scheduler.rd.tut.fi
e0aab5b314621afb0b7f03a3cc97a8a4789aa92e
1c6ad7fb063db2ae20a0accf1d95857ed766f6d2
/src/main/java/com/zxx/demorepository/test/intercept/annotation/CryptField.java
e0e0fb8816690860f5f9c8af77e45ce763a1afb6
[]
no_license
kamjin1996/DemoRepository
b7857cd98871ccfb05dca69092babe99093d5b54
a87680a6710897f39ebfb7b50f03e2062508be70
refs/heads/master
2023-04-07T02:26:31.684768
2022-12-06T06:46:40
2022-12-06T06:46:40
156,940,034
0
0
null
2023-03-27T22:22:16
2018-11-10T02:29:12
Java
UTF-8
Java
false
false
338
java
package com.zxx.demorepository.test.intercept.annotation; import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) public @interface CryptField { String value() default ""; boolean encrypt() default true; boolean decrypt() default true; }
[ "tuosen@tsign.cn" ]
tuosen@tsign.cn
8382257ca580dc90546606dab3b2feb84f9d02fa
27835b326965575e47e91e7089b918b642a91247
/src/by/it/malishevskiy/jd01_02/Test_jd01_02.java
2b159efae6081f8abe841d108f30dfc034fe4b66
[]
no_license
s-karpovich/JD2018-11-13
c3bc03dc6268d52fd8372641b12c341aa3a3e11f
5f5be48cb1619810950a629c47e46d186bf1ad93
refs/heads/master
2020-04-07T19:54:15.964875
2019-04-01T00:37:29
2019-04-01T00:37:29
158,667,895
2
0
null
2018-11-22T08:40:16
2018-11-22T08:40:16
null
UTF-8
Java
false
false
18,071
java
package by.it.malishevskiy.jd01_02; import org.junit.Test; import java.io.*; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; import static org.junit.Assert.*; @SuppressWarnings("all") //поставьте курсор на следующую строку и нажмите Ctrl+Shift+F10 public class Test_jd01_02 { @Test(timeout = 5000) public void testTaskA() throws Exception { System.out.println("\n\nПроверка на минимум и максимум"); checkMethod("TaskA", "static step1", int[].class); run("-1 2 3 4 567 567 4 3 2 -1 4 4").include("-1 567"); System.out.println("\n\nПроверка на вывод значений меньше среднего"); checkMethod("TaskA", "static step2", int[].class); run("-1 22 33 44 567 567 44 33 22 -1 4 4") .include("-1").include("22").include("33").include("44"); System.out.println("\n\nПроверка на индексы минимума"); checkMethod("TaskA", "static step3", int[].class); run("-1 22 33 44 567 567 44 33 22 -1 4 4").include("9 0"); } @Test(timeout = 5000) public void testTaskAstep1_MinMax__TaskA() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step1", int[].class); System.out.println("Проверка на массиве -1, 2, 3, 4, 567, 567, 4, 3, 2, -1, 4, 4"); m.invoke(null, new int[]{-1, 2, 3, 4, 567, 567, 4, 3, 2, -1, 4, 4}); ok.include("").include("-1 567"); } @Test(timeout = 5000) public void testTaskAstep2_Avg__TaskA() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int[].class); System.out.println("Проверка на массиве -1, 22, 30+3, 44, 500+67, 500+67, 44, 30+3, 22, -1, 4, 4"); m.invoke(null, new int[]{-1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4}); ok.include("").include("-1") .include("1").include("2").include("3").include("4") .include("22").include("33").include("44").exclude("567"); } @Test(timeout = 5000) public void testTaskAstep3_IndexMinMax__TaskA() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step3", int[].class); System.out.println("Проверка на массиве -1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4"); m.invoke(null, new int[]{-1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4}); ok.include("").include("9 0"); } @Test(timeout = 5000) public void testTaskB() throws Exception { System.out.println("\n\nПроверка на вывод матрицы 5 x 5"); checkMethod("TaskB", "step1"); run("0 1 2 3") .include("11 12 13 14 15").include("16 17 18 19 20") .include("21 22 23 24 25"); ; System.out.println("\n\nПроверка на ввод номера месяца"); checkMethod("TaskB", "step2", int.class); run("0 2 3 4").include("нет такого месяца"); run("1 2 3 4").include("январь"); run("2 2 3 4").include("февраль"); run("3 2 3 4").include("март"); run("4 2 3 4").include("апрель"); run("5 2 3 4").include("май"); run("6 2 3 4").include("июнь"); run("7 2 3 4").include("июль"); run("8 2 3 4").include("август"); run("9 2 3 4").include("сентябрь"); run("10 2 3 4").include("октябрь"); run("11 2 3 4").include("ноябрь"); run("12 2 3 4").include("декабрь"); run("13 2 3 4").include("нет такого месяца"); System.out.println("\n\nПроверка на решение квадратного уравнения"); checkMethod("TaskB", "step3", double.class, double.class, double.class); run("0 2 4 2").include("-1"); run("0 2 4 0").include("0.0").include("-2.0"); run("0 2 4 4").include("корней нет"); } @Test(timeout = 5000) public void testTaskBstep1_Loop__TaskB() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step1"); m.invoke(null); ok.include("11 12 13 14 15").include("16 17 18 19 20").include("21 22 23 24 25"); } @Test(timeout = 5000) public void testTaskBstep2_Switch__TaskB() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int.class); m.invoke(null, 0); ok.include("нет такого месяца"); m.invoke(null, 1); ok.include("январь"); m.invoke(null, 2); ok.include("февраль"); m.invoke(null, 3); ok.include("март"); m.invoke(null, 4); ok.include("апрель"); m.invoke(null, 5); ok.include("май"); m.invoke(null, 6); ok.include("июнь"); m.invoke(null, 7); ok.include("июль"); m.invoke(null, 8); ok.include("август"); m.invoke(null, 9); ok.include("сентябрь"); m.invoke(null, 10); ok.include("октябрь"); m.invoke(null, 11); ok.include("ноябрь"); m.invoke(null, 12); ok.include("декабрь"); m.invoke(null, 13); ok.include("нет такого месяца"); } @Test(timeout = 5000) public void testTaskBstep3_QEquation__TaskB() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step3", double.class, double.class, double.class); System.out.println("Квадратное уравление:"); System.out.println("для a=2, для b=4, для c=2, ожидается один корень: минус 1"); m.invoke(null, 2, 4, 2); ok.include("-1"); System.out.println("для a=1, для b=-1, для c=-2, ожидается два корня: минус один и два "); m.invoke(null, 1, -1, -2); ok.include("-1").include("2"); System.out.println("для a=2, для b=4, для c=4, ожидается решение без корней"); m.invoke(null, 2, 4, 4); ok.include("корней нет"); } @Test(timeout = 5000) public void testTaskC() throws Exception { System.out.println("\n\nПроверка на создание массива TaskC.step1"); checkMethod("TaskC", "step1", int.class); run("3").include("-3").include("3"); run("4").include("-4").include("4"); Test_jd01_02 ok = run("5").include("-5").include("5"); System.out.println("\nПроверка на сумму элементов TaskC.step2"); checkMethod("TaskC", "step2", int[][].class); int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}}; Method m = ok.aClass.getDeclaredMethod("step2", m4.getClass()); int sum = (int) ok.invoke(m, null, new Object[]{m4}); assertEquals("Неверная сумма в step2", -6, sum); System.out.println("\nПроверка на удаление максимума TaskC.step3"); checkMethod("TaskC", "step3", int[][].class); m = ok.aClass.getDeclaredMethod("step3", int[][].class); int[][] res = (int[][]) ok.invoke(m, null, new Object[]{m4}); int[][] expectmas = {{-1, 2, -2}, {-2, -2, -6}}; assertArrayEquals("Не найден ожидаемый массив {{-1,2,-2},{-2,-2,-6}}", expectmas, res); } @Test(timeout = 5000) public void testTaskCstep1_IndexMinMax__TaskC() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step1", int.class); int[][] mas = (int[][]) m.invoke(null, 5); boolean min = false; boolean max = false; for (int[] row : mas) for (int i : row) { if (i == -5) min = true; if (i == 5) max = true; } if (!max || !min) { fail("В массиве нет максимума 5 или минимума -5"); } } @Test(timeout = 5000) public void testTaskCstep2_Sum__TaskC() throws Exception { Test_jd01_02 ok = run("", false); int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}}; Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int[][].class); int sum = (int) ok.invoke(m, null, new Object[]{m4}); assertEquals("Неверная сумма в step2", -6, sum); } @Test(timeout = 5000) public void testTaskCstep3_DeleteMax__TaskC() throws Exception { Test_jd01_02 ok = run("", false); int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}}; Method m = checkMethod(ok.aClass.getSimpleName(), "static step3", int[][].class); int[][] actualmas = (int[][]) ok.invoke(m, null, new Object[]{m4}); int[][] expectmas = {{-1, 2, -2}, {-2, -2, -6}}; for (int i = 0; i < actualmas.length; i++) { System.out.println("Проверка строки " + i); System.out.println(" Ожидается: " + Arrays.toString(expectmas[i])); System.out.println("Из метода получено: " + Arrays.toString(actualmas[i])); assertArrayEquals("Метод работает некорректно", expectmas[i], actualmas[i]); } System.out.println("Проверка завершена успешно!"); } /* =========================================================================================================== НИЖЕ ВСПОМОГАТЕЛЬНЫЙ КОД ТЕСТОВ. НЕ МЕНЯЙТЕ В ЭТОМ ФАЙЛЕ НИЧЕГО. Но изучить как он работает - можно, это всегда будет полезно. =========================================================================================================== */ //------------------------------- методы ---------------------------------------------------------- private Class findClass(String SimpleName) { String full = this.getClass().getName(); String dogPath = full.replace(this.getClass().getSimpleName(), SimpleName); try { return Class.forName(dogPath); } catch (ClassNotFoundException e) { fail("\nERROR:Тест не пройден. Класс " + SimpleName + " не найден."); } return null; } private Method checkMethod(String className, String methodName, Class<?>... parameters) throws Exception { Class aClass = this.findClass(className); try { methodName = methodName.trim(); Method m; if (methodName.startsWith("static")) { methodName = methodName.replace("static", "").trim(); m = aClass.getDeclaredMethod(methodName, parameters); if ((m.getModifiers() & Modifier.STATIC) != Modifier.STATIC) { fail("\nERROR:Метод " + m.getName() + " должен быть статическим"); } } else m = aClass.getDeclaredMethod(methodName, parameters); m.setAccessible(true); return m; } catch (NoSuchMethodException e) { System.err.println("\nERROR:Не найден метод " + methodName + " либо у него неверная сигнатура"); System.err.println("ERROR:Ожидаемый класс: " + className); System.err.println("ERROR:Ожидаемый метод: " + methodName); return null; } } private Method findMethod(Class<?> cl, String name, Class... param) { try { return cl.getDeclaredMethod(name, param); } catch (NoSuchMethodException e) { fail("\nERROR:Тест не пройден. Метод " + cl.getName() + "." + name + " не найден\n"); } return null; } private Object invoke(Method method, Object o, Object... value) { try { method.setAccessible(true); return method.invoke(o, value); } catch (Exception e) { System.out.println(e.toString()); fail("\nERROR:Не удалось вызвать метод " + method.getName() + "\n"); } return null; } //метод находит и создает класс для тестирования //по имени вызывающего его метода, testTaskA1 будет работать с TaskA1 private static Test_jd01_02 run(String in) { return run(in, true); } private static Test_jd01_02 run(String in, boolean runMain) { Throwable t = new Throwable(); StackTraceElement trace[] = t.getStackTrace(); StackTraceElement element; int i = 0; do { element = trace[i++]; } while (!element.getMethodName().contains("test")); String[] path = element.getClassName().split("\\."); String nameTestMethod = element.getMethodName(); String clName = nameTestMethod.replace("test", ""); clName = clName.replaceFirst(".+__", ""); clName = element.getClassName().replace(path[path.length - 1], clName); System.out.println("\n---------------------------------------------"); System.out.println("Старт теста для " + clName); if (!in.isEmpty()) System.out.println("input:" + in); System.out.println("---------------------------------------------"); return new Test_jd01_02(clName, in, runMain); } //------------------------------- тест ---------------------------------------------------------- public Test_jd01_02() { //Конструктор тестов } //переменные теста private String className; private Class<?> aClass; private PrintStream oldOut = System.out; //исходный поток вывода private PrintStream newOut; //поле для перехвата потока вывода private StringWriter strOut = new StringWriter(); //накопитель строки вывода //Основной конструктор тестов private Test_jd01_02(String className, String in, boolean runMain) { //this.className = className; aClass = null; try { aClass = Class.forName(className); this.className = className; } catch (ClassNotFoundException e) { fail("ERROR:Не найден класс " + className + "/n"); } InputStream reader = new ByteArrayInputStream(in.getBytes()); System.setIn(reader); //перехват стандартного ввода System.setOut(newOut); //перехват стандартного вывода if (runMain) //если нужно запускать, то запустим, иначе оставим только вывод try { Class[] argTypes = new Class[]{String[].class}; Method main = aClass.getDeclaredMethod("main", argTypes); main.invoke(null, (Object) new String[]{}); System.setOut(oldOut); //возврат вывода, нужен, только если был запуск } catch (Exception x) { x.printStackTrace(); } } //проверка вывода private Test_jd01_02 is(String str) { assertTrue("ERROR:Ожидается такой вывод:\n<---начало---->\n" + str + "<---конец--->", strOut.toString().equals(str)); return this; } private Test_jd01_02 include(String str) { assertTrue("ERROR:Строка не найдена: " + str + "\n", strOut.toString().contains(str)); return this; } private Test_jd01_02 exclude(String str) { assertTrue("ERROR:Лишние данные в выводе: " + str + "\n", !strOut.toString().contains(str)); return this; } //логический блок перехвата вывода { newOut = new PrintStream(new OutputStream() { private byte bytes[] = new byte[1]; private int pos = 0; @Override public void write(int b) throws IOException { if (pos==0 && b=='\r') //пропуск \r (чтобы win mac и linux одинаково работали return; if (pos == 0) { //определим кодировку https://ru.wikipedia.org/wiki/UTF-8 if ((b & 0b11110000) == 0b11110000) bytes = new byte[4]; else if ((b & 0b11100000) == 0b11100000) bytes = new byte[3]; else if ((b & 0b11000000) == 0b11000000) bytes = new byte[2]; else bytes = new byte[1]; } bytes[pos++] = (byte) b; if (pos == bytes.length) { //символ готов String s = new String(bytes); //соберем весь символ strOut.append(s); //запомним вывод для теста oldOut.append(s); //копию в обычный вывод pos = 0; //готовим новый символ } } }); } }
[ "3zhenia@mail.ru" ]
3zhenia@mail.ru
04e5fec2162b07e460ac27f81b59e6c3fade69ba
fcd28e246e059e5305ee89931ce7d81edddf8057
/camera/java/camera/logevent_notReadyToTakeImageDataReaderHelper.java
8509bad1f79f815d9fcf26138f200670e6ae84d9
[]
no_license
lsst-ts/ts_sal_runtime
56e396cb42f1204595f9bcdb3a2538007c0befc6
ae918e6f2b73f2ed7a8201bf3a79aca8fb5b36ef
refs/heads/main
2021-12-21T02:40:37.628618
2017-09-14T18:06:48
2017-09-14T18:06:49
145,469,981
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
package camera; import org.opensplice.dds.dcps.Utilities; public final class logevent_notReadyToTakeImageDataReaderHelper { public static camera.logevent_notReadyToTakeImageDataReader narrow(java.lang.Object obj) { if (obj == null) { return null; } else if (obj instanceof camera.logevent_notReadyToTakeImageDataReader) { return (camera.logevent_notReadyToTakeImageDataReader)obj; } else { throw Utilities.createException(Utilities.EXCEPTION_TYPE_BAD_PARAM, null); } } public static camera.logevent_notReadyToTakeImageDataReader unchecked_narrow(java.lang.Object obj) { if (obj == null) { return null; } else if (obj instanceof camera.logevent_notReadyToTakeImageDataReader) { return (camera.logevent_notReadyToTakeImageDataReader)obj; } else { throw Utilities.createException(Utilities.EXCEPTION_TYPE_BAD_PARAM, null); } } }
[ "DMills@lsst.org" ]
DMills@lsst.org
6e9a7dcd96e33cb235c1e055cfac3cefb9209142
173b64b558857daba1f5f11b6f779aaeb1638e71
/src/main/java/ru/butakov/survey/domain/User.java
9af016a97398272c49df9b35c18cb56b757967df
[]
no_license
mello1984/survey
e9aaad582d05908c4f5c4790a1f5cbe5dcf46caf
25f8c30a36cd05761661380769af5300b83684a4
refs/heads/master
2023-06-19T05:46:59.017689
2021-07-07T09:32:56
2021-07-07T09:32:56
378,266,460
0
0
null
null
null
null
UTF-8
Java
false
false
236
java
package ru.butakov.survey.domain; import lombok.*; import lombok.experimental.FieldDefaults; @Data @NoArgsConstructor @AllArgsConstructor @Builder @FieldDefaults(level = AccessLevel.PRIVATE) public class User { String username; }
[ "abutakov84@gmail.com" ]
abutakov84@gmail.com
c673366a04faecab1f2be6e3ae5d20b3bc878051
760f940c21d77760dbe6ead3f504a3246b8c68cf
/app/src/main/java/com/hrsst/housekeeper/mvp/sdcard/SDCardActivity.java
e336ab77a200c7e008f2c4e392487a0a21cbe217
[]
no_license
vidylin/HouseKeeper
441bb888c3c5576a427a45730773fc70121b7d38
c8524253f587d528a2ee9c54ec84730208971b74
refs/heads/master
2020-12-24T12:13:42.487428
2016-12-20T09:40:43
2016-12-20T09:40:43
73,064,440
1
1
null
null
null
null
UTF-8
Java
false
false
12,519
java
package com.hrsst.housekeeper.mvp.sdcard; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.hrsst.housekeeper.R; import com.hrsst.housekeeper.common.data.Contact; import com.hrsst.housekeeper.common.global.Constants; import com.hrsst.housekeeper.common.widget.NormalDialog; import com.hrsst.housekeeper.mvp.apmonitor.ApMonitorActivity; import com.p2p.core.P2PHandler; import com.p2p.core.P2PValue; public class SDCardActivity extends Activity implements View.OnClickListener { private Context mContext; private Contact contact; RelativeLayout sd_format; String command; boolean isRegFilter = false; TextView tv_total_capacity, tv_sd_remainning_capacity,tv_sd_card; ImageView format_icon; ProgressBar progress_format; int SDcardId; int sdId; int usbId; boolean isSDCard; int count = 0; String idOrIp; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_sdcard); mContext = this; contact = (Contact) getIntent().getSerializableExtra("contact"); idOrIp=contact.contactId; if(contact.ipadressAddress!=null){ String mark=contact.ipadressAddress.getHostAddress(); String ip=mark.substring(mark.lastIndexOf(".")+1,mark.length()); if(!ip.equals("")&&ip!=null){ idOrIp=ip; } } initComponent(); showSDProgress(); regFilter(); command=createCommand("80", "0", "00"); P2PHandler.getInstance().getSdCardCapacity(idOrIp, contact.contactPassword,command); } public void initComponent() { tv_sd_card = (TextView) findViewById(R.id.tv_sd_card); tv_total_capacity = (TextView) findViewById(R.id.tv_sd_capacity); tv_sd_remainning_capacity = (TextView)findViewById(R.id.tv_sd_remainning_capacity); sd_format = (RelativeLayout) findViewById(R.id.sd_format); format_icon = (ImageView) findViewById(R.id.format_icon); progress_format = (ProgressBar) findViewById(R.id.progress_format); sd_format.setOnClickListener(this); if (contact.contactType == P2PValue.DeviceType.NPC) { sd_format.setVisibility(RelativeLayout.GONE); } tv_sd_card.setText(contact.contactName); } public void regFilter() { isRegFilter = true; IntentFilter filter = new IntentFilter(); filter.addAction(Constants.P2P.ACK_GET_SD_CARD_CAPACITY); filter.addAction(Constants.P2P.RET_GET_SD_CARD_CAPACITY); filter.addAction(Constants.P2P.ACK_GET_SD_CARD_FORMAT); filter.addAction(Constants.P2P.RET_GET_SD_CARD_FORMAT); filter.addAction(Constants.P2P.RET_GET_USB_CAPACITY); filter.addAction(Constants.P2P.RET_DEVICE_NOT_SUPPORT); mContext.registerReceiver(br, filter); } BroadcastReceiver br = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent intent) { // TODO Auto-generated method stub if (intent.getAction().equals( Constants.P2P.ACK_GET_SD_CARD_CAPACITY)) { int result = intent.getIntExtra("result", -1); if (result == Constants.P2P_SET.ACK_RESULT.ACK_PWD_ERROR) { Intent i = new Intent(); i.setAction(Constants.Action.CONTROL_SETTING_PWD_ERROR); mContext.sendBroadcast(i); } else if (result == Constants.P2P_SET.ACK_RESULT.ACK_NET_ERROR) { Log.e("my", "net error resend:get npc time"); P2PHandler.getInstance().getSdCardCapacity(idOrIp, contact.contactPassword, command); } } else if (intent.getAction().equals( Constants.P2P.RET_GET_SD_CARD_CAPACITY)) { int total_capacity = intent.getIntExtra("total_capacity", -1); int remain_capacity = intent.getIntExtra("remain_capacity", -1); int state = intent.getIntExtra("state", -1); SDcardId = intent.getIntExtra("SDcardID", -1); String id = Integer.toBinaryString(SDcardId); Log.e("id", "msga" + id); while (id.length() < 8) { id = "0" + id; } char index = id.charAt(3); Log.e("id", "msgb" + id); Log.e("id", "msgc" + index); if (state == 1) { if (index == '1') { sdId = SDcardId; tv_total_capacity.setText(String .valueOf(total_capacity) + "M"); tv_sd_remainning_capacity.setText(String .valueOf(remain_capacity) + "M"); showSDImg(); } else if (index == '0') { usbId = SDcardId; } } else { Intent back = new Intent(); back.setAction(Constants.Action.REPLACE_MAIN_CONTROL); mContext.sendBroadcast(back); Toast.makeText(mContext, "SD卡不存在", Toast.LENGTH_SHORT).show(); } } else if (intent.getAction().equals( Constants.P2P.ACK_GET_SD_CARD_FORMAT)) { int result = intent.getIntExtra("result", -1); if (result == Constants.P2P_SET.ACK_RESULT.ACK_PWD_ERROR) { Intent i = new Intent(); i.setAction(Constants.Action.CONTROL_SETTING_PWD_ERROR); mContext.sendBroadcast(i); } else if (result == Constants.P2P_SET.ACK_RESULT.ACK_NET_ERROR) { Log.e("my", "net error resend:get npc time"); P2PHandler.getInstance().setSdFormat(idOrIp, contact.contactPassword, sdId); } } else if (intent.getAction().equals( Constants.P2P.RET_GET_SD_CARD_FORMAT)) { int result = intent.getIntExtra("result", -1); if (result == Constants.P2P_SET.SD_FORMAT.SD_CARD_SUCCESS) { Toast.makeText(mContext, "SD卡格式化成功", Toast.LENGTH_SHORT).show(); } else if (result == Constants.P2P_SET.SD_FORMAT.SD_CARD_FAIL) { Toast.makeText(mContext, "SD卡格式化失败", Toast.LENGTH_SHORT).show(); } else if (result == Constants.P2P_SET.SD_FORMAT.SD_NO_EXIST) { Toast.makeText(mContext, "SD卡不存在", Toast.LENGTH_SHORT).show(); } showSDImg(); } else if (intent.getAction().equals( Constants.P2P.RET_GET_USB_CAPACITY)) { int total_capacity = intent.getIntExtra("total_capacity", -1); int remain_capacity = intent.getIntExtra("remain_capacity", -1); int state = intent.getIntExtra("state", -1); SDcardId = intent.getIntExtra("SDcardID", -1); String id = Integer.toBinaryString(SDcardId); Log.e("id", "msga" + id); while (id.length() < 8) { id = "0" + id; } char index = id.charAt(3); Log.e("id", "msgb" + id); Log.e("id", "msgc" + index); if (state == 1) { if (index == '1') { sdId = SDcardId; tv_total_capacity.setText(String .valueOf(total_capacity) + "M"); tv_sd_remainning_capacity.setText(String .valueOf(remain_capacity) + "M"); showSDImg(); } else if (index == '0') { usbId = SDcardId; } } else { count++; if (contact.contactType == P2PValue.DeviceType.IPC) { if (count == 1) { Intent back = new Intent(); back.setAction(Constants.Action.REPLACE_MAIN_CONTROL); mContext.sendBroadcast(back); Toast.makeText(mContext, "SD卡不存在", Toast.LENGTH_SHORT).show(); } } else { if (count == 2) { Intent back = new Intent(); back.setAction(Constants.Action.REPLACE_MAIN_CONTROL); mContext.sendBroadcast(back); Toast.makeText(mContext, "SD卡不存在", Toast.LENGTH_SHORT).show(); } } } } else if (intent.getAction().equals( Constants.P2P.RET_DEVICE_NOT_SUPPORT)) { Intent back = new Intent(); back.setAction(Constants.Action.REPLACE_MAIN_CONTROL); mContext.sendBroadcast(back); Toast.makeText(mContext, "不支持", Toast.LENGTH_SHORT).show(); } } }; public void showSDProgress() { format_icon.setVisibility(ImageView.GONE); progress_format.setVisibility(progress_format.VISIBLE); sd_format.setClickable(false); } public String createCommand(String bCommandType, String bOption, String SDCardCounts) { return bCommandType + bOption + SDCardCounts; } public void showSDImg() { format_icon.setVisibility(ImageView.VISIBLE); progress_format.setVisibility(progress_format.GONE); sd_format.setClickable(true); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub switch (arg0.getId()) { case R.id.sd_format: final NormalDialog dialog = new NormalDialog(mContext, mContext .getResources().getString(R.string.sd_formatting), mContext .getResources().getString(R.string.delete_sd_remind), mContext.getResources().getString(R.string.ensure), mContext.getResources().getString(R.string.cancel)); dialog.setOnButtonOkListener(new NormalDialog.OnButtonOkListener() { @Override public void onClick() { // TODO Auto-generated method stub P2PHandler.getInstance().setSdFormat(idOrIp, contact.contactPassword, sdId); Log.e("SDcardId", "SDcardId" + SDcardId); } }); dialog.setOnButtonCancelListener(new NormalDialog.OnButtonCancelListener() { @Override public void onClick() { // TODO Auto-generated method stub showSDImg(); dialog.dismiss(); } }); dialog.showNormalDialog(); dialog.setCanceledOnTouchOutside(false); showSDProgress(); break; default: break; } } @Override public void onDestroy() { super.onDestroy(); if (isRegFilter == true) { mContext.unregisterReceiver(br); } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK){ Intent i = new Intent(mContext,ApMonitorActivity.class); i.putExtra("contact",contact); startActivity(i); finish(); } return super.onKeyDown(keyCode, event); } }
[ "1098986730@qq.com" ]
1098986730@qq.com
fb84fed979c900a0f518d5e798b4611a7ccee1d9
a157f0f34ed886bfc9f25454814ef164062f7498
/nodecore-ucp/src/main/java/nodecore/api/ucp/commands/server/MiningSubscribe.java
e631b0b05077dd0ef2b047998ea1497c0f22c3b0
[ "MIT" ]
permissive
xagau/nodecore
d49ea1e6f4835d2fad39d547dfa119cd98240b3c
282f03b4296e71432b183bdfb38d066bc0f575e0
refs/heads/master
2022-12-11T08:28:23.312115
2020-02-24T19:30:18
2020-02-24T19:30:18
257,342,239
0
0
NOASSERTION
2020-04-20T16:35:11
2020-04-20T16:35:10
null
UTF-8
Java
false
false
2,937
java
// VeriBlock NodeCore // Copyright 2017-2019 Xenios SEZC // All rights reserved. // https://www.veriblock.org // Distributed under the MIT software license, see the accompanying // file LICENSE or http://www.opensource.org/licenses/mit-license.php. package nodecore.api.ucp.commands.server; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import nodecore.api.ucp.arguments.UCPArgument; import nodecore.api.ucp.arguments.UCPArgumentFrequencyMS; import nodecore.api.ucp.arguments.UCPArgumentRequestID; import nodecore.api.ucp.commands.UCPCommand; import nodecore.api.ucp.commands.UCPServerCommand; import org.veriblock.core.types.Pair; import java.util.ArrayList; public class MiningSubscribe extends UCPServerCommand { private final UCPCommand.Command command = Command.MINING_SUBSCRIBE; // Not static for serialization purposes // Required private final UCPArgumentRequestID request_id; private final UCPArgumentFrequencyMS update_frequency_ms; public MiningSubscribe(UCPArgument ... arguments) { ArrayList<Pair<String, UCPArgument.UCPType>> pattern = command.getPattern(); if (arguments.length != pattern.size()) { throw new IllegalArgumentException(getClass().getCanonicalName() + "'s constructor cannot be called without exactly " + pattern.size() + " UCPArguments!"); } for (int i = 0; i < pattern.size(); i++) { if (arguments[i].getType() != pattern.get(i).getSecond()) { throw new IllegalArgumentException(getClass().getCanonicalName() + "'s constructor cannot be called with a argument at index " + i + " which is a " + arguments[i].getType() + " instead of a " + pattern.get(i).getSecond() + "!"); } } this.request_id = (UCPArgumentRequestID)arguments[0]; this.update_frequency_ms = (UCPArgumentFrequencyMS)arguments[1]; } public MiningSubscribe(int request_id, int update_frequency_ms) { this.request_id = new UCPArgumentRequestID(request_id); this.update_frequency_ms = new UCPArgumentFrequencyMS(update_frequency_ms); } public static MiningSubscribe reconstitute(String commandLine) { if (commandLine == null) { throw new IllegalArgumentException(new Exception().getStackTrace()[0].getClassName() + "'s reconstitute cannot be called with a null commandLine!"); } GsonBuilder deserializer = new GsonBuilder(); deserializer.registerTypeAdapter(MiningSubscribe.class, new MiningSubscribeDeserializer()); return deserializer.create().fromJson(commandLine, MiningSubscribe.class); } public int getRequestId() { return request_id.getData(); } public int getUpdateFrequencyMS() { return update_frequency_ms.getData(); } public String compileCommand() { return new Gson().toJson(this); } }
[ "JoshuaRack@gmail.com" ]
JoshuaRack@gmail.com
cf171dafeacfbc637330e91536fbe387705e4707
472d7820a5f5d9d5ab2ec150eab0c9bdeb2008c7
/Aries/Sodi/dis/disEnumerations/EntityAppearancePlatformPowerPlantStatusField_1.java
871663be0230ac7180c48936a7eae299f0690670
[]
no_license
slacker247/GPDA
1ad5ebe0bea4528d9a3472d3c34580648ffb670e
fa9006d0877a691f1ddffe88799c844a3e8a669a
refs/heads/master
2022-10-08T07:39:09.786313
2020-06-10T22:22:58
2020-06-10T22:22:58
105,063,261
2
0
null
null
null
null
UTF-8
Java
false
false
4,372
java
/* File: EntityAppearancePlatformPowerPlantStatusField.java CVS Info: $Id$ Compiler: jdk 1.2.2 */ package disEnumerations; import mil.navy.nps.dis.*; import mil.navy.nps.util.*; /** * Entity Appearance Platform Power-Plant Status Field -- Describes the power-plant status of a platform *@version 1.1 *@author Ronan Fauglas *@author <a href="mailto:brutzman@nps.navy.mil?subject=dis-java-vrml: disEnumerations.EntityAppearancePlatformPowerPlantStatusField feedback ">Don Brutzman</a> * *<dt><b>References:</b> *<dd> DIS Data Dictionary: <A href="../../../../../../mil/navy/nps/disEnumerations/JdbeHtmlFiles/pdu/49.htm">Entity Appearance Platform Power-Plant Status Field</A> (local) * <A href="http://SISO.sc.ist.ucf.edu/dis/dis-dd/pdu/49.htm">Entity Appearance Platform Power-Plant Status Field</A> (SISO) *<dd> JDBE:<a href="http://208.145.129.4/jdbe/proj/dis_cd/dis-dd/">DIS Data Dictionary Version 1.0a (DIS-DD)</A> *<dd> Perl script (converting html enumerations to java enumerations) * <A href="../../../../../../mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl"><i>convertJdbeDisEnumerationsToJava.pl</i></A> (local) or * <A href="http://web.3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl"> * <i>http://web.3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl</i></A> *<dd> "Named Constants," <i>The Java Programming Language</i>, Gosling & Arnold. * *<dt><b>Explanation:</b> *<dd>This file has been automatically generated from a local copy of the * <A href="../../../../../../mil/navy/nps/disEnumerations/JdbeHtmlFiles/dis-dd.html">DIS Data Dictionary</A> at * <A href="http://SISO.sc.ist.ucf.edu/dis/dis-dd/">http://SISO.sc.ist.ucf.edu/dis/dis-dd/</A> * html source file by * <A href="../../../../../../mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl">convertJdbeDisEnumerationsToJava.pl</a> (local) or * <A href="http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl">http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/convertJdbeDisEnumerationsToJava.pl</a>. * <P> * This is effectively a C-style enumeration. Java doesn't do enumerations * like C, so you have to wrap a class around it. It's a bit more typing, * but pretty simple-minded. * Note that the variables are declared public. The default for access * is package-wide, but these variables might need to be accessed from * outside the package. Since all the variables are final (i.e. constant), nobody can * change anything anyway, so this is no biggie.<p> * To use these enumerations in your Java code, import the package first: * <b><PRE>import mil.navy.nps.disEnumerations.*;</PRE></b> * You access this via something like <b><code>EntityAppearancePlatformPowerPlantStatusField.POWERPLANTON</code></b>, i.e. combine * the class name, a period, and a class variable (enumeration) name.<P> * *<dt><b>History:</b> *<dd> 21jan98 /Ronan Fauglas /New *<dd> 30mar99 /Don Brutzman /Revised Javadoc, many more enumeration classes * *<dt><b>Location:</b> *<dd><a href="../../../../../../mil/navy/nps/disEnumerations/EntityAppearancePlatformPowerPlantStatusField.java"><i>EntityAppearancePlatformPowerPlantStatusField.java</i></A> (local) *<dd><a href="http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/EntityAppearancePlatformPowerPlantStatusField.java"> * <i>http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/disEnumerations/EntityAppearancePlatformPowerPlantStatusField.java</i></a> * */ public class EntityAppearancePlatformPowerPlantStatusField_1 extends Object { /** *(0) Power Plant Off */ public static final short POWERPLANTOFF = 0; /** *(1) Power Plant On */ public static final short POWERPLANTON = 1; /** * Returns a string containing the enumeration name which corresponds to an enumeration value, * as in <b><code>EntityAppearancePlatformPowerPlantStatusField.toString (0)</code></b> returns the string "<b><code>POWERPLANTOFF</code></b>" */ public static String toString(int idNumber) { switch (idNumber) { case 0: return "Power Plant Off"; case 1: return "Power Plant On"; default : return ""; } }//end of toString }//End of class
[ "jeffmac710@gmail.com" ]
jeffmac710@gmail.com
4ca90d62144219a7bdd88ddb0bed3e3b841fdad8
fca85957a02111c5313ca7acb6b6e6c7a26749ed
/src/main/java/pers/jess/template/common/util/StringRandomUtil.java
671dcb2d991fd9d8767cec0b4668bc1a621611b0
[]
no_license
beginsto/jxwx
8bb0b466c6ceb5eb67c5946b547e055567be5b35
9db169a845c15755bf89364de6c566d5f9495f3a
refs/heads/master
2021-09-09T05:27:35.213588
2018-03-14T00:55:59
2018-03-14T00:55:59
125,134,303
0
0
null
null
null
null
UTF-8
Java
false
false
2,593
java
package pers.jess.template.common.util; import java.util.Random; public class StringRandomUtil { private static Random random = new Random(); /** * 随机 纯数字字符串 * @param length 自定义长度 * @return */ public static String numberRandom(int length){ String val = ""; for(int i = 0; i < length; i++) { val += String.valueOf(random.nextInt(10)); } return val; } /** * 随机小写字符串 * @param length 自定义长度 * @return */ public static String charLowercaseRandom(int length){ String val = ""; for(int i = 0; i < length; i++) { val += (char)(random.nextInt(26) + 97); } return val; } /** * 随机大写字符串 * @param length 自定义长度 * @return */ public static String charCapitalRandom(int length){ String val = ""; for(int i = 0; i < length; i++) { val += (char)(random.nextInt(26) + 65); } return val; } /** * 随机大小写混合字符串 * @param length 自定义长度 * @return */ public static String charCapitalAndLowercaseRandom(int length){ String val = ""; for(int i = 0; i < length; i++) { //输出是大写字母还是小写字母 int temp = random.nextInt(2) % 2 == 0 ? 65 : 97; val += (char)(random.nextInt(26) + temp); } return val; } /** * 随机 数字 大小写 字符串 * @param length 自定义长度 * @return */ public static String stringRandom(int length) { String val = ""; for(int i = 0; i < length; i++) { String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num"; //输出字母还是数字 if( "char".equalsIgnoreCase(charOrNum) ) { //输出是大写字母还是小写字母 int temp = random.nextInt(2) % 2 == 0 ? 65 : 97; val += (char)(random.nextInt(26) + temp); } else if( "num".equalsIgnoreCase(charOrNum) ) { val += String.valueOf(random.nextInt(10)); } } return val; } public static void main(String[] args){ System.out.println(numberRandom(26)); System.out.println(charLowercaseRandom(26)); System.out.println(charCapitalRandom(26)); System.out.println(charCapitalAndLowercaseRandom(26)); System.out.println(stringRandom(26)); } }
[ "920227252@qq.com" ]
920227252@qq.com
4de6cb8677e6aa83d722db8a4567a49031e52a21
5eb95c43cdcb69c1c048d66c68cacd14189c8471
/broker-plugins/amqp-0-10-protocol/src/test/java/org/apache/qpid/server/protocol/v0_10/WindowCreditManagerTest.java
a285558ffb6737f6b1a0d876b59e339210a1a710
[ "Apache-2.0", "MIT" ]
permissive
moazbaghdadi/qpid-java-old
eae07c3d7f0e50ef155d195d1ac849224a6352db
b266b647c8525d531b1dfbacd56757977dacd38b
refs/heads/master
2021-01-20T08:37:29.177233
2017-05-03T15:38:07
2017-05-03T15:38:07
90,167,309
0
1
null
null
null
null
UTF-8
Java
false
false
4,310
java
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.server.protocol.v0_10; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import org.apache.qpid.server.transport.ProtocolEngine; import org.apache.qpid.test.utils.QpidTestCase; public class WindowCreditManagerTest extends QpidTestCase { private WindowCreditManager _creditManager; private ProtocolEngine _protocolEngine; protected void setUp() throws Exception { super.setUp(); _protocolEngine = mock(ProtocolEngine.class); when(_protocolEngine.isTransportBlockedForWriting()).thenReturn(false); _creditManager = new WindowCreditManager(0l, 0l); } /** * Tests that after the credit limit is cleared (e.g. from a message.stop command), credit is * restored (e.g. from completed MessageTransfer) without increasing the available credit, and * more credit is added, that the 'used' count is correct and the proper values for bytes * and message credit are returned along with appropriate 'hasCredit' results (QPID-3592). */ public void testRestoreCreditDecrementsUsedCountAfterCreditClear() { assertEquals("unexpected credit value", 0, _creditManager.getMessageCredit()); assertEquals("unexpected credit value", 0, _creditManager.getBytesCredit()); //give some message credit _creditManager.addCredit(1, 0); assertFalse("Manager should not 'haveCredit' due to having 0 bytes credit", _creditManager.hasCredit()); assertEquals("unexpected credit value", 1, _creditManager.getMessageCredit()); assertEquals("unexpected credit value", 0, _creditManager.getBytesCredit()); //give some bytes credit _creditManager.addCredit(0, 1); assertTrue("Manager should 'haveCredit'", _creditManager.hasCredit()); assertEquals("unexpected credit value", 1, _creditManager.getMessageCredit()); assertEquals("unexpected credit value", 1, _creditManager.getBytesCredit()); //use all the credit _creditManager.useCreditForMessage(1); assertEquals("unexpected credit value", 0, _creditManager.getBytesCredit()); assertEquals("unexpected credit value", 0, _creditManager.getMessageCredit()); assertFalse("Manager should not 'haveCredit'", _creditManager.hasCredit()); //clear credit out (eg from a message.stop command) _creditManager.clearCredit(); assertEquals("unexpected credit value", 0, _creditManager.getBytesCredit()); assertEquals("unexpected credit value", 0, _creditManager.getMessageCredit()); assertFalse("Manager should not 'haveCredit'", _creditManager.hasCredit()); //restore credit (e.g the original message transfer command got completed) //this should not increase credit, because it is now limited to 0 _creditManager.restoreCredit(1, 1); assertEquals("unexpected credit value", 0, _creditManager.getBytesCredit()); assertEquals("unexpected credit value", 0, _creditManager.getMessageCredit()); assertFalse("Manager should not 'haveCredit'", _creditManager.hasCredit()); //give more credit to open the window again _creditManager.addCredit(1, 1); assertEquals("unexpected credit value", 1, _creditManager.getBytesCredit()); assertEquals("unexpected credit value", 1, _creditManager.getMessageCredit()); assertTrue("Manager should 'haveCredit'", _creditManager.hasCredit()); } }
[ "moazbaghdadi@gmail.com" ]
moazbaghdadi@gmail.com
801e63ccf3894f7fcf2b2c4f4dae591d23dd72c8
1547cb466b4888e5ab7c70020f3f3bac66cb7d0b
/target/.generated/com/google/gwt/editor/client/adapters/TakesValueEditor_com_puglieseweb_test_trms_shared_domain_TaxiOptions_RequestFactoryEditorDelegate.java
f643690d220dda5ac0bc23af0127cc82ffaa28ff
[]
no_license
puglieseweb/TaxiRankMS
2a1b3c10fcc20b6f268eb7fd769e6b09618ad77c
d0c64fb2a141e3170bc713d7045c2c3aa2179252
refs/heads/master
2020-04-10T11:55:35.279594
2011-03-15T13:14:58
2011-03-15T13:14:58
1,482,697
0
0
null
null
null
null
UTF-8
Java
false
false
1,373
java
package com.google.gwt.editor.client.adapters; public class TakesValueEditor_com_puglieseweb_test_trms_shared_domain_TaxiOptions_RequestFactoryEditorDelegate extends com.google.gwt.requestfactory.client.impl.RequestFactoryEditorDelegate { private com.google.gwt.editor.client.adapters.TakesValueEditor editor; protected com.google.gwt.editor.client.adapters.TakesValueEditor getEditor() {return editor;} protected void setEditor(com.google.gwt.editor.client.Editor editor) {this.editor=(com.google.gwt.editor.client.adapters.TakesValueEditor)editor;} private com.puglieseweb.test.trms.shared.domain.TaxiOptions object; public com.puglieseweb.test.trms.shared.domain.TaxiOptions getObject() {return object;} protected void setObject(Object object) {this.object=(com.puglieseweb.test.trms.shared.domain.TaxiOptions)object;} protected void attachSubEditors(com.google.gwt.editor.client.impl.DelegateMap delegateMap) { } protected void flushSubEditors(java.util.List errorAccumulator) { } protected void flushSubEditorErrors(java.util.List errorAccumulator) { } protected void refreshEditors() { } protected void traverse(java.util.List paths) { traverseEditor(getEditor(), "", paths); } public static void traverseEditor(com.google.gwt.editor.client.adapters.TakesValueEditor editor, String prefix, java.util.List<String> paths) { } }
[ "puglieseweb@gmail.com" ]
puglieseweb@gmail.com
ff2d4e816349be248f9e504eda471a17c995ab20
4de7d01600423e57ac446d3d04f6762f61381576
/Java_05/src/com/biz/control/For_05.java
0d410e14b2f91824bd01e89fc3b35e1cbb333ec0
[]
no_license
smskit726/Biz_506_2020_05_Java
332112b3bbe762726c7f27e5334d9f69d7c738c9
0a45a6f3d0eee9f0635828321bf9a1573506126e
refs/heads/master
2022-12-08T11:57:24.082378
2020-09-04T05:57:37
2020-09-04T05:57:37
265,504,163
0
0
null
null
null
null
UTF-8
Java
false
false
2,199
java
package com.biz.control; public class For_05 { public static void main(String[] args) { int num = 0; int sum = 0; for(;;) { num++; sum+=num; //sum = sum + num 의 축약형 명령문 if(num >= 10) { break; } } System.out.println("결과 : " + sum); sum = 0; num = 0; for(;;) { num++; sum+=num; //sum = sum + num 의 축약형 명령문 if(num < 10) { } else { break; } } System.out.println("결과 : " + sum); /* * for( ; ;) 명령문의 두번째 세미콜론(;) 앞의 연산식 * for ( ; 조건문; ) * 조건문의 결과값이 true이면 {} 내의 명령문을 실행하고 결과값이 false이면 더이상 반복하지 않고 for명령문을 종료한다. * * 조건문은 * if(조건) { * } else { * break; * } * 와 같은 역할을 수행한다. */ sum = 0; num = 0; for(; num < 10 ;) { num++; sum+=num; //sum = sum + num 의 축약형 명령문 } System.out.println("결과 : " + sum); /* * for( ; ;) 명령문의 첫번째 세미콜론(;) 앞의 명령 * for(초기화코드; 조건문; ) * 초기화 코드는 위에서 선언되어 사용중인 변수값을 clear하는 명령문을 넣을 수 있다. */ // sum = 0; // num = 0; for(num=0, sum=0; num < 10;) { num++; sum+=num; //sum = sum + num 의 축약형 명령문 } System.out.println("결과 : " + sum); /* * for( ; ; ) 명령문의 세번째 명령문 * for( 초기화코드; 조건문; 증감문) * * 1. for()명령을 만나면 * 2. 초기화 명령을 무조건 실행한다. (단, 한번만) * 3. 조건문을 실행하여 결과가 true이면 {} 명령문을 실행한다. * 4. {} 명령문을 실행한 후 for()명령문으로 이동하여 * 5. 증감(num++)명령문을 실행한다. * 6. 다시 조건문을 실행하여 결과가 true인지 검사한다. * * 그리고 계속하여 반복하거나, 중단한다. */ for(num=0, sum=0; num < 10; num++) { sum+=num; //sum = sum + num 의 축약형 명령문 } System.out.println("결과 : " + sum); } }
[ "smskit726@gmail.com" ]
smskit726@gmail.com
6537d0b6179b9d4882bf4da8feae3658fb36a1c7
e3dc5dd135b3f1a2be1130e97292eea14bb904e7
/src/JavaOOP/Lesson2/encapsulation/_1_without_encapsulation/Person.java
ae9f92df6fa14781c32ba426587a856e75e9b8cd
[]
no_license
AnatoliyDeveloper/JavaProg
51fd1d626d2e0879542905ffa88c548cdef48308
daa7e335471451f9b55a99de79cb29f13c01f4c0
refs/heads/master
2020-07-30T20:28:11.918200
2016-11-19T11:01:49
2016-11-19T11:01:57
73,621,142
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package ua.kiev.prog.javaoop.encapsulation._1_without_encapsulation; /** * @author Bohdan Vanchuhov */ public class Person { String name; // field int age; }
[ "sheroryaru@gmail.com" ]
sheroryaru@gmail.com
9574394507dbe50ce14b13d660c74d8dee69065c
2bf18f00081f9701d45313e205251bb93c291bff
/src/main/java/com/mateusz/project/domain/BookDto.java
b77f94aaf60e69b9b8ba66526afbbece65f4b4fb
[]
no_license
MateuszKupiec/project
9d0839e8ffb454093671fd535c347aa3ce422357
0a653c92595b09044daa7ccbf359738b4a3b1cac
refs/heads/master
2023-08-13T00:25:48.356457
2021-10-12T16:37:50
2021-10-12T16:37:50
416,009,105
0
0
null
null
null
null
UTF-8
Java
false
false
567
java
package com.mateusz.project.domain; public class BookDto { private String title; private String author; public BookDto(String title, String author) { this.title = title; this.author = author; } BookDto() { } public String getTitle() { return title; } public String getAuthor() { return author; } @Override public String toString() { return "BookDto{" + "title='" + title + '\'' + ", author='" + author + '\'' + '}'; } }
[ "mateusz.kupiec.pl@gmail.com" ]
mateusz.kupiec.pl@gmail.com
5876e2f75dd3307322fa93b0f7352ff20836b43e
f6df9ef80940c3c51688f924cb3d0a6697a88aa6
/JavaProgrammingSpring2019/src/PracticeForAll/Apple.java
270673088ac474c11d16cc52abfc5de3deb5b2ce
[]
no_license
habibisrafilov/java_programming-Spring-2019
7441ba321eeb9abb99afd244561eb8510ceb86f5
79a05275e96f0b6afe9543b88f3e7c76b31de632
refs/heads/master
2020-05-31T20:20:23.099790
2019-06-05T21:52:52
2019-06-05T21:52:52
190,473,456
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package PracticeForAll; public class Apple extends Shopping { public String shopping(String item , int price) { String word = item; int number = price; return word+" "+number; } }
[ "habib84@mail.ru" ]
habib84@mail.ru
1710bf43f1ccff0c11f1fe38ea4f4121de1bf4bb
e634177d6b3c3ae3830925ba82625c7d12c20bdf
/springcloud-02-shopping-common/src/main/java/com/springcloud/entity/Class1.java
5b19054fb28bc4907178444518d0ab1e20a5ec79
[]
no_license
qfmx/shopping-admin
40a51e426cc7a54811a5f2ef80a0a624efdfe587
9b3dfbc19f8505e4e2da7f22b8ec66a4e6328fb1
refs/heads/master
2022-06-28T08:23:04.518998
2019-06-28T07:24:17
2019-06-28T07:24:17
192,259,547
1
0
null
2022-06-17T02:16:15
2019-06-17T02:11:49
Java
UTF-8
Java
false
false
707
java
package com.springcloud.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * CLASS1表对应的实体类,用于保存表中一行一级类别信息 * @author Ya * */ @Data @NoArgsConstructor @AllArgsConstructor public class Class1 implements java.io.Serializable{ /** * 序列化编号 */ private static final long serialVersionUID = -5094573667413124189L; /** * 类别一编号 */ private Integer class1Id; /** * 类别一名称 */ private String class1Name; /** * 类别一序号 */ private Integer class1Number; /** * 备注 */ private String remarks; }
[ "1125438556@qq.com" ]
1125438556@qq.com
0baa072ee47ab7b92215007a2195576d9cf467f7
f578d80a43fc03d5328b14cf69d067263f06722d
/src/DAO/dao.java
b5c02261b100c6607dd7640652ad09f7c98e6731
[]
no_license
AnggaraAng/Library-App
fe540ad02a92661af3cf7b1342466a24a1c919dd
7d15114fd4a82ed5db79f8dc1a7acb2e1d129f6f
refs/heads/master
2022-10-17T03:29:20.757234
2020-06-19T06:34:42
2020-06-19T06:34:42
273,422,028
0
0
null
null
null
null
UTF-8
Java
false
false
5,536
java
package DAO; import ENTITAS.entitas; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; public class dao { private Connection conn = null; public dao(Connection con) { this.conn = con; } public List<entitas> getUser() { List<entitas> get = new ArrayList(); PreparedStatement ps; ResultSet rs; try { ps = conn.prepareCall("SELECT * FROM usser"); rs = ps.executeQuery(); while (rs.next()) { entitas t = new entitas(); t.setUser(rs.getString(1)); t.setPass(rs.getString(2)); get.add(t); } } catch (Exception e) { } return get; } public List<entitas> getPegawai() { List<entitas> get = new ArrayList(); PreparedStatement ps; ResultSet rs; try { ps = conn.prepareCall("SELECT * FROM pegawai"); rs = ps.executeQuery(); while (rs.next()) { entitas t = new entitas(); t.setPegawai(rs.getString(1)); t.setPas(rs.getString(2)); get.add(t); } } catch (Exception e) { } return get; } public boolean inputdata(entitas t) { PreparedStatement ps; try { ps = conn.prepareStatement("INSERT INTO perpus_new (isbn,judul,kategori,nama_pengarang,nama_penerbit,tahun_terbit) " + "VALUES(?,?,?,?,?,?)"); ps.setString(1, t.getIsbn()); ps.setString(2, t.getJudul()); ps.setString(3, t.getKategori()); ps.setString(4, t.getNama_pengarang()); ps.setString(5, t.getNama_penerbit()); ps.setString(6, t.getTahun_terbit()); if (ps.executeUpdate() > 0) { return true; } } catch (Exception e) { e.printStackTrace(); } return false; } public boolean inputuser(entitas t) { PreparedStatement ps; try { ps = conn.prepareStatement("INSERT INTO usser (user,pass) " + "VALUES(?,?)"); ps.setString(1, t.getUser()); ps.setString(2, t.getPass()); if (ps.executeUpdate() > 0) { return true; } } catch (Exception e) { e.printStackTrace(); } return false; } public List<entitas> getall() { List<entitas> get = new ArrayList(); PreparedStatement ps; ResultSet rs; try { ps = conn.prepareCall("SELECT * FROM perpus_new"); rs = ps.executeQuery(); while (rs.next()) { entitas t = new entitas(); t.setIsbn(rs.getString(1)); t.setJudul(rs.getString(2)); t.setKategori(rs.getString(3)); t.setNama_pengarang(rs.getString(4)); t.setNama_penerbit(rs.getString(5)); t.setTahun_terbit(rs.getString(6)); get.add(t); } } catch (Exception e) { } return get; } public List<entitas> CariBuku(String judul) { List<entitas> get = new ArrayList(); PreparedStatement ps; ResultSet rs; try { ps = conn.prepareCall("SELECT * FROM perpus_new WHERE judul LIKE '%" + judul + "%' OR nama_pengarang LIKE '%" + judul + "%' OR nama_penerbit LIKE '%" + judul + "%' OR tahun_terbit LIKE '%" + judul + "%'"); rs = ps.executeQuery(); while (rs.next()) { entitas t = new entitas(); t.setIsbn(rs.getString(1)); t.setJudul(rs.getString(2)); t.setKategori(rs.getString(3)); t.setNama_pengarang(rs.getString(4)); t.setNama_penerbit(rs.getString(5)); t.setTahun_terbit(rs.getString(6)); get.add(t); } } catch (Exception e) { } return get; } public String hapus(String isbn) { String hasil = "Tidak Berhasil dihapus"; String query = "DELETE FROM perpus_new WHERE isbn='" + isbn + "'"; Statement st; try { st = conn.createStatement(); if (st.executeUpdate(query) > 0) { hasil = "Berhasil dihapus"; } } catch (Exception e) { } return hasil; } public String Perbarui(String isbn, String judul, String kategori, String nama_pengarang, String nama_penerbit, String tahun_terbit) { String hasil = "Tidak Berhasil diperbarui"; String sql = "UPDATE perpus_new SET isbn='" + isbn + "',judul='" + judul + "',kategori='" + kategori + "'" + ",nama_pengarang = '" + nama_pengarang + "',nama_penerbit = '" + nama_penerbit + "',tahun_terbit = '" + tahun_terbit + "' WHERE isbn = '" + isbn + "'"; Statement st; try { st = conn.createStatement(); if (st.executeUpdate(sql) > 0) { hasil = "Berhasil diupdate"; } } catch (Exception e) { } return hasil; } }
[ "anggianggarajr@gmail.com" ]
anggianggarajr@gmail.com
9b7efde516a04f248243f179817023c1a46c8932
40fffc37c379a71c47e45a10f1884ca0b81a4184
/TellMe/app/src/main/java/com/kutztown/tellme/DisplayGuestMain.java
0d596edbfe6181af23279c9784f1eb05d8cf5710
[]
no_license
zkern870/TellMe
32f7ec4b350fc75ea1b7ed84f4bca8d2c40b489b
b1f30b3cfb1ce784281a6d8abb4ba452acc54b72
refs/heads/master
2021-01-10T01:46:41.147060
2016-02-09T00:23:25
2016-02-09T00:23:25
50,141,363
0
1
null
2016-01-22T02:33:55
2016-01-21T22:34:09
null
UTF-8
Java
false
false
1,203
java
package com.kutztown.tellme; import android.content.Intent; 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 DisplayGuestMain extends AppCompatActivity { /** * This will be called when the Tell Me button is clicked from the display * guest activity. It will send to a news feed activity. * @param view */ public void sendGuestNewsFeed (View view){ Intent intent = new Intent(this, sendGuestNewsFeed.class); startActivity(intent); } public void sendGuestFoodFeed (View view ) { Intent intent1 = new Intent(this, sendGuestFeedMe.class); startActivity(intent1); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_guest_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } }
[ "zkern870@live.kutztown.edu" ]
zkern870@live.kutztown.edu
96da45eb029d9bd2dddf0592cd601c9d285134cf
c0dd3ad8a2bda1b8e070d00a15006584e82730bb
/Web-Automation/src/com/sgtesting/testscripts/Assign7.java
abec1f54201b3ab22cfc9e03e60227503163ee25
[]
no_license
RAKESHSHARMAJ/TestAutomation
59d147d59ab82aa69ba29977601c5e95416d15a8
c169a9adb1312926932505be3bdfbbbcedc2d6d5
refs/heads/master
2023-08-25T20:00:37.481851
2021-11-05T16:59:50
2021-11-05T16:59:50
425,008,059
0
0
null
null
null
null
UTF-8
Java
false
false
5,672
java
package com.sgtesting.testscripts; import java.time.Duration; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Assign7 { public static WebDriver oBrowser=null; public static void main(String[] args) { launchBrowser(); navigate(); login(); minimizeFlyoutWindow(); CreateCustomer(); createProject(); createTask(); deleteTask(); deleteProject(); deleteCustomer(); logout(); closeApplication(); } static void launchBrowser() { try { System.setProperty("webdriver.chrome.driver", "D:\\Exampleautomation\\Automation\\Web-Automation\\Library\\Drivers\\chromedriver.exe"); oBrowser=new ChromeDriver(); }catch(Exception e) { e.printStackTrace(); } } static void navigate() { try { oBrowser.navigate().to("http://localhost/login.do"); oBrowser.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(60)); }catch(Exception e) { e.printStackTrace(); } } static void login() { try { oBrowser.findElement(By.id("username")).sendKeys("admin"); oBrowser.findElement(By.name("pwd")).sendKeys("manager"); oBrowser.findElement(By.xpath("//*[@id=\"loginButton\"]/div")).click(); Thread.sleep(3000); }catch (Exception e) { e.printStackTrace(); } } static void minimizeFlyoutWindow() { try { oBrowser.findElement(By.id("gettingStartedShortcutsPanelId")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void CreateCustomer() { try { oBrowser.findElement(By.xpath("//*[@id=\"topnav\"]/tbody/tr/td[3]/a/div[1]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"cpTreeBlock\"]/div[2]/div[1]/div[2]/div/div[3]")).click(); Thread.sleep(3000); oBrowser.findElement(By.xpath("/html/body/div[14]/div[1]")).click(); Thread.sleep(2000); oBrowser.findElement(By.id("customerLightBox_nameField")).sendKeys("bbbb"); oBrowser.findElement(By.xpath("//*[@id=\"customerLightBox_commitBtn\"]/div/span")).click(); Thread.sleep(5000); }catch(Exception e) { e.printStackTrace(); } } static void createProject() { try { oBrowser.findElement(By.xpath("//*[@id=\"cpTreeBlock\"]/div[2]/div[1]/div[2]/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("/html/body/div[14]/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.id("projectPopup_projectNameField")).sendKeys("ttt"); oBrowser.findElement(By.xpath("//*[@id=\"projectPopup_commitBtn\"]/div/span")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void createTask() { try { oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[1]/div[1]/div[3]/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("/html/body/div[13]/div[1]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"createTasksPopup_createTasksTableContainer\"]/table/tbody/tr[1]/td[1]/input")).sendKeys("ccc"); oBrowser.findElement(By.xpath("//*[@id=\"createTasksPopup_commitBtn\"]/div/span")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void deleteTask() { try { oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[1]/div[2]/div[1]/table[1]/tbody/tr/td[2]/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[3]/div[1]/div[2]/div[3]/div/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[3]/div[4]/div/div[3]/div")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskPanel_deleteConfirm_submitTitle\"]")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void deleteProject() { try { oBrowser.findElement(By.xpath ("//*[@id=\"cpTreeBlock\"]/div[2]/div[2]/div/div[2]/div/div[1]/div[2]/div[3]/div[3]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[4]/div[1]/div[2]/div[3]/div/div/div[2]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[4]/div[4]/div/div[3]/div")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"projectPanel_deleteConfirm_submitTitle\"]")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void deleteCustomer() { try { oBrowser.findElement(By.xpath("//*[@id=\"cpTreeBlock\"]/div[2]/div[2]/div/div[2]/div/div[1]/div[2]/div[2]/div[4]")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[2]/div[1]/div[4]/div/div")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"taskListBlock\"]/div[2]/div[4]/div/div[3]/div")).click(); Thread.sleep(2000); oBrowser.findElement(By.xpath("//*[@id=\"customerPanel_deleteConfirm_submitBtn\"]/div")).click(); Thread.sleep(5000); }catch(Exception e) { e.printStackTrace(); } } static void logout() { try { oBrowser.findElement(By.id("logoutLink")).click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void closeApplication() { try { oBrowser.quit(); }catch(Exception e) { e.printStackTrace(); } } }
[ "sharmadevilliers@gmail.com" ]
sharmadevilliers@gmail.com
2db2df83f43921498b83dc395de39e60803a686f
8f4788ac46f7628509478a3dc7099058ae70d07a
/org-netbeans-api-visualfx/src/test/java/test/lod/LevelOfDetailsTest.java
8f33fe15594d42c5cde42bd97bfed407d061fc7f
[]
no_license
theanuradha/visual-library-fx
8cc29d066f06ad4073b5db91b98bca46587c7683
03b40eca1d7e3d57eeda3dc7a59cc2e936d4a942
refs/heads/master
2021-06-24T05:42:44.100965
2020-10-30T11:01:41
2020-10-30T11:01:41
90,547,495
12
1
null
2020-10-30T11:01:42
2017-05-07T16:50:24
Java
UTF-8
Java
false
false
3,637
java
/* * The contents of this file are subject to the terms of the Common Development * and Distribution License (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at http://www.netbeans.org/cddl.html * or http://www.netbeans.org/cddl.txt. * * When distributing Covered Code, include this CDDL Header Notice in each file * and include the License file at http://www.netbeans.org/cddl.txt. * If applicable, add the following below the CDDL Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * The Original Software is NetBeans. The Initial Developer of the Original * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun * Microsystems, Inc. All Rights Reserved. */ package test.lod; import java.awt.Color; import org.netbeans.api.visual.action.ActionFactory; import org.netbeans.api.visual.action.TwoStateHoverProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.border.BorderFactory; import org.netbeans.api.visual.layout.LayoutFactory; import org.netbeans.api.visual.widget.LabelWidget; import org.netbeans.api.visual.widget.LevelOfDetailsWidget; import org.netbeans.api.visual.widget.Scene; import org.netbeans.api.visual.widget.Widget; import test.SceneSupport; /** * @author David Kaspar */ public class LevelOfDetailsTest { public static void main(String[] args) { Scene scene = new Scene(); scene.setZoomFactor(0.2); scene.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, 0)); scene.getActions().addAction(ActionFactory.createZoomAction(1.1, false)); scene.getActions().addAction(ActionFactory.createPanAction()); WidgetAction hover = ActionFactory.createHoverAction(new TwoStateHoverProvider() { public void setHovering(Widget widget) { widget.setOpaque(true); widget.setBackground(Color.GREEN); } public void unsetHovering(Widget widget) { widget.setOpaque(false); widget.setBackground(Color.WHITE); } }); scene.getActions().addAction(hover); scene.addChild(createLabel(scene, "Use mouse-wheel for zooming, use middle button for panning.", 72)); scene.addChild(createLabel(scene, "For more details zoom into the rectangle below.", 72)); Widget root = new LevelOfDetailsWidget(scene, 0.21, 0.3, Double.MAX_VALUE, Double.MAX_VALUE); root.setBorder(BorderFactory.createLineBorder(10)); root.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 4)); scene.addChild(root); for (int a = 0; a < 10; a++) { root.addChild(createLabel(scene, "Row: " + a, 36)); Widget row = new LevelOfDetailsWidget(scene, 0.3, 0.5, Double.MAX_VALUE, Double.MAX_VALUE); row.setBorder(BorderFactory.createLineBorder(4)); row.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 4)); row.getActions().addAction(hover); root.addChild(row); for (int b = 0; b < 20; b++) { Widget item = new LevelOfDetailsWidget(scene, 0.5, 1.0, Double.MAX_VALUE, Double.MAX_VALUE); item.setBorder(BorderFactory.createLineBorder(2)); item.addChild(createLabel(scene, "Item-" + a + "," + b, 18)); item.getActions().addAction(hover); row.addChild(item); } } SceneSupport.show(scene); } private static Widget createLabel(Scene scene, String text, int size) { LabelWidget label = new LabelWidget(scene, text); label.setFont(scene.getDefaultFont().deriveFont((float) size)); return label; } }
[ "theanuradha@gmail.com" ]
theanuradha@gmail.com
1771ecd210e9feb1b21e37b8d472d1e2d595445b
47d0c52d8a73baf2271ec281160c575293821506
/Uebung3_2/src/uebung3_1/Server.java
bc4b1b4b2f55118e416f8370a3da53c1e5c14695
[]
no_license
xchrx/VS2018
54631d4071d4fc5342ea11e67e94cf144b80ef18
e5c57e81cc1213547f75d36f58a6aed64ead4c6f
refs/heads/master
2020-03-19T10:02:00.146512
2018-06-20T15:21:56
2018-06-20T15:21:56
136,337,506
0
0
null
null
null
null
UTF-8
Java
false
false
1,330
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 uebung3_1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Chris */ public class Server { /** * @param args the command line arguments */ public static void main(String[] args) { ExecutorService es = Executors.newFixedThreadPool(10); try { ServerSocket servSocket = new ServerSocket(8080); System.out.println("Wartet auf Verbindung"); while(true) { Socket s = servSocket.accept(); System.out.println("Neue Verbindung"); es.execute(new Requesthandler(s)); } } catch (IOException ex) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); } } }
[ "Christianjuenger93@gmail.com" ]
Christianjuenger93@gmail.com
9d9647e85ef93e16c4fd58901d9a8f6e28910f95
a9f5b738e2f61019ff13d4c854a1b7b2acf0dc90
/test6/src/main/java/test1/DetailController.java
03a8d8887fd33a0a18a2c0279983209f2e167008
[]
no_license
Duy-Phuong/SPRING-MVC
7ba5f18cef2d4c759f21b58a6695f8875f513ee2
6cc2fe39bf26c2df33734a6ec3a9ccd1a34ccd13
refs/heads/master
2020-03-09T08:36:11.470753
2018-05-17T02:00:50
2018-05-17T02:00:50
128,693,083
0
0
null
null
null
null
UTF-8
Java
false
false
701
java
package test1; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import entity.NhanVien; @Controller @RequestMapping("/chitiet") public class DetailController { @GetMapping public String Default() { return "chitiet"; } ///phai SD cai nay: viet k dau @PostMapping public String Display(@ModelAttribute NhanVien nv, ModelMap modelmap) { modelmap.addAttribute("nv", nv); return "chitiet"; } }
[ "tranduyphuong20100@gmail.com" ]
tranduyphuong20100@gmail.com
536bb02a1dae21bc76fa8c7ca0ae1e4f6df9054f
ec3c9056ab5e1c8697a996a7fb57baed3a090bfb
/e3-item-web/target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/jsp/commons/header_jsp.java
ec7b81a97236f0451b2c862a6bcb0761ebe9370c
[]
no_license
lhsjohn/e3mall
7192c682aeff983425361b4cf8068103f2d5f6cb
2582c5abecf11b4e0445c39d33bbb8d871ec3015
refs/heads/master
2020-03-27T04:29:46.579862
2018-08-24T05:58:45
2018-08-24T05:58:45
145,945,218
1
0
null
null
null
null
UTF-8
Java
false
false
6,599
java
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.47 * Generated at: 2018-08-23 07:42:02 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.WEB_002dINF.jsp.commons; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class header_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("<!--shortcut start-->\r\n"); org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "shortcut.jsp", out, false); out.write("\r\n"); out.write("<!--shortcut end-->\r\n"); out.write("<div id=\"header\">\r\n"); out.write(" <div class=\"header_inner\">\r\n"); out.write(" <div class=\"logo\">\r\n"); out.write("\t\t\t<a name=\"sfbest_hp_hp_head_logo\" href=\"http://www.e3mall.cn\" class=\"trackref logoleft\">\r\n"); out.write("\t\t</a>\r\n"); out.write("\t\t\t<div class=\"logo-text\">\r\n"); out.write("\t\t\t\t<img src=\"/images/html/logo_word.jpg\">\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t</div>\r\n"); out.write(" <div class=\"index_promo\"></div>\r\n"); out.write(" <div class=\"search\">\r\n"); out.write(" <form action=\"/productlist/search\" id=\"searchForm\" name=\"query\" method=\"GET\">\r\n"); out.write(" <input type=\"hidden\" name=\"inputBox\" value=\"1\"><input type=\"hidden\" name=\"categoryId\" value=\"0\">\r\n"); out.write(" <input type=\"text\" class=\"text keyword ac_input\" name=\"keyword\" id=\"keyword\" value=\"\" style=\"color: rgb(153, 153, 153);\" onkeydown=\"javascript:if(event.keyCode==13) search_keys('searchForm');\" autocomplete=\"off\">\r\n"); out.write(" <input type=\"button\" value=\"\" class=\"submit\" onclick=\"search_keys('searchForm')\">\r\n"); out.write(" </form>\r\n"); out.write(" <div class=\"search_hot\"><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E5%A4%A7%E9%97%B8%E8%9F%B9#trackref=sfbest_hp_hp_head_Keywords1\">大闸蟹</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E7%9F%B3%E6%A6%B4#trackref=sfbest_hp_hp_head_Keywords2\">石榴</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E6%9D%BE%E8%8C%B8#trackref=sfbest_hp_hp_head_Keywords3\">松茸</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E7%89%9B%E6%8E%92#trackref=sfbest_hp_hp_head_Keywords4\">牛排</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E7%99%BD%E8%99%BE#trackref=sfbest_hp_hp_head_Keywords5\">白虾</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E5%85%A8%E8%84%82%E7%89%9B%E5%A5%B6#trackref=sfbest_hp_hp_head_Keywords6\">全脂牛奶</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E6%B4%8B%E6%B2%B3#trackref=sfbest_hp_hp_head_Keywords7\">洋河</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E7%BB%BF%E8%B1%86#trackref=sfbest_hp_hp_head_Keywords8\">绿豆</a><a target=\"_blank\" href=\"http://www.e3mall.cn/productlist/search?inputBox=1&amp;keyword=%E4%B8%80%E5%93%81%E7%8E%89#trackref=sfbest_hp_hp_head_Keywords9\">一品玉</a></div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"shopingcar\" id=\"topCart\">\r\n"); out.write(" <s class=\"setCart\"></s><a href=\"http://cart.e3mall.cn\" class=\"t\" rel=\"nofollow\">我的购物车</a><b id=\"cartNum\">0</b>\r\n"); out.write(" <span class=\"outline\"></span>\r\n"); out.write(" <span class=\"blank\"></span>\r\n"); out.write(" <div id=\"cart_lists\">\r\n"); out.write(" <!--cartContent--> \r\n"); out.write(" <div class=\"clear\"></div>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write("</div>"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
[ "33946278+lhsjohn@users.noreply.github.com" ]
33946278+lhsjohn@users.noreply.github.com
6440318cac9f2c8a51128ca9fd9abeda3d15fdc4
7c58036ce3281636a98ca0c2c449985498e40cfc
/Serialize/Person.java
12bb8a73f1db7284230fe3950d9ef04a7bee27cf
[]
no_license
SweeneyWEI/Test
150e33a18f530243754001bf5e92d2b460080c5d
0a6cfd485d38e5706af8871ef54e317e0270ad95
refs/heads/master
2021-01-20T12:16:21.456365
2017-10-07T12:49:03
2017-10-07T12:49:03
101,706,342
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package org.Test.Serialize; import java.io.Serializable; /** * Created by weixin on 17-7-30. */ public class Person implements Serializable{ private String name; private String sex; private int age; private int Snumber; public int getSnumber() { return Snumber; } public void setSnumber(int snumber) { Snumber = snumber; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
[ "1154416503@qq.com" ]
1154416503@qq.com
b39dc7f709083264645a493529467de107307dbe
6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386
/google/cloud/metastore/v1/google-cloud-metastore-v1-java/proto-google-cloud-metastore-v1-java/src/main/java/com/google/cloud/metastore/v1/DeleteBackupRequest.java
529c39e248a1ef3eaf2b2b281cc4630339c93b66
[ "Apache-2.0" ]
permissive
oltoco/googleapis-gen
bf40cfad61b4217aca07068bd4922a86e3bbd2d5
00ca50bdde80906d6f62314ef4f7630b8cdb6e15
refs/heads/master
2023-07-17T22:11:47.848185
2021-08-29T20:39:47
2021-08-29T20:39:47
null
0
0
null
null
null
null
UTF-8
Java
false
true
30,534
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/metastore/v1/metastore.proto package com.google.cloud.metastore.v1; /** * <pre> * Request message for [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1.DataprocMetastore.DeleteBackup]. * </pre> * * Protobuf type {@code google.cloud.metastore.v1.DeleteBackupRequest} */ public final class DeleteBackupRequest extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.metastore.v1.DeleteBackupRequest) DeleteBackupRequestOrBuilder { private static final long serialVersionUID = 0L; // Use DeleteBackupRequest.newBuilder() to construct. private DeleteBackupRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private DeleteBackupRequest() { name_ = ""; requestId_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new DeleteBackupRequest(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private DeleteBackupRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { java.lang.String s = input.readStringRequireUtf8(); name_ = s; break; } case 18: { java.lang.String s = input.readStringRequireUtf8(); requestId_ = s; break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.metastore.v1.DeleteBackupRequest.class, com.google.cloud.metastore.v1.DeleteBackupRequest.Builder.class); } public static final int NAME_FIELD_NUMBER = 1; private volatile java.lang.Object name_; /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return The name. */ @java.lang.Override public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); name_ = s; return s; } } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return The bytes for name. */ @java.lang.Override public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int REQUEST_ID_FIELD_NUMBER = 2; private volatile java.lang.Object requestId_; /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The requestId. */ @java.lang.Override public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The bytes for requestId. */ @java.lang.Override public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (!getRequestIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, requestId_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (!getRequestIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, requestId_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.metastore.v1.DeleteBackupRequest)) { return super.equals(obj); } com.google.cloud.metastore.v1.DeleteBackupRequest other = (com.google.cloud.metastore.v1.DeleteBackupRequest) obj; if (!getName() .equals(other.getName())) return false; if (!getRequestId() .equals(other.getRequestId())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER; hash = (53 * hash) + getRequestId().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.metastore.v1.DeleteBackupRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.cloud.metastore.v1.DeleteBackupRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * Request message for [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1.DataprocMetastore.DeleteBackup]. * </pre> * * Protobuf type {@code google.cloud.metastore.v1.DeleteBackupRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.metastore.v1.DeleteBackupRequest) com.google.cloud.metastore.v1.DeleteBackupRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.metastore.v1.DeleteBackupRequest.class, com.google.cloud.metastore.v1.DeleteBackupRequest.Builder.class); } // Construct using com.google.cloud.metastore.v1.DeleteBackupRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); name_ = ""; requestId_ = ""; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.metastore.v1.MetastoreProto.internal_static_google_cloud_metastore_v1_DeleteBackupRequest_descriptor; } @java.lang.Override public com.google.cloud.metastore.v1.DeleteBackupRequest getDefaultInstanceForType() { return com.google.cloud.metastore.v1.DeleteBackupRequest.getDefaultInstance(); } @java.lang.Override public com.google.cloud.metastore.v1.DeleteBackupRequest build() { com.google.cloud.metastore.v1.DeleteBackupRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.metastore.v1.DeleteBackupRequest buildPartial() { com.google.cloud.metastore.v1.DeleteBackupRequest result = new com.google.cloud.metastore.v1.DeleteBackupRequest(this); result.name_ = name_; result.requestId_ = requestId_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.metastore.v1.DeleteBackupRequest) { return mergeFrom((com.google.cloud.metastore.v1.DeleteBackupRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.metastore.v1.DeleteBackupRequest other) { if (other == com.google.cloud.metastore.v1.DeleteBackupRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getRequestId().isEmpty()) { requestId_ = other.requestId_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.metastore.v1.DeleteBackupRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.metastore.v1.DeleteBackupRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private java.lang.Object name_ = ""; /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); name_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @param value The name to set. * @return This builder for chaining. */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } name_ = value; onChanged(); return this; } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @return This builder for chaining. */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * <pre> * Required. The relative resource name of the backup to delete, in the * following form: * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code> * @param value The bytes for name to set. * @return This builder for chaining. */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); name_ = value; onChanged(); return this; } private java.lang.Object requestId_ = ""; /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The requestId. */ public java.lang.String getRequestId() { java.lang.Object ref = requestId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); requestId_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The bytes for requestId. */ public com.google.protobuf.ByteString getRequestIdBytes() { java.lang.Object ref = requestId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); requestId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @param value The requestId to set. * @return This builder for chaining. */ public Builder setRequestId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } requestId_ = value; onChanged(); return this; } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @return This builder for chaining. */ public Builder clearRequestId() { requestId_ = getDefaultInstance().getRequestId(); onChanged(); return this; } /** * <pre> * Optional. A request ID. Specify a unique request ID to allow the server to ignore the * request if it has completed. The server will ignore subsequent requests * that provide a duplicate request ID for at least 60 minutes after the first * request. * For example, if an initial request times out, followed by another request * with the same request ID, the server ignores the second request to prevent * the creation of duplicate commitments. * The request ID must be a valid * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. * </pre> * * <code>string request_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code> * @param value The bytes for requestId to set. * @return This builder for chaining. */ public Builder setRequestIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); requestId_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.metastore.v1.DeleteBackupRequest) } // @@protoc_insertion_point(class_scope:google.cloud.metastore.v1.DeleteBackupRequest) private static final com.google.cloud.metastore.v1.DeleteBackupRequest DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.metastore.v1.DeleteBackupRequest(); } public static com.google.cloud.metastore.v1.DeleteBackupRequest getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<DeleteBackupRequest> PARSER = new com.google.protobuf.AbstractParser<DeleteBackupRequest>() { @java.lang.Override public DeleteBackupRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new DeleteBackupRequest(input, extensionRegistry); } }; public static com.google.protobuf.Parser<DeleteBackupRequest> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<DeleteBackupRequest> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.metastore.v1.DeleteBackupRequest getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
26b9a78f84f26520e0c40462b4cf7ad85bd28cf0
84745d0ad0fdeb70957eacf45c84271c20ebecdc
/HashMapsAndHeaps/FindUniqueElement.java
e90a87c0775fdbfb06efdf92ceda13b19a8efe7d
[]
no_license
AnandKshitij/Java-Codes
1f6c39c882161c360ce9bb5e149311fd4b23696b
f5ca324efd01d214e45c3646c8e878ec7eab99b7
refs/heads/main
2023-01-07T04:51:07.031104
2020-11-05T10:05:01
2020-11-05T10:05:01
310,256,830
0
0
null
null
null
null
UTF-8
Java
false
false
1,227
java
package HashMapsAndHeaps; /* 1. You will be given an Array and its length. 2. You will also be given k, the number of times each element repeats in that array, except ONE element. 3. You need to find that ONE unique element, which does not repeat and return it 4. Input and output is handled for you 5. It is a functional problem ,please do not modify main() Sample Input 7 2 2 8 2 9 0 9 0 Sample Output 8 */ import java.util.*; import java.lang.*; import java.io.*; public class FindUniqueElement { public static void main (String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int input[] = new int [n]; for(int i=0; i<n; i++) { input[i] = s.nextInt(); } solve(input,k); } public static void solve(int [] arr,int k) { HashMap<Integer,Integer> H = new HashMap<>(); for(int i=0; i<arr.length; i++) { int val = arr[i]; if(!H.containsKey(val)) { H.put(val,1); } else { H.put(val,H.get(val)+1); } } for(int i : H.keySet()) { if(H.get(i)==1) { System.out.println(i); } } } }
[ "kshitijanand0512@gmail.com" ]
kshitijanand0512@gmail.com
c1d4eaf9a389e1c18032c94e4d7bc510fca032cd
5dc459ebd5fa612e9c5c8cefdc470eabb77d5641
/src/main/java/com/sforce/soap/partner/fault/ObjectFactory.java
06a792929d43125955351248eeccddfe5ff361eb
[]
no_license
jsuarez-chipiron/audit-trail-extractor
65e043fe6e420aab5fa3c2786d74c21b6e68b218
ff62b5e1da0189e19d016a0598d2bb10f8d31566
refs/heads/master
2021-01-22T03:40:32.930145
2017-05-25T10:54:05
2017-05-25T10:54:05
92,394,046
2
0
null
null
null
null
UTF-8
Java
false
false
8,658
java
package com.sforce.soap.partner.fault; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the com.sforce.soap.partner.fault package. * <p>An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { private final static QName _UnexpectedErrorFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "UnexpectedErrorFault"); private final static QName _Fault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "fault"); private final static QName _LoginFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "LoginFault"); private final static QName _InvalidQueryLocatorFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidQueryLocatorFault"); private final static QName _InvalidNewPasswordFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidNewPasswordFault"); private final static QName _InvalidSObjectFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidSObjectFault"); private final static QName _MalformedQueryFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "MalformedQueryFault"); private final static QName _InvalidIdFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidIdFault"); private final static QName _InvalidFieldFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "InvalidFieldFault"); private final static QName _MalformedSearchFault_QNAME = new QName("urn:fault.partner.soap.sforce.com", "MalformedSearchFault"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sforce.soap.partner.fault * */ public ObjectFactory() { } /** * Create an instance of {@link InvalidSObjectFault } * */ public InvalidSObjectFault createInvalidSObjectFault() { return new InvalidSObjectFault(); } /** * Create an instance of {@link MalformedQueryFault } * */ public MalformedQueryFault createMalformedQueryFault() { return new MalformedQueryFault(); } /** * Create an instance of {@link InvalidIdFault } * */ public InvalidIdFault createInvalidIdFault() { return new InvalidIdFault(); } /** * Create an instance of {@link MalformedSearchFault } * */ public MalformedSearchFault createMalformedSearchFault() { return new MalformedSearchFault(); } /** * Create an instance of {@link InvalidFieldFault } * */ public InvalidFieldFault createInvalidFieldFault() { return new InvalidFieldFault(); } /** * Create an instance of {@link UnexpectedErrorFault } * */ public UnexpectedErrorFault createUnexpectedErrorFault() { return new UnexpectedErrorFault(); } /** * Create an instance of {@link ApiFault } * */ public ApiFault createApiFault() { return new ApiFault(); } /** * Create an instance of {@link InvalidQueryLocatorFault } * */ public InvalidQueryLocatorFault createInvalidQueryLocatorFault() { return new InvalidQueryLocatorFault(); } /** * Create an instance of {@link LoginFault } * */ public LoginFault createLoginFault() { return new LoginFault(); } /** * Create an instance of {@link InvalidNewPasswordFault } * */ public InvalidNewPasswordFault createInvalidNewPasswordFault() { return new InvalidNewPasswordFault(); } /** * Create an instance of {@link ApiQueryFault } * */ public ApiQueryFault createApiQueryFault() { return new ApiQueryFault(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link UnexpectedErrorFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "UnexpectedErrorFault") public JAXBElement<UnexpectedErrorFault> createUnexpectedErrorFault(UnexpectedErrorFault value) { return new JAXBElement<UnexpectedErrorFault>(_UnexpectedErrorFault_QNAME, UnexpectedErrorFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link ApiFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "fault") public JAXBElement<ApiFault> createFault(ApiFault value) { return new JAXBElement<ApiFault>(_Fault_QNAME, ApiFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link LoginFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "LoginFault") public JAXBElement<LoginFault> createLoginFault(LoginFault value) { return new JAXBElement<LoginFault>(_LoginFault_QNAME, LoginFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidQueryLocatorFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidQueryLocatorFault") public JAXBElement<InvalidQueryLocatorFault> createInvalidQueryLocatorFault(InvalidQueryLocatorFault value) { return new JAXBElement<InvalidQueryLocatorFault>(_InvalidQueryLocatorFault_QNAME, InvalidQueryLocatorFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidNewPasswordFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidNewPasswordFault") public JAXBElement<InvalidNewPasswordFault> createInvalidNewPasswordFault(InvalidNewPasswordFault value) { return new JAXBElement<InvalidNewPasswordFault>(_InvalidNewPasswordFault_QNAME, InvalidNewPasswordFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidSObjectFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidSObjectFault") public JAXBElement<InvalidSObjectFault> createInvalidSObjectFault(InvalidSObjectFault value) { return new JAXBElement<InvalidSObjectFault>(_InvalidSObjectFault_QNAME, InvalidSObjectFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link MalformedQueryFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "MalformedQueryFault") public JAXBElement<MalformedQueryFault> createMalformedQueryFault(MalformedQueryFault value) { return new JAXBElement<MalformedQueryFault>(_MalformedQueryFault_QNAME, MalformedQueryFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidIdFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidIdFault") public JAXBElement<InvalidIdFault> createInvalidIdFault(InvalidIdFault value) { return new JAXBElement<InvalidIdFault>(_InvalidIdFault_QNAME, InvalidIdFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link InvalidFieldFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "InvalidFieldFault") public JAXBElement<InvalidFieldFault> createInvalidFieldFault(InvalidFieldFault value) { return new JAXBElement<InvalidFieldFault>(_InvalidFieldFault_QNAME, InvalidFieldFault.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link MalformedSearchFault }{@code >}} * */ @XmlElementDecl(namespace = "urn:fault.partner.soap.sforce.com", name = "MalformedSearchFault") public JAXBElement<MalformedSearchFault> createMalformedSearchFault(MalformedSearchFault value) { return new JAXBElement<MalformedSearchFault>(_MalformedSearchFault_QNAME, MalformedSearchFault.class, null, value); } }
[ "jsuarez@salesforce.com" ]
jsuarez@salesforce.com
453ba4805d4adc5e1a518270c2cf85974b8460fe
114d7cfd55f487b2038344e65a28d47c107b98d5
/src/main/java/cl/awakelab/stsproj/controller/HomeController.java
a99973c7cf0882fb8f1896bfab4a817e7ddbec66
[]
no_license
bguzmanm/stsproj
7656cbf6bee6c14c9d2c6703fff2c6fb8f5ce895
1587fd6932b1aec74d06c24e53bdcaffae6ebdbd
refs/heads/main
2023-07-18T11:15:01.286948
2021-08-26T13:58:07
2021-08-26T13:58:07
397,983,389
0
0
null
null
null
null
UTF-8
Java
false
false
2,025
java
package cl.awakelab.stsproj.controller; import java.util.Map; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.MatrixVariable; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import cl.awakelab.stsproj.model.Facilitador; /** * Handles requests for the application home page. */ @Controller public class HomeController { /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Model model) { Facilitador f = new Facilitador("1-1", "Brian", "Guzmán"); model.addAttribute("f", f); return "home"; } /** * Definimos una expresión regular donde * @param nombre recibe letras desde a hasta la z, entre 1 y 20 caracteres. * @param version recibe números entre 0 y 9, entre 1 y dos digitos, tres veces. * @param extension recibe letras desde la a hasta la z, A hasta la Z, y números desde el 0 al 9, desde 1 a 10 veces. * @return retorna "home", y muestra por consola lo que ingresaste. */ @RequestMapping(value = "/jome/{nombre:[a-zA-Z]{1,20}}.{version:[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}}.{extension:[a-zA-Z0-9]{1,10}}", method = RequestMethod.GET) public String jome(@PathVariable("nombre") String nombre, @PathVariable("version") String version, @PathVariable("extension") String extension) { System.out.println(nombre + "." + version + "." + extension); return "home"; } //GET /pets/42;q=11;r=22 //GET /estudiantes/156-2;gabriel;daniel;ronald;luis //GET /estudiantes/156-2;gabriel;eliseo;ronald;luis;esteban @RequestMapping(value="/pets/{petId}", method = RequestMethod.GET) public String findPet(@MatrixVariable(pathVar="petId") Map<String, String> petMatrixVars) { System.out.println("q= " + petMatrixVars.size()); return "home"; } }
[ "brian.guzman@gmail.com" ]
brian.guzman@gmail.com
1fa1c9728c16dcd28d6898060b2675dfe1d6a754
29423f34238795c607a5ecd9de8acad6c5aef583
/src/test/java/hackathon/epam/selfcoop/customwebdrivers/WebDriverWrapper.java
a70d9e2fc3aa2a81902ac1a3a4477373a9e6c042
[ "MIT" ]
permissive
itev4n7/self-coop-hackathon
98d60fde200814bdb46ecefd79eb3dfd8de74155
2d80f031d6b29cfb13e1d6158475bc25a0c9963f
refs/heads/main
2023-08-24T17:23:13.001825
2021-09-19T06:20:32
2021-09-19T06:20:32
407,802,163
1
0
null
null
null
null
UTF-8
Java
false
false
416
java
package hackathon.epam.selfcoop.customwebdrivers; import org.openqa.selenium.WebDriver; public class WebDriverWrapper { private static final ThreadLocal<WebDriver> driver = new ThreadLocal<>(); private WebDriverWrapper() {} public static void setDriver(WebDriver customDriver) { driver.set(customDriver); } public static WebDriver getDriver() { return driver.get(); } }
[ "alexeykvasovn7@gmail.com" ]
alexeykvasovn7@gmail.com
132ec1d733a45fb9b9c38b7246264875b19c9bec
88b3628394c545c30e00c23402a4c05449d73cf2
/javaConcurrentInPractice/src/main/java/net/jcip/examples/_11_performanceAndScalability/WorkerThread.java
cf03075d8c4033753e6941a812a4c3493fadc5a7
[]
no_license
cyhbyw/ProjectA
42d61d1696978606592a9ec4e9fb17988fe6c2cd
688c62460e5b828618fbe9b346d1f2cba5f1b4b8
refs/heads/master
2022-07-26T13:07:27.971783
2021-03-26T02:09:09
2021-03-26T02:09:09
119,479,548
1
2
null
2022-06-29T17:02:51
2018-01-30T03:54:37
Java
UTF-8
Java
false
false
668
java
package net.jcip.examples._11_performanceAndScalability; import java.util.concurrent.BlockingQueue; /** * WorkerThread * <p/> * Serialized access to a task queue * * @author Brian Goetz and Tim Peierls */ public class WorkerThread extends Thread { private final BlockingQueue<Runnable> queue; public WorkerThread(BlockingQueue<Runnable> queue) { this.queue = queue; } public void run() { while (true) { try { Runnable task = queue.take(); task.run(); } catch (InterruptedException e) { break; /* Allow thread to exit */ } } } }
[ "swust2009cyh@qq.com" ]
swust2009cyh@qq.com
600b87b465197b81d6ff85b5a9a18a1f6d8c4e48
45b3284b991a219633feadff255b915cf0570ae4
/src/runJava/ch04/Ch04Ex09.java
1651a2d3f2fd42c79fac4e9517c3ad50f4f1cb25
[]
no_license
tkillman/runJava
26dc1194a349a7f2801166f3d0dd541a2902bc9b
1525048977220137898fc856c92167507e32914f
refs/heads/master
2022-12-21T04:50:50.943107
2020-09-20T14:02:55
2020-09-20T14:02:55
276,281,167
0
0
null
null
null
null
UHC
Java
false
false
566
java
package runJava.ch04; public class Ch04Ex09 { //*****do while문******* public static void main(String[] args) { int total =0; int i=1; do{ total+=i; i++; //그냥 while문이었다면 i가 1보다 크지 않기 때문에 반복문이 실행되지 않지만 //do while문이기 때문에 반복문이 한번 실행되고 i값이 2가 되면서 //반복문이 실행된다. }while(i>1 && i<10); System.out.println(total); /*while(i>1 && i<10){ total+=i; i++; } System.out.println(total); */ } }
[ "timekillman@gmail.com" ]
timekillman@gmail.com
8e90f3d436a931ebf01eab73dae0dcc519200f55
bbc40cd27dba2d138fe0f9b56becaaa36cc0272f
/springboot-test/src/test/java/com/busekylin/springboottest/ContextTest.java
2831ca7c0f42fa0c384bdf7ebe88031881f4804e
[]
no_license
zhaoleigege/spring-boot
9ec548f8f7dd7aaac0fa070b58ab3c26d655845c
47c0b6abd0322bea7954451aeea194f466d1f1b9
refs/heads/master
2020-04-12T18:07:14.758042
2019-03-21T10:08:34
2019-03-21T10:08:34
162,669,926
3
0
null
null
null
null
UTF-8
Java
false
false
973
java
package com.busekylin.springboottest; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc public class ContextTest { @Autowired private MockMvc mockMvc; @Test public void contextTest() throws Exception { this.mockMvc.perform(get("/web")).andDo(print()).andExpect(status().isOk()); } }
[ "1608233137@qq.com" ]
1608233137@qq.com
945953aa988e3470b14a78766c2512d318febe9d
cd4052964b0cecd0439ceae60f76db3bd05b0587
/Task 3/Additional tasks/Task6.java
25f00ec052358ab0fc1342e8f82751e046908e78
[]
no_license
olia0303/JAVA-Test-Automation
f9c9604ba3d018570418229407bd957423783dd3
02ae11991fa3ecb76586e510c780617a7f8a2c14
refs/heads/master
2020-04-19T05:54:42.420720
2019-03-30T19:47:02
2019-03-30T19:49:59
168,002,640
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
894
java
package start; import java.util.Scanner; public class Task6 { public static void main(String[] args) { // пройти по массиву и поменять местами каждые 2 соседних элемента System.out.print("Введите размер массива: "); Scanner scan = new Scanner(System.in); int size_mas = scan.nextInt(); int[] mas = new int[size_mas]; for (int i = 0; i < size_mas; i++) { mas[i] = (int) (Math.random() * 50); System.out.print(mas[i] + " "); } System.out.println("\nИзмененный массив: "); scan.close(); printMasMultiply(mas); for (int x : mas) System.out.print(x + " "); } public static void printMasMultiply(int[] anyMas) { for (int i = 0; i < anyMas.length - 1; i++) { int temp = anyMas[i]; anyMas[i] = anyMas[i + 1]; anyMas[i + 1] = temp; } System.out.println(); } }
[ "39465668+olia0303@users.noreply.github.com" ]
39465668+olia0303@users.noreply.github.com
d77bc1a28f65984141c04e8b17c35d05d9856852
cd4165438fc5399810da3c9e596c34197c56b8b2
/SpringRestfulWebServices/src/main/java/org/springRestful/services/CountryService.java
633e39ebd0337227af8c22bb79a7fdf05e98452d
[]
no_license
SweetFudge/SpringRestfulWebServices-Example
c266e8d970eaa69c95fb17e901a2ff1dc320c985
4824fb859051943b500c07bef908e2413229b2a3
refs/heads/master
2021-07-24T11:03:59.986794
2017-11-04T20:56:45
2017-11-04T20:56:45
109,529,380
0
0
null
null
null
null
UTF-8
Java
false
false
1,649
java
package org.springRestful.services; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import org.springRestful.beans.Country; public class CountryService { private static List<Country> countries; public CountryService() { if(countries == null){ countries = createListCountries(); } } public List<Country> getCountries(){ return countries; } public Country getCountryById(int id){ Optional<Country> countryRes = countries.stream().filter(u -> u.getId() == id).findFirst(); Country country = (Country)countryRes.orElse(null); return country; } public Country addCountry(Country country){ countries.add(country); return country; } public Country updateCountry(Country country){ countries = countries.stream().map(o -> {if(o.getId() == country.getId()) {return country;} else{return o;}}).collect(Collectors.toList()); return country; } public void deleteCountry(int id){ countries = countries.stream().filter(o -> o.getId() != id).collect(Collectors.toList()); } private List<Country> createListCountries(){ List<Country> countries = new ArrayList<Country>(); countries.add(new Country(1,"Suisse",6000000)); countries.add(new Country(2,"France",60000000)); countries.add(new Country(3,"Italie",40000000)); countries.add(new Country(4,"USA",360000000)); countries.add(new Country(5,"Espagne",35000000)); countries.add(new Country(6,"Allemagne",5000000)); countries.add(new Country(7,"Portugal",35000000)); return countries; } }
[ "adria@DESKTOP-T14FNQ4.home" ]
adria@DESKTOP-T14FNQ4.home
7b98757aa51e148248f959d83bf2838d43ff9fee
21ed1fb22cabc0c69d463e0acfaec3dc4ec7c180
/src/test/java/com/desilva/record/DayRangeRecordCustomCollectorTest.java
fed346240cfc06f819d8daba9fb467cb74eb40bd
[]
no_license
stevedesilva/addressBook
1f2f6b9d1115478e6d8305a087d3abb3d49a7fd4
47105ad27cf39525242bae3a64f774aeb8908f40
refs/heads/master
2021-01-18T18:01:10.298187
2017-03-31T16:15:32
2017-03-31T16:15:32
86,836,660
0
0
null
null
null
null
UTF-8
Java
false
false
6,120
java
package com.desilva.record; import org.junit.Test; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collector; import static com.desilva.record.DayRangeRecordCustomCollector.*; import static com.desilva.record.DayRangeRecordCustomCollector.AgeBoundary.*; import static com.desilva.record.DayRangeRecordCustomCollector.AgeBoundary.OLDER; import static com.desilva.record.DayRangeRecordCustomCollector.AgeBoundary.YOUNGER; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; /** * Created by stevedesilva. */ public class DayRangeRecordCustomCollectorTest { final private Record olderRecord = new Record("Older, Male, 01/01/80"); final private Record youngerRecord = new Record("Younger, Male, 01/01/81"); @Test public void dayRangeRecordCustomCollectorCollectorConstructor_WhenCreated_ShouldNotBeNull() { assertNotNull(new DayRangeRecordCustomCollectorTest()); } @Test public void calculateDifferenceInDaysBetweenBirthDates_GivenYoungerAndOlder_ShouldReturnDiff(){ Map collector = createDayRangeCustomCollector("Older, Male, 01/01/80", "Younger, Male, 01/01/81"); long value = new DayRangeRecordCustomCollector("Younger","Older").calculateDifferenceInDaysBetweenBirthDates(collector); assertEquals(366L, value); } @Test public void calculateDifferenceInDaysBetweenBirthDates_WhenGivenIncorrectOrder_ShouldReorderAndCalculateDiff(){ Map collector = createDayRangeCustomCollector("Younger, Male, 01/01/81","Older, Male, 01/01/80"); long value = new DayRangeRecordCustomCollector("Younger","Older").calculateDifferenceInDaysBetweenBirthDates(collector); assertEquals(366L, value); } private Map createDayRangeCustomCollector(String olderRow, String youngerRow) { Map collector = new HashMap<AgeBoundary,Record>(); Record olderRecord = new Record(olderRow); Record youngerRecord = new Record(youngerRow); collector.put(OLDER, olderRecord); collector.put(YOUNGER, youngerRecord); return collector; } @Test public void supplier_WhenCalled_ShouldReturnSupplierFunc() throws Exception { Supplier<Map<AgeBoundary, Record>> value = new DayRangeRecordCustomCollector("Younger","Older").supplier(); assertNotNull(value); } @Test public void accumulator_WhenCalled_ShouldReturnBiConsumer() throws Exception { BiConsumer<Map<AgeBoundary, Record>, Record> accumulator = new DayRangeRecordCustomCollector("Younger","Older").accumulator(); assertNotNull(accumulator); } @Test public void updateCollectorWithYoungOldRecord_WhenMatchOlderRecord_ShouldAddToOlderMap() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap = new HashMap<AgeBoundary,Record>(); customCollector.updateCollectorWithYoungOldRecord(accumulatorMap, olderRecord); assertEquals(olderRecord,accumulatorMap.get(OLDER)); } @Test public void updateCollectorWithYoungOldRecord_WhenMatchingOlderRecord_ShouldAddToYoungerMap() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap = new HashMap<AgeBoundary,Record>(); customCollector.updateCollectorWithYoungOldRecord(accumulatorMap, youngerRecord); assertEquals(youngerRecord,accumulatorMap.get(YOUNGER)); } @Test public void updateCollectorWithYoungOldRecord_WhenNoMatchFound_ShouldNotAddToMap() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap = new HashMap<AgeBoundary,Record>(); customCollector.updateCollectorWithYoungOldRecord(accumulatorMap, new Record("Not Matching, Male, 01/01/81")); assertEquals(null,accumulatorMap.get(OLDER)); assertEquals(null,accumulatorMap.get(YOUNGER)); } @Test public void combiner_WhenJoiningMaps_ShouldUpdateMap1IfEmptyAndMap2HasARecord() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap1 = new HashMap<AgeBoundary,Record>(); Map accumulatorMap2 = new HashMap<AgeBoundary,Record>(); accumulatorMap2.put(YOUNGER,youngerRecord); accumulatorMap2.put(OLDER,olderRecord); customCollector.combineAgeBoundaryRecordMaps(accumulatorMap1,accumulatorMap2); assertEquals(youngerRecord, accumulatorMap1.get(YOUNGER)); assertEquals(olderRecord, accumulatorMap1.get(OLDER)); } @Test public void combiner_WhenJoiningMaps_ShouldNotUpdateMap1IfAlreadyContainsRecord() throws Exception { DayRangeRecordCustomCollector customCollector = new DayRangeRecordCustomCollector("Younger","Older"); Map accumulatorMap1 = new HashMap<AgeBoundary,Record>(); Map accumulatorMap2 = new HashMap<AgeBoundary,Record>(); accumulatorMap1.put(YOUNGER,youngerRecord); accumulatorMap1.put(OLDER,olderRecord); customCollector.combineAgeBoundaryRecordMaps(accumulatorMap1,accumulatorMap2); assertEquals(youngerRecord, accumulatorMap1.get(YOUNGER)); assertEquals(olderRecord, accumulatorMap1.get(OLDER)); } @Test public void finisher_WhenCalled_ShouldReturnBiConsumer() throws Exception { Function<Map<AgeBoundary, Record>, Long> finisher = new DayRangeRecordCustomCollector("Younger","Older").finisher(); assertNotNull(finisher); } @Test public void characteristics_WhenCalled_ShouldReturnBiConsumer() throws Exception { Set<Collector.Characteristics> characteristics = new DayRangeRecordCustomCollector("Younger","Older").characteristics(); assertNotNull(characteristics); } }
[ "steve.desilva@nexusalpha.com" ]
steve.desilva@nexusalpha.com
b175970604d3d139df820043a2a57538ffbae0bd
86335cbec1af4aac99b5fe23631f88f9f884ecba
/src/main/java/com/example/catalogue/catalogueservice/service/impl/ManufacturerServiceImpl.java
cc00fcbd4412963491f8a223c9d1f27cd22a5466
[]
no_license
Hydropumpon/catalogue-service
579900b846d2c43b7585f1fd00fc0fac2376186d
dcd334e4169c422553ffef3f1d0307885012e7c3
refs/heads/master
2020-12-26T09:03:37.337614
2020-02-22T14:53:14
2020-02-22T14:53:14
237,457,907
0
0
null
null
null
null
UTF-8
Java
false
false
3,801
java
package com.example.catalogue.catalogueservice.service.impl; import com.example.catalogue.catalogueservice.entity.Manufacturer; import com.example.catalogue.catalogueservice.exception.ErrorMessage; import com.example.catalogue.catalogueservice.exception.NotFoundException; import com.example.catalogue.catalogueservice.exception.ServiceErrorCode; import com.example.catalogue.catalogueservice.repository.ManufacturerRepository; import com.example.catalogue.catalogueservice.service.ItemService; import com.example.catalogue.catalogueservice.service.ManufacturerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; @Service public class ManufacturerServiceImpl implements ManufacturerService { private ManufacturerRepository manufacturerRepository; private ItemService itemService; @Autowired public ManufacturerServiceImpl( ItemService itemService, ManufacturerRepository manufacturerRepository) { this.manufacturerRepository = manufacturerRepository; this.itemService = itemService; } @Override @Transactional public Manufacturer addManufacturer(Manufacturer manufacturer) { return manufacturerRepository.save(manufacturer); } @Override @Transactional(readOnly = true) public Page<Manufacturer> getManufacturers(Pageable pageable) { return manufacturerRepository.findAll(pageable); } @Override @Transactional(readOnly = true) public List<Manufacturer> getManufacturersByIdIn(List<Integer> ids) { return manufacturerRepository.findManufacturersByIdIn(ids); } @Override @Transactional public Manufacturer updateManufacturer(Manufacturer manufacturer, Integer id) { return manufacturerRepository.findById(id) .map(manufacturerDb -> { manufacturerDb.setAddress(manufacturer.getAddress()); manufacturerDb.setEmail(manufacturer.getEmail()); manufacturerDb.setFoundationYear(manufacturer.getFoundationYear()); manufacturerDb.setName(manufacturer.getName()); return manufacturerRepository.save(manufacturerDb); }).orElseThrow( () -> new NotFoundException(ErrorMessage.MANUFACTURER_NOT_FOUND, ServiceErrorCode.NOT_FOUND)); } @Override @Transactional public void deleteManufacturer(Integer id) { manufacturerRepository.findById(id) .map(manufacturer -> { itemService.deleteItemsByManufacturer(manufacturer); manufacturerRepository.delete(manufacturer); return Optional.empty(); }) .orElseThrow(() -> new NotFoundException(ErrorMessage.MANUFACTURER_NOT_FOUND, ServiceErrorCode.NOT_FOUND)); } @Override @Transactional(readOnly = true) public Manufacturer getManufacturer(Integer id) { return manufacturerRepository.findById(id).orElseThrow( () -> new NotFoundException(ErrorMessage.MANUFACTURER_NOT_FOUND, ServiceErrorCode.NOT_FOUND)); } }
[ "shirokov.aleksander@gmail.com" ]
shirokov.aleksander@gmail.com
1cb9c169a82ceb1205fd803d0924ee0aeefe948e
213c6fd61f9aa2426c2b669f0fca646e407a0b35
/src/core/se/jbee/inject/Typed.java
18e5bbf2c5f1358f8b5faf3a7aaf68aad968a111
[ "Apache-2.0" ]
permissive
CurtainDog/silk
d332e365c635d4f8369e191da49eb4bf7dd298f7
ae08ff6a5bfffe7e9461c4228b2f8f0d3bc79333
refs/heads/master
2021-01-21T00:36:18.609993
2013-03-10T11:09:18
2013-03-10T11:09:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
530
java
/* * Copyright (c) 2012, Jan Bernitt * * Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0 */ package se.jbee.inject; /** * <i>Has a {@link Type}, is typed</i>. * * @author Jan Bernitt (jan@jbee.se) * * @param <T> * The actual type ({@link Class}) */ public interface Typed<T> { /** * @return The {@link Type} of this object. */ Type<T> getType(); /** * @return This object with the given {@link Type}. */ <E> Typed<E> typed( Type<E> type ); }
[ "jan.bernitt@gmx.de" ]
jan.bernitt@gmx.de
fd9ade85f51f7a45bf5693e74ca3506fe54663f2
cfaff18751b2b1712b554c04572a7b3175971a37
/Pratice 1/src/AdditionArray.java
d4526ca914d76dc72034fcf3f0f9dddc8d3d4493
[]
no_license
ArangMaa/Mani-Code
651cc334598348f3c37cb922b6754a97f69bc981
3f2ff487c10e8b6c5b4476a5c4114c4fcf46c6aa
refs/heads/master
2023-06-04T23:29:17.449090
2021-06-21T16:19:47
2021-06-21T16:19:47
378,984,831
0
0
null
null
null
null
UTF-8
Java
false
false
687
java
public class AdditionArray { public static void main(String[] args) { int [] a=new int [5]; { for(int i=0; i<a.length;i++){// 1st approach to print all the values System.out.println(i); } } boolean []b= new boolean [3]; { for(boolean bb:b){// second approach to print all the values System.out.println(bb); } } //user define data type AdditionArray[] x= new AdditionArray[5];//AdditionArray is name of class { for(AdditionArray yy:x){ System.out.println(yy); } } int []z= new int [3];// addition of 2 arrays z[0]=10; z[1]=20; z[2]=z[0]+z[1]; { System.out.println(z[2]); } } }
[ "MANITA@DESKTOP-LMJT05L" ]
MANITA@DESKTOP-LMJT05L
b4f2f1cab9a04ee766fed247bedc5f2f7f7ceb34
560268487348149621b6c44f67ad0652276cf5fb
/src/java/billservlet/.svn/text-base/Err.java.svn-base
e0d2e109b30e663c2d6a659a9bf50df1ac126de1
[]
no_license
ruchijindal/OnlineDMS
8e2bdf577d75eecfc231f2cb426d6d20b84deb60
0965e9dbcb4a0cf10d13bf0c29790b8a1071dd46
refs/heads/master
2021-01-18T17:25:41.579283
2013-05-19T12:14:19
2013-05-19T12:14:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,989
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package billservlet; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Element; import com.itextpdf.text.Paragraph; import com.itextpdf.text.Rectangle; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import com.smp.jal.ConvertToDate; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import javax.naming.InitialContext; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.sql.DataSource; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.NodeList; /** * * @author smp */ public class Err extends HttpServlet { public class MyPdf implements Runnable { Connection con; String sector; String sec; String cons_no; PreparedStatement ps; ResultSet rs; java.sql.Date billdate; String bdate = null; ConvertToDate ctd; java.sql.Date calbilldate; Calendar dt = Calendar.getInstance(); String cons_nm1; String con_tp; String cons_ctg; String flat_type; String plot_size; String pipe_size; String conn_dt; String nodue_dt; int totcons = -1; Object o; String division; ArrayList<ArrayList> alsec = new <ArrayList>ArrayList(); ArrayList al = new ArrayList(); ; ArrayList alrow; int i = 0; int rows; public Thread t; int p = 0; float p1 = 0; int j = 0; DocumentBuilderFactory dbf = null; DocumentBuilder db = null; org.w3c.dom.Document doc = null; NodeList nl = null; String xmlpath = null; ServletContext context = null; String div = null; MyPdf(java.sql.Date billdate, String sec1) { calbilldate = billdate; sec = sec1; t = new Thread(this); al = new ArrayList<ArrayList>(); alrow = new ArrayList(); t.start(); } public void run() { try { dbf = DocumentBuilderFactory.newInstance(); db = dbf.newDocumentBuilder(); context = getServletContext(); xmlpath = context.getRealPath("") + "/resources/jalutilXML/" + "jal.xml"; // get path on the server doc = db.parse(xmlpath); InitialContext initialContext = new InitialContext(); DataSource dataSource = (DataSource) initialContext.lookup("OnlineJal"); con = dataSource.getConnection(); //con = DBConnection1.dbConnection(xmlpath); NodeList nl1 = doc.getElementsByTagName("division"); div = nl1.item(0).getFirstChild().getNodeValue().trim(); division = "JAL" + div; NodeList nl2 = doc.getElementsByTagName("master_tab"); //sector="MASTER_"+division; sector = nl2.item(0).getFirstChild().getNodeValue().trim(); String sql1 = "select COUNT(DISTINCT CONS_NO) from " + sector + " where trim(sector)='" + sec + "' and CONS_NO is not null and (CONS_NM1 is null or CON_TP is null or CONS_CTG is null or FLAT_TYPE is null or (FLAT_TYPE='PLOT'and PLOT_SIZE is null) or PIPE_SIZE is null or CONN_DT is null " + "or ((to_char(CAL_DATE,'YYYY-MM-DD')>='" + billdate + "' and NODUE_DT IS NULL) or (NODUE_DT IS NOT NULL and to_char(NODUE_DT,'YYYY-MM-DD')>='" + billdate + "'))) order by cons_no"; ps = con.prepareStatement(sql1); rs = ps.executeQuery(); if (rs.next()) { totcons = rs.getInt(1); } String sql = "select cons_no,cons_nm1,con_tp,cons_ctg,flat_type,plot_size,pipe_size,conn_dt,nodue_dt from " + sector + " where trim(sector)='" + sec + "' and CONS_NO is not null and (CONS_NM1 is null or CON_TP is null or CONS_CTG is null or FLAT_TYPE is null or (FLAT_TYPE='PLOT'and PLOT_SIZE is null) or PIPE_SIZE is null or CONN_DT is null " + "or ((to_char(CAL_DATE,'YYYY-MM-DD')>='" + billdate + "' and NODUE_DT IS NULL) or (NODUE_DT IS NOT NULL and to_char(NODUE_DT,'YYYY-MM-DD')>='" + billdate + "'))) order by cons_no"; ps = con.prepareStatement(sql); rs = ps.executeQuery(); while (rs.next()) { p++; cons_no = rs.getString(1); cons_nm1 = rs.getString(2); con_tp = rs.getString(3); cons_ctg = rs.getString(4); flat_type = rs.getString(5); plot_size = rs.getString(6); pipe_size = rs.getString(7); conn_dt = rs.getString(8); nodue_dt = rs.getString(9); al.add(0, cons_no); al.add(1, cons_nm1); al.add(2, con_tp); al.add(3, cons_ctg); al.add(4, flat_type); al.add(5, plot_size); al.add(6, pipe_size); al.add(7, conn_dt); al.add(8, nodue_dt); alsec.add(new ArrayList(al)); al.clear(); } rs.close(); con.commit(); con.close(); // if (!con.isClosed()) { // con.close(); // } } catch (Exception ex) { System.out.println("Exception in Err:" + ex); } //p=totcons; } public ArrayList<ArrayList> calAl() { return alsec; } public int getPercentage() { return p; } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String cons_no; String sec = null; Calendar calbilldate = Calendar.getInstance(); java.sql.Date billdate = null; String bdate = null; ConvertToDate ctd; String strbill_date = null; ArrayList<ArrayList> alsec; int i = 0; int totcons = 0; Object o; HttpSession session = request.getSession(true); //System.out.print("Inside doGet()"); MyPdf pdf; try { ctd = new ConvertToDate(); sec = request.getParameter("sec"); bdate = request.getParameter("billdate"); if (bdate.equals("")) { billdate = null; calbilldate = null; } else { calbilldate.setTimeInMillis(ctd.convertStringToCLDate(bdate).getTimeInMillis()); billdate = new java.sql.Date(calbilldate.getTimeInMillis()); } i++; o = session.getAttribute("myPdf"); if (o == null) { pdf = new MyPdf(billdate, sec); session.setAttribute("myPdf", pdf); //Thread t = new Thread(pdf); //t.start(); } else { pdf = (MyPdf) o; } response.setContentType("text/html"); switch (pdf.getPercentage()) { case -1: isError(response.getOutputStream()); return; default: totcons = pdf.totcons; if (pdf.getPercentage() == totcons) { alsec = pdf.calAl(); session.removeAttribute("myPdf"); isFinished(response.getOutputStream(), strbill_date, sec, alsec); System.out.println("Error List Generated-----------------------------"); return; } isBusy(pdf, response.getOutputStream()); return; } } catch (Exception ex) { System.out.println(ex); } } private void isBusy(MyPdf pdf, ServletOutputStream stream) throws IOException { stream.print("<html><head><title>Please wait...</title><meta http-equiv=\"Refresh\" content=\"5\">" + "<link rel=\"stylesheet\" type=\"text/css\" href=\"resources/css/style.css\" />" + "<div id=\"login\"><div id=\"login-wrapper\" class=\"png_bg\"><div id=\"login-top\">" + "<img alt=\"DMS-JAL\" src=\"resources/images/logo.png\"/><div id=\"profile-links\">" + "<a href=\"jsppages/common/logout.jsp\" title=\"Sign Out\">Sign Out</a>&nbsp;|&nbsp;" + "<a href=\"/DMS/RedirectToCP?page=Err\" title=\"Sign Out\"> Change Password</a> </div> </div></div></div></head>" + "<body> <div id=\"body-wrapper\"> "); stream.print(" <div id=\"main-content\"> <div class=\"content-box\"><div class=\"content-box-header\"></div><div class=\"content-box-content \">"); stream.print("Please Wait while this page refreshes automatically (every 5 seconds)</div></div></div><div id=\"footer\">" + "<p>&copy; 2009 <a href=\"http//www.smptechnologies.org\">SMP Technologies Pvt. Ltd.</a></p></div></div></body>\n</html>"); } private void isFinished(ServletOutputStream stream, String bill_date, String sec, ArrayList<ArrayList> al) throws IOException { stream.print("<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"resources/css/style.css\" />" + "<div id=\"login\"><div id=\"login-wrapper\" class=\"png_bg\"><div id=\"login-top\">" + "<a href=\"jsppages/Search/search.jsp\"><img alt=\"DMS-JAL\" src=\"resources/images/logo.png\"/></a><div id=\"profile-links\">" + "<a href=\"jsppages/common/logout.jsp\" title=\"Sign Out\">Sign Out</a>&nbsp;|&nbsp;" + "<a href=\"jsppages/common/ch_pass.jsp\" title=\"Sign Out\"> Change Password</a> </div> </div></div></div></head>" + "<body> <div id=\"body-wrapper\">"); stream.print(" <div id=\"main-content\"> <div class=\"content-box\"><div class=\"content-box-header\"></div><div class=\"content-box-content \">" + " <div class=\"notification information png_bg\"><a href=\"#\" class=\"close\">" + "<img src=\"resources/images/icons/cross_grey_small.png\" title=\"Close this notification\" alt=\"close\" /></a><div>" + "The document is finished:&nbsp;&nbsp;&nbsp;&nbsp;</div></div><form method=\"POST\">" + "<input type=\"hidden\" name=\"al\" value=\"" + al + "\">" + "<input type=\"hidden\" name=\"sec\" value=\"" + sec + "\"><input type=\"hidden\" name=\"billdate\" value=\"" + bill_date + "\">" + "<input type=\"Submit\" class=\"button\" value=\"Get PDF\"> <a href=\"jsppages/duprecords/error_list.jsp\"><input type=\"button\" class=\"button\" value=\"Back\"></a></form></div></div></div><div id=\"footer\"><small>" + "<p >Copyright &copy; 2009 Developed for JAL by <a href=\"http://smptechnologies.org/\">SMP Technologies Pvt Ltd</a></p></small></div></div></body>\n</html>"); } private void isError(ServletOutputStream stream) throws IOException { stream.print("<html>\n\t<head>\n\t\t<title>Error</title>\n\t</head>\n\t<body>"); stream.print("An error occured.\n\t</body>\n</html>"); } protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DocumentException { //Connection con; String sector; String sec; String cons_no; PreparedStatement ps; ResultSet rs; java.sql.Date billdate; String bdate = null; ConvertToDate ctd; Calendar calbilldate = Calendar.getInstance(); Calendar dt = Calendar.getInstance(); String cons_nm1; String con_tp; String cons_ctg; String flat_type; String plot_size; String pipe_size; String conn_dt; String nodue_dt; int totcons = 0; Object o; String division; ArrayList<ArrayList> alsec = new <ArrayList>ArrayList(); ArrayList alr1; ArrayList al = new ArrayList(); ArrayList alrow; int i = 0; int rows; ByteArrayOutputStream baos; SimpleDateFormat formatter; java.util.Date utilconn_dt = null; java.util.Date utilnodue_dt = null; String alist = request.getParameter("al"); alr1 = new ArrayList(); alsec = new ArrayList<ArrayList>(); alist = alist.substring(alist.indexOf("[") + 1, alist.lastIndexOf("]")); String[] aliststr = alist.split("]"); for (int l = 0; l < aliststr.length; l++) { String[] alstr = aliststr[l].split(","); for (int m = 0; m < alstr.length; m++) { if (m == 0 && l == 0) { alr1.add(alstr[m].substring(1)); } else if (m == 1 && l != 0) { alr1.add(alstr[m].substring(2)); } else if (m != 0) { alr1.add(alstr[m]); } } alsec.add(new ArrayList(alr1)); alr1.clear(); } rows = alsec.size(); sector = (String) request.getParameter("sec"); response.setHeader("Content-Disposition", "attachment;filename=" + "ErrorList.pdf"); //response.setContentType("application/pdf"); Rectangle pageSize = new Rectangle(720, 864); Document document = new Document(pageSize); try { //PdfWriter.getInstance(document,new FileOutputStream("C:/DEFAULTER"+sector+".pdf") ); baos = new ByteArrayOutputStream(); PdfWriter docWriter = null; docWriter = PdfWriter.getInstance(document, baos); //document.setPageSize(PageSize.ARCH_B); document.open(); float[] widths1 = {2f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f}; PdfPTable table = new PdfPTable(widths1); table.getDefaultCell().setBorder(PdfPCell.NO_BORDER); PdfPCell cell = new PdfPCell(new Paragraph("NEW OKHLA INDUSTRIAL DEVELOPMENT AUTHORITY")); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(9); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingBottom(30.0f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Error list of consumers for Sector-" + sector)); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(6); cell.setHorizontalAlignment(Element.ALIGN_MIDDLE); cell.setPaddingBottom(10.0f); table.addCell(cell); cell = new PdfPCell(new Paragraph()); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(6); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setPaddingBottom(10.0f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Consumer Name")); cell.setBorder(Rectangle.BOTTOM); table.addCell(cell); cell = new PdfPCell(new Paragraph("Consumer Number")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Connection Type")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Connection Category")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Flat Type")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Plot size")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Pipe size")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("Connection Date")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Paragraph("No Due Date")); cell.setBorder(Rectangle.BOTTOM); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); for (int k = 0; k < rows; k++) { alrow = (ArrayList) alsec.get(k); cons_no = (String) alrow.get(0); if (cons_no.trim().equals("null")) { cons_no = " "; } cons_nm1 = (String) alrow.get(1); if (cons_nm1.trim().equals("null")) { cons_nm1 = " "; } con_tp = (String) alrow.get(2); if (con_tp.trim().equals("null")) { con_tp = " "; } cons_ctg = (String) alrow.get(3); if (cons_ctg.trim().equals("null")) { cons_ctg = " "; } flat_type = (String) alrow.get(4); if (flat_type.trim().equals("null")) { flat_type = " "; } plot_size = (String) alrow.get(5); if (plot_size.trim().equals("null")) { plot_size = " "; } pipe_size = (String) alrow.get(6); if (pipe_size.trim().equals("null")) { pipe_size = " "; } conn_dt = (String) alrow.get(7); if (conn_dt.trim().equals("null")) { conn_dt = " "; } else { try { formatter = new SimpleDateFormat("yyyy-MM-dd"); utilconn_dt = (java.util.Date) formatter.parse(conn_dt); } catch (ParseException e) { System.out.println("Exception:" + e); } formatter = new SimpleDateFormat("dd-MMM-yy"); conn_dt = formatter.format(new java.sql.Date(utilconn_dt.getTime())); } nodue_dt = (String) alrow.get(8); if (nodue_dt.trim().equals("null")) { nodue_dt = " "; } else { try { formatter = new SimpleDateFormat("yyyy-MM-dd"); utilnodue_dt = (java.util.Date) formatter.parse(nodue_dt); } catch (ParseException e) { System.out.println("Exception:" + e); } formatter = new SimpleDateFormat("dd-MMM-yy"); nodue_dt = formatter.format(new java.sql.Date(utilnodue_dt.getTime())); } cell = new PdfPCell(new Paragraph(cons_nm1)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); //table.addCell (cons_no); cell = new PdfPCell(new Paragraph(cons_no)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); // table.addCell (address); cell = new PdfPCell(new Paragraph(con_tp)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(cons_ctg)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(flat_type)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(plot_size)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); // table.addCell (Double.toString(interest)); cell = new PdfPCell(new Paragraph(pipe_size)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(conn_dt)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); //table.addCell (Double.toString(principal)); cell = new PdfPCell(new Paragraph(nodue_dt)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); } table.setWidthPercentage(100); table.setHorizontalAlignment(Element.ALIGN_CENTER); document.add(table); document.newPage(); document.add(new Paragraph(" ")); document.close(); docWriter.close(); response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma", "public"); response.setContentType("application/pdf"); response.setContentLength(baos.size()); //System.out.println("ByteArrayOutputStream size"+baos.size()); ServletOutputStream out = response.getOutputStream(); baos.writeTo(out); out.flush(); } catch (Exception e) { e.printStackTrace(); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); HttpSession session = request.getSession(false); session.removeAttribute("myPdf"); } catch (DocumentException e) { e.printStackTrace(); } } }
[ "ruchi@knoldus.com" ]
ruchi@knoldus.com
0f02056e9eda3967f097d4da3a3c8de4508450c8
b0f3e88423fe84d4d6966b7351cf741e1659bfc8
/src/c17/NorthwindServlet.java
6cb7f3b799d5e68cde5094346192efd04167e68a
[]
no_license
zhaoxiaoer/csj
4a9381aa52565387a5c32c31777b515319e7ebcc
6f6c8ff889720df690810d2547bdcc86f39b4f9c
refs/heads/master
2020-03-24T22:38:11.961170
2018-10-15T00:31:16
2018-10-15T00:31:16
143,095,425
0
0
null
null
null
null
UTF-8
Java
false
false
2,115
java
package c17; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import util.ServletUtilities; public class NorthwindServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = "Northwind Results"; out.print(ServletUtilities.headWithTitle(title) + "<body bgcolor=\"#FDF5E6\"><center>\n" + "<h1>" + title + "</h1>\n"); showTable(out); out.println("</center></body></html>"); } public void showTable(PrintWriter out) { try { Class.forName("com.mysql.cj.jdbc.Driver"); String url = "jdbc:mysql://127.0.0.1:3306/ztest"; String username = "root"; String password = ""; Connection connection = DriverManager.getConnection(url, username, password); out.println("<ul>"); DatabaseMetaData dbMetaData = connection.getMetaData(); String productName = dbMetaData.getDatabaseProductName(); String productVersion = dbMetaData.getDatabaseProductVersion(); out.println(" <li><b>Database:</b> " + productName + "</li>\n" + " <li><b>Version:</b> " + productVersion + "</li>\n" + "</ul>"); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("SELECT * FROM employee"); out.println("<table border=1>"); ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); int columnCount = resultSetMetaData.getColumnCount(); out.println("<tr>"); for (int i = 1; i <= columnCount; i++) { out.println("<th>" + resultSetMetaData.getColumnName(i) + "</th>"); } out.println("</tr>"); while (resultSet.next()) { out.println("<tr>"); for (int i = 1; i <= columnCount; i++) { out.println(" <td>" + resultSet.getString(i) + "</td>"); } out.println("</tr>"); } out.println("</table>"); connection.close(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException sqle) { sqle.printStackTrace(); } } }
[ "445774833@qq.com" ]
445774833@qq.com
909ff46ff5dff546a41c6db50e3aaa5253550508
3670a40842738cca302cf7093385db87c8245a9e
/com.nickfirsov.composite_config_plugin/src/com/nickfirsov/composite_config_plugin/LaunchConfigUtils.java
080b78ec51e0e62a24b4f118750de70504872579
[]
no_license
NFirsov/Common_Java
e8d2a89967c9eca02378333b24b43a975d1491df
44e200204ab4b6f881144148458d98885a687b26
refs/heads/master
2021-01-16T00:05:01.561347
2016-09-18T21:30:53
2016-09-18T21:30:53
68,548,010
0
0
null
null
null
null
UTF-8
Java
false
false
1,901
java
package com.nickfirsov.composite_config_plugin; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; public class LaunchConfigUtils { private static String InnerConfigs = "InnerConfigs"; private static String LaunchConfigurationType = "com.nickfirsov.composite_config_plugin.composite_launch_config"; public static List<String> GetInnerConfigs(ILaunchConfiguration config) { List<String> list = null; try { list = config.getAttribute(InnerConfigs, list); } catch (CoreException e) { e.printStackTrace(); } return list != null ? list : new ArrayList<String>(); } public static void SetInnerConfigs(ILaunchConfigurationWorkingCopy configWc, List<String> innerConfigs) { configWc.setAttribute(InnerConfigs, innerConfigs); } // Get available configs except of compositeLaunchConfigs to avoid cycles public static List<ILaunchConfiguration> GetAvailableConfigs() { ILaunchManager manager = org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType compositeLaunchConfigType = manager.getLaunchConfigurationType(LaunchConfigurationType); ILaunchConfiguration[] allConfigs = null; try { allConfigs = manager.getLaunchConfigurations(); } catch (CoreException e) { e.printStackTrace(); } List<ILaunchConfiguration> result = new ArrayList<ILaunchConfiguration>(); for(ILaunchConfiguration config : allConfigs) { try { ILaunchConfigurationType cType = config.getType(); if(cType != compositeLaunchConfigType) result.add(config); } catch (CoreException e) { e.printStackTrace(); } } return result; } }
[ "nickfirsov@gmail.com" ]
nickfirsov@gmail.com
10040cfd8e47962f568e420ce27ab9eab318b8dc
4d8aa9979d99d0fad6a384b15c62a54bea0404c8
/app/src/main/java/com/pubnub/sarath/ssw/ui/login/LoginActivity.java
21c96efe0e821945c22fc5069ec609853a0ba035
[]
no_license
sarathpathan/projectSSW
2c6b1be7b9cd72a795a3e0b048a2a5f213fb2f16
2aa88863a449ce2a2fe4d42fcc519b62bdcc5fc7
refs/heads/master
2021-01-05T10:15:11.655097
2020-02-17T00:27:02
2020-02-17T00:27:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,227
java
package com.pubnub.sarath.ssw.ui.login; import android.app.Activity; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import android.content.Intent; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.annotation.StringRes; import androidx.appcompat.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.pubnub.sarath.ssw.R; import com.pubnub.sarath.ssw.MainActivity; public class LoginActivity extends AppCompatActivity { private LoginViewModel loginViewModel; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); loginViewModel = ViewModelProviders.of(this, new LoginViewModelFactory()) .get(LoginViewModel.class); final EditText usernameEditText = findViewById(R.id.username); final EditText passwordEditText = findViewById(R.id.password); final Button loginButton = findViewById(R.id.login); final ProgressBar loadingProgressBar = findViewById(R.id.loading); loginViewModel.getLoginFormState().observe(this, new Observer<LoginFormState>() { @Override public void onChanged(@Nullable LoginFormState loginFormState) { if (loginFormState == null) { return; } loginButton.setEnabled(loginFormState.isDataValid()); if (loginFormState.getUsernameError() != null) { usernameEditText.setError(getString(loginFormState.getUsernameError())); } if (loginFormState.getPasswordError() != null) { passwordEditText.setError(getString(loginFormState.getPasswordError())); } } }); loginViewModel.getLoginResult().observe(this, new Observer<LoginResult>() { @Override public void onChanged(@Nullable LoginResult loginResult) { Log.d("bharath ",""+loginResult.getError()); Log.d("bharath success ",""+loginResult.getSuccess().toString()); if (loginResult == null) { return; } loadingProgressBar.setVisibility(View.GONE); if (loginResult.getError() != null) { showLoginFailed(loginResult.getError()); } if (loginResult.getSuccess() != null) { updateUiWithUser(loginResult.getSuccess()); } setResult(Activity.RESULT_OK); //Complete and destroy login activity once successful finish(); } }); TextWatcher afterTextChangedListener = new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // ignore } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // ignore } @Override public void afterTextChanged(Editable s) { loginViewModel.loginDataChanged(usernameEditText.getText().toString(), passwordEditText.getText().toString()); } }; usernameEditText.addTextChangedListener(afterTextChangedListener); passwordEditText.addTextChangedListener(afterTextChangedListener); passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { loginViewModel.login(usernameEditText.getText().toString(), passwordEditText.getText().toString()); } return false; } }); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadingProgressBar.setVisibility(View.VISIBLE); loginViewModel.login(usernameEditText.getText().toString(), passwordEditText.getText().toString()); } }); } private void updateUiWithUser(LoggedInUserView model) { String welcome = getString(R.string.welcome) + model.getDisplayName(); // TODO : initiate successful logged in experience Toast.makeText(getApplicationContext(), welcome, Toast.LENGTH_LONG).show(); startActivity(new Intent(LoginActivity.this, MainActivity.class)); } private void showLoginFailed(@StringRes Integer errorString) { Toast.makeText(getApplicationContext(), errorString, Toast.LENGTH_SHORT).show(); } }
[ "bharath.psc@gmail.com" ]
bharath.psc@gmail.com
530f4d592a69557adc139406730b4adb4d73cce0
9c5e10ba39daafd864d52260ea4f98ef5a93fd98
/Algorithms/GeekForGeeks/src/com/christy/arrays/LeftRotateByDPositions.java
d35c04951376a1ac5fbaf415a36b14c03afa4098
[]
no_license
christyjohn/practice
817b1214233224daa6260e5c762ca2b6fce2bc87
60bdcb8e58b3c346df83837fb6ec0cfc7e807a5c
refs/heads/master
2023-04-29T00:50:49.137042
2022-05-16T06:57:45
2022-05-16T06:57:45
95,289,669
0
2
null
2023-04-18T16:54:33
2017-06-24T10:00:02
Java
UTF-8
Java
false
false
1,079
java
package com.christy.arrays; import java.util.Arrays; public class LeftRotateByDPositions { public static void main(String[] args) { int[] arr = { 2, 3, 5, 7, 9 }; int[] arr2 = { 2, 3, 5, 7, 9, 10, 13, 15 }; int d = 3; System.out.println("Array before rotating: " + Arrays.toString(arr)); rotateLeft(arr, d); System.out.print("Array after rotating " + d + " positions: "); System.out.println(Arrays.toString(arr)); System.out.println("------------"); System.out.println("Array before rotating: " + Arrays.toString(arr2)); rotateLeft(arr2, d); System.out.print("Array after rotating " + d + " positions: "); System.out.println(Arrays.toString(arr2)); } public static void rotateLeft(int[] arr, int d) { reverse(arr, 0, d-1); reverse(arr, d, arr.length-1); reverse(arr, 0, arr.length -1); } public static void reverse(int[] arr, int startIndex, int endIndex) { while (startIndex < endIndex) { int temp = arr[startIndex]; arr[startIndex] = arr[endIndex]; arr[endIndex] = temp; startIndex++; endIndex--; } } }
[ "christyjohn.crz@gmail.com" ]
christyjohn.crz@gmail.com
a0b243489d949a89e5284a1f14ea5f3efc2676c2
e3935418d2d8426f418f5732dd7448c82fae5ff5
/src/crazyrun/Car.java
7042713435b21b1dcb8d7f2e1b091b894a73410a
[]
no_license
hosseini-sajad/crazy-run
6d9cc2c0b74052c1972f646ba40ab5eee182e779
a356391a348de8bade0da0b896727fd5fbdc7d8d
refs/heads/master
2020-03-13T05:35:33.445189
2018-06-21T15:46:16
2018-06-21T15:46:16
130,987,349
0
1
null
null
null
null
UTF-8
Java
false
false
2,433
java
package crazyrun; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.net.URL; import javax.swing.ImageIcon; public class Car { private double x; private int y; private int width; private int height; private int xSpeedLeft = 10; private int xSpeedRight = 10; private boolean isRight = true; public boolean isIsRight() { return isRight; } public void setIsRight(boolean isRight) { this.isRight = isRight; } public Car(int x, int y, int width, int height, Color color) { setX(x); setY(y); setWidth(width); setHeight(height); } public double getX() { return x; } public void setX(double x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getxSpeedLeft() { return xSpeedLeft; } public void setxSpeedLeft(int xSpeedLeft) { this.xSpeedLeft = xSpeedLeft; } public int getxSpeedRight() { return xSpeedRight; } public void setxSpeedRight(int xSpeedRight) { this.xSpeedRight = xSpeedRight; } public void draw(Graphics g) { URL iconUrl; if (isRight) { iconUrl = getClass().getClassLoader().getResource("car3.gif"); } else { iconUrl = getClass().getClassLoader().getResource("cabriolet.gif"); } if (iconUrl != null) { ImageIcon icon = new ImageIcon(iconUrl); Image image = icon.getImage(); g.drawImage(image, (int) x, y, 100, 50, null); } else { g.setColor(Color.GRAY); g.fillRect((int) getX(), getY(), getWidth(), getHeight()); } } public void moveRight(int gameWidth, int gameHeight) { x += getxSpeedRight(); } public void moveLeft(int gameWidth, int gameHeight) { x -= getxSpeedLeft(); } public Rectangle getBound() { return new Rectangle((int) getX(), getY() + 30, getWidth() - 10, getHeight() - 30); } }
[ "hosseni_sajjad@yahoo.com" ]
hosseni_sajjad@yahoo.com
b72e81aacb1b5cadd89bcf976dafe01715eb7b42
6ba3c8a23348423934c0d7c1173a31f720b40074
/pms/pms-module/pms-core/src/main/java/priv/yzwbblan/pms/base/util/MD5Util.java
e0ae90f8bd4a35e77f3e159e08f210b25d0414d4
[ "Apache-2.0" ]
permissive
ZG0nn71/pms
cdecb2dede68da03018909f66e34b32c373baa14
874e6c3b2c9f818d1ccfe10a0e2dfb8cf50c8f2d
refs/heads/master
2023-05-02T19:51:58.425892
2021-05-26T07:15:53
2021-05-26T07:15:53
363,602,672
1
0
null
null
null
null
UTF-8
Java
false
false
1,122
java
package priv.yzwbblan.pms.base.util; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * MD5加密类(封装jdk自带的md5加密方法) * * @author fengshuonan * @date 2016年12月2日 下午4:14:22 */ public class MD5Util { public static String encrypt(String source) { return encodeMd5(source.getBytes()); } private static String encodeMd5(byte[] source) { try { return encodeHex(MessageDigest.getInstance("MD5").digest(source)); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e.getMessage(), e); } } private static String encodeHex(byte[] bytes) { StringBuffer buffer = new StringBuffer(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { if (((int) bytes[i] & 0xff) < 0x10) buffer.append("0"); buffer.append(Long.toString((int) bytes[i] & 0xff, 16)); } return buffer.toString(); } public static void main(String[] args) { System.out.println(encrypt("123456")); } }
[ "tanxiu19956@126.com" ]
tanxiu19956@126.com
4b6ac87f4f849ce705429f37a63d57ef2222141b
46e5b636da0580a6d7eddd10538ce507f30bee6c
/portalpack.portlets.genericportlets/src/main/java/org/netbeans/modules/portalpack/portlets/genericportlets/ddapi/impl/PortletXmlHelper.java
ead4a02f07b6a5dfce959b8135da20e81aa7871d
[ "Apache-2.0" ]
permissive
timboudreau/netbeans-contrib
b96c700768cca0932a0e2350362352352b3b91f6
f1e67dbd0f5c6ae596bd9754b5b1ba22cfe8cb8e
refs/heads/master
2023-01-25T00:36:37.680959
2023-01-06T06:07:09
2023-01-06T06:07:09
141,208,493
4
2
NOASSERTION
2022-09-01T22:50:24
2018-07-17T00:13:23
Java
UTF-8
Java
false
false
21,684
java
/* * The contents of this file are subject to the terms of the Common Development * and Distribution License (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at http://www.netbeans.org/cddl.html * or http://www.netbeans.org/cddl.txt. * * When distributing Covered Code, include this CDDL Header Notice in each file * and include the License file at http://www.netbeans.org/cddl.txt. * If applicable, add the following below the CDDL Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * Portions Copyrighted 2007 Sun Microsystems, Inc. */ package org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.impl; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.FilterMappingType; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.PortletApp; import org.netbeans.modules.portalpack.portlets.genericportlets.node.ddloaders.PortletXMLDataObject; import org.openide.filesystems.FileLock; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Logger; import java.util.logging.Level; import javax.xml.namespace.QName; import org.netbeans.modules.portalpack.portlets.genericportlets.core.util.CoreUtil; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.PortletType; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.PublicRenderParameterType; import org.netbeans.modules.portalpack.portlets.genericportlets.ddapi.eventing.EventObject; import org.openide.DialogDescriptor; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; /** * This is a helper class to add/delete/modify portlet xml elements * @author Satyaranjan */ public class PortletXmlHelper { private PortletXMLDataObject dbObj; private static Logger logger = Logger.getLogger(CoreUtil.CORE_LOGGER); public PortletXmlHelper(PortletXMLDataObject pDObj) { this.dbObj = pDObj; } public boolean addFilter(String portletName, String filterName) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addFilter() : PortletXmlHelper"); return false; } FilterMappingType filterMapping = null; FilterMappingType[] filterMappings = portletApp.getFilterMapping(); if(filterMappings == null) { } else { for(FilterMappingType filterMap:filterMappings) { if(filterMap.getFilterName().equals(filterName)) { filterMapping = filterMap; break; } } } if(filterMapping == null) { filterMapping = portletApp.newFilterMappingType(); filterMapping.setFilterName(filterName); portletApp.addFilterMapping(filterMapping); }else{ if(isPortletAlreadyPresentInFilterMapping(filterMapping, portletName)) { NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PortletXmlHelper.class, "PORTLET_FILTER_MAPPING_ALREADY_PRESENT"), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); return false; } } filterMapping.addPortletName(portletName); save(); return true; } public boolean removeFilterMapping(String portletName,String filterName) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in removeFilterMapping() : PortletXmlHelper"); return false; } boolean isChanged = false; FilterMappingType[] filterMappings = portletApp.getFilterMapping(); if(filterMappings == null) { return true; } else { for(FilterMappingType filterMap:filterMappings) { if(filterMap.getFilterName().equals(filterName)) { if(isPortletAlreadyPresentInFilterMapping(filterMap, portletName)) { filterMap.removePortletName(portletName); if(filterMap.getPortletName().length == 0) portletApp.removeFilterMapping(filterMap); isChanged = true; } } } } if(isChanged) save(); return true; } public boolean addPublicRenderParameterAsQName(String identifier,QName qname) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addPublicRenderParameterAsQName() : PortletXmlHelper"); return false; } PublicRenderParameterType prType = getPublicRenderParameterForId(identifier); if(prType != null) { Object[] param = {identifier}; NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PortletXmlHelper.class, "MSG_IDENTIFIER_EXISTS",param), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); return false; } PublicRenderParameterType publicRenderParameterType = portletApp.newPublicRenderParameterType(); publicRenderParameterType.setIdentifier(identifier); publicRenderParameterType.setQname(qname); /// if(isPublicRenderParamAlreadyExists(publicRenderParameterType, portletApp.getPublicRenderParameter())) /// return true; portletApp.addPublicRenderParameter(publicRenderParameterType); save(); return true; } public boolean addPublicRenderParameterAsName(String identifier,String name) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addPublicRenderParameterAsName() : PortletXmlHelper"); return false; } PublicRenderParameterType prType = getPublicRenderParameterForId(identifier); if(prType != null) { Object[] param = {identifier}; NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PortletXmlHelper.class, "MSG_IDENTIFIER_EXISTS",param), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); return false; } PublicRenderParameterType publicRenderParameterType = portletApp.newPublicRenderParameterType(); publicRenderParameterType.setIdentifier(identifier); publicRenderParameterType.setName(name); /// if(isPublicRenderParamAlreadyExists(publicRenderParameterType, portletApp.getPublicRenderParameter())) /// return true; portletApp.addPublicRenderParameter(publicRenderParameterType); save(); return true; } public boolean addSupportedPublicRenderParameter(String portletName,String identifier) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addSupportedPublicRenderParameter() : PortletXmlHelper"); return false; } PortletType portletType = null; PortletType[] portlets = portletApp.getPortlet(); for(PortletType portlet:portlets) { if(portlet.getPortletName().equals(portletName)) { portletType = portlet; break; } } if(portletType == null) { logger.log(Level.WARNING,"No portlet found with name : "+portletName); return false; } String[] params = portletType.getSupportedPublicRenderParameter(); for(String param:params) { if(param.equalsIgnoreCase(identifier)) { NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PortletXmlHelper.class, "SUPPORTED_PUBLIC_RENDER_PARAMETER_ALREADY_PRESENT"), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); return false; } } portletType.addSupportedPublicRenderParameter(identifier); save(); return true; } public boolean removeSupportedPublicRenderParameter(String portletName,String identifier) { PortletApp portletApp = null; try{ portletApp = dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return false; } if(portletApp == null) { logger.log(Level.SEVERE,"Portlet App is null in addFilter() : PortletXmlHelper"); return false; } PortletType portletType = null; PortletType[] portlets = portletApp.getPortlet(); for(PortletType portlet:portlets) { if(portlet.getPortletName().equals(portletName)) { portletType = portlet; break; } } if(portletType == null) { logger.log(Level.WARNING,"No portlet found with name : "+portletName); return false; } portletType.removeSupportedPublicRenderParameter(identifier); if(!isPublicRenderParameterIDIsUsedByAnyPortlet(identifier)) { Object[] params = {identifier}; NotifyDescriptor.Confirmation nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(PortletXmlHelper.class, "MSG_PRP_IS_NOT_USED_WANT_TO_DELETE", params), NotifyDescriptor.YES_NO_OPTION); Object retVal = DialogDisplayer.getDefault().notify(nd); if(retVal == NotifyDescriptor.YES_OPTION) { PublicRenderParameterType paramType = getPublicRenderParameterForId(identifier); portletApp.removePublicRenderParameter(paramType); } } save(); return true; } private boolean isPublicRenderParameterIDIsUsedByAnyPortlet(String identifier) { PortletApp portletApp = getPortletApp(); PortletType[] portlets = portletApp.getPortlet(); for(int i=0;i<portlets.length; i++) { String[] ids = portlets[i].getSupportedPublicRenderParameter(); for(String id:ids) { if(id.equals(identifier)) return true; } } return false; } public List<EventObject> getSupportedPublicRenderParameters(String portletName) { PortletApp portletApp = getPortletApp(); if(portletApp == null) return Collections.EMPTY_LIST; PortletType portlet = getPortlet(portletName); if(portlet == null) return Collections.EMPTY_LIST; List<EventObject> prpObjs = new ArrayList(); String[] sprp = portlet.getSupportedPublicRenderParameter(); for(int i=0;i<sprp.length;i++) { PublicRenderParameterType prp = getPublicRenderParameterForId(sprp[i]); if(prp == null) continue; EventObject evt = new EventObject(); evt.setPublicRenderParamId(sprp[i]); evt.setType(EventObject.PUBLIC_RENDER_PARAMETER_TYPE); if(prp.getQname() != null) evt.setQName(prp.getQname()); else evt.setName(prp.getName()); evt.setDefaultNameSpace(portletApp.getPortletDefaultNamespace()); evt.setAlias(prp.getAlias()); prpObjs.add(evt); } return prpObjs; } //Called by storyboard public EventObject addSupportedPublicRenderParameter(String portletName,EventObject prp) { boolean addPRP = true; PortletApp portletApp = getPortletApp(); if(portletApp == null) return null; String id = prp.getPublicRenderParamId(); PublicRenderParameterType prpType = getPublicRenderParameterForId(id); if(prpType == null) //prp entry needs to be added first { //Check if a render parameter with same name but different Id exists String existingId = getPublicRenderParamIDWithSameValue(prp); if(existingId != null) { Object[] param ={existingId}; NotifyDescriptor nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(PortletXmlHelper.class,"MSG_PRP_WITH_SAME_VALUE_EXIST_FOR_ID",param),NotifyDescriptor.Confirmation.YES_NO_OPTION); Object selectedVal = DialogDisplayer.getDefault().notify(nd); if(selectedVal == NotifyDescriptor.NO_OPTION){ //do nothing }else { id = existingId; addPRP = false; } } if(addPRP){ if(prp.isName()) addPublicRenderParameterAsName(id, prp.getName()); else addPublicRenderParameterAsQName(id, prp.getQName()); } } else { //Check if the name/QName is actually same if(!isEqual(prpType, prp)) { String existingId = getPublicRenderParamIDWithSameValue(prp); if(existingId != null) { Object[] param ={existingId}; NotifyDescriptor nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(PortletXmlHelper.class,"MSG_PRP_WITH_SAME_VALUE_EXIST_FOR_ID",param),NotifyDescriptor.Confirmation.YES_NO_OPTION); Object selectedVal = DialogDisplayer.getDefault().notify(nd); if(selectedVal == NotifyDescriptor.NO_OPTION) id = getAFreeIdentifier(id); else { id = existingId; addPRP = false; } } else { id = getAFreeIdentifier(id); } if(addPRP) { if(prp.isName()) addPublicRenderParameterAsName(id, prp.getName()); else addPublicRenderParameterAsQName(id, prp.getQName()); } } } //crate a new EventObject and return EventObject returnEvent = new EventObject(); returnEvent.setQName(prp.getQName()); returnEvent.setName(prp.getName()); returnEvent.setPublicRenderParamId(id); returnEvent.setType(EventObject.PUBLIC_RENDER_PARAMETER_TYPE); addSupportedPublicRenderParameter(portletName, id); return returnEvent; } private String getAFreeIdentifier(String id) { String identifier = id; PublicRenderParameterType p = getPublicRenderParameterForId(identifier); int i = 0; while(p != null) { i++; identifier = id + i; p = getPublicRenderParameterForId(identifier); } return identifier; } private boolean isEqual(PublicRenderParameterType prp,EventObject evt) { if(evt.isName()) { if(evt.getName().equals(prp.getName())) return true; }else { if(evt.getQName().equals(prp.getQname())) return true; } return false; } private static boolean isPortletAlreadyPresentInFilterMapping(FilterMappingType filterMapping, String portletName) { String[] portlets = filterMapping.getPortletName(); for(String portlet:portlets) { if(portlet.equals(portletName)) return true; } return false; } public PublicRenderParameterType getPublicRenderParameterForId(String id) { PortletApp portletApp = getPortletApp(); PublicRenderParameterType[] prpTypes = portletApp.getPublicRenderParameter(); for(PublicRenderParameterType prp:prpTypes) { if(id.equals(prp.getIdentifier())) return prp; } return null; } private String getPublicRenderParamIDWithSameValue(EventObject evt) { String name = evt.getName(); QName qName = evt.getQName(); if (name == null || name.length() == 0) { name = null; } PublicRenderParameterType[] evts = getPortletApp().getPublicRenderParameter(); for (int i = 0; i < evts.length; i++) { if (qName == null) { String tempName = evts[i].getName(); if (name == null) { continue; } if (name.equals(tempName)) { return evts[i].getIdentifier(); } } else { QName tempQName = evts[i].getQname(); if (qName == null) { continue; } if (qName.equals(tempQName)) { return evts[i].getIdentifier(); } } } return null; } private boolean isPublicRenderParamAlreadyExists(PublicRenderParameterType evt, PublicRenderParameterType[] evts) { String name = evt.getName(); QName qName = evt.getQname(); if (name == null || name.length() == 0) { name = null; } for (int i = 0; i < evts.length; i++) { if (qName == null) { String tempName = evts[i].getName(); if (name == null) { continue; } if (name.equals(tempName)) { return true; } } else { QName tempQName = evts[i].getQname(); if (qName == null) { continue; } if (qName.equals(tempQName)) { return true; } } } return false; } public PortletType getPortlet(String portletName) { PortletApp portletApp = getPortletApp(); if (portletApp == null) { return null; } PortletType[] portlets = portletApp.getPortlet(); if (portlets == null) { return null; } for (int i = 0; i < portlets.length; i++) { if (portlets[i].getPortletName().equals(portletName)) { return portlets[i]; } } return null; } public PortletApp getPortletApp() { try{ return dbObj.getPortletApp(); }catch(Exception e){ logger.log(Level.SEVERE,"Error getting PortletApp : ",e); return null; } } public void save() { try { PortletApp portletApp = dbObj.getPortletApp(); FileLock lock = dbObj.getPrimaryFile().lock(); OutputStream out = dbObj.getPrimaryFile().getOutputStream(lock); // ((BaseBean)portletApp).write(out); portletApp.write(out); try{ out.flush(); out.close(); }catch(Exception e){ logger.log(Level.SEVERE,"Error",e); } lock.releaseLock(); } catch (IOException ex) { logger.log(Level.SEVERE,"Error",ex); } } }
[ "satyaranjan@netbeans.org" ]
satyaranjan@netbeans.org
93a3b4fb89198ad592bbd7e72bd05455e7ec1c97
a422de59c29d077c512d66b538ff17d179cc077a
/hsxt/hsxt-access/hsxt-access-web/hsxt-access-web-mcs/src/main/java/com/gy/hsxt/access/web/mcs/services/systemmanage/OperatorService.java
89ac208352c8b1297afe1ffa8bc7ca033be062d4
[]
no_license
liveqmock/hsxt
c554e4ebfd891e4cc3d57e920d8a79ecc020b4dd
40bb7a1fe5c22cb5b4f1d700e5d16371a3a74c04
refs/heads/master
2020-03-28T14:09:31.939168
2018-09-12T10:20:46
2018-09-12T10:20:46
148,461,898
0
0
null
2018-09-12T10:19:11
2018-09-12T10:19:10
null
UTF-8
Java
false
false
2,315
java
/* * Copyright (c) 2015-2018 SHENZHEN GUIYI SCIENCE AND TECHNOLOGY DEVELOP CO., LTD. All rights reserved. * * 注意:本内容仅限于深圳市归一科技研发有限公司内部传阅,禁止外泄以及用于其他的商业目的 */ package com.gy.hsxt.access.web.mcs.services.systemmanage; import java.util.List; import java.util.Map; import com.gy.hsxt.access.web.bean.MCSBase; import com.gy.hsxt.access.web.common.service.IBaseService; import com.gy.hsxt.common.exception.HsException; import com.gy.hsxt.tm.bean.Group; import com.gy.hsxt.uc.as.bean.operator.AsOperator; /** * * 操作员管理服务 * @Package: com.gy.hsxt.access.web.mcs.services.systemmanage * @ClassName: OperatorService * @Description: TODO * * @author: zhangcy * @date: 2016-1-9 下午12:12:30 * @version V1.0 */ @SuppressWarnings("rawtypes") public interface OperatorService extends IBaseService{ /** * 添加操作员 * @param oper * @param adminCustId * @throws HsException */ public String addOper(AsOperator oper, String adminCustId ,List<Long> groupIds) throws HsException; /** * 查询操作员 * @param operCustId * @return * @throws HsException */ public AsOperator searchOperByCustId (String operCustId) throws HsException; /** * 查询企业操作员列表 * @param entCustId * @return * @throws HsException */ public List<AsOperator> listOperByEntCustId(String entCustId) throws HsException; /** * 修改企业操作员信息 * @param oper * @param adminCustId * @throws HsException */ public void updateOper (AsOperator oper, String adminCustId,List<Long> groupIds) throws HsException; /** * 删除操作员 * @param operCustId * @param adminCustId * @throws HsException */ public void deleteOper (String operCustId, String adminCustId) throws HsException; /** * 获取操作员详情 * @param mcsBase * @return */ public Map<String, Object> getOperatorDetail(MCSBase mcsBase); /** * 查询所有工单分组及分组下的所有操作员 * @param entCustId * @return */ public List<Group> findTaskGroupInfo(String entCustId); }
[ "864201042@qq.com" ]
864201042@qq.com
2d0ef578c1695d161ee3631412e6961a1646776c
6ab6106a023a7f485a9ea1ca37db3fb79ed2e36b
/xremoting-core/src/test/java/com/googlecode/xremoting/core/test/CoolService.java
b52329b87051e20e34d67c48fe4d1c1fedf8be59
[ "Apache-2.0" ]
permissive
rpuch/xremoting
b17de05533327bf4e316f82f276d057fc7e4c790
ddae4ee8c7c03f27794e700b19ca841c87d9ee64
refs/heads/master
2023-04-08T21:02:12.802976
2023-03-25T11:23:33
2023-03-25T11:23:33
32,251,973
1
0
Apache-2.0
2022-06-11T08:03:31
2015-03-15T08:58:31
Java
UTF-8
Java
false
false
455
java
package com.googlecode.xremoting.core.test; public class CoolService implements CoolServiceInterface { public String doCoolStuff(String stringArg, Integer integerArg, int intArg, Class<?>[] classArrayArg) { return stringArg + integerArg + intArg + classArrayArg[0].getSimpleName(); } public void throwing() throws Exception { throw new Exception("Just thrown"); } public Person justInvoke(String abc, Object[] objects) { return null; } }
[ "roman.puchkovskiy@0f6dab97-b9ee-1a6d-9288-fe3b798723e7" ]
roman.puchkovskiy@0f6dab97-b9ee-1a6d-9288-fe3b798723e7
ecab7695f4d7ea697db90556f7160a2017ac2553
4a35eb46507eb8207f634e6dad23762d0aec94df
/project/MapExplore/jMetal-jmetal-5.1/jmetal-exec/src/main/java/org/uma/jmetal/runner/multiobjective/SMPSOMeasuresRunner.java
7611f0bea43e935fd82426d4ed2063346dbf74c1
[]
no_license
fairanswers/fss16joe
8800ad81c60ab06f90b9643bf601c6c2c9a51107
f5dde87038ec5404a6bb2d9a538b2ceef571ac9d
refs/heads/master
2020-05-22T06:44:32.138162
2016-12-07T19:46:54
2016-12-07T19:46:54
65,820,114
2
1
null
null
null
null
UTF-8
Java
false
false
6,638
java
// NSGAIIRunner.java // // Author: // Antonio J. Nebro <antonio@lcc.uma.es> // // Copyright (c) 2014 Antonio J. Nebro // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. package org.uma.jmetal.runner.multiobjective; import org.uma.jmetal.algorithm.Algorithm; import org.uma.jmetal.algorithm.multiobjective.nsgaii.NSGAIIBuilder; import org.uma.jmetal.algorithm.multiobjective.nsgaii.NSGAIIMeasures; import org.uma.jmetal.algorithm.multiobjective.smpso.SMPSOBuilder; import org.uma.jmetal.algorithm.multiobjective.smpso.SMPSOMeasures; import org.uma.jmetal.measure.MeasureListener; import org.uma.jmetal.measure.MeasureManager; import org.uma.jmetal.measure.impl.BasicMeasure; import org.uma.jmetal.measure.impl.CountingMeasure; import org.uma.jmetal.measure.impl.DurationMeasure; import org.uma.jmetal.operator.CrossoverOperator; import org.uma.jmetal.operator.MutationOperator; import org.uma.jmetal.operator.SelectionOperator; import org.uma.jmetal.operator.impl.crossover.SBXCrossover; import org.uma.jmetal.operator.impl.mutation.PolynomialMutation; import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; import org.uma.jmetal.problem.DoubleProblem; import org.uma.jmetal.problem.Problem; import org.uma.jmetal.runner.AbstractAlgorithmRunner; import org.uma.jmetal.solution.DoubleSolution; import org.uma.jmetal.util.AlgorithmRunner; import org.uma.jmetal.util.JMetalException; import org.uma.jmetal.util.JMetalLogger; import org.uma.jmetal.util.ProblemUtils; import org.uma.jmetal.util.archive.BoundedArchive; import org.uma.jmetal.util.archive.impl.CrowdingDistanceArchive; import org.uma.jmetal.util.comparator.RankingAndCrowdingDistanceComparator; import org.uma.jmetal.util.evaluator.impl.SequentialSolutionListEvaluator; import org.uma.jmetal.util.pseudorandom.impl.MersenneTwisterGenerator; import java.io.FileNotFoundException; import java.util.List; import java.util.concurrent.TimeUnit; /** * Class to configure and run the NSGA-II algorithm (variant with measures) */ public class SMPSOMeasuresRunner extends AbstractAlgorithmRunner { /** * @param args Command line arguments. * @throws SecurityException * Invoking command: java org.uma.jmetal.runner.multiobjective.NSGAIIMeasuresRunner problemName [referenceFront] */ public static void main(String[] args) throws JMetalException, InterruptedException, FileNotFoundException { DoubleProblem problem; Algorithm<List<DoubleSolution>> algorithm; MutationOperator<DoubleSolution> mutation; String referenceParetoFront = "" ; String problemName ; if (args.length == 1) { problemName = args[0]; } else if (args.length == 2) { problemName = args[0] ; referenceParetoFront = args[1] ; } else { problemName = "org.uma.jmetal.problem.multiobjective.zdt.ZDT4"; referenceParetoFront = "jmetal-problem/src/test/resources/pareto_fronts/ZDT4.pf" ; } problem = (DoubleProblem) ProblemUtils.<DoubleSolution> loadProblem(problemName); BoundedArchive<DoubleSolution> archive = new CrowdingDistanceArchive<DoubleSolution>(100) ; double mutationProbability = 1.0 / problem.getNumberOfVariables() ; double mutationDistributionIndex = 20.0 ; mutation = new PolynomialMutation(mutationProbability, mutationDistributionIndex) ; int maxIterations = 250 ; int swarmSize = 100 ; algorithm = new SMPSOBuilder(problem, archive) .setMutation(mutation) .setMaxIterations(maxIterations) .setSwarmSize(swarmSize) .setRandomGenerator(new MersenneTwisterGenerator()) .setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>()) .setVariant(SMPSOBuilder.SMPSOVariant.Measures) .build(); /* Measure management */ MeasureManager measureManager = ((SMPSOMeasures)algorithm).getMeasureManager() ; CountingMeasure currentIteration = (CountingMeasure) measureManager.<Long>getPullMeasure("currentIteration"); DurationMeasure currentComputingTime = (DurationMeasure) measureManager.<Long>getPullMeasure("currentExecutionTime"); BasicMeasure<List<DoubleSolution>> solutionListMeasure = (BasicMeasure<List<DoubleSolution>>) measureManager.<List<DoubleSolution>> getPushMeasure("currentPopulation"); CountingMeasure iteration2 = (CountingMeasure) measureManager.<Long>getPushMeasure("currentIteration"); solutionListMeasure.register(new Listener()); iteration2.register(new Listener2()); /* End of measure management */ Thread algorithmThread = new Thread(algorithm) ; algorithmThread.start(); /* Using the measures */ int i = 0 ; while(currentIteration.get() < maxIterations) { TimeUnit.SECONDS.sleep(5); System.out.println("Iteration (" + i + ") : " + currentIteration.get()) ; System.out.println("Computing time (" + i + ") : " + currentComputingTime.get()) ; i++ ; } algorithmThread.join(); List<DoubleSolution> population = algorithm.getResult() ; long computingTime = currentComputingTime.get() ; JMetalLogger.logger.info("Total execution time: " + computingTime + "ms"); printFinalSolutionSet(population); if (!referenceParetoFront.equals("")) { printQualityIndicators(population, referenceParetoFront) ; } } private static class Listener implements MeasureListener<List<DoubleSolution>> { private int counter = 0 ; @Override synchronized public void measureGenerated(List<DoubleSolution> solutions) { if ((counter % 1 == 0)) { System.out.println("PUSH MEASURE. Counter = " + counter+ " First solution: " + solutions.get(0)) ; } counter ++ ; } } private static class Listener2 implements MeasureListener<Long> { @Override synchronized public void measureGenerated(Long value) { if ((value % 50 == 0)) { System.out.println("PUSH MEASURE. Iteration: " + value) ; } } } }
[ "joe@bodkinconsulting.com" ]
joe@bodkinconsulting.com