ua.gradsoft.termware.set
Class SetTerm

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

public class SetTerm
extends AbstractSetTerm

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
SetTerm()
           
SetTerm(SetOfTerms subterms)
           
SetTerm(Term[] body)
           
 
Method Summary
 Term createSame(Term[] newBody)
          create term, with same name but new body.
 int getArity()
          return arity of set.
 Term getSubtermAt(int i)
          get i-th subbterm.
 int index(Term t)
           
 int indirectionLevel()
          level of indirection - abstract set term can be setTerm or chain of SetTermWithoutElmenent
 void insert(Term t)
           
 boolean isEmpty()
           
 void setSubtermAt(int i, Term t)
          set i-th subterm.
 boolean substInside(Substitution s)
          apply substitution s to current term.
 
Methods inherited from class ua.gradsoft.termware.set.AbstractSetTerm
concreteOrder, findBoundUnifyIndex, findSubtermBoundEqualsTo, getName, getNameIndex, termClone
 
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

SetTerm

public SetTerm(Term[] body)

SetTerm

public SetTerm()
        throws TermWareException
Throws:
TermWareException

SetTerm

public SetTerm(SetOfTerms subterms)
        throws TermWareException
Throws:
TermWareException
Method Detail

createSame

public 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 AbstractSetTerm
Throws:
TermWareException

getArity

public final int getArity()
return arity of set.

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

getSubtermAt

public Term getSubtermAt(int i)
get i-th subbterm.

Specified by:
getSubtermAt in class AbstractSetTerm
Parameters:
i - - index of term in set
Returns:
i-th subterm of set.

setSubtermAt

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

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

substInside

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

Specified by:
substInside in class AbstractSetTerm
Returns:
true, if substitution change term, otherwise false
Throws:
TermWareException

insert

public void insert(Term t)
Specified by:
insert in class AbstractSetTerm

isEmpty

public final boolean isEmpty()
Specified by:
isEmpty in class AbstractSetTerm

index

public int index(Term t)
          throws TermWareException
Specified by:
index in class AbstractSetTerm
Throws:
TermWareException

indirectionLevel

public int indirectionLevel()
Description copied from class: AbstractSetTerm
level of indirection - abstract set term can be setTerm or chain of SetTermWithoutElmenent

Specified by:
indirectionLevel in class AbstractSetTerm