The Meta-Environment API

aterm
Interface ATermFactory

All Known Implementing Classes:
PureFactory

public interface ATermFactory

An ATermFactory is responsible for making new ATerms. A factory can create a new ATerm by parsing a String, by making it via one of the many "make" methods, or by reading it from an InputStream.

Author:
Hayco de Jong (jong@cwi.nl), Pieter Olivier (olivierp@cwi.nl)

Field Summary
static byte START_OF_SHARED_TEXT_FILE
           
 
Method Summary
 ATerm importTerm(ATerm term)
          Creates an ATerm by importing it from another ATermFactory.
 ATerm make(ATerm pattern, java.util.List<java.lang.Object> args)
          Creates a new ATerm given a pattern and a list of arguments.
 ATerm make(java.lang.String trm)
          Equivalent of parse.
 ATerm make(java.lang.String pattern, java.util.List<java.lang.Object> args)
          Creates a new ATerm given a string pattern and a list of arguments.
 ATerm make(java.lang.String pattern, java.lang.Object arg1)
          Creates a new ATerm given a pattern and a single argument.
 ATerm make(java.lang.String pattern, java.lang.Object arg1, java.lang.Object arg2)
          Creates a new ATerm given a pattern and a fixed number of arguments.
 ATerm make(java.lang.String pattern, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Creates a new ATerm given a pattern and a fixed number of arguments.
 ATerm make(java.lang.String pattern, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
          Creates a new ATerm given a pattern and a fixed number of arguments.
 ATerm make(java.lang.String pattern, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5)
          Creates a new ATerm given a pattern and a fixed number of arguments.
 ATerm make(java.lang.String pattern, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6)
          Creates a new ATerm given a pattern and a fixed number of arguments.
 ATerm make(java.lang.String pattern, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4, java.lang.Object arg5, java.lang.Object arg6, java.lang.Object arg7)
          Creates a new ATerm given a pattern and a fixed number of arguments.
 AFun makeAFun(java.lang.String name, int arity, boolean isQuoted)
          Creates an AFun object
 ATermAppl makeAppl(AFun fun)
          Creates a function application.
 ATermAppl makeAppl(AFun fun, ATerm arg)
          Creates a function application.
 ATermAppl makeAppl(AFun fun, ATerm[] args)
          Creates a function application.
 ATermAppl makeAppl(AFun fun, ATerm arg1, ATerm arg2)
          Creates a function application.
 ATermAppl makeAppl(AFun fun, ATerm arg1, ATerm arg2, ATerm arg3)
          Creates a function application.
 ATermAppl makeAppl(AFun fun, ATerm arg1, ATerm arg2, ATerm arg3, ATerm arg4)
          Creates a function application.
 ATermAppl makeAppl(AFun fun, ATerm arg1, ATerm arg2, ATerm arg3, ATerm arg4, ATerm arg5)
          Creates a function application.
 ATermAppl makeAppl(AFun fun, ATerm arg1, ATerm arg2, ATerm arg3, ATerm arg4, ATerm arg5, ATerm arg6)
          Creates a function application.
 ATermAppl makeApplList(AFun fun, ATermList args)
          Creates a function application.
 ATermBlob makeBlob(byte[] data)
          Creates an ATermBlob (Binary Large OBject).
 ATermInt makeInt(int val)
          Creates a new ATermInt object
 ATermList makeList()
          Creates an empty ATermList object
 ATermList makeList(ATerm single)
          Creates a singleton ATermList object.
 ATermList makeList(ATerm head, ATermList tail)
          Creates a head-tail style ATermList.
 ATermLong makeLong(long val)
          Creates a new ATermLong object
 ATermPlaceholder makePlaceholder(ATerm type)
          Creates an ATermPlaceholder object.
 ATermReal makeReal(double val)
          Creates a new ATermReal object
 ATerm parse(java.lang.String trm)
          Creates a new ATerm by parsing a string.
 ATerm readFromBinaryFile(java.io.InputStream stream)
          Creates an ATerm from a binary stream.
 ATerm readFromFile(java.io.InputStream stream)
          Creates an ATerm from a stream.
 ATerm readFromFile(java.lang.String file)
          Creates an ATerm from a given filename.
 ATerm readFromSharedTextFile(java.io.InputStream stream)
          Creates an ATerm from a shared text stream.
 ATerm readFromTextFile(java.io.InputStream stream)
          Creates an ATerm from a text stream.
 

Field Detail

START_OF_SHARED_TEXT_FILE

static final byte START_OF_SHARED_TEXT_FILE
See Also:
Constant Field Values
Method Detail

parse

ATerm parse(java.lang.String trm)
Creates a new ATerm by parsing a string.

Parameters:
trm - the string representation of the term
Returns:
the parsed term.
See Also:
make(String)

make

ATerm make(java.lang.String trm)
Equivalent of parse.

Parameters:
trm - the string representation of the term
Returns:
the parsed term.
See Also:
parse(String)

make

ATerm make(java.lang.String pattern,
           java.util.List<java.lang.Object> args)
Creates a new ATerm given a string pattern and a list of arguments. First the string pattern is parsed into an ATerm. Then the holes in the pattern are filled with arguments taken from the supplied list of arguments.

Parameters:
pattern - the string pattern containing a placeholder for each argument.
args - the list of arguments to be filled into the placeholders.
Returns:
the constructed term.

make

ATerm make(ATerm pattern,
           java.util.List<java.lang.Object> args)
Creates a new ATerm given a pattern and a list of arguments. The holes in the pattern are filled with arguments taken from the supplied list of arguments.

Parameters:
pattern - the pattern containing a placeholder for each argument.
args - the list of arguments to be filled into the placeholders.
Returns:
the constructed term.

make

ATerm make(java.lang.String pattern,
           java.lang.Object arg1)
Creates a new ATerm given a pattern and a single argument. This convenience method creates an ATerm from a pattern and one argument.

Parameters:
pattern - the pattern containing a placeholder for the argument.
arg1 - the argument to be filled into the hole.
Returns:
the constructed term.

make

ATerm make(java.lang.String pattern,
           java.lang.Object arg1,
           java.lang.Object arg2)
Creates a new ATerm given a pattern and a fixed number of arguments. This convenience method creates an ATerm from a pattern and two arguments.

Parameters:
pattern - the pattern containing a placeholder for the arguments.
arg1 - the argument to be filled into the first hole.
arg2 - the argument to be filled into the second hole.
Returns:
the constructed term.

make

ATerm make(java.lang.String pattern,
           java.lang.Object arg1,
           java.lang.Object arg2,
           java.lang.Object arg3)
Creates a new ATerm given a pattern and a fixed number of arguments. This convenience method creates an ATerm from a pattern and three arguments.

Parameters:
pattern - the pattern containing a placeholder for the arguments.
arg1 - the argument to be filled into the first hole.
arg2 - the argument to be filled into the second hole.
arg3 - the argument to be filled into the third hole.
Returns:
the constructed term.

make

ATerm make(java.lang.String pattern,
           java.lang.Object arg1,
           java.lang.Object arg2,
           java.lang.Object arg3,
           java.lang.Object arg4)
Creates a new ATerm given a pattern and a fixed number of arguments. This convenience method creates an ATerm from a pattern and four arguments.

Parameters:
pattern - the pattern containing a placeholder for the arguments.
arg1 - the argument to be filled into the first hole.
arg2 - the argument to be filled into the second hole.
arg3 - the argument to be filled into the third hole.
arg4 - the argument to be filled into the fourth hole.
Returns:
the constructed term.

make

ATerm make(java.lang.String pattern,
           java.lang.Object arg1,
           java.lang.Object arg2,
           java.lang.Object arg3,
           java.lang.Object arg4,
           java.lang.Object arg5)
Creates a new ATerm given a pattern and a fixed number of arguments. This convenience method creates an ATerm from a pattern and five arguments.

Parameters:
pattern - the pattern containing a placeholder for the arguments.
arg1 - the argument to be filled into the first hole.
arg2 - the argument to be filled into the second hole.
arg3 - the argument to be filled into the third hole.
arg4 - the argument to be filled into the fourth hole.
arg5 - the argument to be filled into the fifth hole.
Returns:
the constructed term.

make

ATerm make(java.lang.String pattern,
           java.lang.Object arg1,
           java.lang.Object arg2,
           java.lang.Object arg3,
           java.lang.Object arg4,
           java.lang.Object arg5,
           java.lang.Object arg6)
Creates a new ATerm given a pattern and a fixed number of arguments. This convenience method creates an ATerm from a pattern and six arguments.

Parameters:
pattern - the pattern containing a placeholder for the arguments.
arg1 - the argument to be filled into the first hole.
arg2 - the argument to be filled into the second hole.
arg3 - the argument to be filled into the third hole.
arg4 - the argument to be filled into the fourth hole.
arg5 - the argument to be filled into the fifth hole.
arg6 - the argument to be filled into the sixth hole.
Returns:
the constructed term.

make

ATerm make(java.lang.String pattern,
           java.lang.Object arg1,
           java.lang.Object arg2,
           java.lang.Object arg3,
           java.lang.Object arg4,
           java.lang.Object arg5,
           java.lang.Object arg6,
           java.lang.Object arg7)
Creates a new ATerm given a pattern and a fixed number of arguments. This convenience method creates an ATerm from a pattern and seven arguments.

Parameters:
pattern - the pattern containing a placeholder for the arguments.
arg1 - the argument to be filled into the first hole.
arg2 - the argument to be filled into the second hole.
arg3 - the argument to be filled into the third hole.
arg4 - the argument to be filled into the fourth hole.
arg5 - the argument to be filled into the fifth hole.
arg6 - the argument to be filled into the sixth hole.
arg7 - the argument to be filled into the seventh hole.
Returns:
the constructed term.

makeInt

ATermInt makeInt(int val)
Creates a new ATermInt object

Parameters:
val - the integer value to be stored.
Returns:
the constructed ATermInt object.

makeLong

ATermLong makeLong(long val)
Creates a new ATermLong object

Parameters:
val - the long value to be stored.
Returns:
the constructed ATermLong object.

makeReal

ATermReal makeReal(double val)
Creates a new ATermReal object

Parameters:
val - the double value to be stored.
Returns:
the constructed ATermReal object.

makeList

ATermList makeList()
Creates an empty ATermList object

Returns:
the (empty) ATermList.

makeList

ATermList makeList(ATerm single)
Creates a singleton ATermList object.

Parameters:
single - the element to be placed in the list.
Returns:
the singleton ATermList object.

makeList

ATermList makeList(ATerm head,
                   ATermList tail)
Creates a head-tail style ATermList.

Parameters:
head - the head of the list.
tail - the tail of the list.
Returns:
the constructed ATermList.

makePlaceholder

ATermPlaceholder makePlaceholder(ATerm type)
Creates an ATermPlaceholder object.

Parameters:
type - the type of the hole in the placeholder.
Returns:
the constructed ATermPlaceholder.

makeBlob

ATermBlob makeBlob(byte[] data)
Creates an ATermBlob (Binary Large OBject).

Parameters:
data - the data to be stored in the blob.
Returns:
the constructed ATermBlob.

makeAFun

AFun makeAFun(java.lang.String name,
              int arity,
              boolean isQuoted)
Creates an AFun object

Parameters:
name - the name of the function symbol.
arity - the arity of the function symbol.
isQuoted - whether the function symbol is quoted ("foo") or not (foo).
Returns:
the constructed AFun.

makeAppl

ATermAppl makeAppl(AFun fun)
Creates a function application.

Parameters:
fun - the function symbol of the application.
Returns:
the constructed function application.

makeAppl

ATermAppl makeAppl(AFun fun,
                   ATerm arg)
Creates a function application.

Parameters:
fun - the function symbol of the application.
arg - the argument of the application.
Returns:
the constructed function application.

makeAppl

ATermAppl makeAppl(AFun fun,
                   ATerm arg1,
                   ATerm arg2)
Creates a function application.

Parameters:
fun - the function symbol of the application.
arg1 - the first argument of the application.
arg2 - the second argument of the application.
Returns:
the constructed function application.

makeAppl

ATermAppl makeAppl(AFun fun,
                   ATerm arg1,
                   ATerm arg2,
                   ATerm arg3)
Creates a function application.

Parameters:
fun - the function symbol of the application.
arg1 - the first argument of the application.
arg2 - the second argument of the application.
arg3 - the third argument of the application.
Returns:
the constructed function application.

makeAppl

ATermAppl makeAppl(AFun fun,
                   ATerm arg1,
                   ATerm arg2,
                   ATerm arg3,
                   ATerm arg4)
Creates a function application.

Parameters:
fun - the function symbol of the application.
arg1 - the first argument of the application.
arg2 - the second argument of the application.
arg3 - the third argument of the application.
arg4 - the fourth argument of the application.
Returns:
the constructed function application.

makeAppl

ATermAppl makeAppl(AFun fun,
                   ATerm arg1,
                   ATerm arg2,
                   ATerm arg3,
                   ATerm arg4,
                   ATerm arg5)
Creates a function application.

Parameters:
fun - the function symbol of the application.
arg1 - the first argument of the application.
arg2 - the second argument of the application.
arg3 - the third argument of the application.
arg4 - the fourth argument of the application.
arg5 - the fifth argument of the application.
Returns:
the constructed function application.

makeAppl

ATermAppl makeAppl(AFun fun,
                   ATerm arg1,
                   ATerm arg2,
                   ATerm arg3,
                   ATerm arg4,
                   ATerm arg5,
                   ATerm arg6)
Creates a function application.

Parameters:
fun - the function symbol of the application.
arg1 - the first argument of the application.
arg2 - the second argument of the application.
arg3 - the third argument of the application.
arg4 - the fourth argument of the application.
arg5 - the fifth argument of the application.
arg6 - the sixth argument of the application.
Returns:
the constructed function application.

makeAppl

ATermAppl makeAppl(AFun fun,
                   ATerm[] args)
Creates a function application.

Parameters:
fun - the function symbol of the application.
args - an array containing the arguments.
Returns:
the constructed function application.

makeApplList

ATermAppl makeApplList(AFun fun,
                       ATermList args)
Creates a function application.

Parameters:
fun - the function symbol of the application.
args - an ATermList containing the arguments.
Returns:
the constructed function application.

readFromTextFile

ATerm readFromTextFile(java.io.InputStream stream)
                       throws java.io.IOException
Creates an ATerm from a text stream.

Parameters:
stream - the inputstream to read the ATerm from.
Returns:
the parsed ATerm.
Throws:
java.io.IOException

readFromSharedTextFile

ATerm readFromSharedTextFile(java.io.InputStream stream)
                             throws java.io.IOException
Creates an ATerm from a shared text stream.

Parameters:
stream - the inputstream to read the ATerm from.
Returns:
the parsed ATerm.
Throws:
java.io.IOException

readFromBinaryFile

ATerm readFromBinaryFile(java.io.InputStream stream)
                         throws java.io.IOException
Creates an ATerm from a binary stream.

Parameters:
stream - the inputstream to read the ATerm from.
Returns:
the parsed ATerm.
Throws:
java.io.IOException

readFromFile

ATerm readFromFile(java.io.InputStream stream)
                   throws java.io.IOException
Creates an ATerm from a stream. This function determines the type of stream (text, shared, binary) and parses the ATerm accordingly.

Parameters:
stream - the inputstream to read the ATerm from.
Returns:
the parsed ATerm.
Throws:
java.io.IOException

readFromFile

ATerm readFromFile(java.lang.String file)
                   throws java.io.IOException
Creates an ATerm from a given filename.

Parameters:
file - the filename to read the ATerm from.
Returns:
the parsed ATerm.
Throws:
java.io.IOException

importTerm

ATerm importTerm(ATerm term)
Creates an ATerm by importing it from another ATermFactory.

Parameters:
term - the term (possibly from another ATermFactory) to rebuild in this factory.
Returns:
the imported ATerm.

The Meta-Environment API