gnu.mapping

Class Values

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 Valuesempty
static Object[]noArgs
Constructor Summary
Values()
Values(Object[] values)
Constructor.
Method Summary
Objectcall_with(Procedure proc)
Apply a Procedure with these values as the arguments.
Objectcanonicalize()
If a simple value, return that value.
static intcountValues(Object value)
Object[]getValues()
Get the values encapsulated.
static Valuesmake()
static Objectmake(Object[] vals)
static Objectmake(Sequence seq)
static Objectmake(TreeList list)
static Objectmake(TreeList list, int startPosition, int endPosition)
static intnextIndex(Object values, int curIndex)
Helper method called by code using a SeriesTarget.
static ObjectnextValue(Object values, int curIndex)
Helper method called by code using a SeriesTarget.
voidprint(Consumer out)
voidreadExternal(ObjectInput in)
ObjectreadResolve()
static Objectvalues$V(Object[] vals)
voidwriteExternal(ObjectOutput out)
static voidwriteValues(Object value, Consumer out)

Field Detail

empty

public static final Values empty

noArgs

public static final Object[] noArgs

Constructor Detail

Values

public Values()

Values

public Values(Object[] values)
Constructor.

Parameters: values the values to encapulate

Method Detail

call_with

public Object call_with(Procedure proc)
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.

countValues

public static int countValues(Object value)

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(Consumer out)

readExternal

public void readExternal(ObjectInput in)

readResolve

public Object readResolve()

values$V

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

writeExternal

public void writeExternal(ObjectOutput out)

Serial Data: Write the length (using writeInt), followed by the values in order (written using writeObject).

writeValues

public static void writeValues(Object value, Consumer out)