JTP API Documentation

jtp.frame.listen
Class VCTemplate

java.lang.Object
  |
  +--jtp.frame.listen.ListenerTemplate
        |
        +--jtp.frame.listen.VCTemplate
All Implemented Interfaces:
Serializable, Unifyable

public class VCTemplate
extends ListenerTemplate

See Also:
Serialized Form

Constructor Summary
VCTemplate(Object slot, Object frame, Object val, boolean inverse)
           
VCTemplate(Object slot, Object frame, Object val, boolean inverse, Object val2, Symbol sign)
           
 
Method Summary
 boolean contains(Variable v)
          Checks if this Unifyable contains a given Variable (in that case, they cannot be unified).
protected  AbstractVCListener createListener(Object value, Object value2, Symbol sign, VCListenerCreationReasoningStep rs)
          The template instance returns a AbstractVCListener that can instantiate the template given a concrete object as input.
 Object deReferenceVariables()
          Replaces all the variables in this Unifyable by their values.
protected  Clause getClause()
          The template instance returns a Clause that, as close as possible, indicates what this template represents in FOL.
 Collection getVariables(Collection tgt)
          Retrieves the variables in this Unifyable and places them into a provided target collection.
 String toString()
           
 boolean unify(Object param1, List param2)
          Attempts to unify with another object, that is find a variable assignment that will make the two objects equal.
 
Methods inherited from class jtp.frame.listen.ListenerTemplate
createLiteral, instantiateTemplate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VCTemplate

public VCTemplate(Object slot,
                  Object frame,
                  Object val,
                  boolean inverse)

VCTemplate

public VCTemplate(Object slot,
                  Object frame,
                  Object val,
                  boolean inverse,
                  Object val2,
                  Symbol sign)
Method Detail

createListener

protected AbstractVCListener createListener(Object value,
                                            Object value2,
                                            Symbol sign,
                                            VCListenerCreationReasoningStep rs)
Description copied from class: ListenerTemplate
The template instance returns a AbstractVCListener that can instantiate the template given a concrete object as input.

Specified by:
createListener in class ListenerTemplate

contains

public boolean contains(Variable v)
Description copied from interface: Unifyable
Checks if this Unifyable contains a given Variable (in that case, they cannot be unified). The simplest (if not always the most efficient) implementation is to delegate u.contains(v) to u.getVariables(null).contains(v).

Parameters:
v - the variable to look for
Returns:
true if the variable was found in this Unifyable.

getVariables

public Collection getVariables(Collection tgt)
Description copied from interface: Unifyable
Retrieves the variables in this Unifyable and places them into a provided target collection.

Parameters:
tgt - the collection to which the variables are added. If null, and this Unifyable contains variables, a new collection is created.
Returns:
the target collection. If target is null, and there are no variables, null is returned; if a new collection is created, it has to be modifyable.

deReferenceVariables

public Object deReferenceVariables()
Description copied from interface: Unifyable
Replaces all the variables in this Unifyable by their values. If a value is, in its turn, a variable, the process is repeated.

Returns:
the copy of this Unifyable with all variables de-referenced. In many subclass implementations, this is returned if no variables needed to be dereferenced.
See Also:
Variable

unify

public boolean unify(Object param1,
                     List param2)
Description copied from interface: Unifyable
Attempts to unify with another object, that is find a variable assignment that will make the two objects equal. If the unification is sucessful, the state of the participating variables is changed, i.e. they receive values. These variables are added to the variable stack. If the function returned true, but the stack didn't grow, then the two objects were probably equal to begin with.

Specified by:
unify in interface Unifyable
Overrides:
unify in class ListenerTemplate
Parameters:
param1 - the object to unify with.
param2 - the variable stack
Returns:
true if successful

toString

public String toString()
Overrides:
toString in class Object

getClause

protected Clause getClause()
Description copied from class: ListenerTemplate
The template instance returns a Clause that, as close as possible, indicates what this template represents in FOL.

Specified by:
getClause in class ListenerTemplate

JTP API Documentation