public class IntervalBasedBacktrackableManager extends SimpleBacktrackableManager
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.
currentLevel, currentLevelMax, objects, trailContainsAllChanges
Constructor and Description |
---|
IntervalBasedBacktrackableManager(Backtrackable[] vars,
int noOfObjects,
int minHoleSize,
int maxNoOfIntervals)
It creates a interval based backtrackable manager.
|
Modifier and Type | Method and Description |
---|---|
void |
addChanged(int index)
It allows to inform the manager that a given item with id (index) has changed at given level.
|
String |
checkRemoveInvariant(int removedLevel)
It checks all backtrackable objects that they have not retained any level equal or above removedLevel.
|
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.
|
getLevel, toString, update
public IntervalBasedBacktrackableManager(Backtrackable[] vars, int noOfObjects, int minHoleSize, int maxNoOfIntervals)
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.public void addChanged(int index)
SimpleBacktrackableManager
addChanged
in interface BacktrackableManager
addChanged
in class SimpleBacktrackableManager
index
- it specifies the index of the object which has changed.public void setLevel(int level)
SimpleBacktrackableManager
setLevel
in interface BacktrackableManager
setLevel
in class SimpleBacktrackableManager
level
- the active level at which the changes will be recorded.public void removeLevel(int removedLevel)
removeLevel
in interface BacktrackableManager
removeLevel
in class SimpleBacktrackableManager
removedLevel
- it specifies the level which is being removed.public String checkRemoveInvariant(int removedLevel)
removedLevel
- the level which has been removed and should not exist in any object.public void setSize(int size)
setSize
in interface BacktrackableManager
setSize
in class SimpleBacktrackableManager
size
- the number of objects in the array.public boolean isRecognizedAsChanged(int index)
isRecognizedAsChanged
in interface BacktrackableManager
isRecognizedAsChanged
in class SimpleBacktrackableManager
index
- the position of the object which status is in question.Copyright © 2022. All rights reserved.