public T setNode(final int pos, final T newValue) { final T oldValue = mProcessNodes.set(pos, newValue); newValue.setOwnerModel(asM()); oldValue.setSuccessors(Collections.<Identifiable>emptySet()); oldValue.setPredecessors(Collections.<Identifiable>emptySet()); oldValue.setOwnerModel(null); newValue.resolveRefs(); for (Identifiable pred : newValue.getPredecessors()) { getNode(pred).addSuccessor(newValue); } for (Identifiable suc : newValue.getSuccessors()) { getNode(suc).addPredecessor(newValue); } return oldValue; }
public boolean addNode(T node) { if (mProcessNodes.add(node)) { node.setOwnerModel(this.asM()); return true; } return false; }