- java.lang.Object
-
- swim.structure.Item
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Itemabsent()abstract voidalias()abstract Itemand(Item that)Recordappended(boolean item)Recordappended(double item)Recordappended(float item)Recordappended(int item)Recordappended(long item)Recordappended(Object... items)Recordappended(String item)Recordappended(Item item)abstract ItembitwiseAnd(Item that)abstract ItembitwiseNot()abstract ItembitwiseOr(Item that)abstract ItembitwiseXor(Item that)abstract Valuebody()abstract booleanbooleanValue()Converts thisIteminto a primitivebooleanvalue, if possible.abstract booleanbooleanValue(boolean orElse)Converts thisIteminto a primitivebooleanvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivebooleanvalue.abstract Itembranch()abstract bytebyteValue()Converts thisIteminto a primitivebytevalue, if possible.abstract bytebyteValue(byte orElse)Converts thisIteminto a primitivebytevalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivebytevalue.<T> Tcast(Form<T> form)<T> Tcast(Form<T> form, T orElse)abstract charcharValue()Converts thisIteminto a primitivecharvalue, if possible.abstract charcharValue(char orElse)Converts thisIteminto a primitivecharvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivecharvalue.<T> Tcoerce(Form<T> form)<T> Tcoerce(Form<T> form, T orElse)abstract Itemcommit()abstract intcompareTo(Item other)Recordconcat(Item that)abstract Itemconditional(Item thenTerm, Item elseTerm)abstract booleancontains(Item item)Returnstrueif thisItemis aRecordthat has a member equal toitem; otherwise returnsfalseif thisItemis not aRecord, or if thisItemis aRecord, but has no member equal toitem.abstract booleancontainsKey(String key)abstract booleancontainsKey(Value key)abstract booleancontainsValue(Value value)abstract <T> Output<T>debug(Output<T> output)Writes a developer readable, debug-formatted string representation of this object tooutput.<T> Output<T>display(Output<T> output)Writes a human readable, display-formatted string representation of this object tooutput.abstract Itemdivide(Item that)abstract doubledoubleValue()Converts thisIteminto a primitivedoublevalue, if possible.abstract doubledoubleValue(double orElse)Converts thisIteminto a primitivedoublevalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivedoublevalue.static Itemempty()Itemeq(Item that)abstract booleanequals(Object other)Itemevaluate(Interpreter interpreter)Itemevaluate(Item scope)static Itemextant()Selectorfilter()Selectorfilter(Item predicate)abstract Valueflattened()Returns the sole member of thisItem, if thisItemis aRecordwith exactly one member, and its member is aValue; returnsExtantif thisItemis an emptyRecord; returnsAbsentif thisItemis aField; otherwise returnsthisif thisItemis aRecordwith more than one member, or if thisItemis a non-RecordValue.abstract floatfloatValue()Converts thisIteminto a primitivefloatvalue, if possible.abstract floatfloatValue(float orElse)Converts thisIteminto a primitivefloatvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivefloatvalue.static ItemfromObject(Object object)Itemge(Item that)abstract Valueget(String key)abstract Valueget(Value key)abstract ValuegetAttr(String key)abstract ValuegetAttr(Text key)abstract FieldgetField(String key)abstract FieldgetField(Value key)abstract ItemgetItem(int index)abstract ValuegetSlot(String key)abstract ValuegetSlot(Value key)static ItemglobalScope()Itemgt(Item that)abstract inthashCode()abstract Itemhead()abstract Valueheader(String tag)Returns the value of the first member of thisItem, if thisItemis aRecord, and its first member is anAttrwhosekeystring is equal totag; otherwise returnsAbsentif thisItemis not aRecord, or if thisItemis aRecordwhose first member is not anAttr, or if thisItemis aRecordwhose first member is anAttrwhosekeydoes not equal thetag.abstract Recordheaders(String tag)Returns theunflattenedheaderof thisItem, if thisItemis aRecord, and its first member is anAttrwhosekeystring is equal totag; otherwise returnsnull.abstract BigIntegerintegerValue()Converts thisIteminto aBigIntegervalue, if possible.abstract BigIntegerintegerValue(BigInteger orElse)Converts thisIteminto aBigIntegervalue, if possible; otherwise returnsorElseif thisItemcan't be converted into aBigIntegervalue.abstract intintValue()Converts thisIteminto a primitiveintvalue, if possible.abstract intintValue(int orElse)Converts thisIteminto a primitiveintvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitiveintvalue.abstract Iteminverse()Iteminvoke(Value args)abstract booleanisAliased()abstract booleanisConstant()abstract booleanisDefined()abstract booleanisDefinite()Returnstrueif thisItemis not one of: an emptyRecord,False,Extant, orAbsent.abstract booleanisDistinct()abstract booleanisMutable()Iterator<Item>iterator()abstract Valuekey()abstract booleankeyEquals(Object key)abstract Valuelambda(Value template)Itemle(Item that)abstract intlength()Returns the number of members contained in thisItem, if thisItemis aRecord; otherwise returns0if thisItemis not aRecord.abstract longlongValue()Converts thisIteminto a primitivelongvalue, if possible.abstract longlongValue(long orElse)Converts thisIteminto a primitivelongvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivelongvalue.Itemlt(Item that)Itemmax(Item that)Itemmin(Item that)abstract Itemminus(Item that)abstract Itemmodulo(Item that)Itemne(Item that)abstract Itemnegative()abstract Itemnot()abstract NumbernumberValue()Converts thisIteminto aNumberobject, if possible.abstract NumbernumberValue(Number orElse)Converts thisIteminto aNumberobject, if possible; otherwise returnsorElseif thisItemcan't be converted into aNumberobject.abstract Itemor(Item that)abstract Itemplus(Item that)abstract Itempositive()intprecedence()Recordprepended(boolean item)Recordprepended(double item)Recordprepended(float item)Recordprepended(int item)Recordprepended(long item)Recordprepended(Object... items)Recordprepended(String item)Recordprepended(Item item)abstract Itemremoved(String key)abstract Itemremoved(Value key)abstract shortshortValue()Converts thisIteminto a primitiveshortvalue, if possible.abstract shortshortValue(short orElse)Converts thisIteminto a primitiveshortvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitiveshortvalue.abstract StringstringValue()Converts thisIteminto aStringvalue, if possible.abstract StringstringValue(String orElse)Converts thisIteminto aStringvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into astringvalue.Itemsubstitute(Interpreter interpreter)Itemsubstitute(Item scope)abstract Stringtag()abstract Recordtail()Returns a view of all but the first member of thisItem, if thisItemis a non-emptyRecord; otherwise returns an emptyRecordif thisItemis not aRecord, or if thisItemis itself an emptyRecord.abstract Valuetarget()abstract Itemtimes(Item that)StringtoString()abstract ValuetoValue()Returns the value component of thisItem, if thisItemis aField; otherwise returnsthisif thisItemis aValue.abstract inttypeOrder()Returns the heterogeneous sort order of thisItem.abstract Recordunflattened()Recordupdated(String key, boolean value)Recordupdated(String key, double value)Recordupdated(String key, float value)Recordupdated(String key, int value)Recordupdated(String key, long value)Recordupdated(String key, String value)Recordupdated(String key, Value value)Recordupdated(Value key, boolean value)Recordupdated(Value key, double value)Recordupdated(Value key, float value)Recordupdated(Value key, int value)Recordupdated(Value key, long value)Recordupdated(Value key, String value)Recordupdated(Value key, Value value)RecordupdatedAttr(String key, boolean value)RecordupdatedAttr(String key, double value)RecordupdatedAttr(String key, float value)RecordupdatedAttr(String key, int value)RecordupdatedAttr(String key, long value)RecordupdatedAttr(String key, String value)RecordupdatedAttr(String key, Value value)RecordupdatedAttr(Text key, boolean value)RecordupdatedAttr(Text key, double value)RecordupdatedAttr(Text key, float value)RecordupdatedAttr(Text key, int value)RecordupdatedAttr(Text key, long value)RecordupdatedAttr(Text key, String value)RecordupdatedAttr(Text key, Value value)RecordupdatedSlot(String key, boolean value)RecordupdatedSlot(String key, double value)RecordupdatedSlot(String key, float value)RecordupdatedSlot(String key, int value)RecordupdatedSlot(String key, long value)RecordupdatedSlot(String key, String value)RecordupdatedSlot(String key, Value value)RecordupdatedSlot(Value key, boolean value)RecordupdatedSlot(Value key, double value)RecordupdatedSlot(Value key, float value)RecordupdatedSlot(Value key, int value)RecordupdatedSlot(Value key, long value)RecordupdatedSlot(Value key, String value)RecordupdatedSlot(Value key, Value value)-
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 Detail
-
isDefined
public abstract boolean isDefined()
-
isDistinct
public abstract boolean isDistinct()
-
isDefinite
public abstract boolean isDefinite()
Returnstrueif thisItemis not one of: an emptyRecord,False,Extant, orAbsent.
-
isConstant
public abstract boolean isConstant()
-
key
public abstract Value key()
-
toValue
public abstract Value toValue()
Returns the value component of thisItem, if thisItemis aField; otherwise returnsthisif thisItemis aValue.
-
tag
public abstract String tag()
Returns thekeystring of the first member of thisItem, if thisItemis aRecord, and its first member is anAttr; otherwise returnsnullif thisItemis not aRecord, or if thisItemis aRecordwhose first member is not anAttr.Used to concisely get the name of the discriminating attribute of a structure. The
tagcan be used to discern the nominal type of a polymorphic structure, similar to an XML element tag.
-
target
public abstract Value target()
Returns theflattenedmembers of thisItemafter all attributes have been removed, if thisItemis aRecord; otherwise returnsthisif thisItemis a non-RecordValue, or returns the value component if thisItemis aField.Used to concisely get the scalar value of an attributed structure. An attributed structure is a
Recordwith one or more attributes that modify one or more other members.
-
flattened
public abstract Value flattened()
Returns the sole member of thisItem, if thisItemis aRecordwith exactly one member, and its member is aValue; returnsExtantif thisItemis an emptyRecord; returnsAbsentif thisItemis aField; otherwise returnsthisif thisItemis aRecordwith more than one member, or if thisItemis a non-RecordValue.Used to convert a unary
Recordinto its memberValue. Facilitates writing code that treats a unaryRecordequivalently to a bareValue.
-
unflattened
public abstract Record unflattened()
-
header
public abstract Value header(String tag)
Returns the value of the first member of thisItem, if thisItemis aRecord, and its first member is anAttrwhosekeystring is equal totag; otherwise returnsAbsentif thisItemis not aRecord, or if thisItemis aRecordwhose first member is not anAttr, or if thisItemis aRecordwhose first member is anAttrwhosekeydoes not equal thetag.Used to conditionally get the value of the head
Attrof a structure, if and only if the key string of the headAttris equal to thetag. Can be used to check if a structure might conform to a nominal type namedtag, while simultaneously getting the value of thetagattribute.
-
headers
public abstract Record headers(String tag)
Returns theunflattenedheaderof thisItem, if thisItemis aRecord, and its first member is anAttrwhosekeystring is equal totag; otherwise returnsnull.The
headersof thetagattribute of a structure are like the attributes of an XML element tag; through unlike an XML element,tagattribute headers are not limited to string keys and values.
-
head
public abstract Item head()
-
tail
public abstract Record tail()
Returns a view of all but the first member of thisItem, if thisItemis a non-emptyRecord; otherwise returns an emptyRecordif thisItemis not aRecord, or if thisItemis itself an emptyRecord.
-
body
public abstract Value body()
-
length
public abstract int length()
Returns the number of members contained in thisItem, if thisItemis aRecord; otherwise returns0if thisItemis not aRecord.
-
contains
public abstract boolean contains(Item item)
Returnstrueif thisItemis aRecordthat has a member equal toitem; otherwise returnsfalseif thisItemis not aRecord, or if thisItemis aRecord, but has no member equal toitem.
-
containsKey
public abstract boolean containsKey(Value key)
-
containsKey
public abstract boolean containsKey(String key)
Returnstrueif thisItemis aRecordthat has aFieldwith aTextkey whose string value is equal to the givenkey; otherwise returnsfalseif thisItemis not aRecord, or if thisItemis aRecord, but has noFieldmember with aTextkey whose string value equals the givenkey. Equivalent tocontainsKey(Value), but avoids boxing thekeystring into aTextvalue.
-
containsValue
public abstract boolean containsValue(Value value)
-
get
public abstract Value get(String key)
Returns the value of the lastFieldmember of thisItemwith aTextkey whose string value is equal to the givenkey; returnsAbsentif thisItemis not aRecord, or if thisItemis aRecord, but has noFieldmember with aTextkey whose string value equals the givenkey. Equivalent toget(Value), but avoids boxing thekeystring into aTextvalue.
-
getAttr
public abstract Value getAttr(String key)
Returns the value of the lastAttrmember of thisItemwith aTextkey whose string value is equal to the givenkey; returnsAbsentif thisItemis not aRecord, or if thisItemis aRecord, but has noAttrmember with aTextkey whose string value equals the givenkey. Equivalent togetAttr(Text), but avoids boxing thekeystring into aTextvalue.
-
getSlot
public abstract Value getSlot(String key)
Returns the value of the lastSlotmember of thisItemwith aTextkey whose string value is equal to the givenkey; returnsAbsentif thisItemis not aRecord, or if thisItemis aRecord, but has noSlotmember with aTextkey whose string value equals the givenkey. Equivalent togetSlot(Value), but avoids boxing thekeystring into aTextvalue.
-
getField
public abstract Field getField(String key)
Returns the lastFieldmember of thisItemwith aTextkey whose string value is equal to the givenkey; returnsnullif thisItemis not aRecord, or if thisItemis aRecord, but has noFieldmember with aTextkey whose string value equals the givenkey. Equivalent togetField(Value), but avoids boxing thekeystring into aTextvalue.
-
getItem
public abstract Item getItem(int index)
-
appended
public Record appended(int item)
-
appended
public Record appended(long item)
-
appended
public Record appended(float item)
-
appended
public Record appended(double item)
-
appended
public Record appended(boolean item)
-
prepended
public Record prepended(int item)
-
prepended
public Record prepended(long item)
-
prepended
public Record prepended(float item)
-
prepended
public Record prepended(double item)
-
prepended
public Record prepended(boolean item)
-
not
public abstract Item not()
-
bitwiseNot
public abstract Item bitwiseNot()
-
negative
public abstract Item negative()
-
positive
public abstract Item positive()
-
inverse
public abstract Item inverse()
-
filter
public Selector filter()
-
evaluate
public Item evaluate(Interpreter interpreter)
-
substitute
public Item substitute(Interpreter interpreter)
-
stringValue
public abstract String stringValue()
Converts thisIteminto aStringvalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into aStringvalue.
-
stringValue
public abstract String stringValue(String orElse)
Converts thisIteminto aStringvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into astringvalue.
-
byteValue
public abstract byte byteValue()
Converts thisIteminto a primitivebytevalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into a primitivebytevalue.
-
byteValue
public abstract byte byteValue(byte orElse)
Converts thisIteminto a primitivebytevalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivebytevalue.
-
shortValue
public abstract short shortValue()
Converts thisIteminto a primitiveshortvalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into a primitiveshortvalue.
-
shortValue
public abstract short shortValue(short orElse)
Converts thisIteminto a primitiveshortvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitiveshortvalue.
-
intValue
public abstract int intValue()
Converts thisIteminto a primitiveintvalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into a primitiveintvalue.
-
intValue
public abstract int intValue(int orElse)
Converts thisIteminto a primitiveintvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitiveintvalue.
-
longValue
public abstract long longValue()
Converts thisIteminto a primitivelongvalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into a primitivelongvalue.
-
longValue
public abstract long longValue(long orElse)
Converts thisIteminto a primitivelongvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivelongvalue.
-
floatValue
public abstract float floatValue()
Converts thisIteminto a primitivefloatvalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into a primitivefloatvalue.
-
floatValue
public abstract float floatValue(float orElse)
Converts thisIteminto a primitivefloatvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivefloatvalue.
-
doubleValue
public abstract double doubleValue()
Converts thisIteminto a primitivedoublevalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into a primitivedoublevalue.
-
doubleValue
public abstract double doubleValue(double orElse)
Converts thisIteminto a primitivedoublevalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivedoublevalue.
-
integerValue
public abstract BigInteger integerValue()
Converts thisIteminto aBigIntegervalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into aBigIntegervalue.
-
integerValue
public abstract BigInteger integerValue(BigInteger orElse)
Converts thisIteminto aBigIntegervalue, if possible; otherwise returnsorElseif thisItemcan't be converted into aBigIntegervalue.
-
numberValue
public abstract Number numberValue()
Converts thisIteminto aNumberobject, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into aNumberobject.
-
numberValue
public abstract Number numberValue(Number orElse)
Converts thisIteminto aNumberobject, if possible; otherwise returnsorElseif thisItemcan't be converted into aNumberobject.
-
charValue
public abstract char charValue()
Converts thisIteminto a primitivecharvalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into a primitivecharvalue.
-
charValue
public abstract char charValue(char orElse)
Converts thisIteminto a primitivecharvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivecharvalue.
-
booleanValue
public abstract boolean booleanValue()
Converts thisIteminto a primitivebooleanvalue, if possible.- Throws:
UnsupportedOperationException- if thisItemcan't be converted into a primitivebooleanvalue.
-
booleanValue
public abstract boolean booleanValue(boolean orElse)
Converts thisIteminto a primitivebooleanvalue, if possible; otherwise returnsorElseif thisItemcan't be converted into a primitivebooleanvalue.
-
cast
public <T> T cast(Form<T> form)
-
cast
public <T> T cast(Form<T> form, T orElse)
-
coerce
public <T> T coerce(Form<T> form)
-
coerce
public <T> T coerce(Form<T> form, T orElse)
-
isAliased
public abstract boolean isAliased()
-
isMutable
public abstract boolean isMutable()
-
alias
public abstract void alias()
-
branch
public abstract Item branch()
-
commit
public abstract Item commit()
-
precedence
public int precedence()
-
typeOrder
public abstract int typeOrder()
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
public abstract int compareTo(Item other)
- Specified by:
compareToin interfaceComparable<Item>
-
keyEquals
public abstract boolean keyEquals(Object key)
-
debug
public abstract <T> Output<T> debug(Output<T> output)
Description copied from interface:DebugWrites a developer readable, debug-formatted string representation of this object tooutput.
-
display
public <T> Output<T> display(Output<T> output)
Description copied from interface:DisplayWrites a human readable, display-formatted string representation of this object tooutput.
-
empty
public static Item empty()
-
extant
public static Item extant()
-
absent
public static Item absent()
-
globalScope
public static Item globalScope()
-
-