/** Register object that will be notified when the state of this flow changes. */ public void addObserver(BigBang bb, TypeFlow<?> observer) { addObserver(bb, observer, true, false); }
/** Adds an observer, if not already present, without triggering update. */ public boolean addOriginalObserver(BigBang bb, TypeFlow<?> observer) { return addObserver(bb, observer, false, false); }
@Override public void initClone(BigBang bb) { assert this.isClone(); this.newTypeFlow.addObserver(bb, this); }
@Override public void initClone(BigBang bb) { /* When the clone is linked check if the all-instantiated contains the source state type. */ if (sourceState.isNull() || sourceState.isEmpty() || bb.getAllInstantiatedTypeFlow().getState().containsType(sourceState.exactType())) { /* If yes, set the state and propagate it to uses. */ addState(bb, sourceState); } else { /* * If no, update the can-be-null state of the source flow and register it as an observer * for all-instantiated. */ addState(bb, sourceState.canBeNull() ? TypeState.forNull() : TypeState.forEmpty()); bb.getAllInstantiatedTypeFlow().addObserver(bb, this); } }
clone.addObserver(bb, originalObserver); } else if (crossMethodUse(original, originalObserver)) { clone.addObserver(bb, clonedObserver);