|
Stefy | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--stefy.avm.TypeHierarchyX
TypeHierarchyX class (DD) implements a hierarchy of types. It provides operations for defining new types, finding type names, building the type hierarchy, etc.
In order to bring an TypeHierarchy instance to a consistent state,
the method normalize
has to be executed.
Field Summary | |
static boolean |
Strict
If true, then a type has to be added before specifying any sub-type relations that includes it, and types can be included in type hierarchy on the fly. |
Constructor Summary | |
TypeHierarchyX()
Constructor. |
|
TypeHierarchyX(java.lang.String top,
java.lang.String bot)
Constructor. |
Method Summary | |
void |
addRelations(java.lang.String relations)
Add type relations. |
void |
addType(java.lang.String name)
Add a new type. |
void |
addType(java.lang.String name,
java.lang.String parents)
Add a type and define its parents. |
TypeHierarchyX |
compile(java.lang.String s)
Compiles a type hierarchy specification from a string. |
TypeHierarchyX |
compile(Tokenizer tok)
Compiles a type hierarchy using a tokenizer. |
void |
defineBotName(java.lang.String name)
Define name of the bottom type. |
void |
defineTopName(java.lang.String name)
Define name of the top type. |
Type |
getTopType()
Get a clone of top type |
Type |
getType(java.lang.String name)
Get type by name. |
java.lang.String |
getTypeName(Type t)
Get a type name. |
TypeX[] |
getTypes(boolean includeNat)
Get an array of types. |
static Tokenizer |
init(Tokenizer tok)
Tokenizer initialization, done before compiling a TypeHierarchy. |
void |
normalize()
|
java.lang.String |
toString()
Prints out a type hierarchy, which can be compiled by the method compile(String) . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static boolean Strict
Constructor Detail |
public TypeHierarchyX(java.lang.String top, java.lang.String bot)
top
- The name of the top type.bot
- The name of the bottom type.public TypeHierarchyX()
Method Detail |
public void defineTopName(java.lang.String name)
name
- top type namepublic void defineBotName(java.lang.String name)
name
- bot type namepublic Type getType(java.lang.String name)
name
- type type namepublic Type getTopType()
public java.lang.String getTypeName(Type t)
t
- the typepublic TypeX[] getTypes(boolean includeNat)
includeNat
- if true not-a-type is include, otherwise it is
not includedpublic void addType(java.lang.String name)
name
- the name of the typepublic void addType(java.lang.String name, java.lang.String parents)
name
- the name of the new typeparents
- the parents in the form "p1,p2,..."public void addRelations(java.lang.String relations)
relations
- in the form "parent:child,P:c:grandchild..."public static Tokenizer init(Tokenizer tok)
tok
- the tokenizer.public TypeHierarchyX compile(java.lang.String s)
s
- input stringcompile(Tokenizer)
public TypeHierarchyX compile(Tokenizer tok) throws java.io.IOException
normalize()
method is used.
Format example:
!define top name: *top*. !define bot name: *bot*. list. nlist :< list. elist:< list. t. t1. t2. employee. dept.
tok
- the input tokenizerpublic void normalize()
public java.lang.String toString()
compile(String)
.
|
Stefy | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |