|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TypeManager
A interface defining a structural representation of the type hierarchy for mob types. The type hierarchy is a directed acyclic graph with type "mob" at the top. Each type inherits from one or more parents.
Type heirarchies also provide default persistence modes for mobs. When a mob with unspecified persistence is written to the blackboard the blackboard checks whether the mob's type has a default persistence mode. If so, the mob is given the default persistence for its type.
Default persistence modes are inherited and can be over-ridden. A type that has no persistence mode specified will take on the type of the first of its parents that has a default persistence. For example, consider given the following (XML) type specification: <typedesc> <mobdecl name="type1" persistence="connected" > </mobdecl> <mobdecl name="type2" persistence="transient" > </mobdecl> <mobdecl name="type3" > </mobdecl> <mobdecl name="type4" > <parent name="type1" /> <parent name="type2" /> </mobdecl> <mobdecl name="type5" > <parent name="type2" /> <parent name="type1" /> </mobdecl> <mobdecl name="type6" > <parent name="type3" /> <parent name="type1" /> </mobdecl> <mobdecl name="type7" > <parent name="type6" /> </mobdecl> </typedesc> Type persistence for each type is as follows:
type1
explicitly has connected persistence
type2
explicitly has transient persistence
type3
has no default persistence
type4
has connected persistence by inheritance from type1
type5
has transient persistence by inheritance from type2
type6
has connected persistence by inheritance from type1
,
since type3
has no default persistence
type7
has connected persistence by inheritance from type3
(which is in turn inherited from type1
Field Summary | |
---|---|
static java.lang.String |
TYPE_MOB
All type heirarchies have the type named "mob" at the top - every mob type inherits either directly or indirectly from this type |
Method Summary | |
---|---|
java.util.Set |
getAllTypeNames()
Get a set containing the names of all the known types in this type manager |
java.util.Set |
getAncestors(java.lang.String typeName)
Get a set containing the names of all ancestors of the given type. |
java.util.Set |
getChildren(java.lang.String typeName)
Get a set containing the names of all children (immediate descendants) of the given type. |
java.util.Set |
getDescendants(java.lang.String typeName)
Get a set containing the names of all descendants of the given type. |
java.util.Set |
getParents(java.lang.String typeName)
Get a set containing the names of all parents (immediate ancestors) of the given type. |
java.lang.String |
getPersistence(java.lang.String typeName)
Get the default persistence mode for this type. |
boolean |
hasType(java.lang.String typeName)
Does the type manager know about the given type? |
boolean |
isATypeOf(Mob mob,
java.lang.String typeName)
Is the mob an instance of typeName? This is true if isATypeOf(mob.getType(), typeName) is true. |
boolean |
isATypeOf(java.lang.String typeName,
java.lang.String parentName)
Is one type a subtype of another? A type is a subtype of another if the types are the same or if is a descendant of it |
java.lang.String |
toXML(java.lang.String initIndent,
java.lang.String otherIndent)
Create an XML representation of the type manager |
Field Detail |
---|
static final java.lang.String TYPE_MOB
Method Detail |
---|
boolean hasType(java.lang.String typeName)
boolean isATypeOf(java.lang.String typeName, java.lang.String parentName)
typeName
is a subtype of parentName
, false otherwiseboolean isATypeOf(Mob mob, java.lang.String typeName)
isATypeOf(mob.getType(), typeName)
is true.
java.lang.String getPersistence(java.lang.String typeName)
null
if no default persistence is specified.java.util.Set getAllTypeNames()
java.util.Set getParents(java.lang.String typeName)
typeName
- the type for which the parents are requested
java.util.Set getChildren(java.lang.String typeName)
typeName
- the type for which the children are requested
java.util.Set getAncestors(java.lang.String typeName)
typeName
- the type for which the ancestors are requested
java.util.Set getDescendants(java.lang.String typeName)
typeName
- the type for which the descendants are requested
java.lang.String toXML(java.lang.String initIndent, java.lang.String otherIndent)
initIndent
- the per-line indent for the entire XML string (which may be multi-line)otherIndent
- additioanl indentation for nested elements
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |