- java.lang.Object
-
- swim.streamlet.AbstractMapInoutlet<K,VI,VO,I,O>
-
- All Implemented Interfaces:
Inlet<I>,Inoutlet<I,O>,MapInlet<K,VI,I>,MapInoutlet<K,VI,VO,I,O>,MapOutlet<K,VO,O>,Outlet<O>
- Direct Known Subclasses:
MapFieldValuesOperator,MemoizeMapCombinator
public abstract class AbstractMapInoutlet<K,VI,VO,I,O> extends Object implements MapInoutlet<K,VI,VO,I,O>
-
-
Constructor Summary
Constructors Constructor Description AbstractMapInoutlet()
-
Method Summary
Modifier and Type Method Description voidbindInput(MapOutlet<K,VI,? extends I> input)voidbindInput(Outlet<? extends I> input)Connects thisInletto anOutletfrom which it will acquire its state.voidbindOutput(Inlet<? super O> output)Adds anoutputto the set ofInlets that depend on the state of thisOutlet.abstract booleancontainsKey(K key)Returnstrueif the current state of thisMapOutletcontains the givenkey; otherwise returnsfalse.protected voiddidInvalidate()protected voiddidInvalidateKey(K key, KeyEffect effect)protected voiddidReconcile(int version)protected voiddidReconcileKey(K key, KeyEffect effect, int version)voiddisconnectInputs()Disconnects allInlets dominated by thisInoutletin the dataflow dependency graph.voiddisconnectOutputs()Disconnects allInletss dominated by thisInoutletin the dataflow graph.abstract Oget()Returns the current state of thisOutlet.abstract VOget(K key)Returns the value assocaited with the givenkeyin the current state of thisMapOutlet, if defined; otherwise returnsnull.MapOutlet<K,VI,? extends I>input()Returns theOutletfrom which thisInletacquires its state; returnsnullif thisInletis disconnected.voidinvalidate()voidinvalidateInput()voidinvalidateInputKey(K key, KeyEffect effect)Marks thisMapOutletas needing aneffectapplied to a givenkey.voidinvalidateKey(K key, KeyEffect effect)voidinvalidateOutput()Marks thisInlet—and theStreamletto which thisInletis attached—as having stale state.voidinvalidateOutputKey(K key, KeyEffect effect)Marks thisMapInletas needing aneffectapplied to a givenkey.abstract Iterator<K>keyIterator()Returns anIteratorover the keys in the current state of thisMapOutlet.protected voidonInvalidate()protected voidonInvalidateKey(K key, KeyEffect effect)protected voidonReconcile(int version)protected voidonReconcileKey(K key, KeyEffect effect, int version)Outlet<VO>outlet(K key)Returns anOutletthat updates when the specifiedkeyupdates.Iterator<Inlet<? super O>>outputIterator()Returns anIteratorover the set ofInlets that depend on the state of thisOutlet.voidreconcile(int version)voidreconcileInput(int version)Reconciles the state of thisOutlet, if the version of thisOutlet's state differs from the targetversion.voidreconcileInputKey(K key, int version)Reconciles the state of an individualkeyin thisMapOutlet, if the version of thisMapOutlet's state differs from the targetversion.voidreconcileKey(K key, int version)voidreconcileOutput(int version)Reconciles the state of thisInlet, if the version of thisInlet's state differs from the targetversion.voidreconcileOutputKey(K key, int version)Reconciles the state of an individualkeyin thisMapInlet, if the version of thisMapInlet's state differs from the targetversion.voidunbindInput()Disconnects thisInletfrom its inputOutlet, if connected.voidunbindOutput(Inlet<? super O> output)Removes anoutputfrom the set ofInlets that depend on the state of thisOutlet.voidunbindOutputs()Disconnects all outputs from thisOutletby invokingInlet.unbindInput()on eachIneltthat depends on the state of thisOutlet.protected voidwillInvalidate()protected voidwillInvalidateKey(K key, KeyEffect effect)protected voidwillReconcile(int version)protected voidwillReconcileKey(K key, KeyEffect effect, int version)
-
-
-
Method Detail
-
containsKey
public abstract boolean containsKey(K key)
Description copied from interface:MapOutletReturnstrueif the current state of thisMapOutletcontains the givenkey; otherwise returnsfalse.- Specified by:
containsKeyin interfaceMapOutlet<K,VI,VO>
-
get
public abstract VO get(K key)
Description copied from interface:MapOutletReturns the value assocaited with the givenkeyin the current state of thisMapOutlet, if defined; otherwise returnsnull.
-
get
public abstract O get()
Description copied from interface:OutletReturns the current state of thisOutlet.
-
keyIterator
public abstract Iterator<K> keyIterator()
Description copied from interface:MapOutletReturns anIteratorover the keys in the current state of thisMapOutlet.- Specified by:
keyIteratorin interfaceMapOutlet<K,VI,VO>
-
input
public MapOutlet<K,VI,? extends I> input()
Description copied from interface:InletReturns theOutletfrom which thisInletacquires its state; returnsnullif thisInletis disconnected.
-
bindInput
public void bindInput(Outlet<? extends I> input)
Description copied from interface:InletConnects thisInletto anOutletfrom which it will acquire its state. If thisInletis already connected, it will first disconnect from its existing input. Then, after updating itsinputproperty, theInletwill invokeOutlet.bindOutput(Inlet)on its newinput.
-
unbindInput
public void unbindInput()
Description copied from interface:InletDisconnects thisInletfrom its inputOutlet, if connected. After setting itsinputproperty tonull, theInletwill invokeOutlet.unbindOutput(Inlet)on its old input, if defined.- Specified by:
unbindInputin interfaceInlet<K>
-
disconnectInputs
public void disconnectInputs()
Description copied from interface:InoutletDisconnects allInlets dominated by thisInoutletin the dataflow dependency graph. Used to recursively clean up chains of combinators passing through thisInoutlet.- Specified by:
disconnectInputsin interfaceInlet<K>- Specified by:
disconnectInputsin interfaceInoutlet<K,VI>- Specified by:
disconnectInputsin interfaceOutlet<K>
-
outlet
public Outlet<VO> outlet(K key)
Description copied from interface:MapOutletReturns anOutletthat updates when the specifiedkeyupdates.
-
outputIterator
public Iterator<Inlet<? super O>> outputIterator()
Description copied from interface:OutletReturns anIteratorover the set ofInlets that depend on the state of thisOutlet.- Specified by:
outputIteratorin interfaceOutlet<K>
-
bindOutput
public void bindOutput(Inlet<? super O> output)
Description copied from interface:OutletAdds anoutputto the set ofInlets that depend on the state of thisOutlet. Theoutputwill be invalidated when the state of thisOutletis invalidated, and updated when thisOutletis updated.- Specified by:
bindOutputin interfaceOutlet<K>
-
unbindOutput
public void unbindOutput(Inlet<? super O> output)
Description copied from interface:OutletRemoves anoutputfrom the set ofInlets that depend on the state of thisOutlet.- Specified by:
unbindOutputin interfaceOutlet<K>
-
unbindOutputs
public void unbindOutputs()
Description copied from interface:OutletDisconnects all outputs from thisOutletby invokingInlet.unbindInput()on eachIneltthat depends on the state of thisOutlet.- Specified by:
unbindOutputsin interfaceOutlet<K>
-
disconnectOutputs
public void disconnectOutputs()
Description copied from interface:InoutletDisconnects allInletss dominated by thisInoutletin the dataflow graph. Used to recursively clean up chains of combinators passing through thisInoutlet.- Specified by:
disconnectOutputsin interfaceInlet<K>- Specified by:
disconnectOutputsin interfaceInoutlet<K,VI>- Specified by:
disconnectOutputsin interfaceOutlet<K>
-
invalidateOutputKey
public void invalidateOutputKey(K key, KeyEffect effect)
Description copied from interface:MapInletMarks thisMapInletas needing aneffectapplied to a givenkey. Invalidating an individual key invalidates the entire state of theInlet. But only the invalidated keys need to be updated in order to reconcile the overall state of theInlet.- Specified by:
invalidateOutputKeyin interfaceMapInlet<K,VI,VO>
-
invalidateInputKey
public void invalidateInputKey(K key, KeyEffect effect)
Description copied from interface:MapOutletMarks thisMapOutletas needing aneffectapplied to a givenkey. Invalidating an individual key invalidates the entire state of theOutlet. But only the invalidated keys need to be updated in order to reconcile the overall state of theOutlet.- Specified by:
invalidateInputKeyin interfaceMapOutlet<K,VI,VO>
-
invalidateOutput
public void invalidateOutput()
Description copied from interface:InletMarks thisInlet—and theStreamletto which thisInletis attached—as having stale state. Invalidating anInletwill recursively invalidate all streamlets that transitively depend on the state of thisInlet. Invalidating anInletdoes not cause its state to be recomputed. A subsequentInlet.reconcileOutput(int)call will reconcile the state of theInlet.- Specified by:
invalidateOutputin interfaceInlet<K>
-
invalidateInput
public void invalidateInput()
Description copied from interface:Outlet- Specified by:
invalidateInputin interfaceOutlet<K>
-
invalidate
public void invalidate()
-
reconcileOutputKey
public void reconcileOutputKey(K key, int version)
Description copied from interface:MapInletReconciles the state of an individualkeyin thisMapInlet, if the version of thisMapInlet's state differs from the targetversion. To reconcile the state of a key, theMapInletfirst invokesMapOutlet.reconcileInputKey(Object, int)on itsinput, if its input is aMapOutlet, or it invokesOutlet.reconcileInput(int), if its input is not aMapOutlet. Then, if all invalid keys have been reconciled, theMapInletinvokesStreamlet.reconcile(int)on its attached streamlet.- Specified by:
reconcileOutputKeyin interfaceMapInlet<K,VI,VO>
-
reconcileInputKey
public void reconcileInputKey(K key, int version)
Description copied from interface:MapOutletReconciles the state of an individualkeyin thisMapOutlet, if the version of thisMapOutlet's state differs from the targetversion. To reconcile the state of a key, theMapOutletfirst invokesStreamlet.reconcile(int)on its attached streamlets. Then, for each dependent output, it invokesMapInlet.reconcileOutputKey(Object, int), if the dependent output is aMapInlet, or it invokesInlet.reconcileOutput(int), if the dependent output is not aMapInlet.- Specified by:
reconcileInputKeyin interfaceMapOutlet<K,VI,VO>
-
reconcileKey
public void reconcileKey(K key, int version)
-
reconcileOutput
public void reconcileOutput(int version)
Description copied from interface:InletReconciles the state of thisInlet, if the version of thisInlet's state differs from the targetversion. To reconcile its state, theInletfirst invokesOutlet.reconcileInput(int)on itsinput, to ensure that its input is up-to-date. It then invokesStreamlet.reconcile(int)on theStreamletto which it's attached, causing theStreamletto reconcile its own state.- Specified by:
reconcileOutputin interfaceInlet<K>
-
reconcileInput
public void reconcileInput(int version)
Description copied from interface:OutletReconciles the state of thisOutlet, if the version of thisOutlet's state differs from the targetversion. To reconcile its state, theOutletfirst invokesStreamlet.reconcile(int)on theStreamletto which it's attached. It then invokesInlet.reconcileOutput(int)on each of its dependentoutputs.- Specified by:
reconcileInputin interfaceOutlet<K>
-
reconcile
public void reconcile(int version)
-
willInvalidate
protected void willInvalidate()
-
onInvalidate
protected void onInvalidate()
-
didInvalidate
protected void didInvalidate()
-
willReconcile
protected void willReconcile(int version)
-
onReconcile
protected void onReconcile(int version)
-
didReconcile
protected void didReconcile(int version)
-
-