List of usage examples for java.util List set
E set(int index, E element);
From source file:net.rllcommunity.plugins.rpgitems.item.RPGItem.java
public ItemStack toItemStack(String locale) { ItemStack rStack = item.clone();/*from w ww . ja v a 2 s . c om*/ RPGMetadata rpgMeta = new RPGMetadata(); ItemMeta meta = getLocaleMeta(locale); List<String> lore = meta.getLore(); lore.set(0, meta.getLore().get(0) + rpgMeta.toMCString()); addExtra(rpgMeta, rStack, lore); meta.setLore(lore); rStack.setItemMeta(meta); return rStack; }
From source file:com.clustercontrol.calendar.composite.CalendarDetailListComposite.java
/** * ???//from w w w. j a v a 2 s . c o m */ public void down() { StructuredSelection selection = (StructuredSelection) m_tableViewer.getSelection();//.firstElement; ArrayList<?> list = (ArrayList<?>) selection.getFirstElement(); //????? Integer order = (Integer) list.get(0); List<CalendarDetailInfo> detailList = this.detailList; //list order+1 ?????? if (order < detailList.size()) { //order???????1 n list????? order - 1 order = order - 1; CalendarDetailInfo a = detailList.get(order); CalendarDetailInfo b = detailList.get(order + 1); detailList.set(order, b); detailList.set(order + 1, a); } update(); //?????? selectItem(order + 1); }
From source file:net.sourceforge.eclipsetrader.core.CurrencyConverter.java
public void setExchangeRatio(Date date, String from, String to, double ratio) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/* ww w. ja v a 2 s. c om*/ calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); date = calendar.getTime(); List list = (ArrayList) historyMap.get(from + to); if (list == null) list = new ArrayList(); History history = new History(date, new Double(ratio)); int index = list.indexOf(history); if (index != -1) { History old = (History) list.get(index); if (!old.ratio.equals(history.ratio)) { list.set(index, history); setChanged(); } } else { list.add(history); setChanged(); } historyMap.put(from + to, list); notifyObservers(); }
From source file:com.googlecode.esms.provider.Tim.java
@Override public List<Result> send(SMS sms) { List<Result> results = new LinkedList<Result>(); for (int r = 0; r < sms.getReceivers().size(); ++r) results.add(Result.UNKNOWN_ERROR); try {/* w ww. jav a 2 s .c o m*/ Result login = login(); if (login != Result.SUCCESSFUL) { results.set(0, login); return results; } // TODO swap SIM here if (sms.getCaptchaText() == null || sms.getCaptchaText() == "") { Result addDispatchNew = addDispatchNew(); if (addDispatchNew == Result.LOGIN_ERROR) { Result relogin = login(); if (relogin != Result.SUCCESSFUL) { results.set(0, relogin); return results; } addDispatchNew = addDispatchNew(); } if (addDispatchNew != Result.SUCCESSFUL) { results.set(0, addDispatchNew); return results; } results.set(0, addDispatchForm(sms)); return results; } else { boolean validateCaptchaForm = validateCaptchaForm(sms, results); if (!validateCaptchaForm) return results; updateCount(); List<Receiver> sortedReceivers = new LinkedList<Receiver>(); for (int r = 0; r < sms.getReceivers().size(); ++r) if (results.get(r).equals(Result.SUCCESSFUL)) { sortedReceivers.add(sms.getReceivers().get(r)); ++count; } for (int r = 0; r < sms.getReceivers().size(); ++r) if (!results.get(r).equals(Result.SUCCESSFUL)) sortedReceivers.add(sms.getReceivers().get(r)); sms.setReceivers(sortedReceivers); } } catch (Exception e) { e.printStackTrace(); results.set(0, Result.NETWORK_ERROR); } return results; }
From source file:com.virtusa.akura.reporting.controller.PrizeTopListController.java
/** * This method is used to process the report data. * * @param annualGradeRankList list of StudentAnnualGradeRank objects * @param map to hold data to show in report * @return list of ClassWiseStudentReportData objects * @throws AkuraAppException the akura app exception *///from w ww. j a v a 2 s . c o m private List<StudentMarksReportData> processTotalPrizeReportData( List<StudentAnnualGradeRank> annualGradeRankList, Map<String, Object> map) throws AkuraAppException { List<StudentMarksReportData> reportDataList = new ArrayList<StudentMarksReportData>(); StudentMarksReportData studentMarksReportData = null; for (StudentAnnualGradeRank studentAnnualGradeRank : annualGradeRankList) { studentMarksReportData = new StudentMarksReportData(); studentMarksReportData.setAdmissionNo(studentAnnualGradeRank.getAdmissionNo()); studentMarksReportData.setName(studentAnnualGradeRank.getNameWithInitials()); List<String> marks = StaticDataUtil.getListWithEmptyValues(MAXIMUM_NO_OF_COLUMNS); List<String> termLabels = StaticDataUtil.getListWithEmptyValues(MAXIMUM_NO_OF_COLUMNS); marks.set(AVERAGE_INDEX, StaticDataUtil.setNoOfDigitsInNumber(2, studentAnnualGradeRank.getAverage())); marks.set(RANK_INDEX, String.valueOf(studentAnnualGradeRank.getRank())); marks.set(TOTAL_INDEX, String.valueOf(studentAnnualGradeRank.getTotal())); List<StudentsGradeRankView> list = studentService .findTermWiseStudentTotalMarks(studentAnnualGradeRank.getStudentClassInfoId()); for (int i = 0; i < MAXIMUM_NO_OF_TERMS; i++) { if (list.size() > i) { termLabels.set(i, TERM + (i + 1)); // marks.set(i, String.valueOf(list.get(i).getTotal())); switch (list.get(i).getId().getTermId()) { case 1: marks.set(0, String.valueOf(list.get(i).getTotal())); break; case 2: marks.set(1, String.valueOf(list.get(i).getTotal())); break; case 3: marks.set(2, String.valueOf(list.get(i).getTotal())); break; case 4: marks.set(3, String.valueOf(list.get(i).getTotal())); break; case 5: marks.set(4, String.valueOf(list.get(i).getTotal())); break; default: break; } } } map.put(TERM_LABEL, termLabels); studentMarksReportData.setMarks(marks); reportDataList.add(studentMarksReportData); } return reportDataList; }
From source file:com.virtusa.akura.reporting.controller.PrizeTopListController.java
/** * This method is used to process the report data. * * @param gradeSubjectRanklist list of StudentGradeSubjectRankView objects * @param map to hold data to show in report * @return list of ClassWiseStudentReportData objects * @throws AkuraAppException the akura app exception *///ww w .j a va 2 s.c o m private List<StudentMarksReportData> processSubjectPrizeReportData( List<StudentGradeSubjectRankView> gradeSubjectRanklist, Map<String, Object> map) throws AkuraAppException { List<StudentMarksReportData> reportDataList = new ArrayList<StudentMarksReportData>(); StudentMarksReportData studentMarksReportData = null; for (StudentGradeSubjectRankView studentGradeSubjectRankView : gradeSubjectRanklist) { studentMarksReportData = new StudentMarksReportData(); studentMarksReportData.setAdmissionNo(studentGradeSubjectRankView.getAdmissionNo()); studentMarksReportData.setName(studentGradeSubjectRankView.getNameWithInitials()); List<String> marks = StaticDataUtil.getListWithEmptyValues(MAXIMUM_NO_OF_COLUMNS); List<String> termLabels = StaticDataUtil.getListWithEmptyValues(MAXIMUM_NO_OF_TERMS); marks.set(AVERAGE_INDEX, StaticDataUtil.setNoOfDigitsInNumber(2, studentGradeSubjectRankView.getAverage())); marks.set(RANK_INDEX, String.valueOf(studentGradeSubjectRankView.getRank())); marks.set(TOTAL_INDEX, String.valueOf(studentGradeSubjectRankView.getTotal())); List<StudentTermMarkDTO> list = studentService.findTermMarksByClassInfoIdAndGradeSubject( studentGradeSubjectRankView.getStudentClassInfoId(), studentGradeSubjectRankView.getGradeSubjectId()); for (int i = 0; i < MAXIMUM_NO_OF_TERMS; i++) { if (list.size() > i) { termLabels.set(i, TERM + (i + 1)); if (list.get(i).isAbsent()) { marks.set(i, ABSENT_STRING); } switch (list.get(i).getTermId()) { case 1: marks.set(0, String.valueOf(list.get(i).getMarks())); break; case 2: marks.set(1, String.valueOf(list.get(i).getMarks())); break; case 3: marks.set(2, String.valueOf(list.get(i).getMarks())); break; case 4: marks.set(3, String.valueOf(list.get(i).getMarks())); break; case 5: marks.set(4, String.valueOf(list.get(i).getMarks())); break; default: break; } } } map.put(TERM_LABEL, termLabels); studentMarksReportData.setMarks(marks); reportDataList.add(studentMarksReportData); } return reportDataList; }
From source file:de.geeksfactory.opacclient.apis.BaseApi.java
@Override public List<SearchField> getSearchFields() throws JSONException, OpacErrorException, IOException { List<SearchField> fields = parseSearchFields(); if (shouldUseMeaningDetector()) { MeaningDetector md = new MeaningDetectorImpl(library); for (int i = 0; i < fields.size(); i++) { fields.set(i, md.detectMeaning(fields.get(i))); }//w ww . j a va2 s .c om Collections.sort(fields, new SearchField.OrderComparator()); } return fields; }
From source file:com.bluecloud.ioc.core.KernelComponentDepender.java
/** * <h3>serviceentry??</h3>/*from w w w. j a v a 2 s . c om*/ * * @param cloneServiceEntries * @param eps * @param entry */ private void cloneServiceEntries(List<EntryMetadata> cloneServiceEntries, int eps, EntryMetadata entry) { int propertyIndex = 0; int sps = 0; for (EntryMetadata serviceEntry : cloneServiceEntries) { sps += serviceEntry.getProperties().size(); } // ?property?property??? int nps = sps - eps >= 0 ? eps : sps; for (int entryIndex = 0; entryIndex < cloneServiceEntries.size(); entryIndex++) { List<PropertyMetadata> cloneEntryProperties = cloneServiceEntries.get(entryIndex).getProperties(); for (int entryPropertyIndex = 0; entryPropertyIndex < cloneEntryProperties .size(); entryPropertyIndex++) { if (propertyIndex < nps) { PropertyMetadata newPM = entry.getProperties().get(propertyIndex); cloneEntryProperties.set(entryPropertyIndex, newPM); } else { return; } propertyIndex++; } } }
From source file:com.bluecloud.ioc.core.KernelComponentDepender.java
/** * <h3>serviceproperty??</h3> * /*from ww w.ja v a 2s . c o m*/ * @param cloneServiceProperties * @param eps * @param entry */ private void cloneServiceProperties(List<PropertyMetadata> cloneServiceProperties, int eps, EntryMetadata entry) { int propertyIndex = 0; int sps = cloneServiceProperties.size(); // ?property?property??? int nps = sps - eps >= 0 ? eps : sps; while (propertyIndex < nps) { cloneServiceProperties.set(propertyIndex, entry.getProperties().get(propertyIndex)); propertyIndex++; } }
From source file:com.funambol.common.pim.utility.PDIMergeUtils.java
/** * Merges the given two lists of TypifiedProperty objects * * @param list1 the first list (must be not null) * @param list2 the second list/*from w ww. j a v a2 s . com*/ * @return true if the first list is changed */ public static MergeResult mergeTypifiedPropertiestList(List list1, List list2) { if (list1 == null || list2 == null) { throw new IllegalStateException("The lists must not be null"); } List typeAlreadyHandled = new ArrayList(); MergeResult listMergeResult = new MergeResult(); if (list2.size() > 0) { Iterator it = list2.iterator(); TypifiedProperty p = null; int pos2 = -1; while (it.hasNext()) { p = (TypifiedProperty) it.next(); pos2 = list2.indexOf(p); typeAlreadyHandled.add(p.getPropertyType()); // // We add/set a property only if his value isn't empty (or null) // int pos1 = list1.indexOf(p); if (pos1 < 0) { if (StringUtils.isNotEmpty(p.getPropertyValueAsString())) { list1.add(p); listMergeResult.addPropertyA(p.getPropertyType()); } } else { // // There is already a property with the same type // MergeResult mergePropertyResult = compareProperties((TypifiedProperty) list1.get(pos1), p); if (mergePropertyResult.isSetARequired()) { list1.set(pos1, p); listMergeResult.addPropertyA(p.getPropertyType()); } if (mergePropertyResult.isSetBRequired()) { list2.set(pos2, (TypifiedProperty) list1.get(pos1)); listMergeResult.addPropertyB(((TypifiedProperty) list1.get(pos1)).getPropertyType()); } } } } // // Now we loop on list1 ignoring the properties already handled // The properties not handled are sure only in list1 // if (list1.size() > 0) { Iterator it = list1.iterator(); TypifiedProperty p = null; while (it.hasNext()) { p = (TypifiedProperty) it.next(); if (typeAlreadyHandled.indexOf(p.getPropertyType()) != -1) { // // This property is already handled // continue; } // // We add/set a property only if his value isn't empty (or null) // if (StringUtils.isNotEmpty(p.getPropertyValueAsString())) { list2.add(p); listMergeResult.addPropertyB(p.getPropertyType()); } } } return listMergeResult; }