|
JTP API Documentation | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jtp.proof.Proof | +--jtp.ReasoningStep
An extension to the InferenceWeb Proof
class that specifies and
implements much of the JTP-specific functionality required of proofs
in JTP.
ReasoningSteps are essentially the messages that are passed between
Reasoner
s which allow them to cooperate.
Field Summary |
Fields inherited from class jtp.proof.Proof |
bindings, goal, inference, subGoals, subProofs |
Constructor Summary | |
protected |
ReasoningStep()
|
|
ReasoningStep(Object goal,
List subSteps)
|
|
ReasoningStep(Object goal,
List subSteps,
List subGoals)
|
Method Summary | |
protected void |
addContentsIfUnifyable(Object value,
Collection tgt)
|
void |
backtrack()
Unbind all variables that are keys in the
bindings . |
Object |
clone()
Ensures that returned clone initially has the same subgoals and
subproofs as this ,
but they do not share
lists. |
protected boolean |
cloneNeedsDereferencing(ReasoningStep clone)
Determines if clone is different from this
because this has data members that contain
Unifyables that were
dereferenced in clone . |
protected Collection |
collectUnifyableElements()
Returns a collection of data members of this ReasoningStep that are instances of Unifyable. |
boolean |
contains(Variable v)
Subclasses of ReasoningStep should not override this method. |
protected ReasoningStep |
createDereferencedClone()
Returns a clone of this ReasoningStep in which all nested Variables have been replaced by the values that they are bound to at the time of clone creation. |
protected Map |
deReferenceBindings(Map bindings)
Simplifies a bindings map. |
protected Object |
deReferenceElement(Object element)
A general method for dereferencing objects that may contain Variables. |
protected List |
deReferenceList(List l)
Returns a list based on l in which all elements
have been dereferenced if possible with
deReferenceElement(Object) . |
Object |
deReferenceVariables()
Subclasses of ReasoningStep should not override this method. |
float |
getCost()
|
Inference |
getInference()
Returns instance of AxiomInference if
subproofs
list is empty. |
List |
getSubProofs()
Returns a List of the direct child Proofs in the proof tree. |
Collection |
getVariables(Collection tgt)
Subclasses of ReasoningStep should not override this method. |
void |
makeStep()
Bind Variables that are keys
in bindings map to the values in the
map. |
abstract String |
tracePrint()
Returns a string that describes the inference that this reasoning step makes. |
boolean |
unify(Object param1,
List param2)
This method from the Unifyable interface should never be called on a ReasoningStep. |
Methods inherited from class jtp.proof.Proof |
getBindings, getGoal, getSubGoals, toString, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected ReasoningStep()
public ReasoningStep(Object goal, List subSteps)
public ReasoningStep(Object goal, List subSteps, List subGoals)
Method Detail |
public abstract String tracePrint()
public List getSubProofs()
Proof
getSubProofs
in class Proof
Proof.getSubGoals()
public void backtrack()
Unbind
all variables that are keys in the
bindings
.
Variable
public void makeStep()
Bind
Variables that are keys
in bindings
map to the values in the
map.
public Object clone()
subgoals
and
subproofs
as this
,
but they do not share
lists. That is, getSubGoals()
and
clone.getSubGoals()
are equals
but not ==
, and the same is true for
getSubProofs()
.
clone
in class Object
public float getCost()
protected void addContentsIfUnifyable(Object value, Collection tgt)
protected Object deReferenceElement(Object element)
If element
is a Unifyable,
dereference
it and return
the resulting object. If element
is a CNFSentence,
dereference
it and return the resulting sentence. Otherwise, return
element
itself.
element
- an object to be dereferenced
element
in which Variables
have been replaced by their bound values. If no dereferencing occurred, element
is returned.protected Map deReferenceBindings(Map bindings)
bindings
- bindings Map to be simplified. Keys are assumed to be Variables.
bindings
. If no dereferencing occurred, bindings
is returned.
IllegalStateException
- if a Variable key dereferences to a non-Variable object that is not equal to the object that its mapped value dereferences toprotected Collection collectUnifyableElements()
This default implementation handles the collection of Unifyables
from the goal
, bindings
,
subgoals
, and subproofs
.
Subclasses should override this method
if they have other data members that could contain Unifyables.
Overriding methods should make a call to super
to collect
Unifyables from the common members mentioned above.
protected ReasoningStep createDereferencedClone()
This default implementation handles dereferencing of Unifyables
nested in goal
,
bindings
, subgoals
,
and subproofs
.
Subclasses should override this method if they have
other data members that could contain
Unifyables that need to be dereferenced. Overriding methods
should make a call to super
to get initial clone
that has the data members mentioned above dereferenced.
protected boolean cloneNeedsDereferencing(ReasoningStep clone)
clone
is different from this
because this
has data members that contain
Unifyables that were
dereferenced in clone
.
This default implementation compares goal
,
bindings
, subgoals
,
and subproofs
of clone
and this
to determine if Unifyables were
dereferenced in the clone.
Subclasses should override this method if they also
override createDereferencedClone()
and may dereference
other data members in the clone.
Overriding methods should make a call to super
to
do comparison for the data members mentioned above.
clone
- a dereferenced clone of this
created with createDereferencedClone()
clone
; false otherwisepublic boolean contains(Variable v)
collectUnifyableElements()
which subclasses should override
if necessary.
contains
in interface Unifyable
v
- the variable to look for
public Collection getVariables(Collection tgt)
collectUnifyableElements()
which subclasses should override
if necessary.
getVariables
in interface Unifyable
tgt
- the collection to which the variables are added. If null, and this Unifyable
contains variables, a new collection is created.
public Object deReferenceVariables()
createDereferencedClone()
and the comparison performed
by cloneNeedsDereferencing(ReasoningStep)
. Subclasses
should override these methods if necessary.
deReferenceVariables
in interface Unifyable
this
is returned if no variables needed to be dereferenced.Variable
public boolean unify(Object param1, List param2)
unify
in interface Unifyable
param1
- the object to unify with.param2
- the variable stack
UnsupportedOperationException
- if calledprotected List deReferenceList(List l)
l
in which all elements
have been dereferenced if possible with
deReferenceElement(Object)
.
l
- list to be dereferenced
l
. If no elements needed dereferencing, l
is returnedpublic Inference getInference()
AxiomInference
if
subproofs
list is empty. Returns instance of ModusPonensInference
if subproofs list is non-empty.
getInference
in class Proof
|
JTP API Documentation | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |