List of usage examples for java.util Collection remove
boolean remove(Object o);
From source file:de.thischwa.pmcms.gui.dialog.pojo.DialogFieldsGalleryComp.java
private void initializeTitleAndName() { String filename = StringUtils.defaultString(gallery.getName()); GridData gridDataLabel = new GridData(); gridDataLabel.widthHint = 100;/*from w w w .j a v a 2s . c o m*/ gridDataLabel.verticalAlignment = GridData.CENTER; gridDataLabel.horizontalAlignment = GridData.END; GridData gridDataText = new GridData(); gridDataText.heightHint = -1; gridDataText.widthHint = 150; Label labelTitle = new Label(this, SWT.RIGHT); labelTitle.setText(LabelHolder.get("dialog.pojo.page.fields.title")); //$NON-NLS-1$ labelTitle.setLayoutData(gridDataLabel); textTitle = new Text(this, SWT.BORDER); textTitle.setTextLimit(256); textTitle.setLayoutData(gridDataText); textTitle.setText(StringUtils.defaultString(gallery.getTitle())); Label labelName = new Label(this, SWT.RIGHT); labelName.setText("* ".concat(LabelHolder.get("dialog.pojo.page.fields.name"))); //$NON-NLS-1$ //$NON-NLS-2$ labelName.setLayoutData(gridDataLabel); textName = new Text(this, SWT.BORDER); textName.setTextLimit(256); textName.setLayoutData(gridDataText); textName.setText(filename); textName.addVerifyListener(new FileNameVerifier()); textName.addModifyListener(new ModifyListenerClearErrorMessages(dialogCreator)); Collection<String> forbiddenNames = new ArrayList<String>(); Collection<Page> sisters = gallery.getParent().getPages(); if (CollectionUtils.isNotEmpty(sisters)) for (Page page : sisters) forbiddenNames.add(page.getName()); Map<String, Gallery> galleries = PoInfo.getGalleries(PoInfo.getSite(gallery)); if (galleries != null && !galleries.keySet().isEmpty()) { for (String name : galleries.keySet()) forbiddenNames.add(name); } if (StringUtils.isNotBlank(filename)) forbiddenNames.remove(filename); textTitle.addModifyListener(new FilenameSuggestorListener(dialogCreator, textName, forbiddenNames)); }
From source file:ubc.pavlab.aspiredb.server.util.PhenotypeUtil.java
private Set<PhenotypeRestriction> createRestrictionsForDescendants(String value, OntologyTerm term, Set<PhenotypeRestriction> expandedRestrictions, Collection<String> remainingTerms) { Collection<OntologyTerm> childTerms = term.getChildren(false); for (OntologyTerm childTerm : childTerms) { PhenotypeRestriction phenotypeRestriction = new PhenotypeRestriction(childTerm.getLabel(), value, childTerm.getUri());/* w w w . j a va 2 s . co m*/ HashSet<String> termList = new HashSet<String>(); termList.add(childTerm.getLabel()); if (remainingTerms.contains(childTerm.getLabel())) { expandedRestrictions.add(phenotypeRestriction); remainingTerms.remove(childTerm.getLabel()); // log.info( "Phenotype \"" + childTerm.getLabel() + " found in database." ); } else { // log.info("Phenotype \"" + childTerm.getLabel() + " not found in database."); } } return expandedRestrictions; }
From source file:uk.ac.ebi.intact.editor.services.curate.interaction.InteractionEditorService.java
private void initialiseFeatures(ParticipantEvidence parent, Collection<FeatureEvidence> features, FeatureEvidenceCloner featureCloner) { List<FeatureEvidence> originalFeatures = new ArrayList<FeatureEvidence>(features); for (FeatureEvidence r : originalFeatures) { if (!isFeatureInitialised(r)) { FeatureEvidence reloaded = initialiseFeature(r, featureCloner); if (reloaded != r) { features.remove(r); parent.addFeature(reloaded); }// ww w. j a v a2s . co m } } }
From source file:org.sonatype.nexus.plugin.obr.test.metadata.ObrResourceWriterTest.java
@Test public void testRoundTripping() throws Exception { final RepositoryItemUid uid1 = testRepository.createUid("/obr/samples/sample.xml"); final RepositoryItemUid uid2 = testRepository.createUid("/obr/sample.xml"); final RepositoryItemUid uid3 = testRepository.createUid("/sample.xml"); ObrResourceReader reader = obrMetadataSource.getReader(openObrSite(uid1)); ObrResourceWriter writer = obrMetadataSource.getWriter(uid2); final Collection<URL> urls = new ArrayList<URL>(); Resource r;/*from w ww. j av a 2 s .com*/ while ((r = reader.readResource()) != null) { urls.add(r.getURL()); writer.append(r); writer.flush(); } reader.close(); writer.complete(); writer.close(); reader = obrMetadataSource.getReader(openObrSite(uid2)); writer = obrMetadataSource.getWriter(uid3); while ((r = reader.readResource()) != null) { writer.append(r); } reader.close(); writer.complete(); writer.close(); reader = obrMetadataSource.getReader(openObrSite(uid3)); while ((r = reader.readResource()) != null) { urls.remove(r.getURL()); } reader.close(); assertEquals(Collections.emptyList(), urls); }
From source file:forge.game.combat.Combat.java
public final void removeBlockAssignment(final Card attacker, final Card blocker) { AttackingBand band = getBandOfAttackerNotNull(attacker); Collection<Card> cc = blockedBands.get(band); if (cc != null) { cc.remove(blocker); }// w w w . jav a 2s . com blocker.updateBlockingForView(); }
From source file:ubic.gemma.core.loader.genome.gene.ncbi.homology.HomologeneServiceImpl.java
@Override public Collection<Gene> getHomologues(Gene gene) { Collection<Gene> genes = new HashSet<>(); if (!this.ready.get()) { return genes; }/*from w w w. j a v a2 s . com*/ Long groupId; Integer ncbiGeneId = gene.getNcbiGeneId(); if (ncbiGeneId == null) return genes; try { groupId = this.getHomologeneGroup(ncbiGeneId.longValue()); } catch (NumberFormatException e) { return genes; } if (groupId == null) { return genes; } genes = this.getGenesInGroup(groupId); if (genes != null) genes.remove(gene); // remove the given gene from the list return genes; }
From source file:edu.mit.magnum.net.Network.java
/** Get the neighbors of the given vertex, do *not* include the node itself in case there is a self-loop */ public Collection<Node> getNeighborsNoSelf(Node node) { // Get the neighbors, may include the given node itself if there is a self-loop Collection<Node> neighbors = graph_.getNeighbors(node); // Remove node if there is a self-loop if (graph_.isNeighbor(node, node)) { neighbors = new HashSet<Node>(neighbors); boolean found = neighbors.remove(node); assert (found); }/*from www . j av a 2 s . c om*/ return neighbors; }
From source file:org.richfaces.component.UIExtendedDataTable.java
protected Collection<Object> getGroupPriority() { Collection<Object> priority = getSortPriority(); if (isGroupingOn()) {// grouping is on UIColumn column = getGroupByColumn(); if ((column.getSortOrder() == null) || (column.getSortOrder().equals(Ordering.UNSORTED))) { column.setSortOrder(Ordering.ASCENDING); }//from w w w . ja v a2 s. c o m String groupColId = column.getId(); // try to add group column id as first if (priority.contains(groupColId)) { priority.remove(groupColId); } if (priority instanceof List) { ((List<Object>) priority).add(0, groupColId); } else { priority.add(groupColId); } } return priority; }
From source file:com.link_intersystems.lang.reflect.criteria.ClassCriteriaTest.java
@SuppressWarnings("unchecked") @Test// ww w . ja v a2s. c o m public void visitAllFilter() { classCriteria.setTraverseStrategy(TraverseStrategy.DEPTH_FIRST); classCriteria.setSelection(ClassType.INTERFACES); classCriteria.add(ReflectFacade.getIsInterfacePredicate()); classCriteria.add(NotPredicate .notPredicate(EqualPredicate.equalPredicate(GenericSubSubWithMultipleInterfaces.class))); classCriteria.setTraverseClassesUniquely(false); Iterator<Class<?>> iterator = classCriteria.getIterable(GenericSubSubWithMultipleInterfaces.class) .iterator(); List<Class<?>> interfaces = IteratorUtils.toList(iterator); Collection<Class<?>> expectedInterfaces = new ArrayList<Class<?>>(Arrays.asList(GenericSubInterface.class, GenericInterface_Types_A_B_C.class, GenericInterface_Types_A_B_C.class)); for (Class<?> interf : interfaces) { assertTrue("Unexpected " + interf + " in interator", expectedInterfaces.remove(interf)); } assertTrue("Iterator does not iterator over the interfaces " + expectedInterfaces, expectedInterfaces.isEmpty()); }
From source file:uk.co.modularaudio.util.audio.mad.graph.GraphIOLinkMap.java
public void unmapProducerChannel(final MadChannelInstance graphChannelInstance, final MadChannelInstance channelInstanceExposed) throws RecordNotFoundException, MAConstraintViolationException { final Collection<MadChannelInstance> gcis = madChannelInstanceToGraphProducerMap .get(channelInstanceExposed); if (RUNTIME_CHECKING) { if (!graphProducerChannelToMadChannelInstanceMap.containsKey(graphChannelInstance)) { throw new RecordNotFoundException("Producer channel unmapping failed as not mapped"); }//from ww w . ja v a 2s . c om if (gcis == null || !gcis.contains(graphChannelInstance)) { throw new RecordNotFoundException("Producer channel unmapping failed as not mapped"); } } graphProducerChannelToMadChannelInstanceMap.remove(graphChannelInstance); gcis.remove(graphChannelInstance); if (gcis.size() == 0) { madChannelInstanceToGraphProducerMap.remove(channelInstanceExposed); } // log.debug("Unmapped graph producer channel \"" + graphChannelInstance.toString() + "\" to "); // log.debug( channelInstanceExposed.instance.getInstanceName() + " \"" + // channelInstanceExposed.toString() + "\""); }