Class Values<E>
java.lang.Object
gnu.lists.AbstractSequence<E>
gnu.mapping.Values<E>
- All Implemented Interfaces:
Consumable, Externalizable, Serializable
- Direct Known Subclasses:
Values.FromArray, Values.FromList, Values.FromTreeList, Values.Values2
Encapsulate multiple values in a single object.
In Scheme and Lisp mainly used to return multiple values from a function.
In XQuery used to represent a non-singleton sequence.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn implementation of Values that stores the values in an array.static classAn implementation of Values that uses a java.util.List.static classAn implementation of Values that uses a TreeList.static classA specialization of Values for exactly 2 values. -
Field Summary
FieldsFields inherited from class AbstractSequence
noInts -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApply a Procedure with these values as the arguments.If a simple value, return that value.static voidcheckFinalPos(Object values, int pos) static intcountValues(Object value) static ObjectgetFromPos(Object values, int pos) static ObjectgetFromPosFinal(Object values, int pos) Object[]Get the values encapsulated.static intstatic Valuesmake()static <E> Objectmake(E[] vals) Create a value for each element of an array.static ObjectExtract a value (single or Values) from a sub-range of a TreeList.static <E> ObjectCreate a value for each element of a list.static <E> Values<E> makeFromArray(E... vals) protected intnextIndex(int ipos) Get the offset from the beginning corresponding to a position cookie.static intHelper method called by compiled code.static ObjectHelper method called by compiled code.voidstatic Objectstatic <E, V1 extends E, V2 extends E>
Values.Values2<E, V1, V2> values2(V1 val1, V2 val2) voidstatic voidwriteValues(Object value, Consumer out) Methods inherited from class AbstractSequence
add, add, addAll, addAll, addPos, asImmutable, badRank, boundedHash, checkCanWrite, checkRank, clear, compare, compare, compare, consume, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createPos, createRelativePos, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, elements, endPos, equals, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, get, get, get, get, getAttribute, getAttributeLength, getBooleanRaw, getByteRaw, getCharRaw, getContainingSequenceSize, getDoubleRaw, getElementKind, getFloatRaw, getIndexDifference, getInt, getInt, getInt, getInt, getInt, getIntRaw, getIterator, getIterator, getIteratorAtPos, getLongRaw, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getRaw, getRowMajor, getShortRaw, getSize, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hashCode, hasNext, hasPrevious, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setAt, setBuffer, setPosNext, setPosPrevious, setRaw, size, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported, unsupportedExceptionMethods inherited from interface Consumable
consumeMethods inherited from interface Externalizable
readExternal
-
Field Details
-
noArgs
-
empty
-
-
Constructor Details
-
Values
protected Values()
-
-
Method Details
-
getValues
Get the values encapsulated. -
values
-
values2
-
make
-
make
Create a value for each element of an array.- Parameters:
vals- values to use. The array should be immutable, as may be re-used for the result.
-
makeFromArray
-
make
-
make
-
canonicalize
If a simple value, return that value. Also, if no values, return empty. -
call_with
-
print
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readResolve
- Throws:
ObjectStreamException
-
incrPos
-
getFromPos
-
getFromPosFinal
-
checkFinalPos
-
nextIndex
Helper method called by compiled code. The compiled code iterates through zero or more values. Return the index of the next value, or -1 if currently at eof. A non-Values object is treated as a singleton value, so in that case there is no next value. -
nextValue
-
nextIndex
protected int nextIndex(int ipos) Description copied from class:AbstractSequenceGet the offset from the beginning corresponding to a position cookie.- Overrides:
nextIndexin classAbstractSequence<E>
-
writeValues
-
countValues
-