ua.gradsoft.termware
Class ShortTerm

java.lang.Object
  extended by ua.gradsoft.termware.Term
      extended by ua.gradsoft.termware.AbstractPrimitiveTerm
          extended by ua.gradsoft.termware.ShortTerm
All Implemented Interfaces:
Serializable, Cloneable

public final class ShortTerm
extends AbstractPrimitiveTerm

Term, which represend short value with java 'short' semantics.

See Also:
Serialized Form

Constructor Summary
ShortTerm(short v)
          create new instanse of ShortTerm
 
Method Summary
 boolean eq(Term t)
          are term logically equal to t ?
 String getName()
          name of term
 Number getNumber()
          return number, which holded in this term.
 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.
 boolean isNumber()
          is this term represents Number ?
 boolean isShort()
          is this term represets short ?
 void print(PrintWriter out)
          print term to out
 Term termClone()
          since short is immutable - return this.
 int termCompare(Term t)
          compare functions.
 
Methods inherited from class ua.gradsoft.termware.AbstractPrimitiveTerm
boundEquals, boundUnify, clone, concreteOrder, createSame, emptyFv, findSubtermIndexBoundEqualsTo, freeEquals, freeUnify, getArity, getBigDecimal, getBigInteger, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getJavaObject, getLong, getNameIndex, getPatternName, getPatternNameIndex, getString, getSubtermAt, getTerm, getXIndex, isAtom, isBigDecimal, isBigInteger, isBoolean, isByte, isChar, isComplexTerm, isDouble, isFloat, isInt, isJavaObject, isLong, isNil, isString, isX, maxFv, minFv, setSubtermAt, shiftFv, subst, substInside
 
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

ShortTerm

public ShortTerm(short v)
create new instanse of ShortTerm

Method Detail

getPrimaryType0

public final int getPrimaryType0()
Description copied from class: Term
return code of level-0 primary type

Specified by:
getPrimaryType0 in class Term
Returns:
PrimaryTypes.SHORT
See Also:
PrimaryTypes

isNumber

public final boolean isNumber()
is this term represents Number ?

Specified by:
isNumber in class Term
Returns:
true

getNumber

public final Number getNumber()
return number, which holded in this term.

Specified by:
getNumber in class Term
Returns:
Short object, with the same value as in term.

isShort

public final boolean isShort()
is this term represets short ?

Overrides:
isShort in class AbstractPrimitiveTerm
Returns:
true

getShort

public final short getShort()
Description copied from class: Term
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. Use ITermHelper.getAsShort(ITerm t, TermWareInstance instance) for this purpose.

Overrides:
getShort in class AbstractPrimitiveTerm
Returns:
short value, which holded in this term.

getName

public final String getName()
name of term

Specified by:
getName in class AbstractPrimitiveTerm
Returns:
printable representation of value.

eq

public boolean eq(Term t)
are term logically equal to t ?

Specified by:
eq in class AbstractPrimitiveTerm
See Also:
TypeConversion

termClone

public Term termClone()
since short is immutable - return this.

Specified by:
termClone in class AbstractPrimitiveTerm

termCompare

public final int termCompare(Term t)
Description copied from class: Term
compare functions. define ordering on set of terms. Note, that ordering is not the same as Java build-in compare.

Specified by:
termCompare in class AbstractPrimitiveTerm
Parameters:
t - - term to compare
See Also:
Term.termCompare(ua.gradsoft.termware.Term)

print

public final void print(PrintWriter out)
print term to out

Specified by:
print in class AbstractPrimitiveTerm
Parameters:
out - - where to output term.