|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.miningmart.m4.utils.InterM4Communicator
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.
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
M4Object s, 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
M4Object s. |
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 |
public InterM4Communicator()
Method Detail |
public void add(java.lang.Object container, M4Object m4o) throws M4Exception
M4Object
to a container's Collection
and takes care of the back-references.
container
- an Object
with a containerm4o
- an M4Object
to be added to the container object
M4Exception
public boolean remove(java.lang.Object container, M4Object m4o) throws M4Exception
M4Object
from a container's Collection
and takes care of the back-references.
container
- an Object
with a container
true
iff the object was found in the container and
could be removed
M4Exception
public void setCollectionTo(java.lang.Object container, java.util.Collection collection) throws M4Exception
Collection
of
M4Object
s. This method sets this Collection
at once, taking care of all references and back-references between the
objects.
container
- an Object
with a containercollection
- a Collection of M4Object
s
M4Exception
public void updateReferenceTo(M4Object m4o, java.lang.Object container) throws M4Exception
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.
m4o
- the M4Object
to set a new reference forcontainer
- the Object
container, the m4o
should now have a reference to.
M4Exception
public void checkNameExists(M4Object m4o, java.lang.Object container) throws M4Exception
Collection
of
M4Object
s, 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)!
m4o
- an M4Object
container
- an Object
with a container
M4Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |