edu.udo.cs.miningmart.m4.utils
Class InterM4Communicator

java.lang.Object
  extended byedu.udo.cs.miningmart.m4.utils.InterM4Communicator
Direct Known Subclasses:
InterM4BaseattributeColumn, InterM4CaseChain, InterM4CaseConcept, InterM4CaseStep, InterM4ChainStep, InterM4ChainToParentChain, InterM4ColumnColumnStatist1, InterM4ColumnColumnStatist2, InterM4ColumnForeignKeyMember, InterM4ColumnPrimaryKeyMember, InterM4ColumnsetColsetStat, InterM4ColumnsetColumn, InterM4ConceptColumnset, InterM4ConceptFeature, InterM4ForeignColumnsetForeignKey, InterM4FromConceptProjection, InterM4FromConceptRelation, InterM4KeyKeymember, InterM4MCFeatureBaseAttribute, InterM4OperatorAssertion, InterM4OperatorCondition, InterM4OperatorConstraint, InterM4OperatorOpParam, InterM4ParameterArrayParameter, InterM4ParameterObjectParameter, InterM4PrimaryColumnsetForeignKey, InterM4StepParameter, InterM4SubConceptConInh, InterM4SuperConceptConInh, InterM4ToConceptProjection, InterM4ToConceptRelation

public abstract class InterM4Communicator
extends java.lang.Object

This abstract class embeds all the necessary communication between two Objects A and B, where A is a container of objects of type B and B has a back-reference to the container A it is in. The non-container objects A are of type M4Object, the container class is usually, but not necessarily a subclass of M4Object. All that is necessary to enable the communication is to create a subclass S implementing the abstract methods by calling the original methods of the classes. Then the offered methods of an "S object" can be called from the corresponding method of the communicating objects.

Version:
$Id: InterM4Communicator.java,v 1.3 2006/04/11 14:10:09 euler Exp $
Author:
Martin Scholz

Constructor Summary
InterM4Communicator()
           
 
Method Summary
 void add(java.lang.Object container, M4Object m4o)
          Adds an M4Object to a container's Collection and takes care of the back-references.
 void checkNameExists(M4Object m4o, java.lang.Object container)
          Each container object contains a Collection of M4Objects, but in most cases names of M4Object need to be unique within the container.
 boolean remove(java.lang.Object container, M4Object m4o)
          Removes an M4Object from a container's Collection and takes care of the back-references.
 void setCollectionTo(java.lang.Object container, java.util.Collection collection)
          Each container object contains a Collection of M4Objects.
 void updateReferenceTo(M4Object m4o, java.lang.Object container)
          This method changes the reference of an M4Object to its embedding container and takes care of all back-references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterM4Communicator

public InterM4Communicator()
Method Detail

add

public void add(java.lang.Object container,
                M4Object m4o)
         throws M4Exception
Adds an M4Object to a container's Collection and takes care of the back-references.

Parameters:
container - an Object with a container
m4o - an M4Object to be added to the container object
Throws:
M4Exception

remove

public boolean remove(java.lang.Object container,
                      M4Object m4o)
               throws M4Exception
Removes an M4Object from a container's Collection and takes care of the back-references.

Parameters:
container - an Object with a container
Returns:
true iff the object was found in the container and could be removed
Throws:
M4Exception

setCollectionTo

public void setCollectionTo(java.lang.Object container,
                            java.util.Collection collection)
                     throws M4Exception
Each container object contains a Collection of M4Objects. This method sets this Collection at once, taking care of all references and back-references between the objects.

Parameters:
container - an Object with a container
collection - a Collection of M4Objects
Throws:
M4Exception

updateReferenceTo

public void updateReferenceTo(M4Object m4o,
                              java.lang.Object container)
                       throws M4Exception
This method changes the reference of an M4Object to its embedding container and takes care of all back-references. This does also include to remove the old back-references, if not already done.

Parameters:
m4o - the M4Object to set a new reference for
container - the Object container, the m4o should now have a reference to.
Throws:
M4Exception

checkNameExists

public void checkNameExists(M4Object m4o,
                            java.lang.Object container)
                     throws M4Exception
Each container object contains a Collection of M4Objects, but in most cases names of M4Object need to be unique within the container. This method checks if the name of a new M4Object is already in use in the specified container and throws an M4NameExistsException, if yes. Please note that no Exception is thrown, if the object itself is already part of the container (unless another object shares its name)!

Parameters:
m4o - an M4Object
container - an Object with a container
Throws:
M4Exception


Copyright © 2001-2005