List of usage examples for java.util ArrayList remove
public boolean remove(Object o)
From source file:com.uwsoft.editor.data.manager.PreferencesManager.java
private void cleanDuplicates(ArrayList<String> paths) { Array<Integer> duplicates = new Array<>(); for (int i = 0; i < paths.size() - 1; i++) { if (duplicates.contains(i, false)) continue; for (int j = i + 1; j < paths.size(); j++) { if (FilenameUtils.equalsNormalized(paths.get(i), paths.get(j))) { duplicates.add(j);//from w w w . j a v a 2s .c o m } } } duplicates.sort(); duplicates.reverse(); for (int i = 0; i < duplicates.size; i++) { paths.remove((int) duplicates.get(i)); } }
From source file:com.emental.mindraider.core.rest.resource.FolderResource.java
/** * Remove notebook from folder./*from ww w. j av a 2 s . co m*/ * * @param notebookUri * URI of the notebook * @throws Exception * a generic exception */ @SuppressWarnings("unchecked") public void removeNotebook(String notebookUri) throws Exception { if (notebookUri == null) { throw new MindRaiderException("Notebook URI can't be null!"); } // presuming that there exist exactly one notebooks group ResourcePropertyGroup[] notebooks; try { notebooks = resource.getData().getPropertyGroup(new URI(PROPERTY_GROUP_URI_NOTEBOOKS)); } catch (URISyntaxException e) { logger.error("removeNotebook(String)", e); return; } if (notebooks != null) { ArrayList<NotebookProperty> arrProperties = notebooks[0].getProperties(); Object notebookToDelete = null; for (NotebookProperty notebookProperty : arrProperties) { if (notebookUri.equals(notebookProperty.getUri().toString())) { notebookToDelete = notebookProperty; break; } } if (notebookToDelete != null) { arrProperties.remove(notebookToDelete); logger.debug("Notebook removed: " + notebookUri); } notebooks[0].setProperties(arrProperties); } }
From source file:fr.inria.oak.paxquery.common.datamodel.metadata.NestedMetadataUtils.java
/** * Gather information about this and all children in two ArrayLists of types * and nested children/*from w w w . j a v a 2s. co m*/ * * @param node * @param nTypes * @param nNested * @throws XMLStratosphereException * @throws XMLStratosphereExecutionException */ private static void enrichNRSMD(NavigationTreePatternNode node, ArrayList<MetadataTypes> nTypes, ArrayList nNested, HashMap<Integer, HashMap<String, ArrayList<Integer>>> mappings, ArrayList<Integer> currentAddress, boolean nestedInParent) throws PAXQueryExecutionException { HashMap thisNodesAttributes = new HashMap(); int thisNodesAttributeCount = 0; int thisNodesCount = 0; //System.out.println("\nENRICH ON " + node.tag + " node address is: // "); //display(currentAddress); if (nestedInParent) { thisNodesAttributeCount = 0; if (currentAddress.size() > 0) { thisNodesCount = ((Integer) currentAddress.get(0)).intValue(); } } else { // not nested if (currentAddress.size() > 0) { thisNodesCount = ((Integer) currentAddress.get(currentAddress.size() - 1)).intValue(); thisNodesAttributeCount = thisNodesCount; currentAddress.remove(currentAddress.size() - 1); } } //System.out.println("STARTING WITH ATTRCOUNT " + // thisNodesAttributeCount + " AND NODE COUNT "+ // thisNodesCount); if (mappings != null) { mappings.put((new Integer(node.globalNodeCounter.get())), thisNodesAttributes); } if (nestedInParent) { thisNodesAttributes.put("Node", currentAddress); } boolean thisNodeHasContributed = false; if (node.storesID()) { MetadataTypes idType = IDTypes(NodeIDSchemeAssignator.getIDScheme(node)); nTypes.add(idType); //System.out.println("In metadata for " + node.tag + " added // ID type: " + idTypes[j]); ArrayList v = new ArrayList(); v.add(new Integer(thisNodesAttributeCount)); thisNodesAttributes.put("ID", append(currentAddress, v)); thisNodesAttributeCount++; if (!nestedInParent) { thisNodesCount++; } thisNodeHasContributed = true; } if (node.storesTag() && (!node.selectsTag())) { nTypes.add(MetadataTypes.STRING_TYPE); ArrayList v = new ArrayList(); v.add(new Integer(thisNodesAttributeCount)); thisNodesAttributes.put("Tag", append(currentAddress, v)); thisNodesAttributeCount++; thisNodeHasContributed = true; } if (node.storesValue()) { nTypes.add(MetadataTypes.STRING_TYPE); ArrayList v = new ArrayList(); v.add(new Integer(thisNodesAttributeCount)); thisNodesAttributes.put("Val", append(currentAddress, v)); thisNodesAttributeCount++; thisNodeHasContributed = true; } if (node.storesContent()) { nTypes.add(MetadataTypes.STRING_TYPE); ArrayList v = new ArrayList(); v.add(new Integer(thisNodesAttributeCount)); thisNodesAttributes.put("Cont", append(currentAddress, v)); thisNodesAttributeCount++; thisNodeHasContributed = true; } int k = 0; Iterator it = node.getEdges().iterator(); while (it.hasNext()) { NavigationTreePatternEdge pe = (NavigationTreePatternEdge) it.next(); if (pe.isNested()) { ArrayList v = new ArrayList(); v.add(new Integer(thisNodesAttributeCount + k)); v = append(currentAddress, v); NestedMetadata aux = getNRSMD(pe.n2, mappings, v, true); nNested.add(aux); nTypes.add(MetadataTypes.TUPLE_TYPE); k++; } else { ArrayList v = new ArrayList(); v.add(new Integer(thisNodesAttributeCount + k)); v = append(currentAddress, v); enrichNRSMD(pe.n2, nTypes, nNested, mappings, v, false); k += flatAttributeNumber(pe.n2); } } //System.out.println("ENRICH ON " + node.tag + " OVER"); }
From source file:com.amalto.core.util.Util.java
/** * fix the conditions./* w w w. j a va 2s . c o m*/ * * @param conditions in workbench. */ public static void fixConditions(ArrayList conditions) { for (int i = conditions.size() - 1; i >= 0; i--) { if (conditions.get(i) instanceof WhereCondition) { WhereCondition condition = (WhereCondition) conditions.get(i); String rightValueOrPath = condition.getRightValueOrPath(); if (rightValueOrPath == null || (rightValueOrPath.length() == 0 && !WhereCondition.EMPTY_NULL.equals(condition.getOperator()))) { conditions.remove(i); } } } }
From source file:com.sbcc.edu.jrollspellchecker.MainWindow.java
public void removeEntries(ArrayList<IndexedWord> words, int index) { int i;// ww w.j ava 2 s.com for (i = 0; i < index; i++) words.remove(i); this.index = this.index - i; }
From source file:de.randi2.services.ChartsServiceImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED) public ChartData generateRecruitmentChartTrialSite(Trial trial) { trial = trialDao.refresh(trial);//from ww w. ja v a2 s.c o m ChartData chData = new ChartData(); ArrayList<String> xL = new ArrayList<String>(); ArrayList<double[]> data = new ArrayList<double[]>(); ArrayList<TrialSubject> subjects1 = new ArrayList<TrialSubject>(trial.getSubjects()); double[] count = new double[trial.getParticipatingSites().size()]; int i = 0; for (TrialSite site : trial.getParticipatingSites()) { ArrayList<TrialSubject> subjects = new ArrayList<TrialSubject>(subjects1); xL.add(site.getName()); count[i] = 0; for (TrialSubject subject : subjects) { if (subject.getTrialSite().getName().equals(site.getName())) { count[i]++; subjects1.remove(subject); } } i++; } for (double j : count) { data.add(new double[] { j }); } chData.setData(data); chData.setXLabels(xL); return chData; }
From source file:es.pode.modificador.presentacion.configurar.modificacion.ConfigurarModificacionControllerImpl.java
/** * @see es.pode.modificador.presentacion.configurar.modificacion.ConfigurarModificacionController#eliminarCambios(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.configurar.modificacion.EliminarCambiosForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//* ww w . java 2 s . c om*/ public final void eliminarCambios(ActionMapping mapping, es.pode.modificador.presentacion.configurar.modificacion.EliminarCambiosForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int[] posiciones = (int[]) request.getSession().getAttribute("posiciones"); request.getSession().removeAttribute("posiciones"); if (posiciones != null) { if (logger.isDebugEnabled()) logger.debug("Se han seleccionado " + posiciones.length + " cambios para eliminar"); ArrayList cambios = new ArrayList(); cambios.addAll(Arrays.asList( this.getConfigurarModificacionSession(request).getConfiguracion().getCambios().getCambios())); ArrayList paraBorrar = new ArrayList(); for (int i = 0; i < posiciones.length; i++) { paraBorrar.add((Change) cambios.get(posiciones[i])); } for (int i = 0; i < paraBorrar.size(); i++) { cambios.remove(paraBorrar.get(i)); } if (logger.isDebugEnabled()) logger.debug("Actualizando el objeto de sesion"); this.getConfigurarModificacionSession(request).getConfiguracion().getCambios() .setCambios((Change[]) cambios.toArray(new Change[cambios.size()])); } else { logger.error("No habia ningun cambio para eliminar"); } }
From source file:com.partytv.server.ImageManager.java
/** * Called when something changes in our data set. Cleans up any weak * references that are no longer valid along the way. *//*from ww w .j ava2 s . co m*/ private void notifyObservers() { final ArrayList<WeakReference<DataSetObserver>> observers = mObservers; final int count = observers.size(); for (int i = count - 1; i >= 0; i--) { final WeakReference<DataSetObserver> weak = observers.get(i); final DataSetObserver obs = weak.get(); if (obs != null) { obs.onChanged(); } else { observers.remove(i); } } }
From source file:com.partytv.server.ImageManager.java
/** * Called when something changes in our data set. Cleans up any weak * references that are no longer valid along the way. *//*from ww w . j ava2s .c o m*/ private void notifyInvalidateObservers() { final ArrayList<WeakReference<DataSetObserver>> observers = mObservers; final int count = observers.size(); for (int i = count - 1; i >= 0; i--) { final WeakReference<DataSetObserver> weak = observers.get(i); final DataSetObserver obs = weak.get(); if (obs != null) { obs.onInvalidated(); } else { observers.remove(i); } } }
From source file:at.ac.tuwien.dsg.csdg.DependencyGraph.java
public String graphToString() { String message = ""; ArrayList<Node> unexploredNodes = new ArrayList<Node>(); unexploredNodes.add(cloudService);/*ww w .ja va 2 s . co m*/ while (unexploredNodes.size() > 0) { Node n = unexploredNodes.get(0); message += n.toString() + " \n "; unexploredNodes.addAll(n.getAllRelatedNodes()); unexploredNodes.remove(0); } return message; }