JTP API Documentation

jtp.rs
Class RSUtils

java.lang.Object
  |
  +--jtp.rs.RSUtils

public class RSUtils
extends Object

Utility methods for ReasoningSteps.


Constructor Summary
RSUtils()
           
 
Method Summary
static ReasoningStepIterator concatenate(ReasoningStepIterator[] rss)
          Given an array of ReasoningStepIterators, returns a single ReasoningStepIterator that iterates over all ReasoningSteps in each ReasoningStepIterator of the array in order.
static ReasoningStepIterator concatenate(ReasoningStepIterator rsi1, ReasoningStepIterator rsi2)
          Given two ReasoningStepIterators, returns a single ReasoningStepIterator that iterates over all ReasoningSteps in rsi1 and then rsi2.
static ReasoningStepIterator concatenate(ReasoningStepIterator rsi1, ReasoningStepIterator rsi2, ReasoningStepIterator rsi3)
          Given three ReasoningStepIterators, returns a single ReasoningStepIterator that iterates over all ReasoningSteps in rsi1, then rsi2, then rsi3.
static int getNestingDepth(ReasoningStep rs)
          Return the depth of the proof tree that rs is the root of.
static Map getRecursiveBindings(Proof rs, Map collector)
          Recursively collects bindings from rs and all of its child proofs in the proof tree below it.
static String printReasoningStep(ReasoningStep rs, String prefix)
          Creates a String representation of a ReasoningStep.
static String printReasoningStepIterator(ReasoningStepIterator rsi, String prefix)
          Creates a String representation of a ReasoningStepIterator.
static void recursiveBacktrack(ReasoningStep rs)
          Unbinds nested Variables in a ReasoningStep.
static ReasoningStep recursiveClone(ReasoningStep rs)
          Constructs a ReasoningStep clone by cloning it and recursively cloning its subproofs as well.
static void recursiveMakeStep(ReasoningStep rs)
          Binds nested Variables in a ReasoningStep.
static Map variableStackToMap(List varStack, Map m)
          Deprecated. use SubstUtils.variableStackToMap(List, Map)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSUtils

public RSUtils()
Method Detail

variableStackToMap

public static Map variableStackToMap(List varStack,
                                     Map m)
Deprecated. use SubstUtils.variableStackToMap(List, Map)


recursiveMakeStep

public static void recursiveMakeStep(ReasoningStep rs)
Binds nested Variables in a ReasoningStep. Recursively calls ReasoningStep.makeStep() on rs and its subproofs.

Parameters:
rs - a ReasoningStep that is to have its Variables bound

recursiveBacktrack

public static void recursiveBacktrack(ReasoningStep rs)
Unbinds nested Variables in a ReasoningStep. Recursively calls ReasoningStep.backtrack() on rs and its subproofs.

Parameters:
rs - a ReasoningStep that is to have its Variables unbound

recursiveClone

public static ReasoningStep recursiveClone(ReasoningStep rs)
Constructs a ReasoningStep clone by cloning it and recursively cloning its subproofs as well.

Parameters:
rs - the ReasoningStep to be cloned
Returns:
a recursive clone of rs

getRecursiveBindings

public static Map getRecursiveBindings(Proof rs,
                                       Map collector)
Recursively collects bindings from rs and all of its child proofs in the proof tree below it.

Parameters:
rs - a Proof from which bindings are to be recursively collected
collector - a Map in which collected bindings will be placed. If null, a HashMap will be created and returned.
Returns:
Map of recursively collected bindings

printReasoningStepIterator

public static String printReasoningStepIterator(ReasoningStepIterator rsi,
                                                String prefix)
                                         throws ReasoningException
Creates a String representation of a ReasoningStepIterator. Each ReasoningStep in the iterator will be retrieved with ReasoningStepIterator.next() and printed to a String with printReasoningStep(ReasoningStep, String).

Parameters:
rsi - a ReasoningStepIterator
prefix - a String that will be prepended to each line in the String representation returned
Returns:
a String representation of rsi
ReasoningException

printReasoningStep

public static String printReasoningStep(ReasoningStep rs,
                                        String prefix)
Creates a String representation of a ReasoningStep. The ReasoningStep will have Strings representations of its class, goal, description, bindings, and subgoals included in the String. Subproofs will be recursively added to the returned String; each child proof will be indented by one more space than its parent.

Parameters:
rs - a ReasoningStep
prefix - a String that will be prepended to each line in the String representation returned
Returns:
a String representation of rs

getNestingDepth

public static int getNestingDepth(ReasoningStep rs)
Return the depth of the proof tree that rs is the root of.

Parameters:
rs - a ReasoningStep
Returns:
integer depth of proof tree

concatenate

public static ReasoningStepIterator concatenate(ReasoningStepIterator rsi1,
                                                ReasoningStepIterator rsi2)
Given two ReasoningStepIterators, returns a single ReasoningStepIterator that iterates over all ReasoningSteps in rsi1 and then rsi2.

Parameters:
rsi1 - a ReasoningStepIterator
rsi2 - a ReasoningStepIterator
Returns:
a ReasoningStepIterator that iterates over contents of rsi1 and rsi2

concatenate

public static ReasoningStepIterator concatenate(ReasoningStepIterator rsi1,
                                                ReasoningStepIterator rsi2,
                                                ReasoningStepIterator rsi3)
Given three ReasoningStepIterators, returns a single ReasoningStepIterator that iterates over all ReasoningSteps in rsi1, then rsi2, then rsi3.

Parameters:
rsi1 - a ReasoningStepIterator
rsi2 - a ReasoningStepIterator
rsi3 - a ReasoningStepIterator
Returns:
a ReasoningStepIterator that iterates over contents of rsi1, rsi2, and rsi3

concatenate

public static ReasoningStepIterator concatenate(ReasoningStepIterator[] rss)
Given an array of ReasoningStepIterators, returns a single ReasoningStepIterator that iterates over all ReasoningSteps in each ReasoningStepIterator of the array in order.

Parameters:
rss - an array of ReasoningStepIterators
Returns:
a ReasoningStepIterator that iterates over contents of each element of rss

JTP API Documentation