edu.cs.ai.kreator.logic
Class Variable

java.lang.Object
  extended by edu.cs.ai.kreator.logic.Term
      extended by edu.cs.ai.kreator.logic.Variable
All Implemented Interfaces:
Latexable, java.lang.Comparable<Term>

public class Variable
extends Term

This class models a variable in first-order logic, i.e., a placeholder for any constant in the universe under discourse.

Author:
Matthias Thimm, Sebastian Loh

Method Summary
 int compareTo(Term other)
           
static Variable create(VariableFactory varFac, java.lang.String name, Sort sort)
          Constructs a new variable with the given name and sort.
static Variable createOrGet(VariableFactory varFac, java.lang.String name, Sort sort)
          Returns an already existing variable or, if necessary, constructs a new variable with the given name and sort.
static Variable createUniqueVariable(VariableFactory varFac, Sort sort)
          Returns a new variable with a unique name of the given sort.
 boolean equals(java.lang.Object obj)
          If the other object is a Term, then equals returns true if both objects have the same class, same name and sort.
 java.lang.String getName()
          returns the name (identifier) of this Term
 Sort getSort()
          Returns the sort of this term.
 VariableFactory getVariableFactory()
          Returns the VariableFactory this variable object belongs to.
 int hashCode()
           
 boolean isGround()
          Specifies if this term is ground, i.e., if there occurs any variable in this term
 java.lang.String toLatex()
          Returns a Latex grammar conform string to generate variables, rules (conditionals) etc.
 java.lang.String toString()
           
 
Methods inherited from class edu.cs.ai.kreator.logic.Term
getAllSequences
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static Variable create(VariableFactory varFac,
                              java.lang.String name,
                              Sort sort)
Constructs a new variable with the given name and sort.

Parameters:
name - a string.
sort - a sort
VariableFactory - the VariableFactory the variable will be registered to
Throws:
java.lang.IllegalArgumentException - if a variable with the same name already exists

createOrGet

public static Variable createOrGet(VariableFactory varFac,
                                   java.lang.String name,
                                   Sort sort)
Returns an already existing variable or, if necessary, constructs a new variable with the given name and sort.

Parameters:
name - a string.
sort - a sort
VariableFactory - the VariableFactory the variable will be or is already registered to

createUniqueVariable

public static Variable createUniqueVariable(VariableFactory varFac,
                                            Sort sort)
Returns a new variable with a unique name of the given sort.

Parameters:
VariableFactory - the VariableFactory the variable will be or is already registered to
sort - the sort of the variable.
Returns:
a variable.

isGround

public boolean isGround()
Description copied from class: Term
Specifies if this term is ground, i.e., if there occurs any variable in this term

Specified by:
isGround in class Term
Returns:
a boolean; "true" if there is no variable in this term

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Description copied from class: Term
returns the name (identifier) of this Term

Specified by:
getName in class Term
Returns:

getSort

public Sort getSort()
Description copied from class: Term
Returns the sort of this term.

Specified by:
getSort in class Term
Returns:
the sort

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Term
If the other object is a Term, then equals returns true if both objects have the same class, same name and sort.

Specified by:
equals in class Term
Returns:
true, if both objects have the same class, name and sort.

compareTo

public int compareTo(Term other)

toLatex

public java.lang.String toLatex()
Description copied from interface: Latexable
Returns a Latex grammar conform string to generate variables, rules (conditionals) etc.

Returns:
a Latex grammar conform string.

getVariableFactory

public VariableFactory getVariableFactory()
Returns the VariableFactory this variable object belongs to.

Returns:
the VariableFactory