List of usage examples for java.util ArrayList remove
public boolean remove(Object o)
From source file:gate.util.reporting.PRTimeReporter.java
/** * Ignores the inconsistent log entries from the benchmark file. Entries from * modules like pronominal coreferencer which have not been converted to new * benchmarking conventions are ignored. * * @param benchmarkIDChain/*from w w w. j a v a 2 s. com*/ * The chain of benchmark ids. This is the third token in the * benchmark file. * @param startTokens * An array of first tokens in the benchmark id chain. * * @return true if valid log entry; false otherwise. */ private boolean validateLogEntry(String benchmarkIDChain, ArrayList<String> startTokens) { String startTokenRegExp = "("; for (int i = 0; i < startTokens.size(); i++) { if ((benchmarkIDChain.split("\\.")).length == 1 && benchmarkIDChain.equals(startTokens.get(i))) { startTokens.remove(i); validEntries += 1; return true; } startTokenRegExp += startTokens.get(i) + "|"; } if (startTokenRegExp.length() > 1) { startTokenRegExp = startTokenRegExp.substring(0, startTokenRegExp.length() - 1); } startTokenRegExp += ")"; if (benchmarkIDChain.matches(startTokenRegExp + "\\.doc_.*?\\.pr_.*")) { validEntries += 1; return true; } else { return false; } }
From source file:at.ac.tuwien.dsg.csdg.DependencyGraph.java
public ArrayList<Node> getAllServiceTopologies() { ArrayList<Node> topologies = new ArrayList<Node>(); ArrayList<Node> unexploredNodes = new ArrayList<Node>(); for (Node n : cloudService.getAllRelatedNodesOfType(RelationshipType.COMPOSITION_RELATIONSHIP)) { if (n.getNodeType() == NodeType.SERVICE_TOPOLOGY) { unexploredNodes.add(n);/*from w ww .ja v a2 s .co m*/ } } while (unexploredNodes.size() > 0) { Node n = unexploredNodes.get(0); if (n.getNodeType() == NodeType.SERVICE_TOPOLOGY) { topologies.add(n); if (n.getAllRelatedNodesOfType(RelationshipType.COMPOSITION_RELATIONSHIP) != null) { for (Node n1 : n.getAllRelatedNodesOfType(RelationshipType.COMPOSITION_RELATIONSHIP)) { if (n1.getNodeType() == NodeType.SERVICE_TOPOLOGY) unexploredNodes.add(n1); } } } unexploredNodes.remove(0); } return topologies; }
From source file:at.ac.tuwien.dsg.csdg.DependencyGraph.java
public ArrayList<Node> getAllServiceUnits() { ArrayList<Node> units = new ArrayList<Node>(); ArrayList<Node> unexploredNodes = new ArrayList<Node>(); for (Node n : cloudService.getAllRelatedNodesOfType(RelationshipType.COMPOSITION_RELATIONSHIP)) { if (n.getNodeType() == NodeType.SERVICE_TOPOLOGY) { unexploredNodes.add(n);/*w w w. j a va 2 s. c o m*/ } } while (unexploredNodes.size() > 0) { Node n = unexploredNodes.get(0); if (n.getNodeType() == NodeType.SERVICE_TOPOLOGY) { if (n.getAllRelatedNodesOfType(RelationshipType.COMPOSITION_RELATIONSHIP) != null) { for (Node n1 : n.getAllRelatedNodesOfType(RelationshipType.COMPOSITION_RELATIONSHIP)) { unexploredNodes.add(n1); } } } else { if (n.getNodeType() == NodeType.SERVICE_UNIT) units.add(n); } unexploredNodes.remove(0); } return units; }
From source file:com.peter.mavenrunner.MavenRunnerTopComponent.java
private void deleteGoalMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteGoalMenuItemActionPerformed TreePath path = projectTree.getSelectionPath(); if (path == null) { return;/*w w w. j av a 2 s . c o m*/ } MyTreeNode node = (MyTreeNode) ((MyTreeNode) path.getLastPathComponent()); if (node.type.equals("goal") || isDebug) { MyTreeNode parentNode = (MyTreeNode) node.getParent(); parentNode.remove(node); projectTree.updateUI(); String key = node.projectInformation.getDisplayName(); ArrayList<PersistData> list = data.get(key); if (list == null) { list = new ArrayList<PersistData>(); data.put(key, list); } log("before delete " + list.size() + ", key=" + key); try { Iterator i = list.iterator(); while (i.hasNext()) { PersistData p = (PersistData) i.next(); if (p.name.equals(node.name)) { list.remove(p); } } } catch (Exception ex) { log(ExceptionUtils.getStackTrace(ex)); } log("after delete " + list.size()); NbPreferences.forModule(this.getClass()).put("data", toString(data)); } }
From source file:com.chinamobile.bcbsp.comm.CommunicatorNew.java
@Override public ConcurrentLinkedQueue<IMessage> getMessageQueue(String vertexID) throws IOException { ArrayList<IMessage> tmpList = messageManager.removeIncomedQueue(vertexID); // Note Singleton if (tmpList == null) { return singletonMsg; }/*w w w .jav a 2 s .co m*/ ConcurrentLinkedQueue<IMessage> tmpQueue = new ConcurrentLinkedQueue<IMessage>(); while (!tmpList.isEmpty()) { tmpQueue.add(tmpList.remove(0)); } tmpList = null; return tmpQueue; }
From source file:net.sourceforge.mipa.predicatedetection.lattice.WindowedLatticeChecker.java
private void pruneLattice(AbstractLatticeIDNode minCGS, int id) { long time = (new Date()).getTime(); long innerTime = 0; if (this.minCGS.getGlobalState()[id].getID().equals(this.maxCGS.getGlobalState()[id].getID())) { mappedLattice.clear();// w w w . j ava 2s .c o m if (DEBUG) { long time_t = (new Date()).getTime(); outConstruction.println("[Out] all CGSs"); outConstruction.flush(); innerTime += (new Date()).getTime() - time_t; wastedTime += (new Date()).getTime() - time_t; } this.minCGS = null; this.maxCGS = null; } else { boolean minFlag = false; ArrayList<AbstractLatticeIDNode> set = new ArrayList<AbstractLatticeIDNode>(); set.add(minCGS); this.minCGS = null; while (!set.isEmpty()) { AbstractLatticeIDNode node = set.remove(0); ArrayList<AbstractLatticeIDNode> sub = subAfterGrown(node, id); for (int i = 0; i < sub.size(); i++) { if (sub.get(i).getGlobalState()[id].getID().equals(node.getGlobalState()[id].getID())) { if (!set.contains(sub.get(i))) { set.add(sub.get(i)); } } else if (minFlag == false && sub.get(i).getGlobalState()[id].getID() .equals(windowedLocalStateSet.get(id).get(0).getID())) { ArrayList<AbstractLatticeIDNode> prec = precAfterGrown(sub.get(i), id); if (prec.size() == 1) { this.minCGS = sub.get(i); minFlag = true; } } } String ID = StringUtils.join(node.getID(), ' '); mappedLattice.remove(ID); if (DEBUG) { long time_t = (new Date()).getTime(); outConstruction.println("[Out]" + ID); outConstruction.flush(); innerTime += (new Date()).getTime() - time_t; wastedTime += (new Date()).getTime() - time_t; } } if (mappedLattice.size() == 0) { this.maxCGS = null; } /* * Iterator<String> it = mappedLattice.keySet().iterator(); * while(it.hasNext()) { String key = it.next(); * AbstractLatticeIDNode node = mappedLattice.get(key); * if(node.getID()[id].equals(minCGS.getID()[id])) { it.remove(); } * } * * it = mappedLattice.keySet().iterator(); while(it.hasNext()) { * String key = it.next(); AbstractLatticeIDNode node = * mappedLattice.get(key); if(precAfterGrown(node, id).size() == 0) * { this.minCGS = node; break; } } if (mappedLattice.size() == 0) { * this.maxCGS = null; } */ } pruneTime = (new Date()).getTime() - time - innerTime; }
From source file:net.sourceforge.mipa.predicatedetection.lattice.WindowedLatticeChecker.java
private void growOriLattice(LocalState localState, int id) { LocalState[] globalState = new LocalState[children.length]; String[] index = new String[children.length]; for (int i = 0; i < children.length; i++) { if (i != id) { globalState[i] = oriMaxCGS.getGlobalState()[i]; index[i] = globalState[i].getID(); }/* w ww .jav a 2 s .c o m*/ } globalState[id] = localState; index[id] = localState.getID(); AbstractLatticeIDNode node = createNode(globalState, index); // only the first node is CGS, can the lattice grow. if (isCGS(node)) { ArrayList<AbstractLatticeIDNode> set = new ArrayList<AbstractLatticeIDNode>(); set.add(node); while (!set.isEmpty()) { AbstractLatticeIDNode newNode = set.remove(0); String ind = StringUtils.join(newNode.getID(), ' '); if (oriMappedLattice.get(ind) == null) { oriMappedLattice.put(ind, newNode); if (DEBUG) { long time_t = (new Date()).getTime(); outOriConstruction.println("[In] " + ind); outOriConstruction.flush(); wastedOriTime += (new Date()).getTime() - time_t; } for (int i = 0; i < children.length; i++) { String[] index_2 = new String[children.length]; LocalState[] globalState_2 = new LocalState[children.length]; for (int j = 0; j < children.length; j++) { if (j != i) { index_2[j] = newNode.getID()[j]; globalState_2[j] = newNode.getGlobalState()[j]; } } index_2[i] = Integer.toString(Integer.valueOf(newNode.getID()[i]) - 1); if (indexIsOriValid(index_2, id)) { globalState_2[i] = localStateSet.get(i).get(Integer.valueOf(index_2[i])); String ID = StringUtils.join(index_2, ' '); if (oriMappedLattice.get(ID) == null) { if (isCGS(globalState_2)) { set.add(createNode(globalState_2, index_2)); } else { outOriConstruction.print("[" + ID + "]: "); for (int j = 0; j < globalState_2.length; j++) { outOriConstruction.print(globalState_2[j].getvc().toString() + ","); } outOriConstruction.println(); outOriConstruction.println("[" + ID + "] is not CGS."); outOriConstruction.println(); outOriConstruction.flush(); } } } String[] index_1 = new String[children.length]; LocalState[] globalState_1 = new LocalState[children.length]; for (int j = 0; j < children.length; j++) { if (j != i) { index_1[j] = newNode.getID()[j]; globalState_1[j] = newNode.getGlobalState()[j]; } } index_1[i] = Integer.toString(Integer.valueOf(newNode.getID()[i]) + 1); if (indexIsOriValid(index_1, id)) { globalState_1[i] = localStateSet.get(i).get(Integer.valueOf(index_1[i])); String ID = StringUtils.join(index_1, ' '); if (oriMappedLattice.get(ID) == null) { if (isCGS(globalState_1)) { set.add(createNode(globalState_1, index_1)); } else { outOriConstruction.print("[" + ID + "]: "); for (int j = 0; j < globalState_1.length; j++) { outOriConstruction.print(globalState_1[j].getvc().toString() + ","); } outOriConstruction.println(); outOriConstruction.println("[" + ID + "] is not CGS."); outOriConstruction.println(); outOriConstruction.flush(); } } } } if (subOri(newNode, id).size() == 0) { oriMaxCGS = newNode; } } } } else { outOriConstruction.print("[" + StringUtils.join(node.getID(), ' ') + "]: "); LocalState[] local = node.getGlobalState(); for (int i = 0; i < local.length; i++) { outOriConstruction.print(local[i].getvc().toString() + ","); } outOriConstruction.println(); outOriConstruction.println("[" + StringUtils.join(node.getID(), ' ') + "] is not CGS."); outOriConstruction.println(); outOriConstruction.flush(); } }
From source file:com.paniclauncher.workers.InstanceInstaller.java
public ArrayList<Mod> sortMods(ArrayList<Mod> original) { ArrayList<Mod> mods = new ArrayList<Mod>(original); for (Mod mod : original) { if (mod.isOptional()) { if (!mod.getLinked().isEmpty()) { for (Mod mod1 : original) { if (mod1.getName().equalsIgnoreCase(mod.getLinked())) { mods.remove(mod); int index = mods.indexOf(mod1) + 1; mods.add(index, mod); }/*from ww w . j ava2 s . c o m*/ } } } } return mods; }
From source file:com.ge.research.semtk.sparqlX.SparqlEndpointInterface.java
public String[] getColumnNamesNotInInputList(String[] inputList) { ArrayList<String> retval = new ArrayList<String>(); for (int i = 0; i < this.resVars.size(); i++) { retval.add((String) (this.resVars.get(i))); }/*from w w w . j a v a2 s . com*/ // filter the ones we do not want. for (String i : inputList) { retval.remove(i); } String[] retval_array = new String[retval.size()]; retval.toArray(retval_array); return retval_array; }
From source file:com.linkedin.pinot.core.startree.OffHeapStarTreeBuilder.java
private List<String> computeDefaultSplitOrder() { ArrayList<String> defaultSplitOrder = new ArrayList<>(); // include only the dimensions not time column. Also, assumes that // skipMaterializationForDimensions is built. for (String dimensionName : dimensionNames) { if (skipMaterializationForDimensions != null && !skipMaterializationForDimensions.contains(dimensionName)) { defaultSplitOrder.add(dimensionName); }/*from w ww .j av a 2 s . co m*/ } if (timeColumnName != null) { defaultSplitOrder.remove(timeColumnName); } Collections.sort(defaultSplitOrder, new Comparator<String>() { @Override public int compare(String o1, String o2) { return dictionaryMap.get(o2).size() - dictionaryMap.get(o1).size(); // descending } }); return defaultSplitOrder; }