-
Method Summary
Modifier and TypeMethodDescriptionstatic Value
absent()
void
alias()
bitwiseAnd
(Item that) bitwiseAnd
(Value that) bitwiseXor
(Item that) bitwiseXor
(Value that) body()
boolean
Converts thisValue
into a primitiveboolean
value, if possible.boolean
booleanValue
(boolean orElse) Converts thisValue
into a primitiveboolean
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitiveboolean
value.branch()
builder()
byte
Converts thisValue
into a primitivebyte
value, if possible.byte
byteValue
(byte orElse) Converts thisValue
into a primitivebyte
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivebyte
value.char
Converts thisValue
into a primitivechar
value, if possible.char
charValue
(char orElse) Converts thisValue
into a primitivechar
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivechar
value.commit()
conditional
(Item thenTerm, Item elseTerm) conditional
(Value thenTerm, Value elseTerm) boolean
Returnstrue
if thisValue
is aRecord
that has a member equal toitem
; otherwise returnsfalse
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has no member equal toitem
.boolean
containsKey
(String key) boolean
containsKey
(Value key) boolean
containsValue
(Value value) double
Converts thisValue
into a primitivedouble
value, if possible.double
doubleValue
(double orElse) Converts thisValue
into a primitivedouble
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivedouble
value.static Value
empty()
static Value
extant()
float
Converts thisValue
into a primitivefloat
value, if possible.float
floatValue
(float orElse) Converts thisValue
into a primitivefloat
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivefloat
value.static Value
fromObject
(Object object) getItem
(int index) head()
Returns the value of the first member of thisValue
, if thisValue
is aRecord
, and its first member is anAttr
whosekey
string is equal totag
; otherwise returnsAbsent
if thisValue
is not aRecord
, or if thisValue
is aRecord
whose first member is not anAttr
, or if thisValue
is aRecord
whose first member is anAttr
whosekey
does not equal thetag
.Returns theunflattened
header
of thisValue
, if thisValue
is aRecord
, and its first member is anAttr
whosekey
string is equal totag
; otherwise returnsnull
.Converts thisValue
into aBigInteger
value, if possible.integerValue
(BigInteger orElse) Converts thisValue
into aBigInteger
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into aBigInteger
value.int
intValue()
Converts thisValue
into a primitiveint
value, if possible.int
intValue
(int orElse) Converts thisValue
into a primitiveint
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitiveint
value.inverse()
boolean
boolean
boolean
Returnstrue
if thisValue
is not one of: an emptyRecord
,False
,Extant
, orAbsent
.boolean
boolean
final Value
key()
boolean
int
length()
Returns the number of members contained in thisValue
, if thisValue
is aRecord
; otherwise returns0
if thisValue
is not aRecord
.long
Converts thisValue
into a primitivelong
value, if possible.long
longValue
(long orElse) Converts thisValue
into a primitivelong
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivelong
value.negative()
not()
Converts thisValue
into aNumber
object, if possible.numberValue
(Number orElse) Converts thisValue
into aNumber
object, if possible; otherwise returnsorElse
if thisValue
can't be converted into aNumber
object.positive()
short
Converts thisValue
into a primitiveshort
value, if possible.short
shortValue
(short orElse) Converts thisValue
into a primitiveshort
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitiveshort
value.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.tag()
Returns thekey
string of the first member of thisValue
, if thisValue
is aRecord
, and its first member is anAttr
; otherwise returnsnull
if thisValue
is not aRecord
, or if thisValue
is aRecord
whose first member is not anAttr
.tail()
Returns a view of all but the first member of thisValue
, if thisValue
is a non-emptyRecord
; otherwise returns an emptyRecord
if thisValue
is not aRecord
, of if thisValue
is itself an emptyRecord
.target()
final Value
toValue()
Always returnsthis
because everyValue
is its own value component.Methods inherited from class swim.structure.Item
appended, appended, appended, appended, appended, appended, appended, appended, cast, cast, coerce, coerce, compareTo, concat, debug, display, equals, evaluate, evaluate, filter, filter, globalScope, hashCode, invoke, isConstant, iterator, max, min, precedence, prepended, prepended, prepended, prepended, prepended, prepended, prepended, prepended, substitute, substitute, toString, typeOrder, updated, updated, updated, updated, updated, updated, updated, updated, updated, updated, updated, updated, updated, updated, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedAttr, updatedSlot, updatedSlot, 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.lang.Iterable
forEach, spliterator
-
Method Details
-
isDefined
public boolean isDefined() -
isDistinct
public boolean isDistinct()- Specified by:
isDistinct
in classItem
-
isDefinite
public boolean isDefinite()Returnstrue
if thisValue
is not one of: an emptyRecord
,False
,Extant
, orAbsent
.- Specified by:
isDefinite
in classItem
-
key
-
toValue
Always returnsthis
because everyValue
is its own value component. -
tag
Returns thekey
string of the first member of thisValue
, if thisValue
is aRecord
, and its first member is anAttr
; otherwise returnsnull
if thisValue
is not aRecord
, or if thisValue
is aRecord
whose 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 thisValue
after all attributes have been removed, if thisValue
is aRecord
; otherwise returnsthis
if thisValue
is not aRecord
.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 thisValue
, if thisValue
is aRecord
with exactly one member, and its member is aValue
; returnsExtant
if thisValue
is an emptyRecord
; otherwise returnsthis
if thisValue
is aRecord
with more than one member, or if thisValue
is not aRecord
.Used to convert a unary
Record
into its memberValue
. Facilitates writing code that treats a unaryRecord
equivalently to a bareValue
. -
unflattened
Returnsthis
if thisValue
is aRecord
; returns aRecord
containing just thisValue
, if thisValue
isdistinct
; otherwise returns an emptyRecord
if thisValue
isExtant
orAbsent
. Facilitates writing code that treats a bareValue
equivalently to a unaryRecord
.- Specified by:
unflattened
in classItem
-
header
Returns the value of the first member of thisValue
, if thisValue
is aRecord
, and its first member is anAttr
whosekey
string is equal totag
; otherwise returnsAbsent
if thisValue
is not aRecord
, or if thisValue
is aRecord
whose first member is not anAttr
, or if thisValue
is aRecord
whose first member 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 thisValue
, if thisValue
is aRecord
, and its first member is anAttr
whosekey
string is equal totag
; otherwise returnsnull
.The
headers
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 thisValue
, if thisValue
is a non-emptyRecord
; otherwise returns an emptyRecord
if thisValue
is not aRecord
, of if thisValue
is itself an emptyRecord
. -
body
-
length
public int length()Returns the number of members contained in thisValue
, if thisValue
is aRecord
; otherwise returns0
if thisValue
is not aRecord
. -
contains
Returnstrue
if thisValue
is aRecord
that has a member equal toitem
; otherwise returnsfalse
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has no member equal toitem
. -
containsKey
Returnstrue
if thisValue
is aRecord
that has aField
member with a key that is equal to the givenkey
; otherwise returnsfalse
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has noField
member with a key equal to the givenkey
.- Specified by:
containsKey
in classItem
-
containsKey
Returnstrue
if thisValue
is aRecord
that has aField
with aText
key whose string value is equal to the givenkey
; otherwise returnsfalse
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has noField
member with aText
key whose string value equals the givenkey
. Equivalent tocontainsKey(Value)
, but avoids boxing thekey
string into aText
value.- Specified by:
containsKey
in classItem
-
containsValue
Returnstrue
if thisValue
is aRecord
that has aField
member with a value that is equal to the givenvalue
; otherwise returnsfalse
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has noField
member with a value equal to the givenvalue
.- Specified by:
containsValue
in classItem
-
get
-
get
Returns the value of the lastField
member of thisValue
with aText
key whose string value is equal to the givenkey
; returnsAbsent
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has noField
member with aText
key whose string value equals the givenkey
. Equivalent toget(Value)
, but avoids boxing thekey
string into aText
value. -
getAttr
-
getAttr
Returns the value of the lastAttr
member of thisValue
with aText
key whose string value is equal to the givenkey
; returnsAbsent
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has noAttr
member with aText
key whose string value equals the givenkey
. Equivalent togetAttr(Text)
, but avoids boxing thekey
string into aText
value. -
getSlot
-
getSlot
Returns the value of the lastSlot
member of thisValue
with aText
key whose string value is equal to the givenkey
; returnsAbsent
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has noSlot
member with aText
key whose string value equals the givenkey
. Equivalent togetSlot(Value)
, but avoids boxing thekey
string into aText
value. -
getField
-
getField
Returns the lastField
member of thisValue
with aText
key whose string value is equal to the givenkey
; returnsnull
if thisValue
is not aRecord
, or if thisValue
is aRecord
, but has noField
member with aText
key whose string value equals the givenkey
. Equivalent togetField(Value)
, but avoids boxing thekey
string into aText
value. -
getItem
-
removed
-
removed
-
conditional
- Specified by:
conditional
in classItem
-
conditional
-
or
-
or
-
and
-
and
-
bitwiseOr
-
bitwiseOr
-
bitwiseXor
- Specified by:
bitwiseXor
in classItem
-
bitwiseXor
-
bitwiseAnd
- Specified by:
bitwiseAnd
in classItem
-
bitwiseAnd
-
lt
-
lt
-
le
-
le
-
eq
-
eq
-
ne
-
ne
-
ge
-
ge
-
gt
-
gt
-
plus
-
plus
-
minus
-
minus
-
times
-
times
-
divide
-
divide
-
modulo
-
modulo
-
not
-
bitwiseNot
- Specified by:
bitwiseNot
in classItem
-
negative
-
positive
-
inverse
-
lambda
-
stringValue
Converts thisValue
into aString
value, if possible.- Specified by:
stringValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into aString
value.
-
stringValue
Converts thisValue
into aString
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into astring
value.- Specified by:
stringValue
in classItem
-
byteValue
public byte byteValue()Converts thisValue
into a primitivebyte
value, if possible.- Specified by:
byteValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into a primitivebyte
value.
-
byteValue
public byte byteValue(byte orElse) Converts thisValue
into a primitivebyte
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivebyte
value. -
shortValue
public short shortValue()Converts thisValue
into a primitiveshort
value, if possible.- Specified by:
shortValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into a primitiveshort
value.
-
shortValue
public short shortValue(short orElse) Converts thisValue
into a primitiveshort
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitiveshort
value.- Specified by:
shortValue
in classItem
-
intValue
public int intValue()Converts thisValue
into a primitiveint
value, if possible.- Specified by:
intValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into a primitiveint
value.
-
intValue
public int intValue(int orElse) Converts thisValue
into a primitiveint
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitiveint
value. -
longValue
public long longValue()Converts thisValue
into a primitivelong
value, if possible.- Specified by:
longValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into a primitivelong
value.
-
longValue
public long longValue(long orElse) Converts thisValue
into a primitivelong
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivelong
value. -
floatValue
public float floatValue()Converts thisValue
into a primitivefloat
value, if possible.- Specified by:
floatValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into a primitivefloat
value.
-
floatValue
public float floatValue(float orElse) Converts thisValue
into a primitivefloat
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivefloat
value.- Specified by:
floatValue
in classItem
-
doubleValue
public double doubleValue()Converts thisValue
into a primitivedouble
value, if possible.- Specified by:
doubleValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into a primitivedouble
value.
-
doubleValue
public double doubleValue(double orElse) Converts thisValue
into a primitivedouble
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivedouble
value.- Specified by:
doubleValue
in classItem
-
integerValue
Converts thisValue
into aBigInteger
value, if possible.- Specified by:
integerValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into aBigInteger
value.
-
integerValue
Converts thisValue
into aBigInteger
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into aBigInteger
value.- Specified by:
integerValue
in classItem
-
numberValue
Converts thisValue
into aNumber
object, if possible.- Specified by:
numberValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into aNumber
object.
-
numberValue
Converts thisValue
into aNumber
object, if possible; otherwise returnsorElse
if thisValue
can't be converted into aNumber
object.- Specified by:
numberValue
in classItem
-
charValue
public char charValue()Converts thisValue
into a primitivechar
value, if possible.- Specified by:
charValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into a primitivechar
value.
-
charValue
public char charValue(char orElse) Converts thisValue
into a primitivechar
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitivechar
value. -
booleanValue
public boolean booleanValue()Converts thisValue
into a primitiveboolean
value, if possible.- Specified by:
booleanValue
in classItem
- Throws:
UnsupportedOperationException
- if thisValue
can't be converted into a primitiveboolean
value.
-
booleanValue
public boolean booleanValue(boolean orElse) Converts thisValue
into a primitiveboolean
value, if possible; otherwise returnsorElse
if thisValue
can't be converted into a primitiveboolean
value.- Specified by:
booleanValue
in classItem
-
isAliased
public boolean isAliased() -
isMutable
public boolean isMutable() -
alias
public void alias() -
branch
-
commit
Description copied from class:Item
-
keyEquals
-
builder
-
empty
-
extant
-
absent
-
fromObject
-