ua.gradsoft.termware
Class TermFactory

java.lang.Object
  extended by ua.gradsoft.termware.TermFactory

public class TermFactory
extends Object

Factory for terms. Common usage: TermWare.getInstance().getTermFactory().createTerm()


Method Summary
 Term createArgsPatternTerm(Term x1, Term x2)
          create args-pattern term f..($x)
 AtomTerm createAtom(String name)
           
static BigDecimalTerm createBigDecimal(BigDecimal value)
           
static BigIntegerTerm createBigInteger(BigInteger value)
           
static Term createBoolean(boolean value)
           
 Term createByte(byte value)
           
static CharTerm createChar(char value)
           
 Term createClassPatternTerm(String className, Term pattern)
           
 Term createComplexTerm(Name name, Term[] body)
           
 Term createComplexTerm(String name, Term[] body)
          return Term with name name and body body
 Term createComplexTerm0(String name)
           
 Term createConsTerm(Term car, Term cdr)
           
static DoubleTerm createDouble(double value)
          create double term with value value
static FloatTerm createFloat(float value)
           
static IntTerm createInt(int value)
           
static Term createJTerm(Object o)
          return Term wrapper arroutnd java.lang.Object
 Term createList(List terms)
          create list [i.
 Term createList(Term[] array)
          create list [i.
 Term createListInArray(Term[] terms, int index)
           
static LongTerm createLong(long value)
           
static Term createNil()
           
static Term createNIL()
           
 Term createParsedTerm(String s)
           
 Term createParsedTerm(String s, SourceCodeLocation startLocation)
           
 Term createSetPattern(Term x1, Term x2)
          create set-pattern ter, { x1 : x2 }
 Term createSetPatternTerm(Term x1, Term x2)
          create set-pattern term { x1 : x2 }
 SetTerm createSetTerm()
           
 SetTerm createSetTerm(SetOfTerms setOfTerms)
           
static ShortTerm createShort(short value)
           
static StringTerm createString(String value)
           
 Term createTerm(boolean b)
           
 Term createTerm(byte value)
           
 Term createTerm(String name, int v)
          Syntax sugar: equal to createTerm(name,ITermFactory.createInt(v),useIndexedNames)
 Term createTerm(String name, int x, int y)
          create term with 2 integer subterms.
 Term createTerm(String name, String s)
          Syntax sugar: equal to createTerm(name,ITermFactory.createString(s))
 Term createTerm(String name, String[] stringBody)
          return complex term, where subterms are atoms with names from stringBody
 Term createTerm(String name, String x1, Term x2)
          create term 'name(x1,x2)', transforming x1 to string term.
 Term createTerm(String name, Term x)
           
 Term createTerm(String name, Term[] body)
          The same as createComplexTerm
 Term createTerm(String name, Term x1, Term x2)
          create term name(x1,x2)
 Term createTerm(String name, Term x1, Term x2, Term x3)
           
 Term createTerm(String name, Term x1, Term x2, Term x3, Term x4)
           
static Term createX(int index)
          create propositional variable with index x.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createParsedTerm

public Term createParsedTerm(String s)
                      throws TermWareException
Throws:
TermWareException

createParsedTerm

public Term createParsedTerm(String s,
                             SourceCodeLocation startLocation)
                      throws TermWareException
Throws:
TermWareException

createNIL

public static Term createNIL()

createNil

public static Term createNil()

createBoolean

public static Term createBoolean(boolean value)

createTerm

public Term createTerm(boolean b)

createByte

public Term createByte(byte value)

createTerm

public Term createTerm(byte value)

createAtom

public AtomTerm createAtom(String name)

createShort

public static ShortTerm createShort(short value)

createInt

public static IntTerm createInt(int value)

createLong

public static LongTerm createLong(long value)

createBigDecimal

public static BigDecimalTerm createBigDecimal(BigDecimal value)

createBigInteger

public static BigIntegerTerm createBigInteger(BigInteger value)

createChar

public static CharTerm createChar(char value)

createString

public static StringTerm createString(String value)

createFloat

public static FloatTerm createFloat(float value)

createDouble

public static DoubleTerm createDouble(double value)
create double term with value value


createX

public static Term createX(int index)
create propositional variable with index x.


createJTerm

public static Term createJTerm(Object o)
                        throws TermWareException
return Term wrapper arroutnd java.lang.Object

Throws:
TermWareException

createComplexTerm

public Term createComplexTerm(String name,
                              Term[] body)
                       throws TermWareException
return Term with name name and body body

Throws:
TermWareException

createTerm

public Term createTerm(String name,
                       Term[] body)
                throws TermWareException
The same as createComplexTerm

Throws:
TermWareException

createTerm

public Term createTerm(String name,
                       String[] stringBody)
                throws TermWareException
return complex term, where subterms are atoms with names from stringBody

Throws:
TermWareException

createComplexTerm

public Term createComplexTerm(Name name,
                              Term[] body)
                       throws TermWareException
Throws:
TermWareException

createSetTerm

public SetTerm createSetTerm()
                      throws TermWareException
Throws:
TermWareException

createSetTerm

public SetTerm createSetTerm(SetOfTerms setOfTerms)
                      throws TermWareException
Throws:
TermWareException

createSetPattern

public Term createSetPattern(Term x1,
                             Term x2)
                      throws TermWareException
create set-pattern ter, { x1 : x2 }

Throws:
TermWareException

createSetPatternTerm

public Term createSetPatternTerm(Term x1,
                                 Term x2)
                          throws TermWareException
create set-pattern term { x1 : x2 }

Throws:
TermWareException

createArgsPatternTerm

public Term createArgsPatternTerm(Term x1,
                                  Term x2)
                           throws TermWareException
create args-pattern term f..($x)

Throws:
TermWareException

createClassPatternTerm

public Term createClassPatternTerm(String className,
                                   Term pattern)
                            throws TermWareException
Throws:
TermWareException

createConsTerm

public Term createConsTerm(Term car,
                           Term cdr)
                    throws TermWareException
Throws:
TermWareException

createTerm

public Term createTerm(String name,
                       Term x)
                throws TermWareException
Throws:
TermWareException

createTerm

public Term createTerm(String name,
                       Term x1,
                       Term x2)
                throws TermWareException
create term name(x1,x2)

Parameters:
name - - functional symbol
x1 - - first argument
x2 - - second argument
Throws:
TermWareException

createTerm

public Term createTerm(String name,
                       Term x1,
                       Term x2,
                       Term x3)
                throws TermWareException
Throws:
TermWareException

createTerm

public Term createTerm(String name,
                       String x1,
                       Term x2)
                throws TermWareException
create term 'name(x1,x2)', transforming x1 to string term.

Throws:
TermWareException

createTerm

public Term createTerm(String name,
                       Term x1,
                       Term x2,
                       Term x3,
                       Term x4)
                throws TermWareException
Throws:
TermWareException

createList

public Term createList(Term[] array)
create list [i. e. cons(x1,cons(x2,...,cons(xN,NIL)..)) ] from array array


createList

public Term createList(List terms)
create list [i. e. cons(x1,cons(x2,...,cons(xN,NIL)..)) ] from list of terms.


createListInArray

public Term createListInArray(Term[] terms,
                              int index)

createComplexTerm0

public Term createComplexTerm0(String name)
                        throws TermWareException
Throws:
TermWareException

createTerm

public final Term createTerm(String name,
                             String s)
                      throws TermWareException
Syntax sugar: equal to createTerm(name,ITermFactory.createString(s))

Throws:
TermWareException

createTerm

public final Term createTerm(String name,
                             int v)
                      throws TermWareException
Syntax sugar: equal to createTerm(name,ITermFactory.createInt(v),useIndexedNames)

Throws:
TermWareException

createTerm

public final Term createTerm(String name,
                             int x,
                             int y)
                      throws TermWareException
create term with 2 integer subterms. syntax sugar arround createComplexTerm

Throws:
TermWareException