SchemaObject
Keywords: uk.ac.ic.doc.automed.reps.SchemaObject,SchemaObject 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 SchemaObject

    java.lang.Object
      |
      +--uk.ac.ic.doc.automed.reps.SchemaObject

All Implemented Interfaces:
  java.lang.Comparable, java.util.Comparator

public class SchemaObject
extends java.lang.Object
implements java.util.Comparator, java.lang.Comparable

The SchemaObject class

Author:
  Michael Boyd (mboyd@doc.ic.ac.uk), Nerissa Tong (nnyt98@doc.ic.ac.uk)
See Also:
  `Schema`, `Scheme`, `Construct`

Method Summary
`protected boolean` | `appearsInSchemeOf(SchemaObject so)` Determines whether or not the schema object appears anywhere in the scheme of another schema object.
`int` | `compare(java.lang.Object o1, java.lang.Object o2)`
`int` | `compareTo(java.lang.Object o)`
`protected static SchemaObject` | `createSchemaObject(Schema ownerSchema, Construct cType, java.lang.Object[] schemeObjects)` Creates a new schema object.
`protected static SchemaObject` | `createSchemaObjectFromDB(int obid, Schema schema)` Instantiates a `SchemaObject` whose record already exists in the STR.
`boolean` | `equals(java.lang.Object o)`
`Construct` | `getConstruct()` Returns the construct type of the schema object.
`Construct` | `getConstructType()`
`int` | `getOBID()` Returns the schema object identifier (OBID) of a schema object.
`SchemaObject[]` | `getReferencedSchemaObjects()` Returns the set of SchemaObjects that are referenced by this SchemaObject.
`Schema` | `getSchema()` Returns the schema to which the schema object belongs.
`static SchemaObject` | `getSchemaObjectByOBID(int objectID)` Returns the `SchemaObject` reference that has the given schema object identifier (OBID).
`java.lang.Object[]` | `getSchemeDefinition()` All SchemaObjects when they are created by methods such as `Schema.createSchemaObject`, `Schema.applyAddTransformation` and `Transformation.createAddTransformation` require that an Object array be supplied that defines the scheme of the new SchemaObject.
`java.lang.Object[]` | `getSchemeNames()`
`java.lang.Object[]` | `getSchemeNames(int idDepth, int typeDepth)`
`java.lang.String` | `getSchemeNamesString()` Returns the scheme representation (of type `String`) of the name of all the elements in a schema object's scheme.
`java.lang.String` | `getSchemeNamesString(int idDepth, int typeDepth)`
`Scheme[]` | `getSchemeObjects()`
`java.lang.String` | `getSchemeString()`
`java.lang.String` | `getSchemeString(Schema context)`
`protected static SchemaObject` | `getTransformationObject(int objectID)`
`protected static SchemaObject` | `getTransformationObject(int objectID, Schema schema)` Instantiates a transformation object.
`Transformation[]` | `getTransformations()` Find the set of `Transformation`s that involve this SchemaObject.
`java.lang.String` | `getValue()` Returns the name/value of the schema object.
`void` | `remove()`
`protected static void` | `removeSchemaObjectFromMap(SchemaObject so)` Deprecated. use @link remove() to remove SchemaObjects Removes a `SchemaObject` object from the schema object `HashMap`.
`void` | `retract()` Removes the SchemaObject from the repository, and all other objects which depend upon it.
`protected boolean` | `sameScheme(SchemaObject so)` Determines whether or not the scheme is the same as that of the given `SchemaObject`.
`void` | `setConstructType(Construct cType)` Sets the construct type of the schema object.
`void` | `setSchema(Schema s)` Sets the schema to which the schema object belongs.
`void` | `setValue(java.lang.String v)` Sets the name/value of the schema object.
`java.lang.String` | `toString()`
`void` | `write(java.io.OutputStream os)`
`void` | `write(java.io.PrintWriter pw)`

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

Method Detail

### createSchemaObject

    protected static SchemaObject createSchemaObject(Schema ownerSchema,
                                                     Construct cType,
                                                     java.lang.Object[] schemeObjects)
                                              throws InconsistentException,
                                                     TypeMismatchException

  Creates a new schema object.

  Parameters:
    `ownerSchema` - the schema in whose context the `SchemaObject` is being created. Set to `null` if the schema object being created does not exist in the context of a schema, i.e., it is a transformation object.
    `cType` - construct type (of class `Construct`) of the schema object. Set to `null` if the construct being constructed is not a proper `Construct` of its underlying model (e.g. cardinality constraints for ER relationships).
    `schemeObjects` - array of `String` and/or schema objects contained in the scheme of the new schema object. The first `String` value is used as the name/value of this object.
  Throws:
    `InconsistentException`
    `TypeMismatchException`

### createSchemaObjectFromDB

    protected static SchemaObject createSchemaObjectFromDB(int obid,
                                                           Schema schema)
                                                    throws InconsistentException,
                                                           IntegrityException

  Instantiates a `SchemaObject` whose record already exists in the STR.

  Parameters:
    `obid` - the schema object identifier (OBID) found in the STR.
    `schema` - the schema in whose context the `SchemaObject` is being created. Set to `null` if the schema object being created does not exist in the context of a schema, i.e., it is a transformation object.
  Throws:
    `InconsistentException`
    `IntegrityException`

### removeSchemaObjectFromMap

    protected static void removeSchemaObjectFromMap(SchemaObject so)

  Deprecated. use @link remove() to remove SchemaObjects Removes a `SchemaObject` object from the schema object `HashMap`.

### getConstruct

    public Construct getConstruct()

  Returns the construct type of the schema object.

  Returns:
    the construct type of the schema object.

### getConstructType

    public Construct getConstructType()

### getSchema

    public Schema getSchema()

  Returns the schema to which the schema object belongs.

  Returns:
    the schema to which the schema object belongs.

### getValue

    public java.lang.String getValue()

  Returns the name/value of the schema object.

  Returns:
    the name/value of the schema object.

### getSchemeNames

    public java.lang.Object[] getSchemeNames()

### getSchemeNames

    public java.lang.Object[] getSchemeNames(int idDepth,
                                             int typeDepth)

### getSchemeObjects

    public Scheme[] getSchemeObjects()

### getSchemeDefinition

    public java.lang.Object[] getSchemeDefinition()

  All SchemaObjects when they are created by methods such as `Schema.createSchemaObject`, `Schema.applyAddTransformation` and `Transformation.createAddTransformation` require that an Object array be supplied that defines the scheme of the new SchemaObject. This method reconstructs this Object array.

  Returns:
    an object array suited to define the scheme of this SchemaObject

### getSchemeNamesString

    public java.lang.String getSchemeNamesString()
                                          throws InconsistentException

  Returns the scheme representation (of type `String`) of the name of all the elements in a schema object's scheme.

  Throws:
    `STRException,` - with brackets as set by @see STR.setOpenSchemeBracket and @see STR.setCloseSchemeBracket
    `InconsistentException`

### getSchemeNamesString

    public java.lang.String getSchemeNamesString(int idDepth,
                                                 int typeDepth)
                                          throws InconsistentException

    `InconsistentException`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### setConstructType

    public void setConstructType(Construct cType)
                          throws InconsistentException

  Sets the construct type of the schema object.

  Parameters:
    `cType` - the construct type of the schema object.
  Throws:
    `InconsistentException`
  See Also:
    `Construct`

### setSchema

    public void setSchema(Schema s)
                   throws IntegrityException

  Sets the schema to which the schema object belongs.

  Throws:
    `NotFoundException`
    `IntegrityException`

### setValue

    public void setValue(java.lang.String v)
                  throws InconsistentException

  Sets the name/value of the schema object.

  Parameters:
    `v` - the string that is to be the name/value of the schema object.
  Throws:
    ``
    `InconsistentException`

### getOBID

    public int getOBID()

  Returns the schema object identifier (OBID) of a schema object.

  Returns:
    the schema object identifier (OBID) of a schema object.

### getSchemaObjectByOBID

    public static SchemaObject getSchemaObjectByOBID(int objectID)
                                              throws InconsistentException

  Returns the `SchemaObject` reference that has the given schema object identifier (OBID).

  Parameters:
    `objectID` - the object identifier (OBID) of the schema object.
  Returns:
    the `SchemaObject` reference that has the given schema object identifier (OBID).
  Throws:
    `InconsistentException`
    `IntegrityException`

### getTransformationObject

    protected static SchemaObject getTransformationObject(int objectID,
                                                          Schema schema)
                                                   throws InconsistentException,
                                                          IntegrityException

  Instantiates a transformation object.

  Parameters:
    `objectID` - the schema object identifier (OBID) found in the STR (from the transformation table).
    `schema` - the schema to which the transformation object belongs.
  Returns:
    the `SchemaObject` reference of the transformation object.
  Throws:
    `InconsistentException`
    `IntegrityException`

### getTransformationObject

    protected static SchemaObject getTransformationObject(int objectID)
                                                   throws InconsistentException,
                                                          IntegrityException

    `InconsistentException`
    `IntegrityException`

### sameScheme

    protected boolean sameScheme(SchemaObject so)

  Determines whether or not the scheme is the same as that of the given `SchemaObject`.

  Parameters:
    `so` - the `SchemaObject` whose scheme is to be compared.
  Returns:
    `true` if the scheme is the same as that of the given `SchemaObject`; `false` otherwise.

### appearsInSchemeOf

    protected boolean appearsInSchemeOf(SchemaObject so)
                                 throws InconsistentException

  Determines whether or not the schema object appears anywhere in the scheme of another schema object.

  Parameters:
    `so` - the `SchemaObject` whose scheme is to be compared.
  Returns:
    `true` if the schema object appears anywhere in the scheme of the given `SchemaObject`; `false` otherwise.
  Throws:
    `InconsistentException`

### remove

    public void remove()
                throws IntegrityException

    `IntegrityException`

### retract

    public void retract()

  Removes the SchemaObject from the repository, and all other objects which depend upon it. In particular any Transformation that manipulates the SchemaObject will also be removed.

### getTransformations

    public Transformation[] getTransformations()
                                        throws InconsistentException

  Find the set of `Transformation`s that involve this SchemaObject.

  Throws:
    `InconsistentException` - if there is some unexpected inconsistency in the repository.

### getReferencedSchemaObjects

    public SchemaObject[] getReferencedSchemaObjects()
                                              throws InconsistentException

  Returns the set of SchemaObjects that are referenced by this SchemaObject.

  Throws:
    `InconsistentException` - if there is some unexpected inconsistency in the repository.

### compareTo

    public int compareTo(java.lang.Object o)

  Specified by:
    `compareTo` in interface `java.lang.Comparable`

### compare

    public int compare(java.lang.Object o1,
                       java.lang.Object o2)

  Specified by:
    `compare` in interface `java.util.Comparator`

### equals

    public boolean equals(java.lang.Object o)

  Specified by:
    `equals` in interface `java.util.Comparator`
  Overrides:
    `equals` in class `java.lang.Object`

### write

    public void write(java.io.OutputStream os)

### write

    public void write(java.io.PrintWriter pw)

### getSchemeString

    public java.lang.String getSchemeString()

### getSchemeString

    public java.lang.String getSchemeString(Schema context)

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