|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectai.krr.SyntaxAdaptableSymbol
ai.krr.AnonymousSymbol
public class AnonymousSymbol
This class implements part of the foundations for symbolic programming in
Java. A Symbol of this kind does not have a unique user-defined reference and
consists of a type (a NamedSymbol
) and a unique index (an int) for
this AnonymousSymbol
that is generated at construction time and
cannot be changed.
As for the order of AnonymousSymbol
s, they are primarily ordered
by their type. If they are of the same type, their index is used to determine
the order between them.
Constructor Summary | |
---|---|
AnonymousSymbol(NamedSymbol type)
This constructor creates a new AnonymousSymbol of the given type. |
Method Summary | |
---|---|
int |
compareTo(AnonymousSymbol aSy)
This function compares this AnonymousSymbol to the given AnonymousSymbol. |
int |
compareTo(Symbol sy)
This function compares this AnonymousSymbol to the given Symbol . |
int |
getClassOrderIndex()
This function returns the index used for ordering Symbols across different classes. |
NamedSymbol |
getType()
This function returns the type (a NamedSymbol ) of this
AnonymousSymbol. |
int |
hashCode()
This function returns the hash code of this Symbol. |
java.lang.String |
toString()
This function returns a printable representation of this AnonymousSymbol which is the type of this AnonymousSymbol followed by the index (without space). |
Methods inherited from class ai.krr.SyntaxAdaptableSymbol |
---|
isBooleanSymbol, isNamedSymbol, isNumericSymbol, prettyPrint, read, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AnonymousSymbol(NamedSymbol type)
This constructor creates a new AnonymousSymbol of the given type. Note: to create an AnonymousSymbol of an unknown type, specify some generic type, e.g. Thing.
type
- the NamedSymbol that represents the category to which this
Symbol belongsMethod Detail |
---|
public int getClassOrderIndex()
This function returns the index used for ordering Symbols across different classes. This index of this class is defined to be 160.
public int compareTo(Symbol sy)
This function compares this AnonymousSymbol to the given Symbol
.
Only NamedSymbol
s are considered to come after AnonymousSymbols
in the order defined here. All other types of Symbols are considered to
come before AnonymousSymbols.
sy
- the Symbol to which this AnonymousSymbol is to be compared
public final NamedSymbol getType()
This function returns the type (a NamedSymbol
) of this
AnonymousSymbol.
public int compareTo(AnonymousSymbol aSy)
This function compares this AnonymousSymbol to the given AnonymousSymbol. If they have different type then the order of the types determines the order between the two symbols here. Otherwise they are ordered by their index.
aSy
- the AnonymousSymbol to which this AnonymousSymbol is compared
public final int hashCode()
This function returns the hash code of this Symbol.
hashCode
in class java.lang.Object
public java.lang.String toString()
This function returns a printable representation of this AnonymousSymbol which is the type of this AnonymousSymbol followed by the index (without space).
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |