- 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(boolean item) booleanadd(double item) booleanadd(float item) booleanadd(int item) voidadd(int index, boolean item) voidadd(int index, double item) voidadd(int index, float item) voidadd(int index, int item) voidadd(int index, long item) voidabstract voidbooleanadd(long item) booleanabstract booleanAdds a single input value to this builder, returningtrueif the state of the builder changed.booleanAdds an input pair to this builder, returningtrueif the state of the builder changed.booleanaddAll(int index, Collection<? extends Item> items) booleanaddAll(Collection<? extends Item> items) Adds multiple input values to this builder, returningtrueif the state of the builder changed.voidalias()bind()Returns the output result of this builder.body()branch()abstract voidclear()commit()intintbooleanReturnstrueif thisRecordhas a member equal toItem.fromObject(item); otherwise returnsfalseif thisRecordhas no member equal toItem.fromObject(item).booleanReturnstrueif thisRecordhas a member equal toitem; otherwise returnsfalseif thisRecordhas no member equal toitem.booleancontainsAll(Collection<?> items) Returnstrueif thisRecordhas a member equal to every item initems; returnsfalseif any item initemsis not contained in thisRecord.booleancontainsKey(String key) Returnstrueif thisRecordhas aFieldmember with a key that is equal to the givenkey; otherwise returnsfalseif thisRecordhas noFieldmember with a key equal to the givenkey.booleancontainsKey(Value key) Returnstrueif thisRecordhas aFieldmember with a key that is equal to the givenkey; otherwise returnsfalseif thisRecordhas noFieldmember with a key equal to the givenkey.booleancontainsValue(Value value) Returnstrueif thisRecordhas aFieldmember with a value that is equal to the givenvalue; otherwise returnsfalseif thisRecordhas noFieldmember with a value equal to the givenvalue.static Recordcreate()static Recordcreate(int initialSize) <T> Output<T>Writes a developer readable, debug-formatted string representation of this object tooutput.static Recordempty()entrySet()booleanevaluate(Interpreter interpreter) intReturns the number ofFieldmembers contained in thisRecord.fieldSet()Returns the sole member of thisRecord, if thisRecordhas exactly one member, and its member is aValue; returnsExtantif thisRecordis empty; otherwise returnsthisif thisRecordhas more than one member.abstract Itemget(int index) Returns the member of thisRecordat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.Returns the lastFieldmember of thisRecordwhose key is equal to the givenkey; returnsnullif thisRecordhas noFieldmember with akeyequal to the givenkey.Returns the lastFieldmember of thisRecordwhose key is equal to the givenkey; returnsnullif thisRecordhas noFieldmember with akeyequal to the givenkey.abstract ItemgetItem(int index) inthashCode()head()intbooleanbooleanisArray()booleanbooleanReturnstrueif thisValueis not one of: an emptyRecord,False,Extant, orAbsent.abstract booleanisEmpty()Returnstrueif thisRecordhas no members.booleanbooleanisObject()item(boolean item) item(double item) item(float item) item(int item) item(long item) iterator()keySet()intlastIndexOf(Object item) final intlength()Returns the number of members contained in thisRecord; equivalent tosize().listIterator(int index) static Recordof()static Recordstatic Recordvoidabstract Itemremove(int index) booleanbooleanremoveAll(Collection<?> items) booleanbooleanbooleanretainAll(Collection<?> items) Replaces the member of thisRecordat the givenindexwith a newitem, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof 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 ItemReplaces the member of thisRecordat the givenindexwith a newitem, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.abstract intsize()Returns the number of members contained in thisRecord.Converts thisValueinto aStringvalue, if possible.stringValue(String orElse) Converts thisValueinto aStringvalue, if possible; otherwise returnsorElseif thisValuecan't be converted into astringvalue.subList(int fromIndex, int toIndex) substitute(Interpreter interpreter) tag()Returns thekeystring of the first member of thisRecord, if the first member is anAttr; otherwise returnsnullif the first member is not anAttr.tail()Returns a view of all but the first member of thisRecord, if thisRecordis non-empty; otherwise returns an emptyRecord, if thisRecordis itself empty.target()Returns theflattenedmembers of thisRecordafter all attributes have been removed.Item[]toArray()<T> T[]toArray(T[] array) intReturns the heterogeneous sort order of thisItem.ReturnsthisRecord.updatedAttr(String key, Value value) updatedAttr(Text key, Value value) updatedSlot(String key, Value value) updatedSlot(Value key, Value value) intReturns the number ofValuemembers 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, toValueMethods 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, updatedSlotMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Constructor Details
-
Record
public Record()
-
-
Method Details
-
isDefinite
public boolean isDefinite()Description copied from class:ValueReturnstrueif thisValueis not one of: an emptyRecord,False,Extant, orAbsent.- Overrides:
isDefinitein classValue
-
isEmpty
public abstract boolean isEmpty()Returnstrueif thisRecordhas 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 ofFieldmembers contained in thisRecord. -
valueCount
public int valueCount()Returns the number ofValuemembers contained in thisRecord. -
isConstant
public boolean isConstant()Description copied from class:Item- Specified by:
isConstantin classItem
-
tag
Returns thekeystring of the first member of thisRecord, if the first member is anAttr; otherwise returnsnullif the 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
Returns theflattenedmembers of thisRecordafter all attributes have been removed.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
Returns the sole member of thisRecord, if thisRecordhas exactly one member, and its member is aValue; returnsExtantif thisRecordis empty; otherwise returnsthisif thisRecordhas more than one member.Used to convert a unary
Recordinto its memberValue. Facilitates writing code that treats a unaryRecordequivalently to a bareValue. -
unflattened
ReturnsthisRecord.- Overrides:
unflattenedin classValue
-
header
Returns the value of the first member of thisRecord, if the first member is anAttrwhosekeystring is equal totag; otherwise returnsAbsentif the first member of thisRecordis not anAttr, or if the first member of thisRecordis 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
Returns theunflattenedheaderof thisRecord. Theheadersof 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
-
tail
Returns a view of all but the first member of thisRecord, if thisRecordis non-empty; otherwise returns an emptyRecord, if thisRecordis itself empty. -
body
-
contains
Returnstrueif thisRecordhas a member equal toItem.fromObject(item); otherwise returnsfalseif thisRecordhas no member equal toItem.fromObject(item). -
contains
Returnstrueif thisRecordhas a member equal toitem; otherwise returnsfalseif thisRecordhas no member equal toitem. -
containsAll
Returnstrueif thisRecordhas a member equal to every item initems; returnsfalseif any item initemsis not contained in thisRecord.- Specified by:
containsAllin interfaceCollection<Item>- Specified by:
containsAllin interfaceList<Item>
-
containsKey
Returnstrueif thisRecordhas aFieldmember with a key that is equal to the givenkey; otherwise returnsfalseif thisRecordhas noFieldmember with a key equal to the givenkey.- Overrides:
containsKeyin classValue
-
containsKey
Returnstrueif thisRecordhas aFieldmember with a key that is equal to the givenkey; otherwise returnsfalseif thisRecordhas noFieldmember with a key equal to the givenkey. Equivalent tocontainsKey(Value), but avoids boxing thekeystring into aTextvalue.- Overrides:
containsKeyin classValue
-
containsValue
Returnstrueif thisRecordhas aFieldmember with a value that is equal to the givenvalue; otherwise returnsfalseif thisRecordhas noFieldmember with a value equal to the givenvalue.- Overrides:
containsValuein classValue
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<Item>
-
get
-
get
Returns the value of the lastFieldmember of thisRecordwhose key is equal to the givenkey; returnsAbsentif thisRecordhas noFieldmember with a key equal to the givenkey. Equivalent toget(Value), but avoids boxing thekeystring into aTextvalue. -
getAttr
-
getAttr
Returns the value of the lastAttrmember of thisRecordwhose key is equal to the givenkey; returnsAbsentif thisRecordhas noAttrmember with a key equal to the givenkey. Equivalent togetAttr(Text), but avoids boxing thekeystring into aTextvalue. -
getSlot
-
getSlot
Returns the value of the lastSlotmember of thisRecordwhose key is equal to the givenkey; returnsAbsentif thisRecordhas noSlotmember with a key equal to the givenkey. Equivalent togetSlot(Value), but avoids boxing thekeystring into aTextvalue. -
getField
Returns the lastFieldmember of thisRecordwhose key is equal to the givenkey; returnsnullif thisRecordhas noFieldmember with akeyequal to the givenkey. -
getField
Returns the lastFieldmember of thisRecordwhose key is equal to the givenkey; returnsnullif thisRecordhas noFieldmember with akeyequal to the givenkey. Equivalent togetField(Value), but avoids boxing thekeystring into aTextvalue. -
get
Returns the member of thisRecordat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.- Specified by:
getin interfaceList<Item>- Throws:
IndexOutOfBoundsException- if theindexis 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 thisRecordat the givenindexwith a newitem, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord. Equivalent tosetItem(int, Item).- Specified by:
setin interfaceList<Item>- Throws:
UnsupportedOperationException- if this is an immutableRecord.IndexOutOfBoundsException- if theindexis out of bounds.
-
setItem
Replaces the member of thisRecordat the givenindexwith a newitem, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.- Throws:
UnsupportedOperationException- if this is an immutableRecord.IndexOutOfBoundsException- if theindexis out of bounds.
-
setItem
Replaces the member of thisRecordat the givenindexwith aTextvalue, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.- Throws:
UnsupportedOperationException- if this is an immutableRecord.IndexOutOfBoundsException- if theindexis out of bounds.
-
setItem
Replaces the member of thisRecordat the givenindexwith aNumvalue, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.- Throws:
UnsupportedOperationException- if this is an immutableRecord.IndexOutOfBoundsException- if theindexis out of bounds.
-
setItem
Replaces the member of thisRecordat the givenindexwith aNumvalue, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.- Throws:
UnsupportedOperationException- if this is an immutableRecord.IndexOutOfBoundsException- if theindexis out of bounds.
-
setItem
Replaces the member of thisRecordat the givenindexwith aNumvalue, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.- Throws:
UnsupportedOperationException- if this is an immutableRecord.IndexOutOfBoundsException- if theindexis out of bounds.
-
setItem
Replaces the member of thisRecordat the givenindexwith aNumvalue, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.- Throws:
UnsupportedOperationException- if this is an immutableRecord.IndexOutOfBoundsException- if theindexis out of bounds.
-
setItem
Replaces the member of thisRecordat the givenindexwith aBoolvalue, returning the previousItemat the givenindex, if theindexis greater than or equal to zero, and less than thelengthof thisRecord.- Throws:
UnsupportedOperationException- if this is an immutableRecord.IndexOutOfBoundsException- if theindexis out of bounds.
-
add
Description copied from interface:BuilderAdds a single input value to this builder, returningtrueif 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:PairBuilderAdds an input pair to this builder, returningtrueif the state of the builder changed.- Specified by:
addin interfacePairBuilder<Value,Value, Record>
-
addAll
Description copied from interface:BuilderAdds multiple input values to this builder, returningtrueif 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:
updatedAttrin classItem
-
updatedAttr
- Overrides:
updatedAttrin classItem
-
updatedSlot
- Overrides:
updatedSlotin classItem
-
updatedSlot
- Overrides:
updatedSlotin classItem
-
appended
-
appended
-
prepended
-
prepended
-
removed
-
removed
-
concat
-
evaluate
-
substitute
- Overrides:
substitutein classItem
-
stringValue
Description copied from class:ValueConverts thisValueinto aStringvalue, if possible.- Overrides:
stringValuein classValue
-
stringValue
Description copied from class:ValueConverts thisValueinto aStringvalue, if possible; otherwise returnsorElseif thisValuecan't be converted into astringvalue.- Overrides:
stringValuein 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:BuilderReturns the output result of this builder. -
toArray
-
toArray
public <T> T[] toArray(T[] array) -
subList
-
entrySet
-
fieldSet
-
keySet
-
values
-
iterator
-
listIterator
- Specified by:
listIteratorin interfaceList<Item>
-
listIterator
- Specified by:
listIteratorin interfaceList<Item>
-
keyIterator
-
valueIterator
-
fieldIterator
-
typeOrder
public int typeOrder()Description copied from class:ItemReturns 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:
compareToin interfaceComparable<Item>- Specified by:
compareToin classItem
-
compareTo
-
equals
-
hashCode
public int hashCode() -
debug
Description copied from interface:DebugWrites a developer readable, debug-formatted string representation of this object tooutput. -
empty
-
create
-
create
-
of
-
of
-
of
-