edu.cs.ai.kreator.logic
Class VariableFactory

java.lang.Object
  extended by edu.cs.ai.kreator.logic.VariableFactory

public class VariableFactory
extends java.lang.Object

An instance of this class is responsible for maintaining a unique object status of variables within the scope of variables, e.g. within clauses. Every such scope should provide for an instance of VariableFactory.

Author:
Matthias Thimm

Field Summary
static org.apache.log4j.Logger LOG
           
 
Constructor Summary
VariableFactory()
          Default constructor.
 
Method Summary
 java.lang.Object clone()
          Deprecated. 
 boolean contains(Variable var)
          Checks if the given variables is contained in this factory.
 boolean containsAll(java.util.Collection<Variable> objects)
          Checks if all elements of the given list are contained in this language.
 boolean containsVariable(java.lang.String varName)
          Checks if a Variable with the given name is contained in this factory.
 boolean containsVariable(java.lang.String variableName, Sort sort)
          Checks if a variable with the given name and sort is contained in this language.
 java.util.List<Variable> getAllVariables()
          Returns a list of all variables in this factory.
 Variable getExistingVariable(java.lang.String varName)
          Return the variable with the given name if it exists, else return null
 boolean isValid(java.util.Collection<Literal> literals)
          Checks if the variables of each Literal in the collection are members of this VariableFactory
 boolean isValid(Literal lit)
          Checks if the variables of a given literal are members of this VariableFactory
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.log4j.Logger LOG
Constructor Detail

VariableFactory

public VariableFactory()
Default constructor. Initializes an empty factory.

Method Detail

getAllVariables

public java.util.List<Variable> getAllVariables()
Returns a list of all variables in this factory.

Returns:
a list of all variables in this factory.

getExistingVariable

public Variable getExistingVariable(java.lang.String varName)
Return the variable with the given name if it exists, else return null

Parameters:
varName - the name of the requested variable
Returns:
the variable with the given name if it exists, else return null

containsVariable

public boolean containsVariable(java.lang.String varName)
Checks if a Variable with the given name is contained in this factory.

Parameters:
varName - the requested variable name
Returns:
a boolean.

containsVariable

public boolean containsVariable(java.lang.String variableName,
                                Sort sort)
Checks if a variable with the given name and sort is contained in this language.

Parameters:
variableName -
sort -
Returns:
a boolean.

contains

public boolean contains(Variable var)
Checks if the given variables is contained in this factory.

Parameters:
variable - a variable.
Returns:
a boolean.

containsAll

public boolean containsAll(java.util.Collection<Variable> objects)
Checks if all elements of the given list are contained in this language.

Parameters:
objects - a list of objects.
Returns:
a boolean.

isValid

public boolean isValid(Literal lit)
Checks if the variables of a given literal are members of this VariableFactory

Parameters:
lit - the literal
Returns:
a boolean

isValid

public boolean isValid(java.util.Collection<Literal> literals)
Checks if the variables of each Literal in the collection are members of this VariableFactory

Parameters:
literals -
Returns:
a boolean

clone

@Deprecated
public java.lang.Object clone()
Deprecated. 

WARNING: The objects in this clone still contain references to their "original" LanguageFactory they are registered to.

Overrides:
clone in class java.lang.Object