List of usage examples for java.util ListIterator set
void set(E e);
From source file:org.opennms.netmgt.dao.castor.DefaultMicroblogConfigurationDao.java
public void saveProfile(final MicroblogProfile profile) throws IOException { reloadConfiguration();/* w w w. ja v a 2 s . c o m*/ final MicroblogConfiguration config = getContainer().getObject(); boolean found = false; final ListIterator<MicroblogProfile> it = config.getMicroblogProfileCollection().listIterator(); while (it.hasNext()) { final MicroblogProfile existing = it.next(); if (existing.getName().equals(profile.getName())) { found = true; it.set(profile); break; } } if (!found) config.addMicroblogProfile(profile); final File file = getContainer().getFile(); if (file == null) { LOG.warn("No file associated with this config. Skipping marshal."); return; } FileWriter writer = null; try { writer = new FileWriter(file); CastorUtils.marshalWithTranslatedExceptions(config, writer); } finally { IOUtils.closeQuietly(writer); } }
From source file:org.jcodec.containers.mp4.boxes.TrakBox.java
public void setDataRef(String url) { MediaInfoBox minf = getMdia().getMinf(); DataInfoBox dinf = minf.getDinf();/*w ww. j a v a2 s.c om*/ if (dinf == null) { dinf = new DataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); UrlBox urlBox = new UrlBox(url); if (dref == null) { dref = new DataRefBox(); dinf.add(dref); dref.add(urlBox); } else { ListIterator<Box> lit = dref.boxes.listIterator(); while (lit.hasNext()) { FullBox box = (FullBox) lit.next(); if ((box.getFlags() & 0x1) != 0) lit.set(urlBox); } } }
From source file:es.uvigo.ei.sing.adops.operations.running.mrbayes.MrBayes3_2ProcessManager.java
@Override public void buildSummary(MrBayesOutput output) throws OperationException { try {/* ww w. ja v a2s . c o m*/ FileUtils.moveFile(new File(output.getConFile().getAbsolutePath() + ".tre"), output.getConFile()); final List<String> lines = FileUtils.readLines(output.getConFile()); final ListIterator<String> itLines = lines.listIterator(); while (itLines.hasNext()) { final String line = itLines.next(); if (line.contains("tree con_50_majrule")) { final String[] lineSplit = line.split("="); final String tree = lineSplit[1].trim(); itLines.set(lineSplit[0] + "= " + Newick.parse(tree.trim())); } } FileUtils.writeLines(output.getConFile(), lines); super.buildSummary(output); } catch (Exception e) { throw new OperationException("Error while working with consensus tree", e); } }
From source file:org.libreplan.business.planner.chart.ContiguousDaysLine.java
public void setValueForAll(T value) { ListIterator<T> listIterator = values.listIterator(); while (listIterator.hasNext()) { listIterator.next();/*from w w w . j a v a 2 s.co m*/ listIterator.set(value); } }
From source file:org.libreplan.business.planner.chart.ContiguousDaysLine.java
public void transformInSitu(IValueTransformer<T, T> transformer) { LocalDate current = startInclusive; ListIterator<T> listIterator = values.listIterator(); while (listIterator.hasNext()) { T previousValue = listIterator.next(); listIterator.set(transformer.transform(current, previousValue)); current = current.plusDays(1);//www. j a v a 2s .c o m } }
From source file:com.platum.restflow.RestflowModel.java
/** * //w w w .ja v a 2s. c om * @param resource * @return */ public RestflowModel updateResource(Resource resource) { Validate.notNull(resource, "Cannot update a null resource."); Validate.notEmpty(resource.getName(), "Resource name cannot be null or empty."); if (resources != null) { ListIterator<Resource> iterator = resources.listIterator(); while (iterator.hasNext()) { if (iterator.next().getName().equals(resource.getName())) { iterator.set(resource); return this; } } } throw new RestflowNotExistsException("Resource does not exists."); }
From source file:com.platum.restflow.RestflowModel.java
/** * /*from ww w.ja v a2 s. c o m*/ * @param datasource * @return */ public RestflowModel updateFileSystem(FileSystemDetails fs) { Validate.notNull(fs, "Cannot update a null filesystem."); Validate.notEmpty(fs.getName(), "Filesystem name cannot be null or empty."); if (resources != null) { ListIterator<FileSystemDetails> iterator = fileSystems.listIterator(); while (iterator.hasNext()) { if (iterator.next().getName().equals(fs.getName())) { iterator.set(fs); return this; } } } throw new RestflowNotExistsException("Datasource does not exists."); }
From source file:com.platum.restflow.RestflowModel.java
/** * //from w w w . j a v a 2s.c om * @param datasource * @return */ public RestflowModel updateDatasource(DatasourceDetails datasource) { Validate.notNull(datasource, "Cannot update a null datasource."); Validate.notEmpty(datasource.getName(), "Datasource name cannot be null or empty."); if (resources != null) { ListIterator<DatasourceDetails> iterator = datasources.listIterator(); while (iterator.hasNext()) { if (iterator.next().getName().equals(datasource.getName())) { iterator.set(datasource); return this; } } } throw new RestflowNotExistsException("Datasource does not exists."); }
From source file:gsilva.lirc.lircclient.config.LircConfigReader.java
private void endEntry() { if (program == null || entry.getProgram() == null || !program.equalsIgnoreCase(entry.getProgram())) return;//from w w w. ja v a 2s . co m if (validator != null) { ListIterator<String> configs = entry.getConfigs().listIterator(); while (configs.hasNext()) { String config = configs.next(); MutableObject<String> mConfig = new MutableObject<String>(config); String error = validator.validateLircConfig(mConfig); if (error != null) syntaxError(error); configs.set(mConfig.getValue()); } } configEntries.add(entry); }
From source file:net.czlee.debatekeeper.PrepTimeBellsEditActivity.java
@SuppressLint("DefaultLocale") private void refreshBellsList() { ArrayList<String> descriptions = mPtbm.getBellDescriptions(); // Convert descriptions to sentence case ListIterator<String> descriptionsIterator = descriptions.listIterator(); while (descriptionsIterator.hasNext()) { String description = descriptionsIterator.next(); descriptionsIterator .set(description.substring(0, 1).toUpperCase(Locale.getDefault()) + description.substring(1)); }/* w w w.j av a 2 s. c o m*/ ListView view = (ListView) findViewById(R.id.prepTimeBellsEditor_bellsList); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, descriptions); view.setAdapter(adapter); // Disable the "clear" button if there is nothing to clear ((Button) findViewById(R.id.prepTimeBellsEditor_clearAllButton)).setEnabled(mPtbm.hasBells()); }