- 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
All Methods Instance Methods Abstract Methods Concrete Methods 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.voiddecohere()voiddecohereInput()Marks thisOutlet—and alloutputsthat depend on the state of thisOutlet—as having decoherent state.voiddecohereInputKey(K key, KeyEffect effect)Marks thisMapOutletas needing aneffectapplied to a givenkey.voiddecohereKey(K key, KeyEffect effect)voiddecohereOutput()Marks thisInlet—and theStreamletto which thisInletis attached—as having decoherent state.voiddecohereOutputKey(K key, KeyEffect effect)Marks thisMapInletas needing aneffectapplied to a givenkey.protected voiddidDecohere()protected voiddidDecohereKey(K key, KeyEffect effect)protected voiddidRecohere(int version)protected voiddidRecohereKey(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.abstract Iterator<K>keyIterator()Returns anIteratorover the keys in the current state of thisMapOutlet.protected voidonDecohere()protected voidonDecohereKey(K key, KeyEffect effect)protected voidonRecohere(int version)protected voidonRecohereKey(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.voidrecohere(int version)voidrecohereInput(int version)Updates the state of thisOutletto make it consistent with the targetversion.voidrecohereInputKey(K key, int version)Updates the state of an individualkeyin thisMapOutletto make it consistent with the targetversion.voidrecohereKey(K key, int version)voidrecohereOutput(int version)Updates the state of thisInletto make it consistent with thetargetversion.voidrecohereOutputKey(K key, int version)Updates the state of an individualkeyin thisMapInletto make it consistent with 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 voidwillDecohere()protected voidwillDecohereKey(K key, KeyEffect effect)protected voidwillRecohere(int version)protected voidwillRecohereKey(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 decohered when the state of thisOutletis decohered, and recohered when thisOutletis recohered.- 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>
-
decohereOutputKey
public void decohereOutputKey(K key, KeyEffect effect)
Description copied from interface:MapInletMarks thisMapInletas needing aneffectapplied to a givenkey. Decohering an individual key decoheres the entire state of theInlet. But only the decoherent keys need to be updated in order to recohere the overall state of theInlet.- Specified by:
decohereOutputKeyin interfaceMapInlet<K,VI,VO>
-
decohereInputKey
public void decohereInputKey(K key, KeyEffect effect)
Description copied from interface:MapOutletMarks thisMapOutletas needing aneffectapplied to a givenkey. Decohering an individual key decoheres the entire state of theOutlet. But only the decoherent keys need to be updated in order to recohere the overall state of theOutlet.- Specified by:
decohereInputKeyin interfaceMapOutlet<K,VI,VO>
-
decohereOutput
public void decohereOutput()
Description copied from interface:InletMarks thisInlet—and theStreamletto which thisInletis attached—as having decoherent state. Decohering anInletwill recursively decohere all streamlets that transitively depend on the state of thisInlet. Decohering anInletdoes not cause its state to be recomputed. A subsequentInlet.recohereOutput(int)call will eventually make the state of theInletcoherent again.- Specified by:
decohereOutputin interfaceInlet<K>
-
decohereInput
public void decohereInput()
Description copied from interface:OutletMarks thisOutlet—and alloutputsthat depend on the state of thisOutlet—as having decoherent state.- Specified by:
decohereInputin interfaceOutlet<K>
-
decohere
public void decohere()
-
recohereOutputKey
public void recohereOutputKey(K key, int version)
Description copied from interface:MapInletUpdates the state of an individualkeyin thisMapInletto make it consistent with the targetversion. TheMapInletonly needs to update if the currentversiondiffers from the targetversion. To update the state of a key, theMapInletfirst invokesMapOutlet.recohereInputKey(Object, int)on itsinput, if its input is aMapOutlet, or it invokesOutlet.recohereInput(int), if its input is not aMapOutlet. Then, if all decoherent keys have been recohered, theMapInletinvokesStreamlet.recohere(int)on its attached streamlet.- Specified by:
recohereOutputKeyin interfaceMapInlet<K,VI,VO>
-
recohereInputKey
public void recohereInputKey(K key, int version)
Description copied from interface:MapOutletUpdates the state of an individualkeyin thisMapOutletto make it consistent with the targetversion. TheMapOutletonly needs to update if its currentversiondiffers from the targetversion. To update the state of a key, theMapOutletfirst invokesStreamlet.recohere(int)on its attached streamlets. Then, for each dependent output, it invokesMapInlet.recohereOutputKey(Object, int), if the dependent output is aMapInlet, or it invokesInlet.recohereOutput(int), if the dependent output is not aMapInlet.- Specified by:
recohereInputKeyin interfaceMapOutlet<K,VI,VO>
-
recohereKey
public void recohereKey(K key, int version)
-
recohereOutput
public void recohereOutput(int version)
Description copied from interface:InletUpdates the state of thisInletto make it consistent with thetargetversion. TheInletonly needs to update if its currentversiondiffers from the targetversion. To update its state, theInletfirst invokesOutlet.recohereInput(int)on itsinput, to ensure that its input is coherent. It then invokesStreamlet.recohere(int)on theStreamletto which it's attached, causing theStreamletto make its own state coherent again.- Specified by:
recohereOutputin interfaceInlet<K>
-
recohereInput
public void recohereInput(int version)
Description copied from interface:OutletUpdates the state of thisOutletto make it consistent with the targetversion. TheOutletonly needs to update if its currentversiondiffers from the targetversion. To update its state, theOutletfirst invokesStreamlet.recohere(int)on theStreamletto which it's attached. It then invokesInlet.recohereOutput(int)on each of its dependentoutputs.- Specified by:
recohereInputin interfaceOutlet<K>
-
recohere
public void recohere(int version)
-
willDecohere
protected void willDecohere()
-
onDecohere
protected void onDecohere()
-
didDecohere
protected void didDecohere()
-
willRecohere
protected void willRecohere(int version)
-
onRecohere
protected void onRecohere(int version)
-
didRecohere
protected void didRecohere(int version)
-
-