- java.lang.Object
-
- swim.streamlet.AbstractMapOutlet<K,V,O>
-
-
Constructor Summary
Constructors Constructor Description AbstractMapOutlet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
bindOutput(Inlet<? super O> output)
Adds anoutput
to the set ofInlet
s that depend on the state of thisOutlet
.abstract boolean
containsKey(K key)
Returnstrue
if the current state of thisMapOutlet
contains the givenkey
; otherwise returnsfalse
.protected void
didInvalidateInput()
protected void
didInvalidateInputKey(K key, KeyEffect effect)
protected void
didReconcileInput(int version)
protected void
didReconcileInputKey(K key, KeyEffect effect, int version)
void
disconnectInputs()
Disconnects allInlet
s dominated by thisOutlet
in the dataflow dependency graph.void
disconnectOutputs()
Disconnects allOutlet
s dominated by thisOutlet
in the dataflow graph.abstract O
get()
Returns the current state of thisOutlet
.abstract V
get(K key)
Returns the value assocaited with the givenkey
in the current state of thisMapOutlet
, if defined; otherwise returnsnull
.void
invalidateInput()
void
invalidateInputKey(K key, KeyEffect effect)
Marks thisMapOutlet
as needing aneffect
applied to a givenkey
.abstract Iterator<K>
keyIterator()
Returns anIterator
over the keys in the current state of thisMapOutlet
.protected void
onInvalidateInput()
protected void
onInvalidateInputKey(K key, KeyEffect effect)
protected void
onReconcileInput(int version)
protected void
onReconcileInputKey(K key, KeyEffect effect, int version)
Outlet<V>
outlet(K key)
Returns anOutlet
that updates when the specifiedkey
updates.Iterator<Inlet<? super O>>
outputIterator()
Returns anIterator
over the set ofInlet
s that depend on the state of thisOutlet
.void
reconcileInput(int version)
Reconciles the state of thisOutlet
, if the version of thisOutlet
's state differs from the targetversion
.void
reconcileInputKey(K key, int version)
Reconciles the state of an individualkey
in thisMapOutlet
, if the version of thisMapOutlet
's state differs from the targetversion
.void
unbindOutput(Inlet<? super O> output)
Removes anoutput
from the set ofInlet
s that depend on the state of thisOutlet
.void
unbindOutputs()
Disconnects all outputs from thisOutlet
by invokingInlet.unbindInput()
on eachInelt
that depends on the state of thisOutlet
.protected void
willInvalidateInput()
protected void
willInvalidateInputKey(K key, KeyEffect effect)
protected void
willReconcileInput(int version)
protected void
willReconcileInputKey(K key, KeyEffect effect, int version)
-
-
-
Field Detail
-
effects
protected HashTrieMap<K,KeyEffect> effects
-
outlets
protected HashTrieMap<K,KeyOutlet<K,V>> outlets
-
version
protected int version
-
-
Method Detail
-
containsKey
public abstract boolean containsKey(K key)
Description copied from interface:MapOutlet
Returnstrue
if the current state of thisMapOutlet
contains the givenkey
; otherwise returnsfalse
.- Specified by:
containsKey
in interfaceMapOutlet<K,V,O>
-
get
public abstract V get(K key)
Description copied from interface:MapOutlet
Returns the value assocaited with the givenkey
in the current state of thisMapOutlet
, if defined; otherwise returnsnull
.
-
get
public abstract O get()
Description copied from interface:Outlet
Returns the current state of thisOutlet
.
-
keyIterator
public abstract Iterator<K> keyIterator()
Description copied from interface:MapOutlet
Returns anIterator
over the keys in the current state of thisMapOutlet
.- Specified by:
keyIterator
in interfaceMapOutlet<K,V,O>
-
outlet
public Outlet<V> outlet(K key)
Description copied from interface:MapOutlet
Returns anOutlet
that updates when the specifiedkey
updates.
-
outputIterator
public Iterator<Inlet<? super O>> outputIterator()
Description copied from interface:Outlet
Returns anIterator
over the set ofInlet
s that depend on the state of thisOutlet
.- Specified by:
outputIterator
in interfaceOutlet<K>
-
bindOutput
public void bindOutput(Inlet<? super O> output)
Description copied from interface:Outlet
Adds anoutput
to the set ofInlet
s that depend on the state of thisOutlet
. Theoutput
will be invalidated when the state of thisOutlet
is invalidated, and updated when thisOutlet
is updated.- Specified by:
bindOutput
in interfaceOutlet<K>
-
unbindOutput
public void unbindOutput(Inlet<? super O> output)
Description copied from interface:Outlet
Removes anoutput
from the set ofInlet
s that depend on the state of thisOutlet
.- Specified by:
unbindOutput
in interfaceOutlet<K>
-
unbindOutputs
public void unbindOutputs()
Description copied from interface:Outlet
Disconnects all outputs from thisOutlet
by invokingInlet.unbindInput()
on eachInelt
that depends on the state of thisOutlet
.- Specified by:
unbindOutputs
in interfaceOutlet<K>
-
disconnectOutputs
public void disconnectOutputs()
Description copied from interface:Outlet
Disconnects allOutlet
s dominated by thisOutlet
in the dataflow graph. Used to recursively clean up chains of combinators originating from thisInlet
.- Specified by:
disconnectOutputs
in interfaceOutlet<K>
-
disconnectInputs
public void disconnectInputs()
Description copied from interface:Outlet
Disconnects allInlet
s dominated by thisOutlet
in the dataflow dependency graph. Used to recursively clean up chains of combinators passing through thisOutlet
.- Specified by:
disconnectInputs
in interfaceOutlet<K>
-
invalidateInputKey
public void invalidateInputKey(K key, KeyEffect effect)
Description copied from interface:MapOutlet
Marks thisMapOutlet
as needing aneffect
applied 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:
invalidateInputKey
in interfaceMapOutlet<K,V,O>
-
invalidateInput
public void invalidateInput()
Description copied from interface:Outlet
- Specified by:
invalidateInput
in interfaceOutlet<K>
-
reconcileInputKey
public void reconcileInputKey(K key, int version)
Description copied from interface:MapOutlet
Reconciles the state of an individualkey
in thisMapOutlet
, if the version of thisMapOutlet
's state differs from the targetversion
. To reconcile the state of a key, theMapOutlet
first 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:
reconcileInputKey
in interfaceMapOutlet<K,V,O>
-
reconcileInput
public void reconcileInput(int version)
Description copied from interface:Outlet
Reconciles the state of thisOutlet
, if the version of thisOutlet
's state differs from the targetversion
. To reconcile its state, theOutlet
first invokesStreamlet.reconcile(int)
on theStreamlet
to which it's attached. It then invokesInlet.reconcileOutput(int)
on each of its dependentoutputs
.- Specified by:
reconcileInput
in interfaceOutlet<K>
-
willInvalidateInput
protected void willInvalidateInput()
-
onInvalidateInput
protected void onInvalidateInput()
-
didInvalidateInput
protected void didInvalidateInput()
-
willReconcileInput
protected void willReconcileInput(int version)
-
onReconcileInput
protected void onReconcileInput(int version)
-
didReconcileInput
protected void didReconcileInput(int version)
-
-