List of usage examples for java.util Iterator remove
default void remove()
From source file:ch.puzzle.itc.mobiliar.presentation.util.UserSettings.java
/** * Filters the testing properties if the current session is not in testing mode * /*from w w w. j av a 2s . c o m*/ * @param listWithTestingProperties */ public List<PropertyDescriptorEntity> filterTestingPropertyDescriptors( List<PropertyDescriptorEntity> listWithTestingProperties) { if (!isTestingMode()) { Iterator<PropertyDescriptorEntity> iterator = listWithTestingProperties.iterator(); while (iterator.hasNext()) { PropertyDescriptorEntity p = iterator.next(); if (p.isTesting()) { iterator.remove(); } } } return listWithTestingProperties; }
From source file:com.mindquarry.desktop.workspace.ConflictHelper.java
/** * Finds all Replaced/Modified, Modified/Replaced and Replaced/Replaced * conflicts./*from www . j a va 2 s. c om*/ */ public static List<Conflict> findReplacedModifiedConflicts(List<Status> remoteAndLocalChanges) { List<Conflict> conflicts = new ArrayList<Conflict>(); Iterator<Status> iter = remoteAndLocalChanges.iterator(); while (iter.hasNext()) { Status status = iter.next(); // local REPLACE remote MOD, local MOD remote REPLACE // or locale REPLACE remote REPLACE if ((status.getTextStatus() == StatusKind.replaced && status.getRepositoryTextStatus() == StatusKind.modified) || (status.getTextStatus() == StatusKind.modified && status.getRepositoryTextStatus() == StatusKind.replaced) || (status.getTextStatus() == StatusKind.replaced && status.getRepositoryTextStatus() == StatusKind.replaced)) { Status conflictParent = status; // we remove all files/stati connected to this conflict iter.remove(); List<Status> localChildren = new ArrayList<Status>(); List<Status> remoteChildren = new ArrayList<Status>(); // find all children (locally and remotely) while (iter.hasNext()) { status = iter.next(); if (FileHelper.isParent(conflictParent.getPath(), status.getPath())) { if (status.getTextStatus() != StatusKind.normal) { localChildren.add(status); } if (status.getRepositoryTextStatus() != StatusKind.normal) { remoteChildren.add(status); } iter.remove(); } else { // no more children found, this conflict is done // reset global iterator for next conflict search iter = remoteAndLocalChanges.iterator(); break; } } conflicts.add(new ReplaceConflict(conflictParent, localChildren, remoteChildren)); } } return conflicts; }
From source file:com.acmutv.ontoqa.core.parser.AdvancedSltagParser.java
/** * Filters ambiguities./*from ww w . j a v a 2 s . c om*/ * @param candidates the list of colliding candidates. * @param state the parser state. */ private static void filterAmbiguities(List<ElementarySltag> candidates, ParserStateNew state, Ontology ontology) { Integer idxPrev = state.getIdxPrev(); ConflictList conflicts = state.getConflictList(); Iterator<ElementarySltag> iterCandidates; /* SYNTACTICALLY SOLVABLE AMBIGUITIES */ LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: solving syntactic ambiguities"); iterCandidates = candidates.iterator(); while (candidates.size() > 1 && iterCandidates.hasNext()) { Sltag candidate = iterCandidates.next(); if (candidate.isSentence()) { if (idxPrev == null && candidate.isLeftSub()) { // excludes is (affermative) when we are at the first word. LOGGER.debug( "[AMBIGUITIES MANAGEMENT] :: excluded ambiguity (found S-rooted left-sub at the beginning of the sentence):\n{}", candidate.toPrettyString()); iterCandidates.remove(); } else if (idxPrev != null && !candidate.isLeftSub()) { // excludes is (interrogative) when we are in the middle of the sentence. LOGGER.debug( "[AMBIGUITIES MANAGEMENT] :: excluded ambiguity (found S-rooted not left-sub candidate within the sentence):\n{}", candidate.toPrettyString()); iterCandidates.remove(); } } else { if (candidate.isLeftAdj()) { LtagNode target = state.getCurr().firstMatch(candidate.getRoot().getCategory(), state.getWords().get(idxPrev), null); if (target == null || LtagNodeMarker.ADJ.equals(target.getMarker())) { LOGGER.debug( "[AMBIGUITIES MANAGEMENT] :: excluded ambiguity (found left adjunctable with no eligible target):\n{}", candidate.toPrettyString()); iterCandidates.remove(); } } else if (candidate.isRightAdj()) { LtagNode target = state.getCurr().firstMatch(candidate.getRoot().getCategory(), state.getWords().get(idxPrev), null); if (target == null || LtagNodeMarker.ADJ.equals(target.getMarker())) { LOGGER.debug( "[AMBIGUITIES MANAGEMENT] :: excluded ambiguity (found right adjunctable with no eligible target):\n{}", candidate.toPrettyString()); iterCandidates.remove(); } } else if (!candidate.isAdjunctable() && (state.getCurr().firstMatch(candidate.getRoot().getCategory(), state.getWords().get(idxPrev), LtagNodeMarker.SUB) == null)) { LOGGER.debug( "[AMBIGUITIES MANAGEMENT] :: excluded ambiguity (found substitutable with no eligible target):\n{}", candidate.toPrettyString()); iterCandidates.remove(); } } } /* SEMANTICALLY SOLVABLE AMBIGUITIES (SUBSTITUTIONS) */ LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: solving semantic ambiguities (substitutions)"); iterCandidates = candidates.iterator(); while (candidates.size() > 1 && iterCandidates.hasNext()) { Sltag candidate = iterCandidates.next(); if (!candidate.isAdjunctable()) { if (!isFeasibleSubstitution(candidate, null, state, ontology)) { LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: excluded ambiguity (not feasible substitution):\n{}", candidate.toPrettyString()); iterCandidates.remove(); } else { LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: solved ambiguity (feasible substitution):\n{}", candidate.toPrettyString()); //iterCandidates.remove(); } } } /* SEMANTICALLY SOLVABLE AMBIGUITIES (ADJUNCTIONS) */ LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: solving semantic ambiguities (adjunctions)"); iterCandidates = candidates.iterator(); while (candidates.size() > 1 && iterCandidates.hasNext()) { Sltag candidate = iterCandidates.next(); if (candidate.isAdjunctable() && candidate.isLeftAdj()) { if (!isFeasibleAdjunction(candidate, null, state, ontology)) { LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: excluded ambiguity (not feasible adjunction):\n{}", candidate.toPrettyString()); iterCandidates.remove(); } else { LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: solved ambiguity (feasible adjunction):\n{}", candidate.toPrettyString()); //iterCandidates.remove(); } } } if (candidates.size() == 1) { LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: solved ambiguities (found unique feasible candidate):\n{}", candidates.get(0).toPrettyString()); return; } /* UNSOLVABLE AMBIGUITIES */ LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: processing unsolved ambiguities"); iterCandidates = candidates.iterator(); while (iterCandidates.hasNext()) { Sltag candidate = iterCandidates.next(); LOGGER.debug("[AMBIGUITIES MANAGEMENT] :: adding ambiguity (idxPrev: {}):\n{}", idxPrev, candidate.toPrettyString()); conflicts.add(candidate, idxPrev); //iterCandidates.remove(); } }
From source file:fr.gael.dhus.database.dao.ProductDao.java
@Override public void deleteAll() { Iterator<Product> it = getAllProducts(); while (it.hasNext()) { it.next();/*from w w w . j ava2 s. c o m*/ it.remove(); } }
From source file:fr.recolnat.database.ExportsDatabase.java
public void cleanup(String exportsPath) { while (database.isClosed()) { try {/*from w ww . j av a 2 s . c o m*/ Thread.sleep(500); } catch (InterruptedException ex) { return; } } File exportDir = new File(exportsPath); File[] exportFiles = exportDir.listFiles(); Iterator<String> itUsersWithExports = database.getAllNames().iterator(); while (itUsersWithExports.hasNext()) { String user = itUsersWithExports.next(); Map userFiles = database.treeMap(user).createOrOpen(); Iterator<String> itFileNames = userFiles.keySet().iterator(); while (itFileNames.hasNext()) { String fileName = itFileNames.next(); for (File ef : exportFiles) { if (ef.getName().equals(fileName)) { ef.delete(); itFileNames.remove(); } } } } database.commit(); }
From source file:com.ace.console.service.sys.impl.ResourceServiceImpl.java
/** * ??????//from www .j av a2 s. c o m * ?,?? * * @param user * @return */ @ReadThroughSingleCache(namespace = Constants.DEFAULT_PROJECT_NAME + ":menus:findMenusByUser", expiration = 600) public List<Menu> findMenus(@ParameterValueKeyProvider User user) { String sort = "parent_id desc,weight desc"; List<Resources> resources = getAllWithSort(sort); Set<String> userPermissions = null; userPermissions = userAuthService.findStringPermissions(user); Iterator<Resources> iter = resources.iterator(); while (iter.hasNext()) { if (!hasPermission(iter.next(), userPermissions)) { iter.remove(); } } return convertToMenus(resources); }
From source file:be.ugent.maf.cellmissy.gui.controller.load.generic.area.GenericAreaImagedPlateController.java
/** * remove timeSteps from List: this is called when the user wants to * overwrite data or to clear data.//from www. j a va2 s . c om * * @param wellHasImagingTypeToOverwrite * @return */ public List<WellHasImagingType> removeOldDataFromList(WellHasImagingType wellHasImagingTypeToOverwrite) { List<WellHasImagingType> list = new ArrayList<>(); Iterator<TimeStep> iterator = timeStepsBindingList.iterator(); while (iterator.hasNext()) { WellHasImagingType wellHasImagingType = iterator.next().getWellHasImagingType(); if (wellHasImagingType.equals(wellHasImagingTypeToOverwrite)) { list.add(wellHasImagingType); iterator.remove(); } } return list; }
From source file:com.dianping.lion.web.tag.SubNavigator.java
private int hasPrivilege(MenuGroup menuGroup) { if (menuGroup.menuOrGroups.isEmpty()) { return -1; }/* w w w . java2s.co m*/ int menuSize = menuGroup.menuOrGroups.size(); Iterator<Object> iterator = menuGroup.menuOrGroups.iterator(); while (iterator.hasNext()) { Object next = iterator.next(); if (next instanceof SubMenu) { int hasPrivilege = hasPrivilege((SubMenu) next); if (hasPrivilege < 0) { iterator.remove(); menuSize--; } else if (hasPrivilege == 0) { menuSize--; } } else if (next instanceof MenuGroup) { int hasPrivilege = hasPrivilege((MenuGroup) next); if (hasPrivilege < 0) { iterator.remove(); menuSize--; } } //??Menu } return menuSize > 0 ? 1 : -1; }
From source file:com.dtstack.jlogstash.inputs.ReadTarFile.java
/** * ??zip??eg: e:\\d\mydata.tar|mydata/aa.log * @throws IOException // ww w . ja v a 2s . c o m */ public void doAfterReaderOver() throws IOException { tarAchive.close(); fins.close(); Iterator<Entry<String, Long>> it = fileCurrPos.entrySet().iterator(); String preFix = tarFileName + "|"; while (it.hasNext()) { Entry<String, Long> entry = it.next(); if (entry.getKey().startsWith(preFix)) { it.remove(); } } //???zip??? fileCurrPos.put(tarFileName, -1l); readEnd = true; }
From source file:com.appeligo.util.ActiveCache.java
private void trimCache() { int size = size(); log.debug("Trimming...size is currently=" + size + ", maxCached=" + maxCached + ", minCached=" + minCached + ", trimming out " + (size - minCached)); assert (size == activeSet.size()) : "activeSet and map sizes don't match!"; Iterator<ActiveObject<K, V>> iter = activeSet.iterator(); while ((size-- > minCached) && iter.hasNext()) { ActiveObject<K, V> ao = iter.next(); ActiveObject<K, V> removed = map.remove(ao.getKey()); iter.remove(); }//from w w w . j a v a2 s . c o m }