- All Implemented Interfaces:
Comparable<Item>
,Iterable<Item>
,Collection<Item>
,List<Item>
,Debug
,Display
,Builder<Item,
,Record> PairBuilder<Value,
Value, Record>
- Direct Known Subclasses:
AbstractRecordOutlet
,RecordStreamlet
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(boolean item) boolean
add
(double item) boolean
add
(float item) boolean
add
(int item) void
add
(int index, boolean item) void
add
(int index, double item) void
add
(int index, float item) void
add
(int index, int item) void
add
(int index, long item) void
abstract void
boolean
add
(long item) boolean
abstract boolean
Adds a single input value to this builder, returningtrue
if the state of the builder changed.boolean
Adds an input pair to this builder, returningtrue
if the state of the builder changed.boolean
addAll
(int index, Collection<? extends Item> items) boolean
addAll
(Collection<? extends Item> items) Adds multiple input values to this builder, returningtrue
if the state of the builder changed.void
alias()
bind()
Returns the output result of this builder.body()
branch()
abstract void
clear()
commit()
int
int
boolean
Returnstrue
if thisRecord
has a member equal toItem.fromObject(item)
; otherwise returnsfalse
if thisRecord
has no member equal toItem.fromObject(item)
.boolean
Returnstrue
if thisRecord
has a member equal toitem
; otherwise returnsfalse
if thisRecord
has no member equal toitem
.boolean
containsAll
(Collection<?> items) Returnstrue
if thisRecord
has a member equal to every item initems
; returnsfalse
if any item initems
is not contained in thisRecord
.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
.boolean
containsValue
(Value value) Returnstrue
if thisRecord
has aField
member with a value that is equal to the givenvalue
; otherwise returnsfalse
if thisRecord
has noField
member with a value equal to the givenvalue
.static Record
create()
static Record
create
(int initialSize) <T> Output<T>
Writes a developer readable, debug-formatted string representation of this object tooutput
.static Record
empty()
entrySet()
boolean
evaluate
(Interpreter interpreter) int
Returns the number ofField
members contained in thisRecord
.fieldSet()
Returns the sole member of thisRecord
, if thisRecord
has exactly one member, and its member is aValue
; returnsExtant
if thisRecord
is empty; otherwise returnsthis
if thisRecord
has more than one member.abstract 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
.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
.abstract Item
getItem
(int index) int
hashCode()
head()
int
boolean
boolean
isArray()
boolean
boolean
Returnstrue
if thisValue
is not one of: an emptyRecord
,False
,Extant
, orAbsent
.abstract boolean
isEmpty()
Returnstrue
if thisRecord
has no members.boolean
boolean
isObject()
item
(boolean item) item
(double item) item
(float item) item
(int item) item
(long item) iterator()
keySet()
int
lastIndexOf
(Object item) final int
length()
Returns the number of members contained in thisRecord
; equivalent tosize()
.listIterator
(int index) static Record
of()
static Record
static Record
void
abstract Item
remove
(int index) boolean
boolean
removeAll
(Collection<?> items) boolean
boolean
boolean
retainAll
(Collection<?> items) 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
.setItem
(int index, boolean value) setItem
(int index, double value) setItem
(int index, float value) setItem
(int index, int value) setItem
(int index, long value) abstract Item
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
.abstract int
size()
Returns the number of members contained in thisRecord
.Converts thisValue
into aString
value, if possible.stringValue
(String orElse) Converts thisValue
into aString
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into astring
value.subList
(int fromIndex, int toIndex) substitute
(Interpreter interpreter) tag()
Returns thekey
string of the first member of thisRecord
, if the first member is anAttr
; otherwise returnsnull
if the first member is not anAttr
.tail()
Returns a view of all but the first member of thisRecord
, if thisRecord
is non-empty; otherwise returns an emptyRecord
, if thisRecord
is itself empty.target()
Returns theflattened
members of thisRecord
after all attributes have been removed.Item[]
toArray()
<T> T[]
toArray
(T[] array) int
Returns the heterogeneous sort order of thisItem
.Returnsthis
Record
.updatedAttr
(String key, Value value) updatedAttr
(Text key, Value value) updatedSlot
(String key, Value value) updatedSlot
(Value key, Value value) int
Returns the number ofValue
members contained in thisRecord
.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
-
Constructor Details
-
Record
public Record()
-
-
Method Details
-
isDefinite
public boolean isDefinite()Description copied from class:Value
Returnstrue
if thisValue
is not one of: an emptyRecord
,False
,Extant
, orAbsent
.- Overrides:
isDefinite
in classValue
-
isEmpty
public abstract boolean isEmpty()Returnstrue
if thisRecord
has no members. -
isArray
public boolean isArray() -
isObject
public boolean isObject() -
size
public abstract int size()Returns the number of members contained in thisRecord
. -
length
public final int length()Returns the number of members contained in thisRecord
; equivalent tosize()
. -
fieldCount
public int fieldCount()Returns the number ofField
members contained in thisRecord
. -
valueCount
public int valueCount()Returns the number ofValue
members contained in thisRecord
. -
isConstant
public boolean isConstant()Description copied from class:Item
- Specified by:
isConstant
in classItem
-
tag
Returns thekey
string of the first member of thisRecord
, if the first member is anAttr
; otherwise returnsnull
if the first member is not anAttr
.Used to concisely get the name of the discriminating attribute of a structure. The
tag
can be used to discern the nominal type of a polymorphic structure, similar to an XML element tag. -
target
Returns theflattened
members of thisRecord
after all attributes have been removed.Used to concisely get the scalar value of an attributed structure. An attributed structure is a
Record
with one or more attributes that modify one or more other members. -
flattened
Returns the sole member of thisRecord
, if thisRecord
has exactly one member, and its member is aValue
; returnsExtant
if thisRecord
is empty; otherwise returnsthis
if thisRecord
has more than one member.Used to convert a unary
Record
into its memberValue
. Facilitates writing code that treats a unaryRecord
equivalently to a bareValue
. -
unflattened
Returnsthis
Record
.- Overrides:
unflattened
in classValue
-
header
Returns the value of the first member of thisRecord
, if the first member is anAttr
whosekey
string is equal totag
; otherwise returnsAbsent
if the first member of thisRecord
is not anAttr
, or if the first member of thisRecord
is anAttr
whosekey
does not equal thetag
.Used to conditionally get the value of the head
Attr
of a structure, if and only if the key string of the headAttr
is equal to thetag
. Can be used to check if a structure might conform to a nominal type namedtag
, while simultaneously getting the value of thetag
attribute. -
headers
Returns theunflattened
header
of thisRecord
. Theheaders
of thetag
attribute of a structure are like the attributes of an XML element tag; through unlike an XML element,tag
attribute headers are not limited to string keys and values. -
head
-
tail
Returns a view of all but the first member of thisRecord
, if thisRecord
is non-empty; otherwise returns an emptyRecord
, if thisRecord
is itself empty. -
body
-
contains
Returnstrue
if thisRecord
has a member equal toItem.fromObject(item)
; otherwise returnsfalse
if thisRecord
has no member equal toItem.fromObject(item)
. -
contains
Returnstrue
if thisRecord
has a member equal toitem
; otherwise returnsfalse
if thisRecord
has no member equal toitem
. -
containsAll
Returnstrue
if thisRecord
has a member equal to every item initems
; returnsfalse
if any item initems
is not contained in thisRecord
.- Specified by:
containsAll
in interfaceCollection<Item>
- Specified by:
containsAll
in interfaceList<Item>
-
containsKey
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 classValue
-
containsKey
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 tocontainsKey(Value)
, but avoids boxing thekey
string into aText
value.- Overrides:
containsKey
in classValue
-
containsValue
Returnstrue
if thisRecord
has aField
member with a value that is equal to the givenvalue
; otherwise returnsfalse
if thisRecord
has noField
member with a value equal to the givenvalue
.- Overrides:
containsValue
in classValue
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<Item>
-
get
-
get
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 toget(Value)
, but avoids boxing thekey
string into aText
value. -
getAttr
-
getAttr
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 togetAttr(Text)
, but avoids boxing thekey
string into aText
value. -
getSlot
-
getSlot
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 togetSlot(Value)
, but avoids boxing thekey
string into aText
value. -
getField
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
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 togetField(Value)
, but avoids boxing thekey
string into aText
value. -
get
Returns the member of thisRecord
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.- Specified by:
get
in interfaceList<Item>
- Throws:
IndexOutOfBoundsException
- if theindex
is out of bounds.
-
getItem
-
put
-
put
-
put
-
put
-
put
-
put
-
put
-
put
-
put
-
put
-
put
-
put
-
put
-
put
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putAttr
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putSlot
-
putAll
-
set
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
. Equivalent tosetItem(int, Item)
.- Specified by:
set
in interfaceList<Item>
- Throws:
UnsupportedOperationException
- if this is an immutableRecord
.IndexOutOfBoundsException
- if theindex
is out of bounds.
-
setItem
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
.- Throws:
UnsupportedOperationException
- if this is an immutableRecord
.IndexOutOfBoundsException
- if theindex
is out of bounds.
-
setItem
Replaces the member of thisRecord
at the givenindex
with aText
value
, returning the previousItem
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.- Throws:
UnsupportedOperationException
- if this is an immutableRecord
.IndexOutOfBoundsException
- if theindex
is out of bounds.
-
setItem
Replaces the member of thisRecord
at the givenindex
with aNum
value
, returning the previousItem
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.- Throws:
UnsupportedOperationException
- if this is an immutableRecord
.IndexOutOfBoundsException
- if theindex
is out of bounds.
-
setItem
Replaces the member of thisRecord
at the givenindex
with aNum
value
, returning the previousItem
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.- Throws:
UnsupportedOperationException
- if this is an immutableRecord
.IndexOutOfBoundsException
- if theindex
is out of bounds.
-
setItem
Replaces the member of thisRecord
at the givenindex
with aNum
value
, returning the previousItem
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.- Throws:
UnsupportedOperationException
- if this is an immutableRecord
.IndexOutOfBoundsException
- if theindex
is out of bounds.
-
setItem
Replaces the member of thisRecord
at the givenindex
with aNum
value
, returning the previousItem
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.- Throws:
UnsupportedOperationException
- if this is an immutableRecord
.IndexOutOfBoundsException
- if theindex
is out of bounds.
-
setItem
Replaces the member of thisRecord
at the givenindex
with aBool
value
, returning the previousItem
at the givenindex
, if theindex
is greater than or equal to zero, and less than thelength
of thisRecord
.- Throws:
UnsupportedOperationException
- if this is an immutableRecord
.IndexOutOfBoundsException
- if theindex
is out of bounds.
-
add
Description copied from interface:Builder
Adds a single input value to this builder, returningtrue
if the state of the builder changed. -
add
-
add
public boolean add(int item) -
add
public boolean add(long item) -
add
public boolean add(float item) -
add
public boolean add(double item) -
add
public boolean add(boolean item) -
add
-
add
-
add
public void add(int index, int item) -
add
public void add(int index, long item) -
add
public void add(int index, float item) -
add
public void add(int index, double item) -
add
public void add(int index, boolean item) -
add
Description copied from interface:PairBuilder
Adds an input pair to this builder, returningtrue
if the state of the builder changed.- Specified by:
add
in interfacePairBuilder<Value,
Value, Record>
-
addAll
Description copied from interface:Builder
Adds multiple input values to this builder, returningtrue
if the state of the builder changed. -
addAll
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
attr
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
slot
-
item
-
item
-
item
-
item
-
item
-
item
-
item
-
remove
-
remove
-
removeKey
-
removeKey
-
removeAll
-
retainAll
-
clear
public abstract void clear() -
updated
-
updated
-
updatedAttr
- Overrides:
updatedAttr
in classItem
-
updatedAttr
- Overrides:
updatedAttr
in classItem
-
updatedSlot
- Overrides:
updatedSlot
in classItem
-
updatedSlot
- Overrides:
updatedSlot
in classItem
-
appended
-
appended
-
prepended
-
prepended
-
removed
-
removed
-
concat
-
evaluate
-
substitute
- Overrides:
substitute
in classItem
-
stringValue
Description copied from class:Value
Converts thisValue
into aString
value, if possible.- Overrides:
stringValue
in classValue
-
stringValue
Description copied from class:Value
Converts thisValue
into aString
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into astring
value.- Overrides:
stringValue
in classValue
-
isAliased
public boolean isAliased() -
isMutable
public boolean isMutable() -
asMutable
-
alias
public void alias() -
branch
-
commit
Description copied from class:Item
-
bind
Description copied from interface:Builder
Returns the output result of this builder. -
toArray
-
toArray
public <T> T[] toArray(T[] array) -
subList
-
entrySet
-
fieldSet
-
keySet
-
values
-
iterator
-
listIterator
- Specified by:
listIterator
in interfaceList<Item>
-
listIterator
- Specified by:
listIterator
in interfaceList<Item>
-
keyIterator
-
valueIterator
-
fieldIterator
-
typeOrder
public int typeOrder()Description copied from class:Item
Returns the heterogeneous sort order of thisItem
. Used to impose a total order on the set of all items. When comparing two items of different types, the items order according to theirtypeOrder
. -
compareTo
- Specified by:
compareTo
in interfaceComparable<Item>
- Specified by:
compareTo
in classItem
-
compareTo
-
equals
-
hashCode
public int hashCode() -
debug
Description copied from interface:Debug
Writes a developer readable, debug-formatted string representation of this object tooutput
. -
empty
-
create
-
create
-
of
-
of
-
of
-