choco.util
Class StoredPointerCycle

java.lang.Object
  extended by choco.util.StoredPointerCycle

public class StoredPointerCycle
extends java.lang.Object

A data structure implementing a subset of a given set, by means of a cyclic chain of pointers (grossly specking, each entry contains the index of the next entry in the cycle). This data structure is convenient for iterating a subset of objets (chain of pointers), starting from any object (cyclic iteration). The data structure is based on backtrackable vectors (@link{StoredIntVector}) It is also robust in the sense that objects can be removed from the cycle while the cycle is being iterated


Field Summary
static int INVALID_INDEX
          wildcard: all entries of the vector contain valid indices (i.e. values from 0 to n-1, n being the vector size) or the constant INVALID_INDEX
protected static java.util.logging.Logger logger
          Reference to the root Logger, an object for logging trace statements related to propagation events (using the java.util.logging package)
protected  StoredIntVector next
          The vectors of entries
 
Constructor Summary
StoredPointerCycle(Environment env)
           
 
Method Summary
 void add(int idx, boolean inCycle)
          Adds an entry to the static collection, at a given index
 IntIterator getCycleButIterator(int avoidIndex)
           
 boolean isInCycle(int idx)
          Tests if a given index is in the cycle or not
 void setInCycle(int i)
          Sets the index into the cycle
 void setOutOfCycle(int i)
          Sets the index into the cycle
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_INDEX

public static final int INVALID_INDEX
wildcard: all entries of the vector contain valid indices (i.e. values from 0 to n-1, n being the vector size) or the constant INVALID_INDEX

See Also:
Constant Field Values

next

protected StoredIntVector next
The vectors of entries


logger

protected static java.util.logging.Logger logger
Reference to the root Logger, an object for logging trace statements related to propagation events (using the java.util.logging package)

Constructor Detail

StoredPointerCycle

public StoredPointerCycle(Environment env)
Method Detail

size

public int size()

isInCycle

public boolean isInCycle(int idx)
Tests if a given index is in the cycle or not


add

public void add(int idx,
                boolean inCycle)
Adds an entry to the static collection, at a given index

Parameters:
inCycle - Specifies if the new entry is in the cycle

setInCycle

public void setInCycle(int i)
Sets the index into the cycle


setOutOfCycle

public void setOutOfCycle(int i)
Sets the index into the cycle


getCycleButIterator

public IntIterator getCycleButIterator(int avoidIndex)