jtp.context
Class DefaultDepthMonitor
java.lang.Object
|
+--jtp.context.DefaultDepthMonitor
- All Implemented Interfaces:
- DepthMonitor
- public class DefaultDepthMonitor
- extends Object
- implements DepthMonitor
This is the default implementation of the DepthMonitor interface.
- See Also:
DepthMonitor
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
currentDepth
protected int currentDepth
maxDepth
protected int maxDepth
maxDepthRequested
protected int maxDepthRequested
DefaultDepthMonitor
public DefaultDepthMonitor(int maxDepth)
getCurrentDepth
public int getCurrentDepth()
- Description copied from interface:
DepthMonitor
- Returns the current search depth.
- Specified by:
getCurrentDepth
in interface DepthMonitor
- Returns:
- current search depth
incrementCurrentDepth
public boolean incrementCurrentDepth(int inc)
- Description copied from interface:
DepthMonitor
- Attempts to increment current depth. Call with a positive argument (typically
1) to
follow a link, negative argument is used for backtracking. Backtracking should
never fail.
- Specified by:
incrementCurrentDepth
in interface DepthMonitor
- Parameters:
inc
- the desired increment to the depth, positive for following a link,
negative for backtracking.
- Returns:
true
if the operation was successful, false
if the depth limit has been reached. In this case, depth stays the same.
setCurrentDepth
public boolean setCurrentDepth(int newDepth)
- Description copied from interface:
DepthMonitor
- Attempts to set current depth to a new value. If the new value is smaller than
the current value, the method should always succeed.
- Specified by:
setCurrentDepth
in interface DepthMonitor
- Returns:
true
if the operation was successful, false
if the depth limit has been reached. In this case, depth stays the same.
getMaxDepth
public int getMaxDepth()
- Specified by:
getMaxDepth
in interface DepthMonitor