- java.lang.Object
-
- swim.streamlet.AbstractMapInletMapOutlet<KI,KO,VI,VO,I,O>
-
- All Implemented Interfaces:
Inlet<I>,MapInlet<KI,VI,I>,MapInletMapOutlet<KI,KO,VI,VO,I,O>,MapOutlet<KO,VO,O>,Outlet<O>
- Direct Known Subclasses:
FilterFieldsOperator
public abstract class AbstractMapInletMapOutlet<KI,KO,VI,VO,I,O> extends Object implements MapInletMapOutlet<KI,KO,VI,VO,I,O>
-
-
Field Summary
Fields Modifier and Type Field Description protected MapOutlet<KI,VI,? extends I>inputprotected HashTrieMap<KO,KeyEffect>inputEffectsprotected HashTrieMap<KO,KeyOutlet<KO,VO>>outletsprotected HashTrieMap<KI,KeyEffect>outputEffectsprotected Inlet<? super O>[]outputsprotected intversion
-
Constructor Summary
Constructors Constructor Description AbstractMapInletMapOutlet()
-
Method Summary
Modifier and Type Method Description voidbindInput(MapOutlet<KI,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(KO key)Returnstrueif the current state of thisMapOutletcontains the givenkey; otherwise returnsfalse.protected voiddidInvalidate()protected voiddidInvalidateInputKey(KO key, KeyEffect effect)protected voiddidInvalidateOutputKey(KI key, KeyEffect effect)protected voiddidReconcile(int version)protected voiddidReconcileInputKey(KO key, KeyEffect effect, int version)protected voiddidReconcileOutputKey(KI key, KeyEffect effect, int version)voiddisconnectInputs()Disconnects allInlets dominated by thisInletin the dataflow dependency graph.voiddisconnectOutputs()Disconnects allOutlets dominated by thisInletin the dataflow graph.abstract Oget()Returns the current state of thisOutlet.abstract VOget(KO key)Returns the value assocaited with the givenkeyin the current state of thisMapOutlet, if defined; otherwise returnsnull.MapOutlet<KI,VI,? extends I>input()Returns theOutletfrom which thisInletacquires its state; returnsnullif thisInletis disconnected.voidinvalidate()voidinvalidateInput()voidinvalidateInputKey(KO key, KeyEffect effect)Marks thisMapOutletas needing aneffectapplied to a givenkey.voidinvalidateOutput()Marks thisInlet—and theStreamletto which thisInletis attached—as having stale state.voidinvalidateOutputKey(KI key, KeyEffect effect)Marks thisMapInletas needing aneffectapplied to a givenkey.abstract Iterator<KO>keyIterator()Returns anIteratorover the keys in the current state of thisMapOutlet.protected voidonInvalidate()protected voidonInvalidateInputKey(KO key, KeyEffect effect)protected voidonInvalidateOutputKey(KI key, KeyEffect effect)protected voidonReconcile(int version)protected voidonReconcileInputKey(KO key, KeyEffect effect, int version)protected voidonReconcileOutputKey(KI key, KeyEffect effect, int version)Outlet<VO>outlet(KO 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(KO key, int version)Reconciles the state of an individualkeyin thisMapOutlet, if the version of thisMapOutlet's state differs from the targetversion.voidreconcileOutput(int version)Reconciles the state of thisInlet, if the version of thisInlet's state differs from the targetversion.voidreconcileOutputKey(KI 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 voidwillInvalidateInputKey(KO key, KeyEffect effect)protected voidwillInvalidateOutputKey(KI key, KeyEffect effect)protected voidwillReconcile(int version)protected KeyEffectwillReconcileInputKey(KO key, KeyEffect effect, int version)protected voidwillReconcileOutputKey(KI key, KeyEffect effect, int version)
-
-
-
Field Detail
-
outputEffects
protected HashTrieMap<KI,KeyEffect> outputEffects
-
inputEffects
protected HashTrieMap<KO,KeyEffect> inputEffects
-
outlets
protected HashTrieMap<KO,KeyOutlet<KO,VO>> outlets
-
version
protected int version
-
-
Method Detail
-
containsKey
public abstract boolean containsKey(KO key)
Description copied from interface:MapOutletReturnstrueif the current state of thisMapOutletcontains the givenkey; otherwise returnsfalse.- Specified by:
containsKeyin interfaceMapOutlet<KI,KO,VI>
-
get
public abstract VO get(KO 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<KO> keyIterator()
Description copied from interface:MapOutletReturns anIteratorover the keys in the current state of thisMapOutlet.- Specified by:
keyIteratorin interfaceMapOutlet<KI,KO,VI>
-
input
public MapOutlet<KI,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<KI>
-
disconnectInputs
public void disconnectInputs()
Description copied from interface:InletDisconnects allInlets dominated by thisInletin the dataflow dependency graph. Used to recursively clean up chains of combinators terminating at thisInlet.- Specified by:
disconnectInputsin interfaceInlet<KI>- Specified by:
disconnectInputsin interfaceOutlet<KI>
-
outlet
public Outlet<VO> outlet(KO 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<KI>
-
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<KI>
-
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<KI>
-
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<KI>
-
disconnectOutputs
public void disconnectOutputs()
Description copied from interface:InletDisconnects allOutlets dominated by thisInletin the dataflow graph. Used to recursively clean up chains of combinators passing through thisInlet.- Specified by:
disconnectOutputsin interfaceInlet<KI>- Specified by:
disconnectOutputsin interfaceOutlet<KI>
-
invalidateOutputKey
public void invalidateOutputKey(KI 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<KI,KO,VI>
-
invalidateInputKey
public void invalidateInputKey(KO 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<KI,KO,VI>
-
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<KI>
-
invalidateInput
public void invalidateInput()
Description copied from interface:Outlet- Specified by:
invalidateInputin interfaceOutlet<KI>
-
invalidate
public void invalidate()
-
reconcileOutputKey
public void reconcileOutputKey(KI 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<KI,KO,VI>
-
reconcileInputKey
public void reconcileInputKey(KO 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<KI,KO,VI>
-
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<KI>
-
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<KI>
-
reconcile
public void reconcile(int version)
-
willInvalidate
protected void willInvalidate()
-
onInvalidate
protected void onInvalidate()
-
didInvalidate
protected void didInvalidate()
-
willReconcileOutputKey
protected void willReconcileOutputKey(KI key, KeyEffect effect, int version)
-
willReconcileInputKey
protected KeyEffect willReconcileInputKey(KO key, KeyEffect effect, int version)
-
willReconcile
protected void willReconcile(int version)
-
onReconcile
protected void onReconcile(int version)
-
didReconcile
protected void didReconcile(int version)
-
-