gnu.mapping
Class Values

java.lang.Object
  extended by gnu.lists.AbstractSequence
      extended by gnu.lists.TreeList
          extended by gnu.mapping.Values
All Implemented Interfaces:
Consumable, Consumer, PositionConsumer, XConsumer, Printable, java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
Nodes, ValueStack

public class Values
extends TreeList
implements Printable, java.io.Externalizable

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

See Also:
Serialized Form

Field Summary
static Values empty
           
static java.lang.Object[] noArgs
           
 
Fields inherited from class gnu.lists.TreeList
attrStart, BEGIN_ATTRIBUTE_LONG, BEGIN_ATTRIBUTE_LONG_SIZE, BEGIN_DOCUMENT, BEGIN_ELEMENT_LONG, BEGIN_ELEMENT_SHORT, BEGIN_ELEMENT_SHORT_INDEX_MAX, BEGIN_ENTITY, BEGIN_ENTITY_SIZE, data, docStart, DOCUMENT_URI, END_ATTRIBUTE_SIZE, END_DOCUMENT, END_ELEMENT_LONG, END_ELEMENT_SHORT, END_ENTITY, gapEnd, gapStart, INT_FOLLOWS, MAX_CHAR_SHORT, objects, oindex, POSITION_PAIR_FOLLOWS, PROCESSING_INSTRUCTION
 
Constructor Summary
Values()
           
Values(java.lang.Object[] values)
          Constructor.
 
Method Summary
 java.lang.Object call_with(Procedure proc)
          Apply a Procedure with these values as the arguments.
 java.lang.Object canonicalize()
          If a simple value, return that value.
static int countValues(java.lang.Object value)
           
 java.lang.Object[] getValues()
          Get the values encapsulated.
static Values make()
           
static java.lang.Object make(java.lang.Object[] vals)
           
static java.lang.Object make(Sequence seq)
           
static java.lang.Object make(TreeList list)
           
static java.lang.Object make(TreeList list, int startPosition, int endPosition)
           
static int nextIndex(java.lang.Object values, int curIndex)
          Helper method called by code using a SeriesTarget.
static java.lang.Object nextValue(java.lang.Object values, int curIndex)
          Helper method called by code using a SeriesTarget.
 void print(Consumer out)
           
 void readExternal(java.io.ObjectInput in)
           
 java.lang.Object readResolve()
           
static java.lang.Object values$V(java.lang.Object[] vals)
           
 void writeExternal(java.io.ObjectOutput out)
           
static void writeValues(java.lang.Object value, Consumer out)
           
 
Methods inherited from class gnu.lists.TreeList
append, append, append, beginEntity, clear, compare, consume, consume, consumeIRange, consumeNext, consumePosRange, createPos, createRelativePos, documentUriOfPos, dump, dump, dump, endAttribute, endDocument, endElement, endEntity, ensureSpace, find, firstAttributePos, firstChildPos, get, getAttributeCount, getIndexDifference, getIntN, getLongN, getNextKind, getNextKindI, getNextTypeName, getNextTypeObject, getPosNext, getPosNextInt, getPosPrevious, gotoAttributesStart, gotoAttributesStart, gotoChildrenStart, hashCode, hasNext, ignoring, isEmpty, nextDataIndex, nextMatching, nextNodeIndex, nextPos, parentOrEntityI, parentOrEntityPos, parentPos, posToDataIndex, resizeObjects, setAttributeName, setElementName, setIntN, size, startAttribute, startAttribute, startDocument, startElement, startElement, statistics, statistics, stringValue, stringValue, stringValue, toString, write, write, write, write, writeBoolean, writeByte, writeCDATA, writeComment, writeDocumentUri, writeDouble, writeFloat, writeInt, writeJoiner, writeLong, writeObject, writePosition, writeProcessingInstruction
 
Methods inherited from class gnu.lists.AbstractSequence
add, add, addAll, addAll, addPos, compare, compare, contains, containsAll, copyPos, elements, endPos, equals, equals, fill, fill, fillPosRange, firstChildPos, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIterator, getIterator, getIteratorAtPos, getLowBound, getSize, gotoChildrenStart, gotoParent, hasPrevious, indexOf, isAfterPos, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setPosNext, setPosPrevious, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported, unsupportedException
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

noArgs

public static final java.lang.Object[] noArgs

empty

public static final Values empty
Constructor Detail

Values

public Values()

Values

public Values(java.lang.Object[] values)
Constructor.

Parameters:
values - the values to encapulate
Method Detail

getValues

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


values$V

public static java.lang.Object values$V(java.lang.Object[] vals)

make

public static Values make()

make

public static java.lang.Object make(java.lang.Object[] vals)

make

public static java.lang.Object make(Sequence seq)

make

public static java.lang.Object make(TreeList list)

make

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

canonicalize

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


call_with

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

Throws:
java.lang.Throwable

print

public void print(Consumer out)
Specified by:
print in interface Printable

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readResolve

public java.lang.Object readResolve()
                             throws java.io.ObjectStreamException
Throws:
java.io.ObjectStreamException

nextIndex

public static int nextIndex(java.lang.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 java.lang.Object nextValue(java.lang.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.


writeValues

public static void writeValues(java.lang.Object value,
                               Consumer out)

countValues

public static int countValues(java.lang.Object value)