TypeHierarchy
Keywords: uk.ac.ic.doc.automed.reps.TypeHierarchy class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.ac.ic.doc.automed.reps
Class TypeHierarchy

    java.lang.Object
      uk.ac.ic.doc.automed.reps.TypeHierarchy

All Implemented Interfaces:
  PersistentObject

    public class TypeHierarchy

extends java.lang.Object
implements PersistentObject

Author:
  acs203 - Andrew Smith A class to store the type hierarchy There is one type hierarchy object per `Model` which is set up when the model is initialised. The HDM type hierarchy acts as a CTH It is created if inter model transformations are performed. High level types and equivalences are added to it to form an intermodel type hierarchy. Using the notation from the technical report.

Nested Class Summary
`class` | `TypeHierarchy.TypeObject` The type object class This class stored information about type objects in a type hierarchy Using the notation in the technical reports on types: hdmEquiv is =, parentName is <

Field Summary
`static java.lang.String` | `HDM_TYPE_ANY`
`static java.lang.String` | `HDM_TYPE_BOOL`
`static java.lang.String` | `HDM_TYPE_FLOAT`
`static java.lang.String` | `HDM_TYPE_INTEGER`
`static java.lang.String` | `HDM_TYPE_NUMERIC`
`static java.lang.String` | `HDM_TYPE_OID`
`static java.lang.String` | `HDM_TYPE_STRING`

Constructor Summary
`TypeHierarchy(int modelId)` Creates a new instance of typeHierarchy for serialisation

Method Summary
`static TypeHierarchy` | `addAllTypesToHierarchy(TypeHierarchy th)` Load ALL types for this type hierarchy.
`TypeHierarchy.TypeObject` | `addTypeToHierarchy(int tid, java.lang.String typeName, int hdmEquiv, int pid)` Add a type from the repository to the hierarchy
`TypeHierarchy.TypeObject` | `addTypeToHierarchy(java.lang.String typeName, java.lang.String parentTypeName, java.lang.String baseType)` Add a new type to the hierarchy and the repository.
`void` | `assertType(java.lang.String typeName, java.lang.String parentTypeName)` Make sure @param typeName is in the type hierarchy.
`boolean` | `castType(int sourceTid, int targetTid)` This method attempts to cast a type to one higher in the type hierarchy.
`static void` | `createTypeHierarchies()` Load all the type information for all models into a static hashMap This method is called once when the system is started into the types hash map
`PersistentKey` | `getKey()` Implements the `PersistentObject` interface
`TypeHierarchy.TypeObject` | `getParentType(java.lang.String typeName)` Retrieve the parent `TypeHierarchy.TypeObject` object of @param typeName from this hierarchy
`java.util.Map` | `getPersistentAttributes()` Implements the `PersistentObject` interface
`TypeHierarchy.TypeObject` | `getType(int tid)` Retrieve a specific `TypeHierarchy.TypeObject` object from this hierarchy by tid
`TypeHierarchy.TypeObject` | `getType(java.lang.String typeName)` Retrieve a specific `TypeHierarchy.TypeObject` object from this hierarchy
`static TypeHierarchy` | `getTypeHierarchy(int mid)` Get the type hierarchy identified by mid or create one if none exits
`int` | `getTypeHierarchyId()` Get the unique identifier for this TypeHierarchy object This is the model id of the `Model` this hierarchy is attached to
`static int` | `getTypeID(int mid, java.lang.String typeName)`
`java.util.List` | `getTypeObjects()` Get all the type objects this TypeHierarchy object
`java.lang.String` | `hdmToHighLevelTypeLookup(java.lang.String hdmTypeName)` Method to return the high level type in model @param mid equivalent to the HDM type @param hdmTypeName
`java.lang.String` | `highLevelToHDMTypeLookup(int tid)` Method to return the name of the HDM type equivalent to to the high level type @param tid
`TypeHierarchy` | `mergeTypeHierarchy(TypeHierarchy cth)` Merge a high level type hierarchy with the HDM CTH

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HDM_TYPE_ANY

    public static final java.lang.String HDM_TYPE_ANY

See Also:
  Constant Field Values

### HDM_TYPE_STRING

    public static final java.lang.String HDM_TYPE_STRING

See Also:
  Constant Field Values

### HDM_TYPE_NUMERIC

    public static final java.lang.String HDM_TYPE_NUMERIC

See Also:
  Constant Field Values

### HDM_TYPE_INTEGER

    public static final java.lang.String HDM_TYPE_INTEGER

See Also:
  Constant Field Values

### HDM_TYPE_BOOL

    public static final java.lang.String HDM_TYPE_BOOL

See Also:
  Constant Field Values

### HDM_TYPE_FLOAT

    public static final java.lang.String HDM_TYPE_FLOAT

See Also:
  Constant Field Values

### HDM_TYPE_OID

    public static final java.lang.String HDM_TYPE_OID

See Also:
  Constant Field Values

Constructor Detail

### TypeHierarchy

    public TypeHierarchy(int modelId)

  Creates a new instance of typeHierarchy for serialisation

Method Detail

### createTypeHierarchies

    public static void createTypeHierarchies()

  Load all the type information for all models into a static hashMap This method is called once when the system is started into the types hash map

### addAllTypesToHierarchy

    public static TypeHierarchy addAllTypesToHierarchy(TypeHierarchy th)
                                                throws NotFoundException

  Load ALL types for this type hierarchy. This method is used by the serialisation process of `Model`
  objects to also serialise associated model types

  Returns:
    `List` a `ArrayList` object of types to maintain order
  Throws:
    `NotFoundException`

### assertType

    public void assertType(java.lang.String typeName,
                           java.lang.String parentTypeName)
                    throws NotFoundException

  Make sure @param typeName is in the type hierarchy. If not, add it with HDMequiv anyType and parent of anyType

  Throws:
    `NotFoundException`

### addTypeToHierarchy

    public TypeHierarchy.TypeObject addTypeToHierarchy(int tid,
                                                       java.lang.String typeName,
                                                       int hdmEquiv,
                                                       int pid)
                                                throws NotFoundException

  Add a type from the repository to the hierarchy

  Parameters:
    `tid` - - The type id of the type
    `typeName` - - The name of the new type
    `hdmEquiv` - - The id of the equivalent HDM type to this type
    `parentTypeName` - - The name of the parent of this type in this model's hierarchy
  Throws:
    `NotFoundException`

### addTypeToHierarchy

    public TypeHierarchy.TypeObject addTypeToHierarchy(java.lang.String typeName,
                                                       java.lang.String parentTypeName,
                                                       java.lang.String baseType)
                                                throws NotFoundException

  Add a new type to the hierarchy and the repository. This is called by the Model class when a model is being created The parent object must exist so types need to be added in a strict order

  Parameters:
    `typeName` - - The name of the new type
    `parentTypeName` - - The name of the parent of this type in this model's hierarchy
    `baseType` - - The name of the base type in the CTH this type is related to
  Throws:
    `NotFoundException`

### getTypeHierarchy

    public static TypeHierarchy getTypeHierarchy(int mid)
                                          throws NotFoundException

  Get the type hierarchy identified by mid or create one if none exits

  Parameters:
    `mid` - - the type hierarchy identifier
  Returns:
    The type hierarchy
  Throws:
    `NotFoundException`

### getType

    public TypeHierarchy.TypeObject getType(java.lang.String typeName)
                                     throws NotFoundException

  Retrieve a specific `TypeHierarchy.TypeObject` object from this hierarchy

  Throws:
    `NotFoundException`

### getTypeID

    public static int getTypeID(int mid,
                                java.lang.String typeName)
                         throws NotFoundException

  Throws:
    `NotFoundException`

### getType

    public TypeHierarchy.TypeObject getType(int tid)
                                     throws NotFoundException

  Retrieve a specific `TypeHierarchy.TypeObject` object from this hierarchy by tid

  Throws:
    `NotFoundException`

### getParentType

    public TypeHierarchy.TypeObject getParentType(java.lang.String typeName)
                                           throws NotFoundException

  Retrieve the parent `TypeHierarchy.TypeObject` object of @param typeName from this hierarchy

  Throws:
    `NotFoundException`

### getTypeObjects

    public java.util.List getTypeObjects()
                                  throws NotFoundException

  Get all the type objects this TypeHierarchy object

  Returns:
    The type objects in the hierarchy
  Throws:
    `NotFoundException`

### getTypeHierarchyId

    public int getTypeHierarchyId()
                           throws NotFoundException

  Get the unique identifier for this TypeHierarchy object This is the model id of the `Model` this hierarchy is attached to

  Returns:
    The type hierarchy identifier
  Throws:
    `NotFoundException`

### mergeTypeHierarchy

    public TypeHierarchy mergeTypeHierarchy(TypeHierarchy cth)
                                     throws NotFoundException

  Merge a high level type hierarchy with the HDM CTH

  Throws:
    `NotFoundException`

### castType

    public boolean castType(int sourceTid,
                            int targetTid)
                     throws AutoMedException

  This method attempts to cast a type to one higher in the type hierarchy. If a constraint is needed for the cast then that constraint is added to the repository

  Parameters:
    `sourceTid` - - The id of the source type
    `targetTid` - - The id of the target type
  Throws:
    `AutoMedException`

### hdmToHighLevelTypeLookup

    public java.lang.String hdmToHighLevelTypeLookup(java.lang.String hdmTypeName)
                                              throws NotFoundException

  Method to return the high level type in model @param mid equivalent to the HDM type @param hdmTypeName

  Parameters:
    `hdmTypeName` - - The HDM type
  Throws:
    `NotFoundException`

### highLevelToHDMTypeLookup

    public java.lang.String highLevelToHDMTypeLookup(int tid)
                                              throws NotFoundException

  Method to return the name of the HDM type equivalent to to the high level type @param tid

  Parameters:
    `tid` - - The high level type id
  Throws:
    `NotFoundException`

### getPersistentAttributes

    public java.util.Map getPersistentAttributes()

  Implements the `PersistentObject` interface

  Specified by:
    `getPersistentAttributes` in interface `PersistentObject`
  See Also:
    `PersistentObject.getPersistentAttributes()`

### getKey

    public PersistentKey getKey()

  Implements the `PersistentObject` interface

  Specified by:
    `getKey` in interface `PersistentObject`
  See Also:
    `uk.ac.ic.doc.automed.wrappersPersistentObject#getKey()`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD