Package jadex.rules.state
Class OAVTypeModel
- java.lang.Object
-
- jadex.rules.state.OAVTypeModel
-
public class OAVTypeModel extends java.lang.ObjectA type model contains all known types. Type models must be associated with a state which uses the type model to ensure that no objects of undefined types are defined.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ClassLoaderclassloaderThe class loader.protected java.lang.StringnameThe model name.protected static java.lang.Class[]PCLThe argument types for property change listener adding/removal (cached for speed).protected OAVTypeModel[]tmodelsThe contained type models.protected java.util.MaptypesAll object types (name -> type).
-
Constructor Summary
Constructors Constructor Description OAVTypeModel(java.lang.String name)Create a new model.OAVTypeModel(java.lang.String name, java.lang.ClassLoader classloader)Create a new model.OAVTypeModel(java.lang.String name, java.lang.ClassLoader classloader, OAVTypeModel[] subtypemodels)Create a new model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTypeModel(OAVTypeModel tmodel)Adds a type model to the state.booleancontains(OAVObjectType type)Test if a type is contained.OAVJavaTypecreateJavaType(java.lang.Class clazz, java.lang.String kind)Create a Java type.OAVObjectTypecreateType(java.lang.String name)Create a type.OAVObjectTypecreateType(java.lang.String name, OAVObjectType supertype)Create a type.booleanequals(java.lang.Object object)Test if two types are equal.java.lang.ClassLoadergetClassLoader()Get the class loader.protected OAVObjectTypegetDeepType(java.lang.String typename)Search for a type in this model and all submodels.OAVTypeModelgetDirectTypeModel()Get a copy of the typemodel without contained models.OAVJavaTypegetJavaType(java.lang.Class clazz)Get a type for a java class.java.lang.StringgetName()Get the name.OAVObjectTypegetObjectType(java.lang.Class clazz)Get a type per name.OAVObjectTypegetObjectType(java.lang.String typename)Get a type per name.OAVTypeModel[]getTypeModels()Get the contained typemodels.inthashCode()Get the hash code.booleanremoveType(OAVObjectType type)Remove an existing type.voidsetClassLoader(java.lang.ClassLoader classloader)Set the classloader.
-
-
-
Field Detail
-
PCL
protected static java.lang.Class[] PCL
The argument types for property change listener adding/removal (cached for speed).
-
name
protected java.lang.String name
The model name.
-
types
protected java.util.Map types
All object types (name -> type).
-
tmodels
protected OAVTypeModel[] tmodels
The contained type models.
-
classloader
protected java.lang.ClassLoader classloader
The class loader.
-
-
Constructor Detail
-
OAVTypeModel
public OAVTypeModel(java.lang.String name)
Create a new model.- Parameters:
name- The name.
-
OAVTypeModel
public OAVTypeModel(java.lang.String name, java.lang.ClassLoader classloader)Create a new model.- Parameters:
name- The name.
-
OAVTypeModel
public OAVTypeModel(java.lang.String name, java.lang.ClassLoader classloader, OAVTypeModel[] subtypemodels)Create a new model.- Parameters:
name- The name.
-
-
Method Detail
-
createType
public OAVObjectType createType(java.lang.String name)
Create a type. Creates a type that can be used to create objects.- Parameters:
name- The type name.- Returns:
- The type.
-
createType
public OAVObjectType createType(java.lang.String name, OAVObjectType supertype)
Create a type. Creates a type that can be used to create objects.- Parameters:
name- The type name.supertype- The supertype.- Returns:
- The type.
-
createJavaType
public OAVJavaType createJavaType(java.lang.Class clazz, java.lang.String kind)
Create a Java type.- Parameters:
clazz- The java class.kind- The kind of type as defined in OAVJavaType.- Returns:
- The new type.
-
removeType
public boolean removeType(OAVObjectType type)
Remove an existing type. Deletes the type from the state.- Parameters:
type- The object type.- Returns:
- True, if could be removed.
-
addTypeModel
public void addTypeModel(OAVTypeModel tmodel)
Adds a type model to the state.- Parameters:
tmodel- The type model.
-
contains
public boolean contains(OAVObjectType type)
Test if a type is contained.- Parameters:
type- The type.- Returns:
- True, if type is part of type model.
-
getObjectType
public OAVObjectType getObjectType(java.lang.Class clazz)
Get a type per name. Creates implicit java types on the fly. TODO: Unify with getObjectType(String typename)- Parameters:
typename- The type name.- Returns:
- The type if contained.
- Throws:
java.lang.RuntimeException- when the type is not found.
-
getObjectType
public OAVObjectType getObjectType(java.lang.String typename)
Get a type per name. Creates implicit java types on the fly. TODO: Unify with getObjectType(Class clazz)- Parameters:
typename- The type name.- Returns:
- The type if contained.
- Throws:
java.lang.RuntimeException- when the type is not found.
-
getName
public java.lang.String getName()
Get the name.- Returns:
- The name.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Get the class loader.- Returns:
- The class loader.
-
setClassLoader
public void setClassLoader(java.lang.ClassLoader classloader)
Set the classloader.- Parameters:
classloader- The classloader to set.
-
equals
public boolean equals(java.lang.Object object)
Test if two types are equal.- Overrides:
equalsin classjava.lang.Object- Returns:
- True if equal.
-
hashCode
public int hashCode()
Get the hash code.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hashcode.
-
getJavaType
public OAVJavaType getJavaType(java.lang.Class clazz)
Get a type for a java class.
-
getTypeModels
public OAVTypeModel[] getTypeModels()
Get the contained typemodels.
-
getDirectTypeModel
public OAVTypeModel getDirectTypeModel()
Get a copy of the typemodel without contained models.
-
getDeepType
protected OAVObjectType getDeepType(java.lang.String typename)
Search for a type in this model and all submodels.- Returns:
- null if not found.
-
-