edu.cs.ai.kreator.logic
Class Sort

java.lang.Object
  extended by edu.cs.ai.kreator.logic.Sort
All Implemented Interfaces:
java.lang.Comparable<Sort>

public class Sort
extends java.lang.Object
implements java.lang.Comparable<Sort>

Author:
Sebastian Loh, Matthias Thimm This class models a sort (or type) of a sorted predicate logic. Each constant and variable is of exactly one sort. Furthermore each argument of every predicate is associated with one sort.

Field Summary
static org.apache.log4j.Logger LOG
           
 
Method Summary
 int compareTo(Sort other)
           
static Sort create(LanguageFactory lang, java.lang.String name)
          Constructs a new sort with the given name.
static Sort createOrGet(LanguageFactory lang, java.lang.String name)
          Return an already existing sort or, if necessary, constructs a new sort with the given name.
 boolean equals(java.lang.Object obj)
           
 LanguageFactory getLanguageFactory()
          Returns the LanguageFactory this sort object belongs to.
 java.lang.String getName()
           
 Sort getThing()
          The thing sort of this language.
 int hashCode()
           
 java.lang.String toLatex()
          Returns a Latex grammar conform string to generate variables, rules (conditionals) etc.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

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

create

public static Sort create(LanguageFactory lang,
                          java.lang.String name)
                   throws WriteProtectionException
Constructs a new sort with the given name.

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

createOrGet

public static Sort createOrGet(LanguageFactory lang,
                               java.lang.String name)
                        throws WriteProtectionException
Return an already existing sort or, if necessary, constructs a new sort with the given name.

Parameters:
name - a string.
languageFactory - the LanguageFactory the sort will be or is already registered to
Throws:
WriteProtectionException

getName

public java.lang.String getName()

getThing

public Sort getThing()
The thing sort of this language.

Returns:
the thing sort of this language.

hashCode

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

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

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

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.

compareTo

public int compareTo(Sort other)
Specified by:
compareTo in interface java.lang.Comparable<Sort>

getLanguageFactory

public LanguageFactory getLanguageFactory()
Returns the LanguageFactory this sort object belongs to.

Returns:
the lang