Package org.jacop.core
Class IntervalBasedBacktrackableManager
java.lang.Object
org.jacop.core.SimpleBacktrackableManager
org.jacop.core.IntervalBasedBacktrackableManager
- All Implemented Interfaces:
BacktrackableManager
- Version:
- 4.9
This manager works as simple manager to the point when cutoff value for a list is reached. The objects indexes are continously stored in a list, but they are stored in the trail only as a list of holes. There is a possibility to express the maximum number of holes being registered as well as minimum size requirement for hole.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean
(package private) int[]
It specifies a trail.(package private) int
(package private) int
(package private) int
(package private) int
(package private) int
(package private) int[]
(package private) Boolean
(package private) Boolean
Fields inherited from class org.jacop.core.SimpleBacktrackableManager
currentLevel, currentLevelMax, currentlyChanged, cutOffValue, debug, emptyLevel, fullLevel, levelInfo, noOfObjects, objects, trail, trailContainsAllChanges
-
Constructor Summary
ConstructorsConstructorDescriptionIntervalBasedBacktrackableManager
(Backtrackable[] vars, int noOfObjects, int minHoleSize, int maxNoOfIntervals) It creates a interval based backtrackable manager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChanged
(int index) It allows to inform the manager that a given item with id (index) has changed at given level.private void
addChangedToInterval
(int index) checkRemoveInvariant
(int removedLevel) It checks all backtrackable objects that they have not retained any level equal or above removedLevel.private int[]
boolean
isRecognizedAsChanged
(int index) It allows for easy testing if a given object is considered by the manager as the object which has changed and needs being informed about backtracking.void
removeLevel
(int removedLevel) It allows to inform all objects which have changed at removedLevel that the backtracking from that level has occurred.void
setLevel
(int level) It specifies the level which should become the active one in the manager.void
setSize
(int size) It specifies how many objects within objects array are being actually managed.Methods inherited from class org.jacop.core.SimpleBacktrackableManager
getLevel, toString, update
-
Field Details
-
intervalBasedTrail
It specifies a trail. A recorded changes which will be used upon backtracking to inform the objects about backtracking. -
intervalCutOffValue
int intervalCutOffValue -
maxNoOfIntervals
int maxNoOfIntervals -
minHoleSize
int minHoleSize -
minHoleSizeAfterSplit
int minHoleSizeAfterSplit -
currentIntervals
int[] currentIntervals -
temporaryArray
int[] temporaryArray -
removeCount
int removeCount -
addingToIntervals
boolean addingToIntervals -
valueFalse
Boolean valueFalse -
valueTrue
Boolean valueTrue
-
-
Constructor Details
-
IntervalBasedBacktrackableManager
public IntervalBasedBacktrackableManager(Backtrackable[] vars, int noOfObjects, int minHoleSize, int maxNoOfIntervals) It creates a interval based backtrackable manager. At some point, instead of storing a list of changed indexes the manager stores a fixed number of intervals representing objects which have not changed.- Parameters:
vars
- the number of objects.noOfObjects
- the number of objects being handled.minHoleSize
- the minimum size of the hole to be registered.maxNoOfIntervals
- maximum number of holes (intervals) being registered.
-
-
Method Details
-
addChanged
public void addChanged(int index) Description copied from class:SimpleBacktrackableManager
It allows to inform the manager that a given item with id (index) has changed at given level.- Specified by:
addChanged
in interfaceBacktrackableManager
- Overrides:
addChanged
in classSimpleBacktrackableManager
- Parameters:
index
- it specifies the index of the object which has changed.
-
setLevel
public void setLevel(int level) Description copied from class:SimpleBacktrackableManager
It specifies the level which should become the active one in the manager.- Specified by:
setLevel
in interfaceBacktrackableManager
- Overrides:
setLevel
in classSimpleBacktrackableManager
- Parameters:
level
- the active level at which the changes will be recorded.
-
computeIntervals
private int[] computeIntervals() -
removeLevel
public void removeLevel(int removedLevel) It allows to inform all objects which have changed at removedLevel that the backtracking from that level has occurred.- Specified by:
removeLevel
in interfaceBacktrackableManager
- Overrides:
removeLevel
in classSimpleBacktrackableManager
- Parameters:
removedLevel
- it specifies the level which is being removed.
-
checkRemoveInvariant
It checks all backtrackable objects that they have not retained any level equal or above removedLevel.- Parameters:
removedLevel
- the level which has been removed and should not exist in any object.- Returns:
- the description of the inconsistency, not maintained invariant.
-
addChangedToInterval
private void addChangedToInterval(int index) -
setSize
public void setSize(int size) It specifies how many objects within objects array are being actually managed. It allows to specify partially empty array.- Specified by:
setSize
in interfaceBacktrackableManager
- Overrides:
setSize
in classSimpleBacktrackableManager
- Parameters:
size
- the number of objects in the array.
-
isRecognizedAsChanged
public boolean isRecognizedAsChanged(int index) It allows for easy testing if a given object is considered by the manager as the object which has changed and needs being informed about backtracking.- Specified by:
isRecognizedAsChanged
in interfaceBacktrackableManager
- Overrides:
isRecognizedAsChanged
in classSimpleBacktrackableManager
- Parameters:
index
- the position of the object which status is in question.- Returns:
- it returns true if the manager recognizes object at position index as changed one.
-