aterm
Interface ATerm

All Superinterfaces:
aterm.ATermVisitable, aterm.visitor.Visitable
All Known Subinterfaces:
ATermAppl, ATermBlob, ATermInt, ATermList, ATermPlaceholder, ATermReal

public interface ATerm
extends aterm.ATermVisitable

This is the base interface for all ATerm interfaces, which will ultimately be implemented by two separate ATerm Factories (a native and a pure one).


Field Summary
static int APPL
          A term of type APPL (function application)
static int BLOB
          A term of type BLOB (Binary Large OBject)
static int INT
          A term of type INT
static int LIST
          A term of type LIST
static int PLACEHOLDER
          A term of type PLACEHOLDER
static int REAL
          A term of type REAL
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks equality of this term against any java object.
 aterm.ATerm getAnnotation(aterm.ATerm label)
          Gets a annotation associated with specific label from this term.
 aterm.ATermList getAnnotations()
          Gets all annotations of this term.
 aterm.ATermFactory getFactory()
          Retrieves the factory responsible for creating this ATerm.
 int getType()
          Gets the type of this term.
 int hashCode()
          Gets a hashcode value of this term.
 boolean isEqual(aterm.ATerm term)
          Checks equality of this term against another term.
 aterm.ATerm make(java.util.List args)
          Create a new term based on this term as a pattern and a list of arguments.
 java.util.List match(aterm.ATerm pattern)
          Matches this term against a term pattern.
 java.util.List match(java.lang.String pattern)
          Matches this term against a String pattern.
 aterm.ATerm removeAnnotation(aterm.ATerm label)
          Removes a specific annotation from this term.
 aterm.ATerm removeAnnotations()
          Removes all annotations of this term.
 aterm.ATerm setAnnotation(aterm.ATerm label, aterm.ATerm anno)
          Sets annotation of this term with given label.
 aterm.ATerm setAnnotations(aterm.ATermList annos)
          Sets all annotations of this term.
 java.lang.String toString()
          Gets a string representation of this term.
 void writeToSharedTextFile(java.io.OutputStream stream)
          Write a term to a shared text file/stream.
 void writeToTextFile(java.io.OutputStream stream)
          Write a term to a text file/stream.
 
Methods inherited from interface aterm.ATermVisitable
accept
 
Methods inherited from interface aterm.visitor.Visitable
getChildAt, getChildCount, setChildAt
 

Field Detail

INT

public static final int INT
A term of type INT

See Also:
Constant Field Values

REAL

public static final int REAL
A term of type REAL

See Also:
Constant Field Values

APPL

public static final int APPL
A term of type APPL (function application)

See Also:
Constant Field Values

LIST

public static final int LIST
A term of type LIST

See Also:
Constant Field Values

PLACEHOLDER

public static final int PLACEHOLDER
A term of type PLACEHOLDER

See Also:
Constant Field Values

BLOB

public static final int BLOB
A term of type BLOB (Binary Large OBject)

See Also:
Constant Field Values
Method Detail

getType

public int getType()
Gets the type of this term.

Returns:
the type of this ATerm.
See Also:
INT, REAL, APPL, LIST, PLACEHOLDER, BLOB

hashCode

public int hashCode()
Gets a hashcode value of this term.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode of this term.

match

public java.util.List match(java.lang.String pattern)
Matches this term against a String pattern. The pattern is parsed into a term, which this term is then matched against.

Parameters:
pattern - the string pattern to match this term against.
Returns:
a list containing the subterms matching the placeholders if the match succeeds, or null if the match fails.
Throws:
aterm.ParseError - if pattern cannot be parsed into a term.
See Also:
match(ATerm)

match

public java.util.List match(aterm.ATerm pattern)
Matches this term against a term pattern. A list containing the subterms matching the placeholders in the pattern is built as this term is matched against the pattern.

Parameters:
pattern - The term pattern to match this term against.
Returns:
a list containing the subterms matching the placeholders if the match succeeds, or null if the match fails.

getAnnotation

public aterm.ATerm getAnnotation(aterm.ATerm label)
Gets a annotation associated with specific label from this term.

Parameters:
label - the label of the desired annotation.
Returns:
the annotation associated with label, or null if annotation with specified label does not exist.
See Also:
setAnnotation(aterm.ATerm, aterm.ATerm)

setAnnotation

public aterm.ATerm setAnnotation(aterm.ATerm label,
                                 aterm.ATerm anno)
Sets annotation of this term with given label. If no annotation with this label exists, a new annotation is created, otherwise the existing annotation is updated.

Parameters:
label - the label of the annotation.
anno - the annotation itself.
Returns:
a new version of this term with the requested annotation.
See Also:
getAnnotation(aterm.ATerm)

removeAnnotation

public aterm.ATerm removeAnnotation(aterm.ATerm label)
Removes a specific annotation from this term.

Parameters:
label - the label of the annotation to be removed.
Returns:
a new version of this term without the annotation.
See Also:
setAnnotation(aterm.ATerm, aterm.ATerm)

getAnnotations

public aterm.ATermList getAnnotations()
Gets all annotations of this term.

Returns:
all annotations of this term
See Also:
setAnnotations(aterm.ATermList)

setAnnotations

public aterm.ATerm setAnnotations(aterm.ATermList annos)
Sets all annotations of this term.

Parameters:
annos - the annotations to set.
Returns:
a new version of this term with the requested annotations.
See Also:
getAnnotations()

removeAnnotations

public aterm.ATerm removeAnnotations()
Removes all annotations of this term.

Returns:
a new version of this term without annotations.
See Also:
setAnnotations(aterm.ATermList)

isEqual

public boolean isEqual(aterm.ATerm term)
Checks equality of this term against another term. This method exists to keep a tight relation to the C-library. Experienced Java programmers might feel more comfortable using the equals(java.lang.Object) method.

Parameters:
term - the term to check for equality.
Returns:
true iff terms are equal (including any annotations they might have!), false otherwise.
See Also:
equals(Object)

equals

public boolean equals(java.lang.Object obj)
Checks equality of this term against any java object. Note that for two terms to be equal, any annotations they might have must be equal as well.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to check for equality.
Returns:
true iff term equals obj (including annotations).
See Also:
isEqual(aterm.ATerm)

writeToTextFile

public void writeToTextFile(java.io.OutputStream stream)
                     throws java.io.IOException
Write a term to a text file/stream.

Parameters:
stream - the stream to write to
java.io.IOException

writeToSharedTextFile

public void writeToSharedTextFile(java.io.OutputStream stream)
                           throws java.io.IOException
Write a term to a shared text file/stream. An efficient shared ASCII representation of this term is written to the stream.

Parameters:
stream - the stream to write this term to
java.io.IOException

make

public aterm.ATerm make(java.util.List args)
Create a new term based on this term as a pattern and a list of arguments.

Parameters:
args - the list of arguments used to fill up holes in the pattern

getFactory

public aterm.ATermFactory getFactory()
Retrieves the factory responsible for creating this ATerm.

Returns:
the factory that created this ATerm object.

toString

public java.lang.String toString()
Gets a string representation of this term.

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