public boolean retainAll(Collection<?> objects) { boolean retain = candidates.retainAll(objects); if (retain){ Collection<Interactor> interactors = new ArrayList<Interactor>(objects.size()); for (Object o : objects){ interactors.add(((Participant)o).getInteractor()); } getInteractor().retainAll(interactors); } return retain; }
/** * Sets the component set type. * Sets the type to molecule set (MI:1304) if the given type is null */ public void setType(CvTerm type) { if (type == null){ this.type = CvTermUtils.createMoleculeSetType(); } else { this.type = type; } getInteractor().setInteractorType(this.type); }
public void onInteractorUpdate(Entity entity, Interactor oldInteractor) { // check that the listener still makes sensr if (contains(entity)){ boolean needsToRemoveOldInteractor = true; // check if an interactor is not in another entity that is kept. // remove any interactors that are kept with other entities for (P e : this){ // we want to check if an interactor is the same as old interactor in another entry if (e != entity){ if (oldInteractor.equals(e.getInteractor())){ needsToRemoveOldInteractor = false; } } } if (!needsToRemoveOldInteractor){ getInteractor().remove(oldInteractor); } getInteractor().add(entity.getInteractor()); } }
protected void processInteractorPool(Collection<MitabXref> xref, InteractorPool interactor) { InteractorPool pool = (InteractorPool)interactor; for (Xref ref : xref){ // we have a component of the interactor pool if (XrefUtils.doesXrefHaveQualifier(ref, Xref.INTERACTOR_SET_QUALIFIER_MI, Xref.INTERACTOR_SET_QUALIFIER)){ Interactor subInteractor = interactorFactory.createInteractorFromDatabase(ref.getDatabase(), ref.getId().toLowerCase()); if (subInteractor != null){ subInteractor.getIdentifiers().add(new MitabXref(ref.getDatabase(), ref.getId(), ref.getVersion(), CvTermUtils.createIdentityQualifier())); ((MitabInteractor)subInteractor).setSourceLocator(((MitabXref)ref).getSourceLocator()); } // create a default interactor else{ subInteractor = interactorFactory.createInteractor(ref.getId().toLowerCase(), CvTermUtils.createUnknownInteractorType()); subInteractor.getIdentifiers().add(new MitabXref(ref.getDatabase(), ref.getId(), ref.getVersion(), CvTermUtils.createIdentityQualifier())); ((MitabInteractor)subInteractor).setSourceLocator(((MitabXref)ref).getSourceLocator()); } // add the component to the interactor pool pool.add(subInteractor); } // we have a simple xref else{ pool.getXrefs().add(ref); } } }
public boolean add(P interactor) { if (candidates.add(interactor)){ interactor.setChangeListener(this); getInteractor().add(interactor.getInteractor()); interactor.setParentPool(this); return true; } return false; }
Iterator<Interactor> interactorIterator = interactorPool.iterator(); while (interactorIterator.hasNext()){ Interactor subInteractor = interactorIterator.next(); Iterator<Interactor> interactorIterator = interactorPool.iterator(); while (interactorIterator.hasNext()){ Interactor subInteractor = interactorIterator.next(); Iterator<Interactor> interactorIterator = interactorPool.iterator(); boolean first = true; while (interactorIterator.hasNext()){
public void clear() { for (P entity : this){ entity.setChangeListener(null); entity.setParentPool(null); } candidates.clear(); getInteractor().clear(); }
public boolean removeAll(Collection<?> objects) { boolean remove = candidates.removeAll(objects); if (remove){ Collection<Interactor> interactors = new ArrayList<Interactor>(objects.size()); for (Object o : objects){ Participant entity = (Participant)o; entity.setChangeListener(null); interactors.add(entity.getInteractor()); entity.setInteraction(null); } // check if an interactor is not in another entity that is kept. // remove any interactors that are kept with other entities for (P entity : this){ interactors.remove(entity.getInteractor()); } getInteractor().removeAll(interactors); } return remove; }
public boolean remove(Object o) { if (candidates.remove(o)){ ParticipantCandidate entity = (ParticipantCandidate)o; entity.setChangeListener(null); getInteractor().remove(entity.getInteractor()); entity.setParentPool(null); return true; } return false; }
public boolean addAll(Collection<? extends P> interactors) { boolean added = this.candidates.addAll(interactors); if (added){ for (P entity : this){ entity.setChangeListener(this); getInteractor().add(entity.getInteractor()); entity.setParentPool(this); } } return added; }