JTP API Documentation

jtp.context
Interface DepthMonitor

All Known Implementing Classes:
DefaultDepthMonitor

public interface DepthMonitor

This interface provides the basic search control functionality. When a reasoner wants to follow a search path, it adds the cost of the next link to current depth by calling incrementCurrentDepth(int) or setCurrentDepth(int). It can proceed only if the method returns true, otherwise the search depth limit has been exceeded, and the depth hasn't been changed. When backtracking, the reasoner should set the depth to its previous value.


Method Summary
 int getCurrentDepth()
          Returns the current search depth.
 int getMaxDepth()
           
 boolean incrementCurrentDepth(int inc)
          Attempts to increment current depth.
 boolean setCurrentDepth(int newDepth)
          Attempts to set current depth to a new value.
 

Method Detail

getMaxDepth

public int getMaxDepth()

getCurrentDepth

public int getCurrentDepth()
Returns the current search depth.

Returns:
current search depth

incrementCurrentDepth

public boolean incrementCurrentDepth(int inc)
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.

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)
Attempts to set current depth to a new value. If the new value is smaller than the current value, the method should always succeed.

Returns:
true if the operation was successful, false if the depth limit has been reached. In this case, depth stays the same.

JTP API Documentation