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, java.lang.Appendable
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_DOCUMENT, data, docStart, END_DOCUMENT, END_GROUP_LONG, END_GROUP_SHORT, gapEnd, gapStart, INT_FOLLOWS, 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.
 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(java.io.PrintWriter ps)
           
 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, 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, hashCode, hasNext, 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, compare, compare, contains, containsAll, copyPos, elements, endPos, equals, equals, fill, fill, fillPosRange, 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
 
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(java.io.PrintWriter ps)
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)