tom.engine.adt.typeconstraints
Class TypeConstraintsAbstractType

java.lang.Object
  extended by tom.engine.adt.typeconstraints.TypeConstraintsAbstractType
All Implemented Interfaces:
Comparable, shared.SharedObject, shared.SharedObjectWithID, Visitable
Direct Known Subclasses:
Info, TypeConstraint, TypeConstraintList

public abstract class TypeConstraintsAbstractType
extends Object
implements shared.SharedObjectWithID, Visitable, Comparable

This class provides a skeletal implementation of terms When implementing the interface shared.SharedObjectWithID, the objects are immutable and can be compared in constant time, using ==.


Field Summary
protected static aterm.ATermFactory atermFactory
           
protected static shared.SharedObjectFactory factory
           
 
Constructor Summary
protected TypeConstraintsAbstractType()
          Sole constructor.
 
Method Summary
abstract  int compareTo(Object o)
          Compares two terms.
abstract  int compareToLPO(Object o)
          Compares two terms.
protected static boolean convertATermToBoolean(aterm.ATerm at, ATermConverter atConv)
          Converts an ATerm into a boolean
protected static char convertATermToChar(aterm.ATerm at, ATermConverter atConv)
          Converts an ATerm into a char
protected static double convertATermToDouble(aterm.ATerm at, ATermConverter atConv)
          Converts an ATerm into a double
protected static float convertATermToFloat(aterm.ATerm at, ATermConverter atConv)
          Converts an ATerm into a float
protected static int convertATermToInt(aterm.ATerm at, ATermConverter atConv)
          Converts an ATerm into an int
protected static long convertATermToLong(aterm.ATerm at, ATermConverter atConv)
          Converts an ATerm into a long
protected static String convertATermToString(aterm.ATerm at, ATermConverter atConv)
          Converts an ATerm into a string
 int getUniqueIdentifier()
          Returns an integer that identifies this term in a unique way.
 void setUniqueIdentifier(int uniqueID)
          Modifies the integer that identifies this term in a unique way.
abstract  String symbolName()
          Returns a string representation of the top symbol of this term.
abstract  aterm.ATerm toATerm()
          Returns an ATerm representation of this term.
 String toString()
          Returns a string representation of this term.
abstract  void toStringBuilder(StringBuilder buffer)
          Appends a string representation of this term to the buffer given as argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface shared.SharedObject
duplicate, equivalent, hashCode
 
Methods inherited from interface tom.library.sl.Visitable
getChildAt, getChildCount, getChildren, setChildAt, setChildren
 

Field Detail

factory

protected static final shared.SharedObjectFactory factory

atermFactory

protected static final aterm.ATermFactory atermFactory
Constructor Detail

TypeConstraintsAbstractType

protected TypeConstraintsAbstractType()
Sole constructor. (For invocation by subclass constructors, typically implicit.)

Method Detail

toATerm

public abstract aterm.ATerm toATerm()
Returns an ATerm representation of this term.

Returns:
an ATerm representation of this term.

symbolName

public abstract String symbolName()
Returns a string representation of the top symbol of this term.

Returns:
a string representation of the top symbol of this term.

toString

public String toString()
Returns a string representation of this term.

Overrides:
toString in class Object
Returns:
a string representation of this term.

toStringBuilder

public abstract void toStringBuilder(StringBuilder buffer)
Appends a string representation of this term to the buffer given as argument.

Parameters:
buffer - the buffer to which a string represention of this term is appended.

compareTo

public abstract int compareTo(Object o)
Compares two terms. This functions implements a total order.

Specified by:
compareTo in interface Comparable
Parameters:
o - object to which this term is compared
Returns:
a negative integer, zero, or a positive integer as this term is less than, equal to, or greater than the argument

compareToLPO

public abstract int compareToLPO(Object o)
Compares two terms. This functions implements a total lexicographic path ordering.

Parameters:
o - object to which this term is compared
Returns:
a negative integer, zero, or a positive integer as this term is less than, equal to, or greater than the argument

convertATermToString

protected static String convertATermToString(aterm.ATerm at,
                                             ATermConverter atConv)
Converts an ATerm into a string

Parameters:
at - ATerm to convert
atConv - converter applied to the ATerm before coersion
Returns:
a string

convertATermToInt

protected static int convertATermToInt(aterm.ATerm at,
                                       ATermConverter atConv)
Converts an ATerm into an int

Parameters:
at - ATerm to convert
atConv - converter applied to the ATerm before coersion
Returns:
an int

convertATermToFloat

protected static float convertATermToFloat(aterm.ATerm at,
                                           ATermConverter atConv)
Converts an ATerm into a float

Parameters:
at - ATerm to convert
atConv - converter applied to the ATerm before coersion
Returns:
a float

convertATermToDouble

protected static double convertATermToDouble(aterm.ATerm at,
                                             ATermConverter atConv)
Converts an ATerm into a double

Parameters:
at - ATerm to convert
atConv - converter applied to the ATerm before coersion
Returns:
a double

convertATermToLong

protected static long convertATermToLong(aterm.ATerm at,
                                         ATermConverter atConv)
Converts an ATerm into a long

Parameters:
at - ATerm to convert
atConv - converter applied to the ATerm before coersion
Returns:
a long

convertATermToBoolean

protected static boolean convertATermToBoolean(aterm.ATerm at,
                                               ATermConverter atConv)
Converts an ATerm into a boolean

Parameters:
at - ATerm to convert
atConv - converter applied to the ATerm before coersion
Returns:
a boolean

convertATermToChar

protected static char convertATermToChar(aterm.ATerm at,
                                         ATermConverter atConv)
Converts an ATerm into a char

Parameters:
at - ATerm to convert
atConv - converter applied to the ATerm before coersion
Returns:
a char

getUniqueIdentifier

public int getUniqueIdentifier()
Returns an integer that identifies this term in a unique way. t1.getUniqueIdentifier()==t2.getUniqueIdentifier() iff t1==t2.

Specified by:
getUniqueIdentifier in interface shared.SharedObjectWithID
Returns:
an integer that identifies this term in a unique way.

setUniqueIdentifier

public void setUniqueIdentifier(int uniqueID)
Modifies the integer that identifies this term in a unique way.

Specified by:
setUniqueIdentifier in interface shared.SharedObjectWithID
Parameters:
uniqueID - integer that identifies this term in a unique way.