Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

behavioral::TMutableObservable Class Reference

Inheritance diagram for behavioral::TMutableObservable:

model::TTupleMutableObservable List of all members.

Public Methods

 TMutableObservable ()
void addMutator (IMutator tMUTATOR)
void deleteMutator (IMutator tMUTATOR)
void deleteMutators ()
 Clears the mutator list so that this object no longer has any mutators.

void setNeedMutation ()
int countMutators ()
boolean needMutation ()
void notifyMutators ()
void notifyMutators (Object tARGUMENT)

Protected Methods

void clearNeedMutation ()

Protected Attributes

Vector tMutatorVector
 Vector for mutators.


Detailed Description

Mutable observable class. This class represents a mutable observable object. It can be subclassed to represent an object that the application wants to have mutated and observed. A mutable object can have one or more mutators and one or more observers (they are hold in different containers). A mutator may be any object that implements interface IMutator. After a mutable instance needs to be mutated (changed), an application calling the TMutableObservable's notifyMutators method, causes all of its mutators to be notified of the need to be mutated by a call to their update method. The order in which notifications will be delivered is unspecified. The default implementation provided in this class will notify mutators in the order in which they registered interest, but subclasses may change this order, use no guaranteed order, deliver notifications on separate threads, or may guarantee that their subclass follows this order, as they choose.

When an mutable object is newly created, its set of mutators is empty. Two mutators are considered the same if and only if the equals method returns true for them.

Definition at line 54 of file TMutableObservable.java.


Constructor & Destructor Documentation

behavioral::TMutableObservable::TMutableObservable   [inline]
 

Builds a new instance.

Postcondition:
( countMutators() == 0 )

Definition at line 87 of file TMutableObservable.java.

References behavioral::TMutableObservable::tMutatorVector.


Member Function Documentation

void behavioral::TMutableObservable::addMutator IMutator    tMUTATOR [inline]
 

Adds an mutator to the set of mutators for this object, provided that it is not the same as some mutator already in the set.

Parameters:
tMUTATOR  The mutator to be added.

Definition at line 98 of file TMutableObservable.java.

References behavioral::TMutableObservable::tMutatorVector.

void behavioral::TMutableObservable::clearNeedMutation   [inline, protected]
 

Indicates that this object has no longer changed, or that it has already notified all of its mutators of its most recent change, so that the needMutation method will now return false.

Definition at line 73 of file TMutableObservable.java.

Referenced by behavioral::TMutableObservable::notifyMutators().

int behavioral::TMutableObservable::countMutators   [inline]
 

Returns the number of mutators of this mutable object.

Returns:
The number of mutators.

Definition at line 136 of file TMutableObservable.java.

References behavioral::TMutableObservable::tMutatorVector.

void behavioral::TMutableObservable::deleteMutator IMutator    tMUTATOR [inline]
 

Deletes an mutator from the set of mutators of this object.

Parameters:
tMUTATOR  The mutator to be removed.

Definition at line 107 of file TMutableObservable.java.

References behavioral::TMutableObservable::tMutatorVector.

boolean behavioral::TMutableObservable::needMutation   [inline]
 

Tests if this object need to be mutated.

Returns:
True if this object need to be mutated.

Definition at line 145 of file TMutableObservable.java.

Referenced by behavioral::TMutableObservable::notifyMutators().

void behavioral::TMutableObservable::notifyMutators Object    tARGUMENT [inline]
 

If this object need a mutation, as indicated by the needMutation method, then it notifies all of its mutators and calls the clearNeedMutation method to indicate that this object has no longer need for mutation. It also calls the setChanged method to indicate that this object has changed.

Parameters:
tARGUMENT  An argument passed to the mutator update method.
See also:
IMutator , java.util.ObserversetChanged

Definition at line 174 of file TMutableObservable.java.

References behavioral::TMutableObservable::clearNeedMutation(), behavioral::TMutableObservable::needMutation(), and behavioral::TMutableObservable::tMutatorVector.

void behavioral::TMutableObservable::notifyMutators   [inline]
 

If this object need a mutation, as indicated by the needMutation method, then it notifies all of its mutators and calls the clearNeedMutation method to indicate that this object has no longer need for mutation. It also calls the setChanged method to indicate that this object has changed.

See also:
IMutator , java.util.ObserversetChanged

Definition at line 159 of file TMutableObservable.java.

void behavioral::TMutableObservable::setNeedMutation   [inline]
 

Marks this mutable object as having been changed; the needMutation method will now return true.

Definition at line 122 of file TMutableObservable.java.


The documentation for this class was generated from the following file:
Generated on Mon Oct 13 02:35:27 2003 for MPCL by doxygen1.2.18