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 A class to store the type hierarchy

Field Summary
`static java.lang.String` | `HDM_TYPE_ANY`
`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 mid, java.lang.String name, int hdmEquiv, int parentType)` Creates a new instance of typeHierarchy for serialisation
`TypeHierarchy(int mid, java.lang.String name, java.lang.String modelName, int hdmEquiv, int parentType)`

Method Summary
`static void` | `assertType(int mid, java.lang.String typeName)` This method checks whether @param typeName exists in the type hierarchy for Model @param mid and if not it creates it
`boolean` | `castType(int sourceTid, int targetTid)` This method attempts to cast a type to one higher in the type hierarchy.
`static int` | `createType(int modelID, java.lang.String typeName, int hdmEquiv, int parentType)` Create a new `TypeHierarchy` object in the database
`int` | `getHDMEquiv()` Get the type id of the HDM equivalent of this type
`PersistentKey` | `getKey()` Implements the `PersistentObject` interface
`int` | `getMID()` Get the id of the model the type comes from
`java.lang.String` | `getModelName()`
`java.lang.String` | `getName()` Get the name of the type
`int` | `getParent()` Get the type id of the parent of this type
`java.util.Map` | `getPersistentAttributes()` Implements the `PersistentObject` interface
`static TypeHierarchy` | `getType(int tid)` Get the type object identified by tid
`static TypeHierarchy` | `getType(java.lang.String modelName, java.lang.String typeName)` Retrieve a `TypeHierarchy` object from database based on name and model
`int` | `getTypeId()` Get the type of this object
`static int` | `getTypeId(int mid, java.lang.String typeName)` Get the type object identified by tid
`static TypeHierarchy[]` | `getTypes()` Returns an array of all types.
`static java.lang.String` | `hdmToHighLevelTypeLookup(int mid, java.lang.String hdmTypeName)` Method to return the high level type in model @param mid equivalent to the HDM type @param hdmTypeName
`static java.lang.String` | `highLevelToHDMTypeLookup(int tid)` Method to return the HDM type equivalent to to the high level type @param tid
`static java.util.List` | `loadAllTypes()` Load ALL types.
`static void` | `loadTypes()` Load all the type information from the repository into the types hash map
`static java.util.List` | `loadTypes(java.lang.String modelName)` Load types for a specific model
`void` | `setHDMEquivName(java.lang.String hdmName)`
`void` | `setTypeId(int tid)`
`static void` | `setupEquivalences(int mid, java.lang.String typeName, java.lang.String hdmTypeName, java.lang.String parentTypeName)` Create a new type and set up the type equivalences between hdm and the model this type belongs to

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_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 mid,
                         java.lang.String name,
                         int hdmEquiv,
                         int parentType)
                  throws AutoMedException

  Creates a new instance of typeHierarchy for serialisation

  Throws:
    `AutoMedException`

### TypeHierarchy

    public TypeHierarchy(int mid,
                         java.lang.String name,
                         java.lang.String modelName,
                         int hdmEquiv,
                         int parentType)
                  throws AutoMedException

Throws:
  `AutoMedException`

Method Detail

### loadTypes

    public static void loadTypes()

  Load all the type information from the repository into the types hash map

### loadTypes

    public static java.util.List loadTypes(java.lang.String modelName)
                                    throws AutoMedException

  Load types for a specific model

  Parameters:
    `modelName` - The name of the `Model` object as an alternative key
  Returns:
    `List` an `ArrayList` object of types (tid --> object)
  Throws:
    `AutoMedException`

### loadAllTypes

    public static java.util.List loadAllTypes()
                                       throws AutoMedException

  Load ALL types. 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:
    `AutoMedException`

### getName

    public java.lang.String getName()
                             throws NotFoundException

  Get the name of the type

  Returns:
    The name of the type
  Throws:
    `NotFoundException`

### getMID

    public int getMID()
               throws NotFoundException

  Get the id of the model the type comes from

  Returns:
    The model id
  Throws:
    `NotFoundException`

### getParent

    public int getParent()
                  throws NotFoundException

  Get the type id of the parent of this type

  Returns:
    The parent type id
  Throws:
    `NotFoundException`

### getHDMEquiv

    public int getHDMEquiv()
                    throws NotFoundException

  Get the type id of the HDM equivalent of this type

  Returns:
    The id of the HDM equivalent type
  Throws:
    `NotFoundException`

### getType

    public static TypeHierarchy getType(int tid)
                                 throws NotFoundException

  Get the type object identified by tid

  Parameters:
    `tid` - - the type identifier
  Returns:
    The type object
  Throws:
    `NotFoundException`

### getTypeId

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

  Get the type object identified by tid

  Parameters:
    `tid` - - the type identifier
  Returns:
    The type object
  Throws:
    `NotFoundException`

### getTypeId

    public int getTypeId()

  Get the type of this object

### setTypeId

    public void setTypeId(int tid)

### setHDMEquivName

    public void setHDMEquivName(java.lang.String hdmName)

### getModelName

    public java.lang.String getModelName()

### getType

    public static TypeHierarchy getType(java.lang.String modelName,
                                        java.lang.String typeName)
                                 throws NotFoundException

  Retrieve a `TypeHierarchy` object from database based on name and model

  Throws:
    `NotFoundException`

### getTypes

    public static TypeHierarchy[] getTypes()

  Returns an array of all types.

  Returns:
    an array of all types.

### 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`

### assertType

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

  This method checks whether @param typeName exists in the type hierarchy for Model @param mid and if not it creates it

  Parameters:
    `mid` - - The id of the model this type comes from
  Throws:
    `NotFoundException`

### hdmToHighLevelTypeLookup

    public static java.lang.String hdmToHighLevelTypeLookup(int mid,
                                                            java.lang.String hdmTypeName)

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

  Parameters:
    `mid` - - The model id
    `hdmTypeName` - - The HDM type

### highLevelToHDMTypeLookup

    public static java.lang.String highLevelToHDMTypeLookup(int tid)

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

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

### setupEquivalences

    public static void setupEquivalences(int mid,
                                         java.lang.String typeName,
                                         java.lang.String hdmTypeName,
                                         java.lang.String parentTypeName)

  Create a new type and set up the type equivalences between hdm and the model this type belongs to

  Parameters:
    `mid` - - The id of the model this type belongs to
    `typeName` - - The name of the new type
    `hdmTypeId` - - The id of the equivalent HDM type to this type
    `parentTypeName` - - The name of the parent of this type in this model's hierarchy

### createType

    public static int createType(int modelID,
                                 java.lang.String typeName,
                                 int hdmEquiv,
                                 int parentType)
                          throws NotFoundException

  Create a new `TypeHierarchy` object in the database

  Throws:
    `NotFoundException`

### getKey

    public PersistentKey getKey()

  Implements the `PersistentObject` interface

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

### getPersistentAttributes

    public java.util.Map getPersistentAttributes()

  Implements the `PersistentObject` interface

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

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