ua.gradsoft.termware.set
Class AbstractSetTerm

java.lang.Object
  extended by ua.gradsoft.termware.Term
      extended by ua.gradsoft.termware.AbstractComplexTerm
          extended by ua.gradsoft.termware.set.AbstractSetTerm
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
SetTerm

public abstract class AbstractSetTerm
extends AbstractComplexTerm

set term, - subterms are elements of set, ordered in our natural order

See Also:
Serialized Form

Field Summary
 
Fields inherited from class ua.gradsoft.termware.AbstractComplexTerm
emptyFv_
 
Constructor Summary
AbstractSetTerm()
           
 
Method Summary
 PartialOrderingResult concreteOrder(Term x, Substitution s)
          compare for 'more concrete' relation.
abstract  Term createSame(Term[] newBody)
          create term, with same name but new body.
 int findBoundUnifyIndex(Term t, Substitution s)
          return first index, which matched term t or throw MatchingFailure.
 int findSubtermBoundEqualsTo(Term t)
           
abstract  int getArity()
          get arity of term.
 String getName()
          get name of term.
 Object getNameIndex()
          get name index in bounded symbol table or sust string, if name in symbol table does not exists.
abstract  Term getSubtermAt(int i)
          get i-th subterm.
abstract  int index(Term t)
           
abstract  int indirectionLevel()
          level of indirection - abstract set term can be setTerm or chain of SetTermWithoutElmenent
abstract  void insert(Term t)
           
abstract  boolean isEmpty()
           
abstract  void setSubtermAt(int i, Term t)
          set i-th subterm.
abstract  boolean substInside(Substitution s)
          apply substitution s to current term.
 Term termClone()
          do 'deep-clone' of object.
 
Methods inherited from class ua.gradsoft.termware.AbstractComplexTerm
boundEquals, boundUnify, clone, emptyFv, findSubtermIndexBoundEqualsTo, freeEquals, freeUnify, getBigDecimal, getBigInteger, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getJavaObject, getLong, getNumber, getPatternName, getPatternNameIndex, getPrimaryType0, getShort, getString, getTerm, getXIndex, isAtom, isBigDecimal, isBigInteger, isBoolean, isByte, isChar, isComplexTerm, isDouble, isFloat, isInt, isJavaObject, isLong, isNil, isNumber, isShort, isString, isX, maxFv, minFv, normalizeFv, print, recheckEmptyFv, resetFV, shiftFv, subst, termCompare
 
Methods inherited from class ua.gradsoft.termware.Term
containsSubtermBoundEqualsTo, getAsBigDecimal, getAsBigInteger, getAsBoolean, getAsByte, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsJavaObject, getAsLong, getAsNumber, getAsShort, getAsString, getPrimaryType1, print, println, println
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSetTerm

public AbstractSetTerm()
Method Detail

createSame

public abstract Term createSame(Term[] newBody)
                         throws TermWareException
Description copied from class: Term
create term, with same name but new body. If this term have arity 0, or other than original - throws exception.

Specified by:
createSame in class AbstractComplexTerm
Throws:
TermWareException

getName

public final String getName()
Description copied from class: AbstractComplexTerm
get name of term. (i. e. functional symbold)

Specified by:
getName in class AbstractComplexTerm
Returns:
name

getNameIndex

public final Object getNameIndex()
Description copied from class: AbstractComplexTerm
get name index in bounded symbol table or sust string, if name in symbol table does not exists.

Specified by:
getNameIndex in class AbstractComplexTerm

getArity

public abstract int getArity()
Description copied from class: AbstractComplexTerm
get arity of term.

Specified by:
getArity in class AbstractComplexTerm
Returns:
arity of term

getSubtermAt

public abstract Term getSubtermAt(int i)
Description copied from class: AbstractComplexTerm
get i-th subterm.

Specified by:
getSubtermAt in class AbstractComplexTerm
Parameters:
i - - index of subterm to get.
Returns:
subterm, which located by index i

setSubtermAt

public abstract void setSubtermAt(int i,
                                  Term t)
                           throws TermWareException
Description copied from class: AbstractComplexTerm
set i-th subterm.

Specified by:
setSubtermAt in class AbstractComplexTerm
Parameters:
i - - indext of subterm to set.
t - - subterm to set.
Throws:
TermWareException

substInside

public abstract boolean substInside(Substitution s)
                             throws TermWareException
apply substitution s to current term.

Overrides:
substInside in class AbstractComplexTerm
Returns:
true, if substitution change term, otherwise false
Throws:
TermWareException

termClone

public Term termClone()
               throws TermWareException
Description copied from class: AbstractComplexTerm
do 'deep-clone' of object. i. e. after calling termClone we sure, that call of setSubtermAt() in any subtree of deepClone of original term does not affect original term.

Specified by:
termClone in class AbstractComplexTerm
Throws:
TermWareException

findSubtermBoundEqualsTo

public int findSubtermBoundEqualsTo(Term t)
                             throws TermWareException
Throws:
TermWareException

findBoundUnifyIndex

public int findBoundUnifyIndex(Term t,
                               Substitution s)
                        throws TermWareException
return first index, which matched term t or throw MatchingFailure.

Throws:
TermWareException

concreteOrder

public PartialOrderingResult concreteOrder(Term x,
                                           Substitution s)
                                    throws TermWareException
Description copied from class: Term
compare for 'more concrete' relation. i. e. x.<(concrete)<(y) means, that for each substitution of free variables sx exists substituion sy : x[sx] = y[sy] .
Substitution s store previously matched variables.

Specified by:
concreteOrder in class Term
Throws:
TermWareException

insert

public abstract void insert(Term t)
                     throws TermWareException
Throws:
TermWareException

isEmpty

public abstract boolean isEmpty()

index

public abstract int index(Term t)
                   throws TermWareException
Throws:
TermWareException

indirectionLevel

public abstract int indirectionLevel()
level of indirection - abstract set term can be setTerm or chain of SetTermWithoutElmenent