gnu.mapping

Class Values

Implemented Interfaces:
Externalizable, Consumable, Consumer, PositionConsumer, Printable, XConsumer
Known Direct Subclasses:
Nodes, ValueStack

public class Values
extends TreeList
implements Printable, Externalizable

Encapsulate multiple values in a single object. In Scheme and Lisp mainly used to return multiple values from a function.

Field Summary

static Values
empty
static Object[]
noArgs

Fields inherited from class gnu.lists.TreeList

BEGIN_ATTRIBUTE_LONG, BEGIN_DOCUMENT, END_DOCUMENT, END_GROUP_LONG, END_GROUP_SHORT, INT_FOLLOWS, POSITION_PAIR_FOLLOWS, PROCESSING_INSTRUCTION, attrStart, data, docStart, gapEnd, gapStart, objects, oindex

Constructor Summary

Values()
Values(Object[] values)
Constructor.

Method Summary

Object
call_with(Procedure proc)
Apply a Procedure with these values as the arguments.
Object
canonicalize()
If a simple value, return that value.
Object[]
getValues()
Get the values encapsulated.
static Values
make()
static Object
make(Object[] vals)
static Object
make(Sequence seq)
static Object
make(TreeList list)
static Object
make(TreeList list, int startPosition, int endPosition)
static int
nextIndex(Object values, int curIndex)
Helper method called by code using a SeriesTarget.
static Object
nextValue(Object values, int curIndex)
Helper method called by code using a SeriesTarget.
void
print(java.io.PrintWriter ps)
void
readExternal(ObjectInput in)
Object
readResolve()
static Object
values$V(Object[] vals)
void
writeExternal(ObjectOutput out)
static void
writeValues(Object value, Consumer out)

Methods inherited from class gnu.lists.TreeList

baseUriOfPos, beginAttribute, beginAttribute, beginDocument, beginGroup, beginGroup, clear, compare, consume, consume, consumeIRange, consumeNext, consumePosRange, createPos, createRelativePos, dump, dump, endAttribute, endDocument, endGroup, ensureSpace, find, find, firstAttributePos, firstChildPos, get, getIndexDifference, getIntN, getLongN, getNextKind, getNextTypeIndex, getNextTypeName, getNextTypeObject, getPosNext, getPosNextInt, getPosPrevious, gotoAttributesStart, gotoAttributesStart, gotoChildrenStart, hasNext, hashCode, ignoring, isEmpty, nextDataIndex, nextMatching, nextNodeIndex, nextPos, parentPos, posToDataIndex, resizeObjects, setIntN, size, statistics, statistics, stringValue, stringValue, toString, write, writeBaseUri, writeBoolean, writeByte, writeCDATA, writeChar, writeChars, writeComment, writeDouble, writeFloat, writeInt, writeLong, writeObject, writePosition, writeProcessingInstruction

Methods inherited from class gnu.lists.AbstractSequence

add, add, addAll, addAll, addPos, append, baseUriOfPos, clear, compare, compare, compare, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createPos, createRelativePos, elements, endPos, equals, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, fromEndIndex, get, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasNext, hasPrevious, hashCode, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setPosNext, setPosPrevious, size, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported

Field Details

empty

public static final Values empty

noArgs

public static final Object[] noArgs

Constructor Details

Values

public Values()

Values

public Values(Object[] values)
Constructor.
Parameters:
values - the values to encapulate

Method Details

call_with

public Object call_with(Procedure proc)
            throws Throwable
Apply a Procedure with these values as the arguments.

canonicalize

public final Object canonicalize()
If a simple value, return that value. Also, if no values, return empty.

getValues

public Object[] getValues()
Get the values encapsulated.

make

public static Values make()

make

public static Object make(Object[] vals)

make

public static Object make(Sequence seq)

make

public static Object make(TreeList list)

make

public static Object make(TreeList list,
                          int startPosition,
                          int endPosition)

nextIndex

public static int nextIndex(Object values,
                            int curIndex)
Helper method called by code using a SeriesTarget. 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

public static Object nextValue(Object values,
                               int curIndex)
Helper method called by code using a SeriesTarget. The compiled code iterates through zero or more values. Extract the object referenced by the curIndex. A non-Values object is treated as a singleton value.

print

public void print(java.io.PrintWriter ps)

readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException

readResolve

public Object readResolve()
            throws ObjectStreamException

values$V

public static Object values$V(Object[] vals)

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException

writeValues

public static void writeValues(Object value,
                               Consumer out)