edu.udo.cs.miningmart.m4.core
Class Chain

java.lang.Object
  extended byedu.udo.cs.miningmart.m4.core.M4Object
      extended byedu.udo.cs.miningmart.m4.core.M4Data
          extended byedu.udo.cs.miningmart.m4.core.GraphicalM4Object
              extended byedu.udo.cs.miningmart.m4.core.Chain
All Implemented Interfaces:
Chain, java.lang.Comparable, GraphicalM4Object, HasCrossReferences, M4Data, M4Object, M4Table, java.io.Serializable, XmlInfo

public class Chain
extends GraphicalM4Object
implements XmlInfo, Chain, HasCrossReferences

Version:
$Id: Chain.java,v 1.7 2006/04/11 14:10:14 euler Exp $
Author:
Martin Scholz
See Also:
Serialized Form

Field Summary
static java.lang.String ATTRIB_CASE_ID
           
static java.lang.String ATTRIB_CHAIN_DESCR
           
static java.lang.String ATTRIB_CHAIN_ID
           
static java.lang.String ATTRIB_CHAIN_NAME
           
static java.lang.String ATTRIB_PARENTCHAIN_ID
           
static java.lang.String M4_TABLE
           
static M4Info m4Info
          Cache for getM4Info()
 
Fields inherited from class edu.udo.cs.miningmart.m4.core.GraphicalM4Object
graph2coord
 
Fields inherited from class edu.udo.cs.miningmart.m4.core.M4Data
myDocumentation
 
Fields inherited from class edu.udo.cs.miningmart.m4.core.M4Object
myId, myName
 
Fields inherited from interface edu.udo.cs.miningmart.m4.utils.XmlInfo
M4_XML_VERSION, TAG_COLLECTION, TAG_DOUBLE, TAG_INTEGER, TAG_LONG, TAG_M4_ID, TAG_SHORT, TAG_STRING, TAG_XML_ID
 
Fields inherited from interface edu.udo.cs.miningmart.m4.utils.M4Table
NOT_NULL
 
Constructor Summary
Chain(DB db)
           
 
Method Summary
 void addStep(Step step)
          Adds a Step to this Chain and takes care about back-reference integrity.
 void addSubChain(Chain subchain)
          Adds a Chain to this Chain and takes care about back-reference integrity.
 Chain copy(Case newCase)
          Make a copy of this chain.
 Chain createSubChain(java.lang.String name, java.util.Collection stepsAndChains)
          Creates a new Chain whose parent chain is this Chain.
 void deleteSoon()
          When a chain is deleted, it moves its steps to its parent chain.
 boolean dependencyExists(Chain toChain)
          This method checks if there is a dependency between any of the steps of this chain (including all steps of all direct or indirect subchains), and any of the steps of the given chain (again including all steps of all direct or indirect subchains).
 boolean dependencyExists(Step toStep)
          This method checks if there is a dependency between any of the steps of this chain (including all steps of all direct or indirect subchains), and the given step.
 java.util.Collection getAllChains()
          Return all direct or indirect subchains of this chain.
 java.util.Collection getAllSteps()
          Return all steps of this chain and all direct or indirect subchains.
 java.util.Collection getAllTransitionsToChain(Chain toChain)
          This method returns pairs of Steps.
 java.util.Collection getCrossReferences()
          Implements the interface HasCrossReferences
 java.util.Collection getDependentObjects()
          This method is part of the XML-serialization and needs to be implemented by all M4Data sub-classes that need to be serialized.
 java.lang.String getDescription()
          Gets the description.
 java.util.Collection getDirectSubChains()
          Active getter of the chains embedded in this chain.
protected  java.util.Collection getGraphicallyEmbeddedObjects()
           
 java.lang.String getIdAttributeName()
           
 java.util.Collection getInvolvedConcepts()
          Returns a Collection of the Concepts that are used as input or output in any of the top level steps of this chain.
 M4Info getM4Info()
           
 java.lang.String getM4TableName()
           
protected  java.util.Collection getObjectsInNamespace(java.lang.Class typeOfObjects)
          This method returns the objects of the specified type that form a namespace in the scope of this M4Data object.
 Chain getParentChain()
          Gets the parent chain.
 java.util.Collection getPredecessors(Step toStep)
          This method returns all steps in this chain, including steps in subchains etc., that are a direct predecessor of the given Step.
 java.util.Collection getSuccessors(Step fromStep)
          This method returns all steps in this chain, including steps in subchains etc., that are a direct successor of the given Step.
 Case getTheCase()
          Gets the Case.
 java.util.Collection getTopLevelSteps()
          Active getter of the steps embedded in this chain.
 java.util.Iterator getTopLevelStepsSequentialised()
          Active getter of the steps embedded in this chain.
 M4Info getXmlInfo()
           
protected  boolean hasCoordinates()
          Chains have coordinates.
 boolean hasPredecessorOutside()
          This method returns TRUE iff a Step exists in this Chain that is a successor of a Step outside this Chain.
 boolean hasSuccessorOutside()
          This method returns TRUE iff a Step exists in this Chain that is a predecessor of a Step outside this Chain.
 void primitiveSetCase(Case m4case)
          Primitive setter of the Case field.
 void primitiveSetParentChain(Chain theParentChain)
           
 void print()
          Method to print data about this M4Object.
protected  void removeAllM4References()
          This method needs to be implemented by all M4Data objects.
 boolean removeStep(Step step)
          Removes a Step from this Chain and takes care about back-reference integrity.
 void resolveSubChain(Chain chain)
          If the given Chain is a direct subchain of this Chain, it is resolved, ie its Steps and subchains become steps and direct subchains of this chain.
 void setDescription(java.lang.String description)
          Sets the description.
 void setParentChain(Chain theParentChain)
          Sets the parent chain of this chain to the given parentChain.
 void setTheCase(Case m4Case)
          Sets a new Case object and cares about back-reference integrity.
 
Methods inherited from class edu.udo.cs.miningmart.m4.core.GraphicalM4Object
deleteLocal, getCoordinates, getPoint, primitiveSetCoordinates, setCoordinatesDirty, setName, setPoint, storeLocal
 
Methods inherited from class edu.udo.cs.miningmart.m4.core.M4Data
exportLocal, genericGetter, genericSetter, getDocumentation, getObjectsReferencingMe, getObjectsReferencingMe, getObjectTag, getValidName, getXmlIdTag, getXmlVersion, hasDeleteStatus, importLocal, isDirty, isWaitingForDelete, primitiveGetDocObject, primitiveSetDocObject, readFromDb, readFromDbLocal, removeDocObject, removeFromDb, removeSetFromDb, setDirty, setDocumentation, setId, updateObjectsFromTable
 
Methods inherited from class edu.udo.cs.miningmart.m4.core.M4Object
compareTo, doPrint, doPrint, equals, executeBusinessSingleValueSqlRead, executeBusinessSingleValueSqlReadL, executeBusinessSqlRead, executeBusinessSqlWrite, executeM4SingleValueSqlRead, executeM4SingleValueSqlReadL, executeM4SqlRead, executeM4SqlWrite, getCasePrintObject, getId, getM4Db, getM4ObjectFromCache, getName, getNextM4SequenceValue, isNew, load, putM4ObjectToCache, replaceSpacesInName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.udo.cs.miningmart.m4.utils.XmlInfo
doPrint, doPrint, exportLocal, genericGetter, genericSetter, getObjectTag, getXmlIdTag, getXmlVersion, importLocal
 
Methods inherited from interface edu.udo.cs.miningmart.m4.GraphicalM4Object
getPoint, setPoint
 
Methods inherited from interface edu.udo.cs.miningmart.m4.M4Data
getDocumentation, getValidName, isDirty, isWaitingForDelete, setDocumentation
 
Methods inherited from interface edu.udo.cs.miningmart.m4.M4Object
doPrint, doPrint, equals, executeBusinessSingleValueSqlRead, executeBusinessSingleValueSqlReadL, executeBusinessSqlRead, executeBusinessSqlWrite, executeM4SingleValueSqlRead, executeM4SingleValueSqlReadL, executeM4SqlRead, executeM4SqlWrite, getCasePrintObject, getId, getM4Db, getM4ObjectFromCache, getName, getNextM4SequenceValue, isNew, load, putM4ObjectToCache, replaceSpacesInName, setId, setName
 

Field Detail

M4_TABLE

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

ATTRIB_CHAIN_ID

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

ATTRIB_CASE_ID

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

ATTRIB_PARENTCHAIN_ID

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

ATTRIB_CHAIN_NAME

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

ATTRIB_CHAIN_DESCR

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

m4Info

public static M4Info m4Info
Cache for getM4Info()

Constructor Detail

Chain

public Chain(DB db)
Parameters:
db - the instance of DB used for the embedding Case
Method Detail

getM4TableName

public java.lang.String getM4TableName()
Specified by:
getM4TableName in interface M4Table
See Also:
M4Table.getM4TableName()

getIdAttributeName

public java.lang.String getIdAttributeName()
Specified by:
getIdAttributeName in interface M4Table
See Also:
M4Table.getIdAttributeName()

getM4Info

public M4Info getM4Info()
Specified by:
getM4Info in interface M4Table
See Also:
M4Table.getM4Info()

getXmlInfo

public M4Info getXmlInfo()
Specified by:
getXmlInfo in interface XmlInfo
Returns:
a M4Info object with the information of all XML fields of this object.
See Also:
XmlInfo.getXmlInfo()

print

public void print()
Description copied from interface: M4Object
Method to print data about this M4Object.

Specified by:
print in interface M4Object
Overrides:
print in class GraphicalM4Object
See Also:
M4Object.print()

getCrossReferences

public java.util.Collection getCrossReferences()
Implements the interface HasCrossReferences

Specified by:
getCrossReferences in interface HasCrossReferences

getObjectsInNamespace

protected java.util.Collection getObjectsInNamespace(java.lang.Class typeOfObjects)
                                              throws M4Exception
Description copied from class: M4Data
This method returns the objects of the specified type that form a namespace in the scope of this M4Data object. For example, a Concept's namespace for the type BaseAttribute is the Collection of all BaseAttributes for this Concept. Many M4Data objects never have a namespace, they return null. If a namespace could exist but doesn't, an empty Collection is returned.

Specified by:
getObjectsInNamespace in class M4Data
Parameters:
typeOfObjects - the type of objects that form the namespace
Returns:
a Collection of objects of type typeOfObjects, or null.
Throws:
M4Exception
See Also:
M4Data.getObjectsInNamespace(Class)

getTopLevelSteps

public java.util.Collection getTopLevelSteps()
                                      throws M4Exception
Active getter of the steps embedded in this chain. Only the steps belonging directly to this chain are returned. Steps of subchains are not included in the returned collection.

Specified by:
getTopLevelSteps in interface Chain
Returns:
a Collection of Steps
Throws:
M4Exception

getTopLevelStepsSequentialised

public java.util.Iterator getTopLevelStepsSequentialised()
                                                  throws M4Exception
Active getter of the steps embedded in this chain. Only the steps belonging directly to this chain are returned. Steps of subchains are not included in the returned iterator. The iterator iterates through the Steps in the right sequential order. If there are no top level steps, NULL is returned.

Specified by:
getTopLevelStepsSequentialised in interface Chain
Returns:
an Iterator through Steps, or NULL.
Throws:
M4Exception

createSubChain

public Chain createSubChain(java.lang.String name,
                            java.util.Collection stepsAndChains)
                     throws M4Exception
Creates a new Chain whose parent chain is this Chain. The name of the Chain should be unique within the Case. All steps in the given collection are added as steps of the newly created chain. All chains in the given collection are added as direct subchains of the newly created chain.

Specified by:
createSubChain in interface Chain
Parameters:
name - the name to be given to the new chain
stepsAndChains - a Collection of Steps and/or Chains.
Returns:
the created chain
Throws:
M4Exception
See Also:
Case.createChain(String, Collection)

getTheCase

public Case getTheCase()
Gets the Case.

Specified by:
getTheCase in interface Chain
Returns:
Returns a Case

deleteSoon

public void deleteSoon()
                throws M4Exception
When a chain is deleted, it moves its steps to its parent chain.

Specified by:
deleteSoon in interface M4Data
Overrides:
deleteSoon in class GraphicalM4Object
Throws:
M4Exception

getAllSteps

public java.util.Collection getAllSteps()
                                 throws M4Exception
Return all steps of this chain and all direct or indirect subchains.

Specified by:
getAllSteps in interface Chain
Returns:
a Collection of Steps
Throws:
M4Exception

getAllChains

public java.util.Collection getAllChains()
                                  throws M4Exception
Return all direct or indirect subchains of this chain.

Specified by:
getAllChains in interface Chain
Returns:
a Collection of Chains
Throws:
M4Exception

dependencyExists

public boolean dependencyExists(Step toStep)
                         throws M4Exception
Description copied from interface: Chain
This method checks if there is a dependency between any of the steps of this chain (including all steps of all direct or indirect subchains), and the given step. Attention: only the direction from this chain to the given step is tested, not the backwards direction!

Specified by:
dependencyExists in interface Chain
Parameters:
toStep - the destination step
Returns:
TRUE iff any of the steps in this chain is a predecessor of the given step.
Throws:
M4Exception
See Also:
Chain.dependencyExists(Step)

dependencyExists

public boolean dependencyExists(Chain toChain)
                         throws M4Exception
Description copied from interface: Chain
This method checks if there is a dependency between any of the steps of this chain (including all steps of all direct or indirect subchains), and any of the steps of the given chain (again including all steps of all direct or indirect subchains). Attention: only the direction from this chain to the given chain is tested, not the backwards direction!

Specified by:
dependencyExists in interface Chain
Parameters:
toChain - the destination chain
Returns:
TRUE iff any of the steps in this chain has a successor in the given chain.
Throws:
M4Exception
See Also:
Chain.dependencyExists(Chain)

getPredecessors

public java.util.Collection getPredecessors(Step toStep)
                                     throws M4Exception
This method returns all steps in this chain, including steps in subchains etc., that are a direct predecessor of the given Step.

Specified by:
getPredecessors in interface Chain
Parameters:
toStep - the Step whose predecessors are returned
Returns:
a Collection of Steps
Throws:
M4Exception

getSuccessors

public java.util.Collection getSuccessors(Step fromStep)
                                   throws M4Exception
Description copied from interface: Chain
This method returns all steps in this chain, including steps in subchains etc., that are a direct successor of the given Step.

Specified by:
getSuccessors in interface Chain
Parameters:
fromStep - the Step whose successors are returned
Returns:
a Collection of Steps
Throws:
M4Exception
See Also:
Chain.getSuccessors(Step)

hasPredecessorOutside

public boolean hasPredecessorOutside()
                              throws M4Exception
Description copied from interface: Chain
This method returns TRUE iff a Step exists in this Chain that is a successor of a Step outside this Chain.

Specified by:
hasPredecessorOutside in interface Chain
Returns:
TRUE iff this Chain has a predecessor Step outside this Chain.
Throws:
M4Exception
See Also:
Chain.hasPredecessorOutside()

hasSuccessorOutside

public boolean hasSuccessorOutside()
                            throws M4Exception
Description copied from interface: Chain
This method returns TRUE iff a Step exists in this Chain that is a predecessor of a Step outside this Chain.

Specified by:
hasSuccessorOutside in interface Chain
Returns:
TRUE iff this Chain has a successor Step outside this Chain.
Throws:
M4Exception
See Also:
Chain.hasSuccessorOutside()

getAllTransitionsToChain

public java.util.Collection getAllTransitionsToChain(Chain toChain)
                                              throws M4Exception
This method returns pairs of Steps. In each pair, the first Step belongs to this Chain, or one of its direct or indirect subchains, and the second to the given Chain or one of its subchains, and there is a direct dependency (transition) between them. This method returns a Collection of Arrays of Steps. Each Array has exactly two elements. The one with index 0 is a Step from this Chain, the one with index 1 is a Step from the given Chain, and a direct dependeny between the Steps exists.

Specified by:
getAllTransitionsToChain in interface Chain
Parameters:
toChain - the given Chain
Returns:
a Collection of two-element Arrays of Steps
Throws:
M4Exception

getInvolvedConcepts

public java.util.Collection getInvolvedConcepts()
                                         throws M4Exception
Returns a Collection of the Concepts that are used as input or output in any of the top level steps of this chain. Steps of subchains are not involved.

Specified by:
getInvolvedConcepts in interface Chain
Returns:
a Collection of Concepts
Throws:
M4Exception

getParentChain

public Chain getParentChain()
Gets the parent chain. Returns NULL if no parent exists.

Specified by:
getParentChain in interface Chain
Returns:
the parent chain, or NULL if no parent chain exists.

getDescription

public java.lang.String getDescription()
Gets the description.

Specified by:
getDescription in interface Chain
Returns:
Returns a String

setTheCase

public void setTheCase(Case m4Case)
                throws M4Exception
Sets a new Case object and cares about back-reference integrity.

Specified by:
setTheCase in interface Chain
Parameters:
m4Case - the Case to be set
Throws:
M4Exception

primitiveSetCase

public void primitiveSetCase(Case m4case)
Primitive setter of the Case field. Do not use it!

Parameters:
m4case - The Case to set

setParentChain

public void setParentChain(Chain theParentChain)
                    throws M4Exception
Description copied from interface: Chain
Sets the parent chain of this chain to the given parentChain.

Specified by:
setParentChain in interface Chain
Parameters:
theParentChain - the new parent chain of this chain.
Throws:
M4Exception

primitiveSetParentChain

public void primitiveSetParentChain(Chain theParentChain)

setDescription

public void setDescription(java.lang.String description)
Sets the description.

Specified by:
setDescription in interface Chain
Parameters:
description - The description to set

addStep

public void addStep(Step step)
             throws M4Exception
Adds a Step to this Chain and takes care about back-reference integrity.

Specified by:
addStep in interface Chain
Parameters:
step - the Step to be added
Throws:
M4Exception

removeStep

public boolean removeStep(Step step)
                   throws M4Exception
Removes a Step from this Chain and takes care about back-reference integrity.

Specified by:
removeStep in interface Chain
Parameters:
step - the Step to be removed
Throws:
M4Exception

removeAllM4References

protected void removeAllM4References()
                              throws M4Exception
Description copied from class: M4Data
This method needs to be implemented by all M4Data objects. It has to remove all references to other M4Objects.

Specified by:
removeAllM4References in class M4Data
Throws:
M4Exception
See Also:
M4Data.removeAllM4References()

hasCoordinates

protected boolean hasCoordinates()
Chains have coordinates.

Specified by:
hasCoordinates in class GraphicalM4Object

getGraphicallyEmbeddedObjects

protected java.util.Collection getGraphicallyEmbeddedObjects()
                                                      throws M4Exception
Throws:
M4Exception
See Also:
GraphicalM4Object#getGraphicallyEbeddedObjects()

getDependentObjects

public java.util.Collection getDependentObjects()
                                         throws M4Exception
Description copied from class: M4Data
This method is part of the XML-serialization and needs to be implemented by all M4Data sub-classes that need to be serialized.

Specified by:
getDependentObjects in interface XmlInfo
Overrides:
getDependentObjects in class GraphicalM4Object
Throws:
M4Exception
See Also:
M4Data.getDependentObjects()

copy

public Chain copy(Case newCase)
           throws M4Exception
Make a copy of this chain. The copy is attached to the given case.

Specified by:
copy in interface Chain
Throws:
M4Exception
See Also:
copy(Case)

addSubChain

public void addSubChain(Chain subchain)
                 throws M4Exception
Description copied from interface: Chain
Adds a Chain to this Chain and takes care about back-reference integrity. The given Chain will be a direct subchain of this chain.

Specified by:
addSubChain in interface Chain
Throws:
M4Exception
See Also:
edu.udo.cs.miningmart.m4.Chain#addChain(Chain)

resolveSubChain

public void resolveSubChain(Chain chain)
                     throws M4Exception
Description copied from interface: Chain
If the given Chain is a direct subchain of this Chain, it is resolved, ie its Steps and subchains become steps and direct subchains of this chain.

Specified by:
resolveSubChain in interface Chain
Parameters:
chain - the Chain to be resolved
Throws:
M4Exception
See Also:
Chain.resolveSubChain(Chain)

getDirectSubChains

public java.util.Collection getDirectSubChains()
                                        throws M4Exception
Description copied from interface: Chain
Active getter of the chains embedded in this chain. Attention: this method returns ONLY the direct subchains! To get all subchains, including subchains of subchains etc., use the method getAllChains().

Specified by:
getDirectSubChains in interface Chain
Returns:
a Collection of Chains
Throws:
M4Exception
See Also:
edu.udo.cs.miningmart.m4.Chain#getTopChains()


Copyright © 2001-2005