- java.lang.Object
-
- swim.structure.Item
-
- swim.structure.Value
-
- swim.structure.Record
-
- swim.dataflow.AbstractRecordOutlet
-
- swim.dataflow.RecordModel
-
- All Implemented Interfaces:
Comparable<Item>
,Iterable<Item>
,Collection<Item>
,List<Item>
,Debug
,Display
,RecordOutlet
,MapOutlet<Value,Value,Record>
,Outlet<Record>
,StreamletScope<Value>
,Builder<Item,Record>
,PairBuilder<Value,Value,Record>
- Direct Known Subclasses:
RecordScope
public class RecordModel extends AbstractRecordOutlet
-
-
Field Summary
Fields Modifier and Type Field Description protected HashTrieMap<Value,RecordFieldUpdater>
fieldUpdaters
protected Record
state
-
Fields inherited from class swim.dataflow.AbstractRecordOutlet
effects, outlets, outputs, version
-
-
Constructor Summary
Constructors Constructor Description RecordModel()
RecordModel(Record state)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, Item item)
boolean
add(Item item)
Adds a single input value to this builder, returningtrue
if the state of the builder changed.void
bindValue(Value key, Value expr)
void
clear()
void
compile(Record record)
void
compileField(Field field, int index)
void
compileItem(Item item, int index)
void
compileValue(Value value, int index)
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
.boolean
containsOwnKey(Value key)
static RecordModel
create(Record record)
void
disconnectInputs()
Disconnects allInlet
s dominated by thisOutlet
in the dataflow dependency graph.int
fieldCount()
Returns the number ofField
members contained in thisRecord
.Item
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
.Value
get(Value key)
Value
getAttr(Text key)
Field
getField(Value key)
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
.Item
getItem(int index)
Value
getSlot(Value key)
static RecordModel
globalScope()
int
indexOf(Object item)
boolean
isArray()
boolean
isEmpty()
Returnstrue
if thisRecord
has no members.boolean
isObject()
Iterator<Value>
keyIterator()
Returns anIterator
over the keys in the current state of thisMapOutlet
.int
lastIndexOf(Object item)
void
materialize(Record record)
void
materializeField(Field field)
void
materializeItem(Item item)
void
materializeValue(Value value)
MapOutlet<Value,Value,Record>
memoize()
static RecordModel
of()
static RecordModel
of(Object object)
static RecordModel
of(Object... objects)
Value
put(String key, Value newValue)
Value
put(Value key, Value newValue)
Value
putAttr(String key, Value newValue)
Value
putAttr(Text key, Value newValue)
Value
putSlot(String key, Value newValue)
Value
putSlot(Value key, Value newValue)
void
reify()
void
reify(Reifier reifier)
Item
reifyItem(Item item, Reifier reifier)
Item
remove(int index)
Item
setItem(int index, Item newItem)
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
.int
size()
Returns the number of members contained in thisRecord
.Record
subList(int fromIndex, int toIndex)
int
valueCount()
Returns the number ofValue
members contained in thisRecord
.-
Methods inherited from class swim.dataflow.AbstractRecordOutlet
bindOutput, decohereInput, decohereInputKey, didDecohereInput, didDecohereInputKey, didRecohereInput, didRecohereInputKey, disconnectOutputs, get, onDecohereInput, onDecohereInputKey, onRecohereInput, onRecohereInputKey, outlet, outlet, outputIterator, recohereInput, recohereInputKey, streamletContext, streamletScope, unbindOutput, unbindOutputs, willDecohereInput, willDecohereInputKey, willRecohereInput, willRecohereInputKey
-
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, containsKey, containsValue, create, create, debug, empty, entrySet, equals, evaluate, fieldIterator, fieldSet, flattened, get, getAttr, getField, getSlot, hashCode, head, header, headers, isAliased, isConstant, isDefinite, isMutable, item, item, item, item, item, item, item, iterator, keySet, length, listIterator, listIterator, 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, removeKey, removeKey, 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, substitute, tag, tail, target, toArray, toArray, typeOrder, unflattened, updated, updated, updatedAttr, updatedAttr, updatedSlot, updatedSlot, 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, 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 Detail
-
state
protected Record state
-
fieldUpdaters
protected HashTrieMap<Value,RecordFieldUpdater> fieldUpdaters
-
-
Constructor Detail
-
RecordModel
public RecordModel(Record state)
-
RecordModel
public RecordModel()
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Description copied from class:Record
Returnstrue
if thisRecord
has no members.
-
isArray
public boolean isArray()
Description copied from class:Record
-
isObject
public boolean isObject()
Description copied from class:Record
-
size
public int size()
Description copied from class:Record
Returns the number of members contained in thisRecord
.
-
fieldCount
public int fieldCount()
Description copied from class:Record
Returns the number ofField
members contained in thisRecord
.- Overrides:
fieldCount
in classRecord
-
valueCount
public int valueCount()
Description copied from class:Record
Returns the number ofValue
members contained in thisRecord
.- Overrides:
valueCount
in classRecord
-
containsKey
public boolean containsKey(Value key)
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
.- Specified by:
containsKey
in interfaceMapOutlet<Value,Value,Record>
- Overrides:
containsKey
in classRecord
-
containsOwnKey
public boolean containsOwnKey(Value key)
- Overrides:
containsOwnKey
in classAbstractRecordOutlet
-
indexOf
public int indexOf(Object item)
-
lastIndexOf
public int lastIndexOf(Object item)
- Specified by:
lastIndexOf
in interfaceList<Item>
- Overrides:
lastIndexOf
in classRecord
-
getField
public Field getField(Value key)
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
.
-
get
public Item get(int index)
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
.
-
setItem
public Item setItem(int index, Item newItem)
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
public boolean add(Item item)
Description copied from interface:Builder
Adds a single input value to this builder, returningtrue
if the state of the builder changed.
-
add
public void add(int index, Item item)
-
remove
public Item remove(int index)
-
clear
public void clear()
-
subList
public Record subList(int fromIndex, int toIndex)
-
keyIterator
public final Iterator<Value> keyIterator()
Description copied from interface:MapOutlet
Returns anIterator
over the keys in the current state of thisMapOutlet
.- Specified by:
keyIterator
in interfaceMapOutlet<Value,Value,Record>
- Specified by:
keyIterator
in classAbstractRecordOutlet
-
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<Record>
- Overrides:
disconnectInputs
in classAbstractRecordOutlet
-
materialize
public void materialize(Record record)
-
materializeItem
public void materializeItem(Item item)
-
materializeField
public void materializeField(Field field)
-
materializeValue
public void materializeValue(Value value)
-
compile
public void compile(Record record)
-
compileItem
public void compileItem(Item item, int index)
-
compileField
public void compileField(Field field, int index)
-
compileValue
public void compileValue(Value value, int index)
-
reify
public void reify(Reifier reifier)
-
reify
public void reify()
-
create
public static RecordModel create(Record record)
-
of
public static RecordModel of()
-
of
public static RecordModel of(Object object)
-
of
public static RecordModel of(Object... objects)
-
globalScope
public static RecordModel globalScope()
-
-