uk.ac.ic.doc.automed.reps
Class Construct

java.lang.Object
  extended by uk.ac.ic.doc.automed.reps.Construct
All Implemented Interfaces:
java.util.Comparator, Positionable, PersistentObject

public class Construct
extends java.lang.Object
implements java.util.Comparator, Positionable, PersistentObject

Edited by mdle on 20/10/2005 to implement the PersistentObject interface


Field Summary
static int CLASS_ALTERNATION
          Class of construct which acts as a place holder for one of list of alternative constructs.
static int CLASS_CONSTRAINT
          Class of construct for constraints, i.e.
static int CLASS_LINK
          Class of construct for linking constructs, i.e.
static int CLASS_LINK_NODAL
          Class of construct for link-nodal constructs, i.e.
static int CLASS_MAXIMUM
           
static int CLASS_MINIMUM
           
static int CLASS_NODAL
          Class of construct for nodal constructs, i.e.
static int CLASS_SEQUENCE
          Class of construct which acts as a place holder for a list of constructs.
static java.lang.String CONSTRAINT_EXCLUSION
           
static java.lang.String CONSTRAINT_INCLUSION
           
static java.lang.String CONSTRAINT_MANDATORY
           
static java.lang.String CONSTRAINT_REFLEXIVE
           
static java.lang.String CONSTRAINT_UNDEFINED
           
static java.lang.String CONSTRAINT_UNION
           
static java.lang.String CONSTRAINT_UNIQUE
           
static int CONSTRUCT_TYPE_ANY
           
static int CONSTRUCT_TYPE_ARRAY
           
static int CONSTRUCT_TYPE_REFERENCE
           
static Construct ConstructAny
           
static Construct ConstructArray
           
static Construct ConstructReference
           
 
Constructor Summary
protected Construct(Model model, int cid, java.lang.String constructName, int constructClass, boolean constructIsRoot)
          Instantiates a Construct, which is assumed to already exist in the STR.
 
Method Summary
 ConstructScheme addConstraintScheme()
          Constraint schemes can only be added to constructs of type Nodal, Link-Nodal, Link or Constraint Defaults to isKey = true, 1..1
 ConstructScheme addConstraintScheme(boolean isKey)
           
 ConstructScheme addConstraintScheme(int lower, int upper)
           
 ConstructScheme addConstraintScheme(int lower, int upper, boolean isKey)
           
 void addConstructConstraint(int cid, java.lang.String cname, java.lang.String def)
          Add a new construct constraint to repository
 ConstructScheme addEdgeNameScheme()
          EdgeName schemes can only be added to LINK and LINK-NODAL construct types.
 ConstructScheme addEdgeNameScheme(boolean isKey)
           
 ConstructScheme addLabelScheme()
          Label schemes are scheme arguments that have no corresponding HDM (except maybe through automatic HDM node and edge names if the label is defined as key for its construct) Defaults to isKey = true, 1..1
 ConstructScheme addLabelScheme(boolean isKey)
           
 ConstructScheme addLabelScheme(int lower, int upper)
           
 ConstructScheme addLabelScheme(int lower, int upper, boolean isKey)
           
 ConstructScheme addNodeNameScheme()
          NodeName schemes can only be added to NODAL and LINK-NODAL construct types.
 ConstructScheme addNodeNameScheme(boolean isKey)
           
 ConstructScheme addNodeNameScheme(int lower, int upper)
           
 ConstructScheme addNodeNameScheme(int lower, int upper, boolean isKey)
           
 ConstructScheme addReferenceScheme(Construct type)
           
 ConstructScheme addReferenceScheme(Construct type, boolean isKey)
           
 ConstructScheme addReferenceScheme(Construct type, int lower, int upper)
           
 ConstructScheme addReferenceScheme(Construct type, int lower, int upper, boolean isKey)
           
 ConstructScheme addTypeScheme()
          Constraint schemes can only be added to constructs of type Nodal and Link-Nodal Defaults to isKey = true, 1..1
 ConstructScheme addTypeScheme(boolean isKey)
           
 ConstructScheme addTypeScheme(int lower, int upper)
           
 ConstructScheme addTypeScheme(int lower, int upper, boolean isKey)
           
 int compare(java.lang.Object o1, java.lang.Object o2)
          Ordering of Constructs is determined by their getCID() value.
 ConstructScheme createConstructScheme(int schemeType, Construct refCon, boolean isKey, int HDMType, int lBound, int uBound)
          Semi-deprecated! See the various addXxxScheme() methods.
 boolean equals(java.lang.Object o)
           
 void exportSchemes(java.io.OutputStream os)
           
 void exportSchemes(java.io.PrintWriter pw)
           
 java.awt.Point getAbsolutePosition()
          Same behaviour as getPosition() since Construct instances are not placed relative to other Positionables.
 java.lang.String getArcDrawable()
          Returns the name of the class implementing drawable that should be used to draw arc elements of this construct.
 java.awt.Color getBackgroundColor()
          Return the default background colour to be used from drawing SchemaObjects of this Construct.
 int getCID()
          Returns the construct identifier (CID) of the construct.
 java.util.List getConstraint()
          Returns a List of ConstructConstraint objects associated to this construct
 java.lang.String getConstraintDefinition(java.lang.String constraint_name)
          Return the definition of a constraint used within this Construct.
static Construct getConstruct(int cid)
          Returns the Construct identified by the given construct identifier (CID).
 int getConstructClass()
          Returns the class of the construct.
static java.lang.String getConstructClassString(int conClass)
           
 java.lang.String getConstructDescription()
          Returns a printable description of the construct including all of its schemes.
 java.awt.Color getForegroundColor()
          Return the default foreground colour to be used from drawing SchemaObjects of this Construct.
 PersistentKey getKey()
          Implements PersistentObject interface Added by mdle on 20/10/2005
 java.lang.String getLabel()
          Get the text used to label this Construct.
 java.awt.Point getLabelPosition()
           
 int getLabelXPos()
           
 int getLabelYPos()
           
 Model getModel()
          Return the Model to which this Construct belongs
 java.lang.String getName()
          Returns the name of the construct.
 java.util.Map getPersistentAttributes()
          Implements PersistentObject interface Added by mdle on 20/10/2005
 java.awt.Point getPosition()
          Return the Point that represents the position of this Positionable in a Panel.
 Positionable getPositionedRelativeTo()
          Return the Positionable this is relative to.
 java.lang.Object getRepObject()
           
 SchemaObject[] getSchemaObjects()
          Find all SchemaObjects that are instances of a particular Construct.
 ConstructScheme[] getScheme()
          Returns an array of ConstructScheme objects representing the scheme of the construct.
 java.awt.Color getTextColor()
          Return the default text colour to be used from drawing SchemaObjects of this Construct.
protected  int getValuePosInScheme()
          Returns the position in the construct's scheme where the construct's name is, i.e.
 java.lang.String getVertexDrawable()
          Returns the name of the class implementing drawable that should be used to draw nodal elements of this construct.
 int getXPos()
           
 int getYPos()
           
 void importSchemes(java.io.InputStream is)
           
 boolean isRoot()
          Returns whether or not the construct is a construct of its underlying model.
 void remove()
          Removes the Construct from the repository if it is not being used, and removes all the construct's Scheme elements.
protected static void removeConstructFromMap(Construct con)
          Deprecated. Remove constructs using @link remove() which will also do the job of this method Removes from the HashMap that holds the CID and ref to all Construct objs.
 void retract()
          Removes the Construct from the repository, and all other objects which depend upon it.
 void setAbsolutePosition(int x, int y)
          Same behaviour as #setPosition() since Construct instances are not placed relative to other Positionables.
 void setArcDrawable(java.lang.String arcDrawable)
          Sets the name of the class used to draw the arc of this Construct in any diagram containing it.
 void setBackgroundColor(java.awt.Color c)
          Set the default background colour to be used from drawing SchemaObjects of this Construct.
 void setConstraintDefinition(java.lang.String constraint_name, java.lang.String constraint_definition)
          Set the definition of a constraint used within this Construct.
 void setConstructClass(int constructClass)
          Sets the class of the construct.
 void setForegroundColor(java.awt.Color c)
          Set the default foreground colour to be used from drawing SchemaObjects of this Construct.
 void setLabel(java.lang.String label)
           
 void setLabelPosition(int x, int y)
           
 void setLabelXPos(int x)
           
 void setLabelYPos(int y)
           
 void setName(java.lang.String constructName)
          Sets the name of the construct to the given string.
 void setPosition(int x, int y)
           
 void setRoot(boolean root)
          Sets whether or not the construct is a construct type of its underlying data model.
 void setTextColor(java.awt.Color c)
          Set the default text colour to be used from drawing SchemaObjects of this Construct.
 void setVertexDrawable(java.lang.String vertexDrawable)
          Sets the name of the class used to draw the vertex of this Construct in any diagram containing it.
 void setXPos(int x)
           
 void setYPos(int y)
           
 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
 

Field Detail

CLASS_MINIMUM

public static final int CLASS_MINIMUM
See Also:
Constant Field Values

CLASS_NODAL

public static final int CLASS_NODAL
Class of construct for nodal constructs, i.e. those constructs which can exist independently of other constructs in a modelling language. For example, in ER models, entities are nodal constructs.

See Also:
Constant Field Values

CLASS_LINK_NODAL

public static final int CLASS_LINK_NODAL
Class of construct for link-nodal constructs, i.e. those constructs which are attached to other constructs in a modelling language, and which can have an extent. For example, in ER models, attributes are link-nodal.

See Also:
Constant Field Values

CLASS_LINK

public static final int CLASS_LINK
Class of construct for linking constructs, i.e. those constructs which are used to associated constructs with each other, and which can have an extent. For example, in ER models, relationships are link constructs.

See Also:
Constant Field Values

CLASS_CONSTRAINT

public static final int CLASS_CONSTRAINT
Class of construct for constraints, i.e. those constructs which do not have an extent, but which restrict the extent of other constructs. For example, in ER models, isa hierarchies are constraint constructs.

See Also:
Constant Field Values

CLASS_ALTERNATION

public static final int CLASS_ALTERNATION
Class of construct which acts as a place holder for one of list of alternative constructs. No SchemaObject can be an instance of this class of construct.

See Also:
Constant Field Values

CLASS_SEQUENCE

public static final int CLASS_SEQUENCE
Class of construct which acts as a place holder for a list of constructs. No SchemaObject can be an instance of this class of construct.

See Also:
Constant Field Values

CLASS_MAXIMUM

public static final int CLASS_MAXIMUM
See Also:
Constant Field Values

CONSTRUCT_TYPE_ARRAY

public static final int CONSTRUCT_TYPE_ARRAY
See Also:
Constant Field Values

CONSTRUCT_TYPE_ANY

public static final int CONSTRUCT_TYPE_ANY
See Also:
Constant Field Values

CONSTRUCT_TYPE_REFERENCE

public static final int CONSTRUCT_TYPE_REFERENCE
See Also:
Constant Field Values

ConstructReference

public static final Construct ConstructReference

ConstructAny

public static final Construct ConstructAny

ConstructArray

public static final Construct ConstructArray

CONSTRAINT_REFLEXIVE

public static final java.lang.String CONSTRAINT_REFLEXIVE
See Also:
Constant Field Values

CONSTRAINT_INCLUSION

public static final java.lang.String CONSTRAINT_INCLUSION
See Also:
Constant Field Values

CONSTRAINT_EXCLUSION

public static final java.lang.String CONSTRAINT_EXCLUSION
See Also:
Constant Field Values

CONSTRAINT_MANDATORY

public static final java.lang.String CONSTRAINT_MANDATORY
See Also:
Constant Field Values

CONSTRAINT_UNIQUE

public static final java.lang.String CONSTRAINT_UNIQUE
See Also:
Constant Field Values

CONSTRAINT_UNION

public static final java.lang.String CONSTRAINT_UNION
See Also:
Constant Field Values

CONSTRAINT_UNDEFINED

public static final java.lang.String CONSTRAINT_UNDEFINED
See Also:
Constant Field Values
Constructor Detail

Construct

protected Construct(Model model,
                    int cid,
                    java.lang.String constructName,
                    int constructClass,
                    boolean constructIsRoot)
Instantiates a Construct, which is assumed to already exist in the STR.

Parameters:
model - the model to which the construct belongs.
cid - the construct identifier (CID) of the construct returned by the MDR.
constructName - name of the construct.
constructClass - class of the construct.
constructIsRoot - set to true if the construct is root (i.e., it is itself a construct in its underlying model); false otherwise.
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Ordering of Constructs is determined by their getCID() value. Hence a constructs that depends on another constructs will be ordered after that construct.

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

removeConstructFromMap

protected static void removeConstructFromMap(Construct con)
Deprecated. Remove constructs using @link remove() which will also do the job of this method Removes from the HashMap that holds the CID and ref to all Construct objs.


remove

public void remove()
Removes the Construct from the repository if it is not being used, and removes all the construct's Scheme elements.

Throws:
MDRException - if the Construct is used to implement a SchemaObject.

retract

public void retract()
Removes the Construct from the repository, and all other objects which depend upon it. In particular any SchemaObject that is based on the this construct is removed, and any Transformation that created that SchemaObject will also be removed.


createConstructScheme

public ConstructScheme createConstructScheme(int schemeType,
                                             Construct refCon,
                                             boolean isKey,
                                             int HDMType,
                                             int lBound,
                                             int uBound)
                                      throws java.sql.SQLException,
                                             DSRException,
                                             MDRException,
                                             java.io.IOException
Semi-deprecated! See the various addXxxScheme() methods. Creates a new ConstructScheme for the construct.

Parameters:
schemeType - type of the scheme (one of Scheme.TYPE_NAME, Scheme.TYPE_CONSTRUCT, Scheme.TYPE_ALTERNATION, and Scheme.TYPE_SEQUENCE, see Constants).
refCon - the type of construct (of class Construct) that is represented by the scheme position being created.
isKey - set to true if the current scheme position is (part of) the key of the whole scheme; false otherwise.
HDMType - the HDM type of the construct's scheme (one of Scheme.HDM_TYPE_N1, Scheme.HDM_TYPE_N2, Scheme.HDM_TYPE_P1, Scheme.HDM_TYPE_P1, and Scheme.HDM_TYPE_C), see Constants.
lBound - minimum occurence of the scheme.
uBound - maximum occurence of the scheme.
Throws:
MDRException
java.sql.SQLException
DSRException
java.io.IOException
See Also:
ConstructScheme

addNodeNameScheme

public ConstructScheme addNodeNameScheme()
                                  throws ConstructSchemeSyntaxException,
                                         java.sql.SQLException,
                                         DSRException,
                                         MDRException,
                                         java.io.IOException
NodeName schemes can only be added to NODAL and LINK-NODAL construct types. There can be only one NodeName scheme with card 1..1 for NODAL, no such constraints on LINK-NODAL. Defaults to isKey = true, 1..1

Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addNodeNameScheme

public ConstructScheme addNodeNameScheme(boolean isKey)
                                  throws ConstructSchemeSyntaxException,
                                         java.sql.SQLException,
                                         DSRException,
                                         MDRException,
                                         java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addNodeNameScheme

public ConstructScheme addNodeNameScheme(int lower,
                                         int upper)
                                  throws ConstructSchemeSyntaxException,
                                         java.sql.SQLException,
                                         DSRException,
                                         MDRException,
                                         java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addNodeNameScheme

public ConstructScheme addNodeNameScheme(int lower,
                                         int upper,
                                         boolean isKey)
                                  throws ConstructSchemeSyntaxException,
                                         java.sql.SQLException,
                                         DSRException,
                                         MDRException,
                                         java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addEdgeNameScheme

public ConstructScheme addEdgeNameScheme()
                                  throws ConstructSchemeSyntaxException,
                                         java.sql.SQLException,
                                         DSRException,
                                         MDRException,
                                         java.io.IOException
EdgeName schemes can only be added to LINK and LINK-NODAL construct types. There can be only one EdgeName scheme with card 1..1. Defaults to isKey = true

Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addEdgeNameScheme

public ConstructScheme addEdgeNameScheme(boolean isKey)
                                  throws ConstructSchemeSyntaxException,
                                         java.sql.SQLException,
                                         DSRException,
                                         MDRException,
                                         java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addReferenceScheme

public ConstructScheme addReferenceScheme(Construct type)
                                   throws ConstructSchemeSyntaxException,
                                          java.sql.SQLException,
                                          DSRException,
                                          MDRException,
                                          java.io.IOException
Parameters:
type - == null means any construct I guess, maybe not implementable. construct type ? NODAL : can't have a reference scheme LINK or LINK-NODAL : reference is to an existing construct which has a corresponding HDM node or edge (i.e. scheme) and is used in the construction of this construct's HDM scheme CONSTRAINT : reference is to existing construct which has a corresponding HDM node or edge (i.e. scheme) and is used in the construction of this constraints HDM sentence through scheme references in the construct's constraint schemes (this is also true for constraint scheme arguments of constructs of type NODAL, LINK or LINK-NODAL). ALTERNATIOIN or SEQUENCE : Reference is to existing constructs, no correlation to HDM, just syntax building. Throws exception if construct type = NODAL Defaults to isKey = true, 1..1
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addReferenceScheme

public ConstructScheme addReferenceScheme(Construct type,
                                          boolean isKey)
                                   throws ConstructSchemeSyntaxException,
                                          java.sql.SQLException,
                                          DSRException,
                                          MDRException,
                                          java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addReferenceScheme

public ConstructScheme addReferenceScheme(Construct type,
                                          int lower,
                                          int upper)
                                   throws ConstructSchemeSyntaxException,
                                          java.sql.SQLException,
                                          DSRException,
                                          MDRException,
                                          java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addReferenceScheme

public ConstructScheme addReferenceScheme(Construct type,
                                          int lower,
                                          int upper,
                                          boolean isKey)
                                   throws ConstructSchemeSyntaxException,
                                          java.sql.SQLException,
                                          DSRException,
                                          MDRException,
                                          java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addConstraintScheme

public ConstructScheme addConstraintScheme()
                                    throws ConstructSchemeSyntaxException,
                                           java.sql.SQLException,
                                           DSRException,
                                           MDRException,
                                           java.io.IOException
Constraint schemes can only be added to constructs of type Nodal, Link-Nodal, Link or Constraint Defaults to isKey = true, 1..1

Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addConstraintScheme

public ConstructScheme addConstraintScheme(boolean isKey)
                                    throws ConstructSchemeSyntaxException,
                                           java.sql.SQLException,
                                           DSRException,
                                           MDRException,
                                           java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addConstraintScheme

public ConstructScheme addConstraintScheme(int lower,
                                           int upper)
                                    throws ConstructSchemeSyntaxException,
                                           java.sql.SQLException,
                                           DSRException,
                                           MDRException,
                                           java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addConstraintScheme

public ConstructScheme addConstraintScheme(int lower,
                                           int upper,
                                           boolean isKey)
                                    throws ConstructSchemeSyntaxException,
                                           java.sql.SQLException,
                                           DSRException,
                                           MDRException,
                                           java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addTypeScheme

public ConstructScheme addTypeScheme()
                              throws ConstructSchemeSyntaxException,
                                     java.sql.SQLException,
                                     DSRException,
                                     MDRException,
                                     java.io.IOException
Constraint schemes can only be added to constructs of type Nodal and Link-Nodal Defaults to isKey = true, 1..1

Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addTypeScheme

public ConstructScheme addTypeScheme(boolean isKey)
                              throws ConstructSchemeSyntaxException,
                                     java.sql.SQLException,
                                     DSRException,
                                     MDRException,
                                     java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addTypeScheme

public ConstructScheme addTypeScheme(int lower,
                                     int upper)
                              throws ConstructSchemeSyntaxException,
                                     java.sql.SQLException,
                                     DSRException,
                                     MDRException,
                                     java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addTypeScheme

public ConstructScheme addTypeScheme(int lower,
                                     int upper,
                                     boolean isKey)
                              throws ConstructSchemeSyntaxException,
                                     java.sql.SQLException,
                                     DSRException,
                                     MDRException,
                                     java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addLabelScheme

public ConstructScheme addLabelScheme()
                               throws ConstructSchemeSyntaxException,
                                      java.sql.SQLException,
                                      DSRException,
                                      MDRException,
                                      java.io.IOException
Label schemes are scheme arguments that have no corresponding HDM (except maybe through automatic HDM node and edge names if the label is defined as key for its construct) Defaults to isKey = true, 1..1

Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addLabelScheme

public ConstructScheme addLabelScheme(boolean isKey)
                               throws java.sql.SQLException,
                                      DSRException,
                                      MDRException,
                                      java.io.IOException
Throws:
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addLabelScheme

public ConstructScheme addLabelScheme(int lower,
                                      int upper)
                               throws ConstructSchemeSyntaxException,
                                      java.sql.SQLException,
                                      DSRException,
                                      MDRException,
                                      java.io.IOException
Throws:
ConstructSchemeSyntaxException
java.sql.SQLException
DSRException
MDRException
java.io.IOException

addLabelScheme

public ConstructScheme addLabelScheme(int lower,
                                      int upper,
                                      boolean isKey)
                               throws java.sql.SQLException,
                                      DSRException,
                                      MDRException,
                                      java.io.IOException
Throws:
java.sql.SQLException
DSRException
MDRException
java.io.IOException

getName

public java.lang.String getName()
Returns the name of the construct.

Returns:
name of the construct.

getConstructClass

public int getConstructClass()
Returns the class of the construct.

Returns:
the class of the construct.

isRoot

public boolean isRoot()
Returns whether or not the construct is a construct of its underlying model.

Returns:
true if the construct is a construct of its underlying model; false otherwise.

getScheme

public ConstructScheme[] getScheme()
Returns an array of ConstructScheme objects representing the scheme of the construct.

Returns:
an array of ConstructScheme objects representing the scheme of the construct.
See Also:
ConstructScheme

getConstraint

public java.util.List getConstraint()
Returns a List of ConstructConstraint objects associated to this construct


addConstructConstraint

public void addConstructConstraint(int cid,
                                   java.lang.String cname,
                                   java.lang.String def)
Add a new construct constraint to repository


getVertexDrawable

public java.lang.String getVertexDrawable()
Returns the name of the class implementing drawable that should be used to draw nodal elements of this construct.

Returns:
name of the construct.

setVertexDrawable

public void setVertexDrawable(java.lang.String vertexDrawable)
Sets the name of the class used to draw the vertex of this Construct in any diagram containing it. By default Gui uses DrawVertex to paint a construct in a diagram, but this can be replaced by a user provided class.

Parameters:
vertexDrawable - full class name of the DrawableVertex implementation that is to be used by Gui when drawing this Construct. Normally this is an extension of DrawVertex.

setArcDrawable

public void setArcDrawable(java.lang.String arcDrawable)
Sets the name of the class used to draw the arc of this Construct in any diagram containing it. By default Gui uses DrawArc to paint a construct in a diagram, but this can be replaced by a user provided class.

Parameters:
arcDrawable - full class name of the DrawableArc implementation that is to be used by Gui when drawing this Construct. Normally this is an extension of DrawArc.

getArcDrawable

public java.lang.String getArcDrawable()
Returns the name of the class implementing drawable that should be used to draw arc elements of this construct. Note that the class named must implement the DrawableArc interface, and normally should extend DrawArc.

Returns:
name of the construct.

getConstructDescription

public java.lang.String getConstructDescription()
Returns a printable description of the construct including all of its schemes. This calls


setName

public void setName(java.lang.String constructName)
             throws MDRException,
                    java.sql.SQLException,
                    DSRException,
                    java.io.IOException
Sets the name of the construct to the given string.

Parameters:
constructName - the string that is to be the construct's name.
Throws:
MDRException
java.sql.SQLException
DSRException
java.io.IOException

setConstructClass

public void setConstructClass(int constructClass)
                       throws MDRException,
                              java.sql.SQLException,
                              DSRException,
                              java.io.IOException
Sets the class of the construct.

Parameters:
constructClass - the class of the construct.
Throws:
MDRException
java.sql.SQLException
DSRException
java.io.IOException

setRoot

public void setRoot(boolean root)
             throws java.sql.SQLException,
                    DSRException,
                    MDRException,
                    java.io.IOException
Sets whether or not the construct is a construct type of its underlying data model.

Parameters:
root - set to true if the construct is a construct type of its underlying model; false otherwise.
Throws:
MDRException
java.sql.SQLException
DSRException
java.io.IOException

getCID

public int getCID()
Returns the construct identifier (CID) of the construct.

Returns:
the construct identifier (CID) of the construct.

getConstruct

public static Construct getConstruct(int cid)
                              throws AutoRepException
Returns the Construct identified by the given construct identifier (CID). Ordinarily one would usr Model.getConstruct(String) to get a reference to Construct, i.e. against the Model to which it beongs.

Returns:
the Construct identified by the given construct identifier (CID).
Throws:
AutoRepException - if a reference to the construct identified by the given construct identifier (CID) cannot be found.

getValuePosInScheme

protected int getValuePosInScheme()
                           throws AutoRepException
Returns the position in the construct's scheme where the construct's name is, i.e. where the scheme type is Scheme.TYPE_NAME.

Returns:
the position in the construct's scheme where the construct's name is, i.e., where the scheme type is Scheme.TYPE_NAME.
Throws:
AutoRepException - if the position in the construct's scheme where the construct's name is cannot be found.

getConstructClassString

public static java.lang.String getConstructClassString(int conClass)

getModel

public Model getModel()
Return the Model to which this Construct belongs


getSchemaObjects

public SchemaObject[] getSchemaObjects()
                                throws IntegrityException
Find all SchemaObjects that are instances of a particular Construct. Useful when it is necessary to find all occurances of a data modelling language in use, and to find objects when deleting a data modelling language.

Throws:
IntegrityException

importSchemes

public void importSchemes(java.io.InputStream is)
                   throws java.io.IOException,
                          SyntaxException
Throws:
java.io.IOException
SyntaxException

exportSchemes

public void exportSchemes(java.io.OutputStream os)

exportSchemes

public void exportSchemes(java.io.PrintWriter pw)

write

public void write(java.io.OutputStream os)

write

public void write(java.io.PrintWriter pw)

getXPos

public int getXPos()
Specified by:
getXPos in interface Positionable

getYPos

public int getYPos()
Specified by:
getYPos in interface Positionable

setXPos

public void setXPos(int x)
Specified by:
setXPos in interface Positionable

setYPos

public void setYPos(int y)
Specified by:
setYPos in interface Positionable

setPosition

public void setPosition(int x,
                        int y)
Specified by:
setPosition in interface Positionable

setAbsolutePosition

public void setAbsolutePosition(int x,
                                int y)
Same behaviour as #setPosition() since Construct instances are not placed relative to other Positionables.

Specified by:
setAbsolutePosition in interface Positionable

getPosition

public java.awt.Point getPosition()
Description copied from interface: Positionable
Return the Point that represents the position of this Positionable in a Panel. Note that depending on the implementation of the interface, this might a coordinate relative to some other positionable

Specified by:
getPosition in interface Positionable

getAbsolutePosition

public java.awt.Point getAbsolutePosition()
Same behaviour as getPosition() since Construct instances are not placed relative to other Positionables.

Specified by:
getAbsolutePosition in interface Positionable

getPositionedRelativeTo

public Positionable getPositionedRelativeTo()
Description copied from interface: Positionable
Return the Positionable this is relative to. If not relative to some other Positionable then return null.

Specified by:
getPositionedRelativeTo in interface Positionable

getLabelXPos

public int getLabelXPos()
Specified by:
getLabelXPos in interface Positionable

getLabelYPos

public int getLabelYPos()
Specified by:
getLabelYPos in interface Positionable

getLabelPosition

public java.awt.Point getLabelPosition()
Specified by:
getLabelPosition in interface Positionable

setLabelXPos

public void setLabelXPos(int x)
Specified by:
setLabelXPos in interface Positionable

setLabelYPos

public void setLabelYPos(int y)
Specified by:
setLabelYPos in interface Positionable

setLabelPosition

public void setLabelPosition(int x,
                             int y)
Specified by:
setLabelPosition in interface Positionable

getForegroundColor

public java.awt.Color getForegroundColor()
Return the default foreground colour to be used from drawing SchemaObjects of this Construct.

Specified by:
getForegroundColor in interface Positionable
Returns:
A Color, or null if no default colour is set for this Construct nor its Model

setForegroundColor

public void setForegroundColor(java.awt.Color c)
Set the default foreground colour to be used from drawing SchemaObjects of this Construct.

Specified by:
setForegroundColor in interface Positionable
Parameters:
A - Color that will be used when drawing SchemaObjects of this Construct where no + invidual foreground color has been set.

getBackgroundColor

public java.awt.Color getBackgroundColor()
Return the default background colour to be used from drawing SchemaObjects of this Construct.

Specified by:
getBackgroundColor in interface Positionable
Returns:
A Color, or null if no default colour is set for this Construct nor its Model

setBackgroundColor

public void setBackgroundColor(java.awt.Color c)
Set the default background colour to be used from drawing SchemaObjects of this Construct.

Specified by:
setBackgroundColor in interface Positionable
Parameters:
A - Color that will be used when drawing SchemaObjects of this Construct where no + invidual background color has been set.

getTextColor

public java.awt.Color getTextColor()
Return the default text colour to be used from drawing SchemaObjects of this Construct.

Specified by:
getTextColor in interface Positionable
Returns:
A Color, or null if no default colour is set for this Construct nor its Model

setTextColor

public void setTextColor(java.awt.Color c)
Set the default text colour to be used from drawing SchemaObjects of this Construct.

Specified by:
setTextColor in interface Positionable
Parameters:
A - Color that will be used when drawing SchemaObjects of this Construct where no + invidual text color has been set.

getConstraintDefinition

public java.lang.String getConstraintDefinition(java.lang.String constraint_name)
Return the definition of a constraint used within this Construct.

Parameters:
constraint_name - A string that may appear as a constraint in this construct
Returns:
A String constaining an IQL definition of the constraint named in this Construct

setConstraintDefinition

public void setConstraintDefinition(java.lang.String constraint_name,
                                    java.lang.String constraint_definition)
Set the definition of a constraint used within this Construct.

Parameters:
constraint_name - A string that may appear as a constraint in this construct
constraint_definition - String constaining an IQL definition of the constraint named in this Construct.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getKey

public PersistentKey getKey()
Implements PersistentObject interface Added by mdle on 20/10/2005

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

getPersistentAttributes

public java.util.Map getPersistentAttributes()
Implements PersistentObject interface Added by mdle on 20/10/2005

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

getLabel

public java.lang.String getLabel()
Get the text used to label this Construct. Note that this will differ from getName() at least in that any characters that need escaping for printing are escaped.

Specified by:
getLabel in interface Positionable
Returns:
Name of this construct used for writing on to the screen or file

setLabel

public void setLabel(java.lang.String label)
Specified by:
setLabel in interface Positionable

getRepObject

public java.lang.Object getRepObject()
Specified by:
getRepObject in interface Positionable