choco.mem
Class TwoStateIntVector

java.lang.Object
  extended by choco.mem.TwoStateIntVector
All Implemented Interfaces:
IStateIntVector

public class TwoStateIntVector
extends java.lang.Object
implements IStateIntVector

A class that implements a vector of integers with two states (one current and one single historical state) TODO: implement all those darn methods


Field Summary
static int MIN_CAPACITY
          Minimal capacity of a vector
 
Constructor Summary
TwoStateIntVector(Environment env, int initialSize, int initialValue)
           
 
Method Summary
 void add(int i)
          Adds a new search at the end of the vector.
 int get(int index)
          Returns the indexth element of the vector.
 boolean isEmpty()
          Checks if the vector is empty.
 void removeLast()
          removes the search at the end of the vector.
 void restoreState()
           
 void saveState()
           
 int set(int index, int val)
          Assigns a new value val to the element index.
 int size()
          Returns the current size of the stored search vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_CAPACITY

public static final int MIN_CAPACITY
Minimal capacity of a vector

See Also:
Constant Field Values
Constructor Detail

TwoStateIntVector

public TwoStateIntVector(Environment env,
                         int initialSize,
                         int initialValue)
Parameters:
env - the memory environment
initialSize - the initial size of the vector
initialValue - the initial value for all entries of the vector
Method Detail

size

public int size()
Returns the current size of the stored search vector.

Specified by:
size in interface IStateIntVector

isEmpty

public boolean isEmpty()
Checks if the vector is empty.

Specified by:
isEmpty in interface IStateIntVector

add

public void add(int i)
Adds a new search at the end of the vector.

Specified by:
add in interface IStateIntVector
Parameters:
i - The search to add.

removeLast

public void removeLast()
removes the search at the end of the vector. does nothing when called on an empty vector

Specified by:
removeLast in interface IStateIntVector

get

public int get(int index)
Returns the indexth element of the vector.

Specified by:
get in interface IStateIntVector

set

public int set(int index,
               int val)
Assigns a new value val to the element index.

Specified by:
set in interface IStateIntVector

saveState

public void saveState()

restoreState

public void restoreState()