|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunsw.cse.mica.data.LocalTypeManager
public class LocalTypeManager
A class representing a local copy of the type hierarchy for mob types. It can be constructed via XML from either a stream or a file.
Field Summary |
---|
Fields inherited from interface unsw.cse.mica.data.TypeManager |
---|
TYPE_MOB |
Constructor Summary | |
---|---|
LocalTypeManager()
|
Method Summary | |
---|---|
boolean |
addType(java.lang.String typeName,
java.lang.String persistence,
java.lang.String[] parents)
|
java.util.Set |
getAllTypeNames()
We make a new set because the set returned by keySet() is still backed by the map and can thus mess with our internal state. |
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 parentName)
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 |
void |
loadTypesDirectory()
Load from the default directory, if it exists, otherwise do nothing. |
void |
loadTypesDirectory(MicaProperties args)
Load a typemanager from the directory specified by the arguments. |
void |
loadTypesDirectory(java.lang.String abstypedir)
Load from the directory specified. |
void |
readTypeFile(java.io.File file)
Reads an XML file describing the relation between types |
java.lang.String |
toString()
|
java.lang.String |
toXML()
|
java.lang.String |
toXML(java.lang.String initIndent,
java.lang.String otherIndent)
Create an XML representation of the type manager |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LocalTypeManager()
Method Detail |
---|
public boolean hasType(java.lang.String typeName)
TypeManager
hasType
in interface TypeManager
public boolean isATypeOf(java.lang.String typeName, java.lang.String parentName)
TypeManager
isATypeOf
in interface TypeManager
typeName
is a subtype of parentName
, false otherwisepublic boolean isATypeOf(Mob mob, java.lang.String parentName)
TypeManager
isATypeOf(mob.getType(), typeName)
is true.
isATypeOf
in interface TypeManager
public java.lang.String getPersistence(java.lang.String typeName)
TypeManager
getPersistence
in interface TypeManager
null
if no default persistence is specified.public java.util.Set getAllTypeNames()
getAllTypeNames
in interface TypeManager
public java.util.Set getParents(java.lang.String typeName)
getParents
in interface TypeManager
typeName
-
public java.util.Set getChildren(java.lang.String typeName)
getChildren
in interface TypeManager
typeName
-
public java.util.Set getAncestors(java.lang.String typeName)
TypeManager
getAncestors
in interface TypeManager
typeName
- the type for which the ancestors are requested
public java.util.Set getDescendants(java.lang.String typeName)
TypeManager
getDescendants
in interface TypeManager
typeName
- the type for which the descendants are requested
public boolean addType(java.lang.String typeName, java.lang.String persistence, java.lang.String[] parents) throws TypeException
TypeException
public void loadTypesDirectory() throws TypeException
TypeException
public void loadTypesDirectory(MicaProperties args) throws TypeException
MicaConstants.PARAM_MICA_HOME
(if present), otherwise micaHome is specified as the value of MicaConstants.DEFAULT_MICA_HOME
.
typePath is specified by a parameter whose key is the value of MicaConstants.PARAM_TYPE_PATH
(if present), otherwise typePath is specified as the value of MicaConstants.DEFAULT_TYPE_PATH
.
TypeException
public void loadTypesDirectory(java.lang.String abstypedir) throws TypeException
abstypedir
-
TypeException
public void readTypeFile(java.io.File file) throws TypeException
file
- The File that is loaded.
TypeException
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toXML()
public java.lang.String toXML(java.lang.String initIndent, java.lang.String otherIndent)
TypeManager
toXML
in interface TypeManager
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 |