|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectua.gradsoft.termware.Term
ua.gradsoft.termware.AttributedTerm
public class AttributedTerm
Term with attributes.
| Constructor Summary | |
|---|---|
AttributedTerm(Term t)
|
|
AttributedTerm(Term term,
Map<String,Term> attributes)
|
|
| Method Summary | |
|---|---|
boolean |
boundEquals(Term x)
equality, when propositional variables are already bounded. |
boolean |
boundUnify(Term t,
Substitution s)
unification when we already have s
and when same propositional variables means same things |
PartialOrderingResult |
concreteOrder(Term x,
Substitution s)
compare for 'more concrete' relation. |
Term |
createSame(Term[] newBody)
create term, with same name but new body. |
boolean |
emptyFv()
true, if term does not contains free propositional variables. |
int |
findSubtermIndexBoundEqualsTo(Term x)
|
boolean |
freeEquals(Term x)
Equality when all propositional variables are equal |
boolean |
freeUnify(Term t,
Substitution s)
do unification of this and t
and store in s substitution. |
int |
getArity()
get arity (i. |
BigDecimal |
getAsBigDecimal(TermWareInstance instance)
get BigDecimal value, if this term represent some Numeric value, otherwise throw UnsupportedOperationException |
BigInteger |
getAsBigInteger(TermWareInstance instance)
get BigInteger value, if this term represent some Numeric value, otherwise throw UnsupportedOperationException |
boolean |
getAsBoolean(TermWareInstance instance)
get boolean value, if this term can be converted to boolean |
byte |
getAsByte(TermWareInstance instance)
get Byte value, if this term represent some Numeric value, otherwise throw UnsupportedOperationException |
char |
getAsChar(TermWareInstance instance)
get char value. |
double |
getAsDouble(TermWareInstance instance)
get double value, if this term represent some number, otherwise throw ConversionException |
float |
getAsFloat(TermWareInstance instance)
get float value, if this term represent some number, otherwise throw ConversionException |
int |
getAsInt(TermWareInstance instance)
get integer value, if this term represent some number, otherwise throw ConversionException |
Object |
getAsJavaObject(TermWareInstance instance)
|
long |
getAsLong(TermWareInstance instance)
get long value, if this term represent some number, otherwise throw ConversionException |
Number |
getAsNumber(TermWareInstance instance)
|
short |
getAsShort(TermWareInstance instance)
get short value, if this term represent some number, otherwise throw ConversionException |
Term |
getAttribute(String attribute)
get attribute with name name . |
Map<String,Term> |
getAttributes()
return map, where keys are attribute names, value - values of attributes. |
BigDecimal |
getBigDecimal()
get BigDecimal value, if this term represent BigDecimal, otherwise throw UnsupportedOperationException |
BigInteger |
getBigInteger()
get BigDecimal value, if this term represent BigInteger, otherwise throw UnsupportedOperationException |
boolean |
getBoolean()
get boolean value, if this term represent boolean, otherwise throw UnsupportedOperationException |
byte |
getByte()
get byte value, if this term represent byte, otherwise throw UnsupportedOperationException |
char |
getChar()
get char value, if this term represent char, otherwise throw UnsupportedOperationException |
double |
getDouble()
get double value, if this term represent double, otherwise throw UnsupportedOperationException Note, that this method does not provide conversion of other numeric types to double. |
float |
getFloat()
get float value, if this term represent float, otherwise throw UnsupportedOperationException. |
int |
getInt()
get integer value, if this term represent integer, otherwise throw UnsupportedOperationException |
Object |
getJavaObject()
|
long |
getLong()
get long value, if this term represent long, otherwise throw UnsupportedOperationException Note, that this method does not provide conversion of other numeric types to long. |
String |
getName()
get name of functional symbol. |
Object |
getNameIndex()
get index of name in instance symbol table. |
Number |
getNumber()
get numeric value, if this term represent number, otherwise throw UnsupportedOperationException |
String |
getPatternName()
return name of pattern, for which unification is applicable. |
Object |
getPatternNameIndex()
return index of pattern name. |
int |
getPrimaryType0()
return code of level-0 primary type |
short |
getShort()
get short value, if this term represent short, otherwise throw UnsupportedOperationException Note, that this method does not provide conversion of other numeric types to short. |
String |
getString()
get string value, if this term represent string, otherwise throw InvalidPrimitiveTypeException |
Term |
getSubtermAt(int i)
get subterm of current term. |
Term |
getTerm()
get term. |
int |
getXIndex()
if this variable is a propositional variable, return index of one. |
boolean |
isAtom()
is term is atom ? |
boolean |
isBigDecimal()
true, if this term is BigDecimal |
boolean |
isBigInteger()
true, if this term is BigInteger |
boolean |
isBoolean()
is term is booleam ? |
boolean |
isByte()
true, if this term is Byte |
boolean |
isChar()
is term is char ? |
boolean |
isComplexTerm()
true, if this term have subterms |
boolean |
isDouble()
is Term is double ? |
boolean |
isFloat()
is Term is float ? |
boolean |
isInt()
is term is Int ? |
boolean |
isJavaObject()
if this term is Java Object ? |
boolean |
isLong()
is Term is long ? |
boolean |
isNil()
is term is nil ? |
boolean |
isNumber()
is term is Number ? |
boolean |
isShort()
is Term is short ? |
boolean |
isString()
is Term is string ? |
boolean |
isX()
true if this term is propositional variable. |
int |
maxFv()
get maximum index of free propositional variable in term |
int |
minFv()
get minimal index of free propositional variable in term. |
void |
print(PrintWriter out)
print term on out |
void |
setAttribute(String attribute,
Term value)
set attribute with name name and value value . |
void |
setSubtermAt(int i,
Term t)
set i-th subterm to t when i < arity then throw IndexOutOfBoundsException |
void |
shiftFv(int newMinFv)
renumerate propositional variables in such case, that minFv(shiftFv(t))==newMinFv |
Term |
subst(Substitution s)
receive new term, which is sibstution of current term and s |
boolean |
substInside(Substitution s)
apply substitution s to current term. |
Term |
termClone()
deep clone of term. |
int |
termCompare(Term x)
compare functions. |
Term |
unAttribute()
|
| Methods inherited from class ua.gradsoft.termware.Term |
|---|
containsSubtermBoundEqualsTo, getAsString, getPrimaryType1, print, println, println |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AttributedTerm(Term term,
Map<String,Term> attributes)
public AttributedTerm(Term t)
| Method Detail |
|---|
public boolean boundEquals(Term x)
throws TermWareException
Term
boundEquals in class Termx - - term to compare.
TermWareException
public boolean boundUnify(Term t,
Substitution s)
throws TermWareException
Term s
and when same propositional variables means same things
boundUnify in class TermTermWareException
public Term createSame(Term[] newBody)
throws TermWareException
Term
createSame in class TermTermWareExceptionpublic boolean emptyFv()
Term
emptyFv in class Term
public boolean freeEquals(Term x)
throws TermWareException
Term
freeEquals in class Termx - - term to compare.
TermWareException
public boolean freeUnify(Term t,
Substitution s)
throws TermWareException
Term this and t
and store in s substitution.
freeUnify in class TermTermWareExceptionpublic int getArity()
Term
getArity in class Term
public BigDecimal getBigDecimal()
throws UnsupportedOperationException
Term
getBigDecimal in class TermUnsupportedOperationException - raised if this term does not represent BigDecimal value.
public BigDecimal getAsBigDecimal(TermWareInstance instance)
throws ConversionException
Term
getAsBigDecimal in class TermConversionException - is conversion is not possible.
public BigInteger getBigInteger()
throws UnsupportedOperationException
Term
getBigInteger in class TermUnsupportedOperationException - raised if this term does not represent BigInteger value.
public BigInteger getAsBigInteger(TermWareInstance instance)
throws ConversionException
Term
getAsBigInteger in class TermConversionException - raised if conversion is impossible.public boolean getBoolean()
Term
getBoolean in class Term
public boolean getAsBoolean(TermWareInstance instance)
throws ConversionException
Term
getAsBoolean in class TermConversionExceptionpublic byte getByte()
Term
getByte in class Term
public byte getAsByte(TermWareInstance instance)
throws ConversionException
Term
getAsByte in class TermConversionException - if conversion to byte is impossible.public char getChar()
Term
getChar in class Term
public char getAsChar(TermWareInstance instance)
throws ConversionException
Term instance type conversion routines.
getAsChar in class TermConversionExceptionpublic double getDouble()
Term
getDouble in class Term
public double getAsDouble(TermWareInstance instance)
throws ConversionException
Term
getAsDouble in class TermConversionException - if conversion is impossible.public float getFloat()
Term
getFloat in class Term
public float getAsFloat(TermWareInstance instance)
throws ConversionException
Term
getAsFloat in class TermConversionException - if conversion is impossible.public int getInt()
Term
getInt in class Term
public int getAsInt(TermWareInstance instance)
throws ConversionException
Term
getAsInt in class TermConversionException - if conversion is impossible.public Object getJavaObject()
getJavaObject in class Term
public Object getAsJavaObject(TermWareInstance instance)
throws ConversionException
getAsJavaObject in class TermConversionExceptionpublic long getLong()
Term
getLong in class Term
public long getAsLong(TermWareInstance instance)
throws ConversionException
Term
getAsLong in class TermConversionException - if conversion is impossible.public String getName()
Term
getName in class Termpublic Object getNameIndex()
Term
getNameIndex in class Termpublic String getPatternName()
Term { x : y }
is a pattern for set, where x - element from set, y -
rest of set). Name of this term is set_pattern , but pattern name is
set
getPatternName in class Termpublic Object getPatternNameIndex()
Term
getPatternNameIndex in class Termpublic Number getNumber()
Term
getNumber in class Term
public Number getAsNumber(TermWareInstance instance)
throws ConversionException
getAsNumber in class TermConversionExceptionpublic int getPrimaryType0()
Term
getPrimaryType0 in class TermPrimaryTypes
public short getShort()
throws UnsupportedOperationException
Term
getShort in class TermUnsupportedOperationException - raised if this term does not represent double value.
public short getAsShort(TermWareInstance instance)
throws ConversionException
Term
getAsShort in class Terminstance - instance of runtime environment.
ConversionException - if conversion is impossible.public String getString()
Term
getString in class Termpublic Term getSubtermAt(int i)
Term
getSubtermAt in class Termi - - index of subterm, starting from 0
public Term getTerm()
Term
getTerm in class Termpublic int getXIndex()
Term
getXIndex in class Termpublic boolean isAtom()
Term
isAtom in class Termpublic boolean isBigDecimal()
Term
isBigDecimal in class Termpublic boolean isBigInteger()
Term
isBigInteger in class Termpublic boolean isBoolean()
Term
isBoolean in class Termpublic boolean isByte()
Term
isByte in class Termpublic boolean isChar()
Term
isChar in class Termpublic boolean isComplexTerm()
Term
isComplexTerm in class Termpublic boolean isDouble()
Term
isDouble in class Termpublic boolean isFloat()
Term
isFloat in class Termpublic boolean isInt()
Term
isInt in class Termpublic boolean isJavaObject()
Term
isJavaObject in class Termpublic boolean isLong()
Term
isLong in class Termpublic boolean isNil()
Term
isNil in class Termpublic boolean isNumber()
Term
isNumber in class Termpublic boolean isShort()
Term
isShort in class Termpublic boolean isString()
Term
isString in class Termpublic boolean isX()
Term
isX in class Term
public int maxFv()
throws TermWareException
Term
maxFv in class TermTermWareException
public int minFv()
throws TermWareException
Term
minFv in class TermTermWareExceptionpublic void print(PrintWriter out)
Term out
print in class Termout - - PrintWriter, where to print term.
public void setSubtermAt(int i,
Term t)
throws TermWareException
Term
setSubtermAt in class Termi - - index of subterm to set.t - - subterm to set.
TermWareException
public void shiftFv(int newMinFv)
throws TermWareException
Term minFv(shiftFv(t))==newMinFv
shiftFv in class TermTermWareException
public Term subst(Substitution s)
throws TermWareException
Term s
subst in class TermTermWareException
public boolean substInside(Substitution s)
throws TermWareException
Term s to current term.
substInside in class TermTermWareException
public Term termClone()
throws TermWareException
Term
termClone in class TermTermWareExceptionpublic int termCompare(Term x)
Term
termCompare in class Termx - - term to compare
public PartialOrderingResult concreteOrder(Term x,
Substitution s)
throws TermWareException
Term x.<(concrete)<(y) means, that for each substitution
of free variables sx exists substituion sy :
x[sx] = y[sy] . s store previously matched variables.
concreteOrder in class TermTermWareException
public int findSubtermIndexBoundEqualsTo(Term x)
throws TermWareException
findSubtermIndexBoundEqualsTo in class TermTermWareExceptionpublic Term unAttribute()
public void setAttribute(String attribute,
Term value)
Attributed name and value value .
If value is NIL, then attribute is erased from set.
setAttribute in interface Attributedpublic Term getAttribute(String attribute)
Attributed name .
When such attribute does not exists -- return NIL.
getAttribute in interface Attributedpublic Map<String,Term> getAttributes()
Attributed
getAttributes in interface Attributed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||