List of usage examples for java.util List clear
void clear();
From source file:com.msopentech.odatajclient.engine.data.AbstractEntryResource.java
@SuppressWarnings("unchecked") private void setLinks(final List<LINK> links, final List<LinkResource> linkResources) { links.clear(); for (LinkResource link : linkResources) { links.add((LINK) link);// www . ja v a 2s .c o m } }
From source file:net.reichholf.dreamdroid.DreamDroidTest.java
public void httpTest() { SimpleHttpClient shc = SimpleHttpClient.getInstance(); List<NameValuePair> parameters = new ArrayList<NameValuePair>(); SaxDataProvider sdp = new SaxDataProvider(new GenericSaxParser()); parameters.clear(); if (shc.fetchPageContent(URIStore.TIMER_LIST, parameters)) { long starttime = System.currentTimeMillis(); ArrayList<ExtendedHashMap> timerlist = new ArrayList<ExtendedHashMap>(); E2TimerHandler th = new E2TimerHandler(timerlist); sdp.getParser().setHandler(th);/*from ww w. j a v a 2 s . c om*/ String input = shc.getPageContentString(); sdp.parse(input); long runtime = (System.currentTimeMillis() - starttime); System.out.println(">>>>>>>>> Servicelist Took " + runtime + " millis"); } parameters.clear(); if (shc.fetchPageContent(URIStore.MOVIES, parameters)) { long starttime = System.currentTimeMillis(); ArrayList<ExtendedHashMap> movielist = new ArrayList<ExtendedHashMap>(); E2MovieListHandler mlh = new E2MovieListHandler(movielist); sdp.getParser().setHandler(mlh); String input = shc.getPageContentString(); sdp.parse(input); mMapList.clear(); mMapList.addAll(movielist); mAdapter.notifyDataSetChanged(); long runtime = (System.currentTimeMillis() - starttime); System.out.println(movielist); System.out.println(">>>>>>>>> Movielist Took " + runtime + " millis"); } //// All TV Services // parameters.clear(); // parameters.add(new BasicNameValuePair("sRef", RefStore.TV_ALL)); // // if (shc.fetchPageContent(URIStore.SERVICES, parameters)) { // // init some stuff // long starttime = System.currentTimeMillis(); // // ArrayList<ExtendedHashMap> servicelist = new ArrayList<ExtendedHashMap>(); // E2ServiceListHandler slh = new E2ServiceListHandler(servicelist); // sdp.getParser().setHandler( slh ); // // String services = shc.getPageContentString(); // // // Parse // sdp.parse(services); // // long runtime = (System.currentTimeMillis() - starttime); // // System.out.println(">>>>>>>>> Servicelist Took " + runtime // + " millis"); // // } // //// Service EPG for ARD parameters.clear(); parameters.add(new BasicNameValuePair("sRef", "1:0:1:6DCA:44D:1:FFFF0162:0:0:0:")); if (shc.fetchPageContent(URIStore.EPG_SERVICE, parameters)) { ArrayList<ExtendedHashMap> epglist = new ArrayList<ExtendedHashMap>(); sdp.getParser().setHandler(new E2EventHandler(epglist)); String epg = shc.getPageContentString(); long starttime = System.currentTimeMillis(); sdp.parse(epg); long runtime = (System.currentTimeMillis() - starttime); System.out.println(">>>>>>>>> EPG Took " + runtime + " millis"); System.out.println("<<<<<<<< STOP"); } }
From source file:com.smartitengineering.cms.spi.impl.type.search.ContentTypeSearcherImpl.java
@Override public void reIndex(final WorkspaceId workspaceId) { executorService.submit(new Runnable() { @Override/* w ww .jav a2s . co m*/ public void run() { final QueryParameter param; if (workspaceId == null) { param = null; } else { param = QueryParameterFactory.getStringLikePropertyParam("id", new StringBuilder(workspaceId.toString()).append(':').toString(), MatchMode.START); } final QueryParameter<Integer> maxResultsParam = QueryParameterFactory.getMaxResultsParam(100); boolean hasMore = true; ContentTypeId lastId = null; List<QueryParameter> params = new ArrayList<QueryParameter>(); while (hasMore) { params.clear(); if (param != null) { params.add(param); } params.add(maxResultsParam); if (lastId != null) { try { params.add(QueryParameterFactory.getGreaterThanPropertyParam("id", contentTypeLoader.getByteArrayFromId(lastId))); } catch (Exception ex) { logger.warn("Could not add last id clause " + lastId.toString(), ex); } } List<ContentType> list = contentTypeLoader.getQueryResult(params); if (list == null || list.isEmpty()) { hasMore = false; } else { final ContentType[] contents = new ContentType[list.size()]; int index = 0; for (ContentType content : list) { reindexListener.notify(SmartContentAPI.getInstance().getEventRegistrar() .<ContentType>createEvent(EventType.UPDATE, Type.CONTENT_TYPE, content)); contents[index++] = content; } lastId = contents[contents.length - 1].getContentTypeID(); } } } }); }
From source file:com.jci.utils.CommonUtils.java
/** * Gets the new rowkeys.// ww w. j a v a 2 s .c o m * * @param partitionKey the partition key * @param tableName the table name * @param rowKeys the row keys * @param cloudTable the cloud table * @return the new rowkeys */ public static List<Map<String, Integer>> getNewRowkeys(String partitionKey, String tableName, List<String> rowKeys, CloudTable cloudTable) { final int queryBatchSize = 100; List<String> temp = new ArrayList<>(); Map<String, Integer> oldRowkeyToStatusMap = new HashMap<>(); if (Constants.TABLE_PO_DETAILS.equals(tableName)) { for (int i = 0; i < rowKeys.size(); i++) { temp.add(rowKeys.get(i)); if (i != 0 && i % queryBatchSize == 0) { String query = QueryBuilder.processPosQuery(partitionKey, temp); TableQuery<PoEntity> partitionQuery = TableQuery.from(PoEntity.class).where(query); for (PoEntity entity : cloudTable.execute(partitionQuery)) { oldRowkeyToStatusMap.put(entity.getRowKey(), entity.getSupplierDeliveryState()); } temp.clear(); } } if (temp.size() > 0) { String query = QueryBuilder.processPosQuery(partitionKey, temp); TableQuery<PoEntity> partitionQuery = TableQuery.from(PoEntity.class).where(query); for (PoEntity entity : cloudTable.execute(partitionQuery)) { oldRowkeyToStatusMap.put(entity.getRowKey(), entity.getSupplierDeliveryState()); } temp.clear(); } } else if (Constants.TABLE_SUPPLIER.equals(tableName)) { for (int i = 0; i < rowKeys.size(); i++) { temp.add(rowKeys.get(i)); if (i != 0 && i % queryBatchSize == 0) { String query = QueryBuilder.processPosQuery(partitionKey, temp); TableQuery<SuppEntity> partitionQuery = TableQuery.from(SuppEntity.class).where(query); for (SuppEntity entity : cloudTable.execute(partitionQuery)) { oldRowkeyToStatusMap.put(entity.getRowKey(), entity.getSupplierDeliveryState()); } temp.clear(); } } if (temp.size() > 0) { String query = QueryBuilder.processPosQuery(partitionKey, temp); TableQuery<SuppEntity> partitionQuery = TableQuery.from(SuppEntity.class).where(query); for (SuppEntity entity : cloudTable.execute(partitionQuery)) { oldRowkeyToStatusMap.put(entity.getRowKey(), entity.getSupplierDeliveryState()); } temp.clear(); } } else if (Constants.TABLE_ITEM.equals(tableName)) { for (int i = 0; i < rowKeys.size(); i++) { temp.add(rowKeys.get(i)); if (i != 0 && i % queryBatchSize == 0) { String query = QueryBuilder.processPosQuery(partitionKey, temp); TableQuery<ItemEntity> partitionQuery = TableQuery.from(ItemEntity.class).where(query); for (ItemEntity entity : cloudTable.execute(partitionQuery)) { oldRowkeyToStatusMap.put(entity.getRowKey(), entity.getSupplierDeliveryState()); } temp.clear(); } } if (temp.size() > 0) { String query = QueryBuilder.processPosQuery(partitionKey, temp); TableQuery<ItemEntity> partitionQuery = TableQuery.from(ItemEntity.class).where(query); for (ItemEntity entity : cloudTable.execute(partitionQuery)) { oldRowkeyToStatusMap.put(entity.getRowKey(), entity.getSupplierDeliveryState()); } temp.clear(); } } else if (Constants.TABLE_GR_DETAILS.equals(tableName)) { for (int i = 0; i < rowKeys.size(); i++) { temp.add(rowKeys.get(i)); if (i != 0 && i % queryBatchSize == 0) { String query = QueryBuilder.processPosQuery(partitionKey, temp); TableQuery<GrEntity> partitionQuery = TableQuery.from(GrEntity.class).where(query); for (GrEntity entity : cloudTable.execute(partitionQuery)) { oldRowkeyToStatusMap.put(entity.getRowKey(), entity.getSupplierDeliveryState()); } temp.clear(); } } if (temp.size() > 0) { String query = QueryBuilder.processPosQuery(partitionKey, temp); TableQuery<GrEntity> partitionQuery = TableQuery.from(GrEntity.class).where(query); for (GrEntity entity : cloudTable.execute(partitionQuery)) { oldRowkeyToStatusMap.put(entity.getRowKey(), entity.getSupplierDeliveryState()); } temp.clear(); } } Map<String, Integer> newRowkeyToStatusMap = new HashMap<>(); for (int i = 0; i < rowKeys.size(); i++) { if (!oldRowkeyToStatusMap.containsKey(rowKeys.get(i))) { newRowkeyToStatusMap.put(rowKeys.get(i), 1); } } List<Map<String, Integer>> res = new ArrayList<>(); res.add(newRowkeyToStatusMap);//new rowkeys res.add(oldRowkeyToStatusMap);//old row keys return res; }
From source file:org.openmrs.module.OT.web.controller.majorOT.queue.SearchProcedureController.java
@RequestMapping(method = RequestMethod.GET) public String searchTest(@RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "phrase", required = false) String phrase, @RequestParam(value = "procedure", required = false) Integer procedureId, @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request, Model model) {//from w ww . ja va2 s . c om OperationTheatreService ots = (OperationTheatreService) Context.getService(OperationTheatreService.class); List<Concept> procedures = new ArrayList<Concept>(); Concept procedure = Context.getConceptService().getConcept(procedureId); if (procedure != null) { if (procedures.isEmpty()) procedures.add(procedure); else { procedures.clear(); procedures.add(procedure); } } else { if (procedures.isEmpty()) procedures = ots.getProceduresMajorOT(); else { procedures.clear(); procedures = ots.getProceduresMajorOT(); } } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); if (currentPage == null) currentPage = 1; List<OpdTestOrder> schedules = ots.getSchedulesMajorOT(date, phrase, procedures, currentPage); List<OTScheduleModel> otProcedures = OperationTheatreUtil_Major.generateModelsFromSchedules(schedules); int total = ots.countScheduleMajorOT(date, phrase, procedures); PagingUtil pagingUtil = new PagingUtil(OTConstants.PAGESIZE, currentPage, total); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("otProcedures", otProcedures); model.addAttribute("otProcedureNo", otProcedures.size()); } catch (ParseException e) { e.printStackTrace(); System.out.println("Error when parsing schedule date!"); return null; } return "/module/OT/majorOT/search"; }
From source file:org.openmrs.module.OT.web.controller.minorOT.queue.SearchProcedureController.java
@RequestMapping(method = RequestMethod.GET) public String searchTest(@RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "phrase", required = false) String phrase, @RequestParam(value = "procedure", required = false) Integer procedureId, @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request, Model model) {//from w w w. j a v a 2 s. c o m OperationTheatreService ots = (OperationTheatreService) Context.getService(OperationTheatreService.class); List<Concept> procedures = new ArrayList<Concept>(); Concept procedure = Context.getConceptService().getConcept(procedureId); if (procedure != null) { if (procedures.isEmpty()) procedures.add(procedure); else { procedures.clear(); procedures.add(procedure); } } else { if (procedures.isEmpty()) procedures = ots.getProceduresMinorOT(); else { procedures.clear(); procedures = ots.getProceduresMinorOT(); } } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); if (currentPage == null) currentPage = 1; List<OpdTestOrder> schedules = ots.getSchedulesMinorOT(date, phrase, procedures, currentPage); List<OTScheduleModel> otProcedures = OperationTheatreUtil.generateModelsFromSchedules(schedules); int total = ots.countScheduleMinorOT(date, phrase, procedures); PagingUtil pagingUtil = new PagingUtil(OTConstants.PAGESIZE, currentPage, total); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("otProcedures", otProcedures); model.addAttribute("otProcedureNo", otProcedures.size()); } catch (ParseException e) { e.printStackTrace(); System.out.println("Error when parsing schedule date!"); return null; } return "/module/OT/minorOT/search"; }
From source file:ch.unibas.charmmtools.generate.inputs.CHARMM_Generator_DGHydr.java
private void genInputPythonGas(boolean genOnly) { List<String> args = new ArrayList<>(); args.clear(); args.add("--ti"); args.add(this.ti_type); args.add("--tps"); args.add(this.solu_top); args.add("--slu"); args.add(this.solu_cor); args.add("--par"); args.add(this.par); args.add("--lpun"); args.add(this.lpun); if (genOnly) { args.add("--chm"); args.add("../../scripts/charmm"); } else {// w w w . j a v a 2 s . c o m args.add("--rem"); args.add("verdi"); args.add("--num"); args.add("8"); } args.add("--lmb"); args.add(Double.toString(this.l_min)); args.add(Double.toString(this.l_space)); args.add(Double.toString(this.l_max)); // args.add("--nst"); // args.add("5000"); // args.add("--neq"); // args.add("1000"); if (genOnly) { args.add("--generate"); } File script = new File("scripts/charmm-ti/perform-ti.py"); //File output = null; if (genOnly) { output = new File(myDir + "/dg_gen_" + this.ti_type + "_gas" + ".out"); logger.info("OUTPUT file from perform-ti generate is : " + output.getAbsolutePath()); } else { output = new File(myDir + "/dg_run_" + this.ti_type + "_gas" + ".out"); logger.info("OUTPUT file from perform-ti running is : " + output.getAbsolutePath()); } int returnCode; //// if (genOnly) { returnCode = runner.exec(script, args, output); // } else { // returnCode = runner.exec(script, args); // } String[] exts = { "inp" }; myFiles.addAll(FileUtils.listFiles(myDir, exts, false)); }
From source file:de.micromata.genome.db.jpa.tabattr.entities.JpaTabAttrBaseDO.java
/** * Set the value of the attribute./*from w w w . java 2s . c o m*/ * * if value is longer than VALUE_MAXLENGHT the string will be split and stored in additional data children entities. * * @param value the new string data */ public void setStringData(String value) { List<JpaTabAttrDataBaseDO<?, PK>> data = getData(); data.clear(); int maxValLength = getValueMaxLength(); if (StringUtils.length(value) > maxValLength) { this.value = value.substring(0, maxValLength); String rest = value.substring(maxValLength); int maxDataLength = getMaxDataLength(); int rowIdx = 0; while (rest.length() > 0) { String ds = StringUtils.substring(rest, 0, maxDataLength); rest = StringUtils.substring(rest, maxDataLength); JpaTabAttrDataBaseDO<?, PK> dataDo = createData(ds); dataDo.setDatarow(rowIdx++); data.add(dataDo); } } else { this.value = value; } }
From source file:org.openmrs.module.OT.web.controller.minorOT.observation.searchObsProcedureController.java
@RequestMapping(method = RequestMethod.GET) public String searchTest(@RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "phrase", required = false) String phrase, @RequestParam(value = "procedure", required = false) Integer procedureId, @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request, Model model) {/*from w w w . ja v a2 s.c o m*/ OperationTheatreService ots = (OperationTheatreService) Context.getService(OperationTheatreService.class); List<Concept> procedures = new ArrayList<Concept>(); Concept procedure = Context.getConceptService().getConcept(procedureId); if (procedure != null) { if (procedures.isEmpty()) procedures.add(procedure); else { procedures.clear(); procedures.add(procedure); } } else { if (procedures.isEmpty()) procedures = ots.getProceduresMinorOT(); else { procedures.clear(); procedures = ots.getProceduresMinorOT(); } } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); if (currentPage == null) currentPage = 1; List<MinorOTProcedure> otSchedules = ots.getMinorOTSchedules(date, phrase, procedures, currentPage); List<OTScheduleModel> otProcedures = OperationTheatreUtil.generateObsModelsFromSchedules(otSchedules); int total = ots.countMinorOTSchedule(date, phrase, procedures); PagingUtil pagingUtil = new PagingUtil(OTConstants.PAGESIZE, currentPage, total); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("otProcedures", otProcedures); model.addAttribute("otProcedureNo", otProcedures.size()); } catch (ParseException e) { e.printStackTrace(); System.out.println("Error when parsing Accepted schedule date!"); return null; } return "/module/OT/minorOT/searchObs"; }
From source file:org.openmrs.module.OT.web.controller.majorOT.observation.searchObsProcedureController.java
@RequestMapping(method = RequestMethod.GET) public String searchTest(@RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "phrase", required = false) String phrase, @RequestParam(value = "procedure", required = false) Integer procedureId, @RequestParam(value = "currentPage", required = false) Integer currentPage, HttpServletRequest request, Model model) {/*from ww w .j a v a2 s .c om*/ OperationTheatreService ots = (OperationTheatreService) Context.getService(OperationTheatreService.class); List<Concept> procedures = new ArrayList<Concept>(); Concept procedure = Context.getConceptService().getConcept(procedureId); if (procedure != null) { if (procedures.isEmpty()) procedures.add(procedure); else { procedures.clear(); procedures.add(procedure); } } else { if (procedures.isEmpty()) procedures = ots.getProceduresMajorOT(); else { procedures.clear(); procedures = ots.getProceduresMajorOT(); } } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); if (currentPage == null) currentPage = 1; List<MajorOTProcedure> otSchedules = ots.getMajorOTSchedules(date, phrase, procedures, currentPage); List<OTScheduleModel> otProcedures = OperationTheatreUtil_Major .generateObsModelsFromSchedules(otSchedules); int total = ots.countMajorOTSchedule(date, phrase, procedures); PagingUtil pagingUtil = new PagingUtil(OTConstants.PAGESIZE, currentPage, total); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("otProcedures", otProcedures); model.addAttribute("otProcedureNo", otProcedures.size()); } catch (ParseException e) { e.printStackTrace(); System.out.println("Error when parsing Accepted schedule date!"); return null; } return "/module/OT/majorOT/searchObs"; }