|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.mem.Environment
public class Environment
The root class for managing memory and sessions.
A environment is associated to each problem. It is responsible for managing backtrackable data.
Field Summary | |
---|---|
static int |
BOOL_TRAIL
Index of the StoredBoolTrail for storing booleans. |
int |
currentWorld
The current world number (should be less than maxWorld ). |
static int |
FLOAT_TRAIL
Index of the StoredFloatTrail for storing
integer vectors. |
static int |
INT_TRAIL
Index of the StoredIntTrail for storing integers. |
static int |
INT_VECTOR_TRAIL
Index of the StoredIntVectorTrail for storing
integer vectors. |
static int |
LONG_TRAIL
Index of the StoredLongTrail for storing
integer vectors. |
protected ITrailStorage[] |
trails
Contains all the ITrailStorage trails for
storing different kinds of data. |
static int |
VECTOR_TRAIL
Index of the StoredVectorTrail for storing vectors. |
Constructor Summary | |
---|---|
Environment()
Constructs a new Environment with
the default stack sizes : 50000 and 1000. |
Method Summary | |
---|---|
int |
getIntTrailSize()
returns the size of the trail used for storing integers |
int |
getIntVectorTrailSize()
returns the size of the trail used for storing search arrays |
ITrailStorage |
getTrail(int i)
Returns the i th trail in the trail array. |
int |
getTrailSize()
returns the size of the trail |
int |
getWorldIndex()
Returns the world number. |
StoredBitSet |
makeBitSet(int size)
Factory pattern: new StoredBitSetVector objects are created by the environment |
StoredBitSet |
makeBitSet(int[] entries)
|
IStateBool |
makeBool(boolean initialValue)
Factory pattern: new IStateBool objects are created by the environment |
StoredFloat |
makeFloat()
Factory pattern: new IStateFloat objects are created by the environment (no initial value is assigned to the backtrackable search) |
StoredFloat |
makeFloat(double initialValue)
Factory pattern: new IStateFloat objects are created by the environment |
IStateInt |
makeInt()
Factory pattern: new IStateInt objects are created by the environment (no initial value is assigned to the backtrackable search) |
IStateInt |
makeInt(int initialValue)
Factory pattern: new IStateInt objects are created by the environment |
StoredIntVector |
makeIntVector()
Factory pattern: new IStateIntVector objects are created by the environment. |
StoredIntVector |
makeIntVector(int[] entries)
Factory pattern: new IStateIntVector objects are created by the environment |
StoredIntVector |
makeIntVector(int size,
int initialValue)
Factory pattern: new IStateIntVector objects are created by the environment |
PartiallyStoredIntVector |
makePartiallyStoredIntVector()
|
PartiallyStoredVector |
makePartiallyStoredVector()
|
void |
worldCommit()
Accepts all modifications since the previous choice point in the search tree. |
void |
worldPop()
Backtracks to the previous choice point in the search tree. |
void |
worldPush()
Starts a new branch in the search tree. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BOOL_TRAIL
StoredBoolTrail
for storing booleans.
public static final int INT_TRAIL
StoredIntTrail
for storing integers.
public static final int VECTOR_TRAIL
StoredVectorTrail
for storing vectors.
public static final int INT_VECTOR_TRAIL
StoredIntVectorTrail
for storing
integer vectors.
trails
,
Constant Field Valuespublic static final int FLOAT_TRAIL
StoredFloatTrail
for storing
integer vectors.
trails
,
Constant Field Valuespublic static final int LONG_TRAIL
StoredLongTrail
for storing
integer vectors.
trails
,
Constant Field Valuespublic int currentWorld
maxWorld
).
protected ITrailStorage[] trails
ITrailStorage
trails for
storing different kinds of data.
Constructor Detail |
---|
public Environment()
Environment
with
the default stack sizes : 50000 and 1000.
Method Detail |
---|
public ITrailStorage getTrail(int i)
i
th trail in the trail array.
i
- index of the trail.public int getWorldIndex()
currentWorld
public void worldPush()
public void worldPop()
public void worldCommit()
public IStateInt makeInt()
public IStateInt makeInt(int initialValue)
initialValue
- the initial value of the backtrackable integerpublic IStateBool makeBool(boolean initialValue)
initialValue
- the initial value of the backtrackable booleanpublic StoredIntVector makeIntVector()
public StoredIntVector makeIntVector(int size, int initialValue)
size
- the number of entries in the vectorinitialValue
- the common initial value for all entries (backtrackable integers)public StoredIntVector makeIntVector(int[] entries)
entries
- an array to be copied as set of initial contents of the vectorpublic PartiallyStoredVector makePartiallyStoredVector()
public PartiallyStoredIntVector makePartiallyStoredIntVector()
public StoredBitSet makeBitSet(int size)
public StoredBitSet makeBitSet(int[] entries)
public StoredFloat makeFloat()
public StoredFloat makeFloat(double initialValue)
initialValue
- the initial value of the backtrackable searchpublic int getTrailSize()
public int getIntTrailSize()
public int getIntVectorTrailSize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |