Module swim.dataflow
Package swim.dataflow
Class AbstractRecordStreamlet<I extends Value,O extends Value>
java.lang.Object
swim.structure.Item
swim.structure.Value
swim.structure.Record
swim.dataflow.RecordStreamlet<I,O>
swim.dataflow.AbstractRecordStreamlet<I,O>
- All Implemented Interfaces:
Comparable<Item>
,Iterable<Item>
,Collection<Item>
,List<Item>
,Debug
,Display
,GenericStreamlet<I,
,O> Streamlet<I,
,O> StreamletScope<O>
,Builder<Item,
,Record> PairBuilder<Value,
Value, Record>
- Direct Known Subclasses:
DownlinkStreamlet
public abstract class AbstractRecordStreamlet<I extends Value,O extends Value>
extends RecordStreamlet<I,O>
implements GenericStreamlet<I,O>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StreamletContext
protected StreamletScope<? extends O>
protected int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
Adds a single input value to this builder, returningtrue
if the state of the builder changed.void
Connects theInlet
of thisStreamlet
, identified by the givenkey
, to theinput
from which theInlet
should acquire its state.<T> T
<T> T
<T> T
<T> T
void
clear()
<T> T
coerceInput
(String key, Form<T> form) <T> T
coerceInput
(String key, Form<T> form, T orElse) <T> T
coerceInput
(Inlet<? extends I> inlet, Form<T> form) <T> T
coerceInput
(Inlet<? extends I> inlet, Form<T> form, T orElse) compileInlets
(Class<?> streamletClass, RecordStreamlet<I, O> streamlet) boolean
containsKey
(String key) Returnstrue
if thisRecord
has aField
member with a key that is equal to the givenkey
; otherwise returnsfalse
if thisRecord
has noField
member with a key equal to the givenkey
.boolean
containsKey
(Value key) Returnstrue
if thisRecord
has aField
member with a key that is equal to the givenkey
; otherwise returnsfalse
if thisRecord
has noField
member with a key equal to the givenkey
.void
decohere()
Marks thisStreamlet
—and all of its outlets—as having inconsistent state.protected void
void
didDecohereInlet
(Inlet<? extends I> inlet) void
didDecohereOutlet
(Outlet<? super O> outlet) protected void
didRecohere
(int version) void
didRecohereInlet
(Inlet<? extends I> inlet, int version) void
didRecohereOutlet
(Outlet<? super O> outlet, int version) void
Disconnects allInlet
s dominated by thisStreamlet
in the dataflow dependency graph.void
Disconnects allInlets
s dominated by thisStreamlet
in the dataflow graph.get
(int index) Returns the member of thisRecord
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.Returns the lastField
member of thisRecord
whose key is equal to the givenkey
; returnsnull
if thisRecord
has noField
member with akey
equal to the givenkey
.Returns the lastField
member of thisRecord
whose key is equal to the givenkey
; returnsnull
if thisRecord
has noField
member with akey
equal to the givenkey
.<I2 extends I>
I2<I2 extends I>
I2<I2 extends I>
I2<I2 extends I>
I2getItem
(int index) inlet()
Returns theInlet
to thisStreamlet
identified by the givenkey
; returnsnull
if thisStreamlet
has no suchInlet
.inoutlet()
boolean
isEmpty()
Returnstrue
if thisRecord
has no members.protected void
protected void
protected void
onRecohere
(int version) protected void
onRecohereInlets
(int version) protected void
onRecohereOutlets
(int version) outlet()
Returns theOutlet
of thisStreamlet
identified by the givenkey
; returnsnull
if thisStreamlet
has no suchOutlet
.void
recohere
(int version) Updates the state of thisStreamlet
to make it consistent with the targetversion
.remove
(int index) boolean
boolean
Replaces the member of thisRecord
at the givenindex
with a newitem
, returning the previousItem
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.void
setStreamletContext
(StreamletContext context) Sets the environment in which thisStreamlet
operates.void
setStreamletScope
(StreamletScope<? extends O> scope) Sets the lexically scoped parent of thisStreamlet
.int
size()
Returns the number of members contained in thisRecord
.Returns the environment in which thisStreamlet
operates.StreamletScope<? extends O>
Returns the lexically scoped parent of thisStreamlet
.void
unbindInput
(String key) Disconnects theInlet
of thisStreamlet
, identified by the givenkey
, from itsinput
Outlet
, if connected.protected void
void
willDecohereInlet
(Inlet<? extends I> inlet) void
willDecohereOutlet
(Outlet<? super O> outlet) protected void
willRecohere
(int version) void
willRecohereInlet
(Inlet<? extends I> inlet, int version) void
willRecohereOutlet
(Outlet<? super O> outlet, int version) Methods inherited from class swim.dataflow.RecordStreamlet
compile, compileInlet, isConstant
Methods inherited from class swim.structure.Record
add, add, add, add, add, add, add, add, add, add, add, add, add, addAll, addAll, alias, appended, appended, asMutable, attr, attr, attr, attr, attr, attr, attr, attr, attr, attr, attr, attr, attr, attr, attr, attr, bind, body, branch, commit, compareTo, compareTo, concat, contains, contains, containsAll, containsValue, create, create, debug, empty, entrySet, equals, evaluate, fieldCount, fieldIterator, fieldSet, flattened, hashCode, head, header, headers, indexOf, isAliased, isArray, isDefinite, isMutable, isObject, item, item, item, item, item, item, item, iterator, keyIterator, keySet, lastIndexOf, length, listIterator, listIterator, of, of, of, prepended, prepended, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAttr, putAttr, putAttr, putAttr, putAttr, putAttr, putAttr, putAttr, putAttr, putAttr, putAttr, putAttr, putSlot, putSlot, putSlot, putSlot, putSlot, putSlot, putSlot, putSlot, putSlot, putSlot, putSlot, putSlot, remove, removeAll, removed, removed, retainAll, set, setItem, setItem, setItem, setItem, setItem, setItem, slot, slot, slot, slot, slot, slot, slot, slot, slot, slot, slot, slot, slot, slot, slot, slot, stringValue, stringValue, subList, substitute, tag, tail, target, toArray, toArray, typeOrder, unflattened, updated, updated, updatedAttr, updatedAttr, updatedSlot, updatedSlot, valueCount, valueIterator, values
Methods inherited from class swim.structure.Value
absent, and, and, bitwiseAnd, bitwiseAnd, bitwiseNot, bitwiseOr, bitwiseOr, bitwiseXor, bitwiseXor, booleanValue, booleanValue, builder, byteValue, byteValue, charValue, charValue, conditional, conditional, divide, divide, doubleValue, doubleValue, eq, eq, extant, floatValue, floatValue, fromObject, ge, ge, gt, gt, integerValue, integerValue, intValue, intValue, inverse, isDefined, isDistinct, key, keyEquals, lambda, le, le, longValue, longValue, lt, lt, minus, minus, modulo, modulo, ne, ne, negative, not, numberValue, numberValue, or, or, plus, plus, positive, shortValue, shortValue, times, times, toValue
Methods inherited from class swim.structure.Item
appended, appended, appended, appended, appended, appended, cast, cast, coerce, coerce, display, evaluate, filter, filter, globalScope, invoke, max, min, precedence, prepended, prepended, prepended, prepended, prepended, prepended, substitute, toString, updated, updated, updated, updated, updated, updated, updated, updated, updated, updated, updated, updated, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedSlot, updatedSlot, updatedSlot, updatedSlot, updatedSlot, updatedSlot, updatedSlot, updatedSlot, updatedSlot, updatedSlot, updatedSlot, updatedSlot
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Field Details
-
scope
-
context
-
version
protected int version
-
-
Constructor Details
-
AbstractRecordStreamlet
-
AbstractRecordStreamlet
public AbstractRecordStreamlet()
-
-
Method Details
-
streamletScope
Description copied from interface:Streamlet
Returns the lexically scoped parent of thisStreamlet
. Returnsnull
if thisStreamlet
has no lexical parent.- Specified by:
streamletScope
in interfaceStreamlet<I extends Value,
O extends Value> - Specified by:
streamletScope
in interfaceStreamletScope<I extends Value>
-
setStreamletScope
Description copied from interface:Streamlet
Sets the lexically scoped parent of thisStreamlet
. -
streamletContext
Description copied from interface:Streamlet
Returns the environment in which thisStreamlet
operates.- Specified by:
streamletContext
in interfaceStreamlet<I extends Value,
O extends Value> - Specified by:
streamletContext
in interfaceStreamletScope<I extends Value>
-
setStreamletContext
Description copied from interface:Streamlet
Sets the environment in which thisStreamlet
operates. -
isEmpty
public boolean isEmpty()Description copied from class:Record
Returnstrue
if thisRecord
has no members. -
size
public int size()Description copied from class:Record
Returns the number of members contained in thisRecord
. -
containsKey
Description copied from class:Record
Returnstrue
if thisRecord
has aField
member with a key that is equal to the givenkey
; otherwise returnsfalse
if thisRecord
has noField
member with a key equal to the givenkey
.- Overrides:
containsKey
in classRecord
-
containsKey
Description copied from class:Record
Returnstrue
if thisRecord
has aField
member with a key that is equal to the givenkey
; otherwise returnsfalse
if thisRecord
has noField
member with a key equal to the givenkey
. Equivalent toRecord.containsKey(Value)
, but avoids boxing thekey
string into aText
value.- Overrides:
containsKey
in classRecord
-
get
Description copied from class:Record
-
get
Description copied from class:Record
Returns the value of the lastField
member of thisRecord
whose key is equal to the givenkey
; returnsAbsent
if thisRecord
has noField
member with a key equal to the givenkey
. Equivalent toRecord.get(Value)
, but avoids boxing thekey
string into aText
value. -
getAttr
Description copied from class:Record
-
getAttr
Description copied from class:Record
Returns the value of the lastAttr
member of thisRecord
whose key is equal to the givenkey
; returnsAbsent
if thisRecord
has noAttr
member with a key equal to the givenkey
. Equivalent toRecord.getAttr(Text)
, but avoids boxing thekey
string into aText
value. -
getSlot
Description copied from class:Record
-
getSlot
Description copied from class:Record
Returns the value of the lastSlot
member of thisRecord
whose key is equal to the givenkey
; returnsAbsent
if thisRecord
has noSlot
member with a key equal to the givenkey
. Equivalent toRecord.getSlot(Value)
, but avoids boxing thekey
string into aText
value. -
getField
Description copied from class:Record
Returns the lastField
member of thisRecord
whose key is equal to the givenkey
; returnsnull
if thisRecord
has noField
member with akey
equal to the givenkey
. -
getField
Description copied from class:Record
Returns the lastField
member of thisRecord
whose key is equal to the givenkey
; returnsnull
if thisRecord
has noField
member with akey
equal to the givenkey
. Equivalent toRecord.getField(Value)
, but avoids boxing thekey
string into aText
value. -
get
Description copied from class:Record
Returns the member of thisRecord
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
. -
getItem
Description copied from class:Record
-
put
-
put
-
putAttr
-
putAttr
-
putSlot
-
putSlot
-
setItem
Description copied from class:Record
Replaces the member of thisRecord
at the givenindex
with a newitem
, returning the previousItem
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
. -
add
Description copied from interface:Builder
Adds a single input value to this builder, returningtrue
if the state of the builder changed. -
add
-
remove
-
removeKey
-
removeKey
-
clear
public void clear() -
inlet
Description copied from interface:Streamlet
Returns theInlet
to thisStreamlet
identified by the givenkey
; returnsnull
if thisStreamlet
has no suchInlet
. -
inlet
-
bindInput
Description copied from interface:Streamlet
Connects theInlet
of thisStreamlet
, identified by the givenkey
, to theinput
from which theInlet
should acquire its state. Delegates toInlet.bindInput(Outlet)
on the identifiedInlet
. -
unbindInput
Description copied from interface:Streamlet
Disconnects theInlet
of thisStreamlet
, identified by the givenkey
, from itsinput
Outlet
, if connected. Delegates toInlet.unbindInput()
on the identifiedInlet
. -
outlet
Description copied from interface:Streamlet
Returns theOutlet
of thisStreamlet
identified by the givenkey
; returnsnull
if thisStreamlet
has no suchOutlet
. -
outlet
-
inoutlet
-
decohere
public void decohere()Description copied from interface:Streamlet
Marks thisStreamlet
—and all of its outlets—as having inconsistent state. Decohering aStreamlet
will recursively decohere all streamlets that transitively depend on the state of thisStreamlet
. Decohering aStreamlet
does not cause its state to be recomputed. A subsequentStreamlet.recohere(int)
call will eventually make the state of theStreamlet
coherent again. -
recohere
public void recohere(int version) Description copied from interface:Streamlet
Updates the state of thisStreamlet
to make it consistent with the targetversion
. TheStreamlet
only needs to update if its currentversion
differs from the targetversion
. To update its state, theStreamlet
first invokesInlet.recohereOutput(int)
on each of its inlets, to ensure that its input states are coherent. It then recomputes its own state in an implementation defined manner. Finally, it invokesOutlet.recohereInput(int)
on its outlets, causing all transitively dependent streamlets to make their own states coherent again. -
getInput
-
getInput
-
getInput
-
getInput
-
castInput
-
castInput
-
castInput
-
castInput
-
coerceInput
-
coerceInput
-
coerceInput
-
coerceInput
-
getOutput
-
getOutput
-
disconnectInputs
public void disconnectInputs()Description copied from interface:Streamlet
Disconnects allInlet
s dominated by thisStreamlet
in the dataflow dependency graph. Used to recursively clean up chains of combinators terminating at thisStreamlet
. -
disconnectOutputs
public void disconnectOutputs()Description copied from interface:Streamlet
Disconnects allInlets
s dominated by thisStreamlet
in the dataflow graph. Used to recursively clean up chains of combinators originating from thisStreamlet
. -
willDecohereInlet
- Specified by:
willDecohereInlet
in interfaceGenericStreamlet<I extends Value,
O extends Value>
-
didDecohereInlet
- Specified by:
didDecohereInlet
in interfaceGenericStreamlet<I extends Value,
O extends Value>
-
willRecohereInlet
- Specified by:
willRecohereInlet
in interfaceGenericStreamlet<I extends Value,
O extends Value>
-
didRecohereInlet
- Specified by:
didRecohereInlet
in interfaceGenericStreamlet<I extends Value,
O extends Value>
-
willDecohereOutlet
- Specified by:
willDecohereOutlet
in interfaceGenericStreamlet<I extends Value,
O extends Value>
-
didDecohereOutlet
- Specified by:
didDecohereOutlet
in interfaceGenericStreamlet<I extends Value,
O extends Value>
-
willRecohereOutlet
- Specified by:
willRecohereOutlet
in interfaceGenericStreamlet<I extends Value,
O extends Value>
-
didRecohereOutlet
- Specified by:
didRecohereOutlet
in interfaceGenericStreamlet<I extends Value,
O extends Value>
-
willDecohere
protected void willDecohere() -
onDecohere
protected void onDecohere() -
onDecohereOutlets
protected void onDecohereOutlets() -
didDecohere
protected void didDecohere() -
willRecohere
protected void willRecohere(int version) -
onRecohereInlets
protected void onRecohereInlets(int version) -
onRecohere
protected void onRecohere(int version) -
onRecohereOutlets
protected void onRecohereOutlets(int version) -
didRecohere
protected void didRecohere(int version) -
compileInlets
public static <I extends Value,O extends Value> void compileInlets(Class<?> streamletClass, RecordStreamlet<I, O> streamlet)
-