jess
Class ValueVector

java.lang.Object
  |
  +--jess.ValueVector
Direct Known Subclasses:
Fact, Funcall

public class ValueVector
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A mini version of Vector (a self-extending array) that only holds Values. Not synchronized, so you must be careful of multithreading issues.

(C) E.J Friedman-Hill and Sandia National Laboratories

Author:
E.J. Friedman-Hill
See Also:
Serialized Form

Constructor Summary
ValueVector()
          Construct a ValueVector of the default size (10)
ValueVector(int size)
          Construct a ValueVector of the given size
 
Method Summary
 ValueVector add(Value val)
          Add a new element to the end of this ValueVector.
 java.lang.Object clone()
          Create a shallow copy of this ValueVector
 ValueVector cloneInto(ValueVector vv)
          Make the parameter into a copy of this ValueVector
 boolean equals(java.lang.Object o)
          Comparethis valueVector to another object.
 Value get(int i)
          Fetch the entry at position i in thie ValueVector
 ValueVector set(Value val, int i)
          Set the entry at position i to val.
 ValueVector setLength(int i)
          Set the length of this ValueVector.
 int size()
          Fetch the size of this ValueVector
 java.lang.String toString()
          Return a String version of this ValueVector, without parentheses.
 java.lang.String toStringWithParens()
          Return a String version of this ValueVector, with parentheses around all ValueVectors.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueVector

public ValueVector()
Construct a ValueVector of the default size (10)

ValueVector

public ValueVector(int size)
Construct a ValueVector of the given size
Parameters:
size - The number of Values this vector can hold at creation
Method Detail

size

public final int size()
Fetch the size of this ValueVector
Returns:
The size of this ValueVector

clone

public java.lang.Object clone()
Create a shallow copy of this ValueVector
Overrides:
clone in class java.lang.Object
Returns:
The copy

cloneInto

public ValueVector cloneInto(ValueVector vv)
Make the parameter into a copy of this ValueVector
Parameters:
vv - A ValueVector, whose contents are erased.
Returns:
The parameter

get

public final Value get(int i)
                throws JessException
Fetch the entry at position i in thie ValueVector
Parameters:
i - The 0-based index of the Value to fetch
Returns:
The Value

setLength

public ValueVector setLength(int i)
Set the length of this ValueVector. If necessary the storage will be extended.
Parameters:
i - The new length (>= 0)

set

public final ValueVector set(Value val,
                             int i)
                      throws JessException
Set the entry at position i to val. i must be >= 0 and < the return value of size().
Parameters:
val - The new value
i - The index at which to place it.

add

public final ValueVector add(Value val)
Add a new element to the end of this ValueVector. The storage will be extended if necessary.
Parameters:
val - The value to add.

equals

public boolean equals(java.lang.Object o)
Comparethis valueVector to another object.
Overrides:
equals in class java.lang.Object
Parameters:
o - Another object
Returns:
True if the object is a valueVector of the same size containing Values that compare equal to the ones in this Vector.

toString

public java.lang.String toString()
Return a String version of this ValueVector, without parentheses.
Overrides:
toString in class java.lang.Object
Returns:
The String

toStringWithParens

public java.lang.String toStringWithParens()
Return a String version of this ValueVector, with parentheses around all ValueVectors.
Returns:
The String

© 1997 E.J. Friedman-Hill and Sandia Corporation