All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class quicktime.app.spaces.SimpleSpace

java.lang.Object
   |
   +----quicktime.app.spaces.SimpleSpace

public abstract class SimpleSpace
extends Object
implements Space
SimpleSpace provides a default reference implementation of the Space interface. The following actions are taken by the SimpleSpace class when members or controllers are added to the Space. The SimpleSpace can be used in different settings - ie. it has no predefined application for managing display (presentation) or model contexts. The QTJava library provides DisplaySpaces as extensions and concrete classes of the SimpleSpace. However applications can also use SimpleSpace as a parent class for other kinds of Spaces, such as model spaces.

The SimpleSpace has no knowledge or implementation of the type of collection that is used to hold the collection of members. It is a delegated responsibility of the subclass to implement the Collection methods. There are two protected methods that the subclass should call after they have successfully added or removed a member - memberAdded and memberRemoved respectively. These methods ensure the behaviour of members as outlined.

See Also:
SWCompositor, GroupDrawable

Variable Index

 o containedSpaces
This vector is used to collect any Spaces that are added as members to this Space
 o controllersVec
This vector is used to collect the Controllers that are added to the Space
 o ticklers
This TickleList is used to collect any ticklish controllers that are added to the Space
 o timer
This is the Timer that both provides a TimeBase for the Space and tickles the Space based on the scale and period of the Timer

Constructor Index

 o SimpleSpace(Protocol)
Called by classes that extend the SimpleSpace.
 o SimpleSpace(Protocol, int, int)
Called by classes that extend the SimpleSpace.

Method Index

 o addController(Controller)
This method is used by the application to add a Controller to the Space.
 o addedTo(Object)
This method is called by some kind of container object when the Listener is added to the object that is the source of the interest.
 o addMember(Object)
Adds an object to the collection.
 o controllers()
Returns an Enumeration of all Controllers that are currently attached to the Space.
 o finalize()
 o getProtocol()
Returns the Protocol object that defines if a member is an appropriate member of the Space.
 o getSource()
This object is the source for all of the members and controllers of the Space that implement the Listener interface.
 o getTimer()
Returns the Timer of the Space.
 o hasMember(Object)
Returns true if the specified QTDrawable is a member of this Group.
 o isAppropriate(Object)
Returns true if the Object object is an appropriate member of the Space.
 o isEmpty()
Returns true if the collection contains no members, or false if it has one or more members.
 o memberAdded(Object)
When the sub-class defines the addMember method and has added the member to its collection it should call memberAdded to ensure that the member roles as defined within the Space are correctly established.
 o memberRemoved(Object)
When the sub-class defines the removeMember method and has removed the member from its collection it should call memberRemoved to ensure that the member roles as defined within the Space are correctly maintained.
 o members()
Returns an enumeration to iterate over the current members of a collection.
 o removeAllControllers()
This method will remove all of the controllers that are currently attached to the Space.
 o removeAllMembers()
This method will remove all of the members that are currently contained by the space.
 o removeController(Controller)
Removes a controller that was previously added to the Space.
 o removedFrom(Object)
This method is called by the specified object when the Listener object is removed from the object that is the source of the interest.
 o removeMember(Object)
If the object is a member of the collection it is removed.
 o size()
Returns the number of members in the collection, ie.
 o tickle(float, int)
The Timer invokes the tickle method when the invocation constraints of the Timer are reached.
 o tickleList()
Returns an Enumeration of all of the Controllers that implement the Ticklish interface (TicklishControllers) that have been added to the Space.
 o timeChanged(int)
Invoked by the timer when a time condition of its time base has changed.

Variables

 o controllersVec
 protected Vector controllersVec
This vector is used to collect the Controllers that are added to the Space

 o containedSpaces
 protected Vector containedSpaces
This vector is used to collect any Spaces that are added as members to this Space

 o ticklers
 protected TickleList ticklers
This TickleList is used to collect any ticklish controllers that are added to the Space

 o timer
 protected Timer timer
This is the Timer that both provides a TimeBase for the Space and tickles the Space based on the scale and period of the Timer

Constructors

 o SimpleSpace
 protected SimpleSpace(Protocol protocols) throws QTException
Called by classes that extend the SimpleSpace. The sub class must pass in a Protocol object that defines the protocol (ie. the Class type of member objects) that the sub-class Space knows how to deal with. This ensure that members of a Space meet some minimal functionality.

This constructor does not create a Timer, the subclass must create a Timer in its constructor. This is provided so that subclasses can customise the Timer.

Parameters:
protocols - the Protocol that is enforced on candidate member objects of this space.
See Also:
Protocol, Timer
 o SimpleSpace
 protected SimpleSpace(Protocol protocols,
                       int scale,
                       int period) throws QTException
Called by classes that extend the SimpleSpace. The sub class must pass in a Protocol object that defines the protocol (ie. the Class type of member objects) that the sub-class Space knows how to deal with. This ensure that members of a Space meet some minimal functionality. The constructor also provides a scale and period for the construction of the Space's Timer. This scale and period can be reset at any time using appropriate methods on the Timer class.

Parameters:
protocols - the Protocol that is enforced on candidate member objects of this space.
scale - the scale of the Space's Timer - this may NOT be zero.
period - the period of the Space's Timer.
See Also:
Protocol, Timer

Methods

 o timeChanged
 public void timeChanged(int newTime) throws QTException
Invoked by the timer when a time condition of its time base has changed.

Parameters:
the - newTime of the time base resulting from the changed time line of the timer
 o tickle
 public boolean tickle(float er,
                       int time) throws QTException
The Timer invokes the tickle method when the invocation constraints of the Timer are reached. If the sub-class Space has its own tickle requirements then it should overide the tickle method, however to ensure that any ticklish controllers are tickled the overiding implementation should first call super.tickle.

Parameters:
er - the effective rate of the Timer when the time condition matches
time - the time that the Timer invoked the tickle method.
Returns:
true if the Ticklish object should receive a consequent tickle, or false if the Ticklish object should not be tickled again.
 o tickleList
 public Enumeration tickleList()
Returns an Enumeration of all of the Controllers that implement the Ticklish interface (TicklishControllers) that have been added to the Space. These controllers are tickled each time the Space itself is tickled by its Timer.

Returns:
an Enumeration of Ticklish objects
 o getSource
 public Object getSource()
This object is the source for all of the members and controllers of the Space that implement the Listener interface. All such members and controllers will have the same source as the parent space when it is addedTo a Listener source. If the parent Space has not been added to a Listener source this returns null.

Returns:
the Listener source object
 o getProtocol
 public Protocol getProtocol()
Returns the Protocol object that defines if a member is an appropriate member of the Space.

Returns:
a Protocol object.
 o isAppropriate
 public boolean isAppropriate(Object object)
Returns true if the Object object is an appropriate member of the Space. To be an appropriate member the object must pass the passProtocol method of the Protocol object of the Space.

Parameters:
object - the Object to test
Returns:
true if the object passes the current protocol of the Protocol object of the Space.
 o hasMember
 public synchronized boolean hasMember(Object object)
Returns true if the specified QTDrawable is a member of this Group.

Returns:
a boolean
 o addedTo
 public synchronized void addedTo(Object interest)
This method is called by some kind of container object when the Listener is added to the object that is the source of the interest.

Parameters:
source - the object that is to be the source of interest for the the Listener object.
 o removedFrom
 public synchronized void removedFrom(Object interest)
This method is called by the specified object when the Listener object is removed from the object that is the source of the interest.

Parameters:
source - the object that is to be the source of interest for the the Listener object.
 o addController
 public synchronized void addController(Controller c) throws QTException
This method is used by the application to add a Controller to the Space. A Controller will control members of a Space.

Parameters:
c - the Controller to add to the Space.
 o removeController
 public synchronized void removeController(Controller c) throws QTException
Removes a controller that was previously added to the Space.

Parameters:
c - the Controller to remove from the Space.
 o controllers
 public Enumeration controllers()
Returns an Enumeration of all Controllers that are currently attached to the Space.

Returns:
an Enumeration
 o getTimer
 public Timer getTimer()
Returns the Timer of the Space. This Timer provids a TimeBase for the Space and if active will tickle and send timeChanged calls to the TicklishControllers that are attached to the Space.

Returns:
a Timer
 o addMember
 public abstract boolean addMember(Object member) throws QTException
Adds an object to the collection. Returns true if the object is appropriate member of the collection (and thus added) and false if not.

Parameters:
member - the object that should be added as a member to the collection
Returns:
a boolean.
 o removeMember
 public abstract void removeMember(Object member) throws QTException
If the object is a member of the collection it is removed.

Parameters:
member - the object to remove from the collection
 o memberAdded
 protected synchronized void memberAdded(Object member) throws QTException
When the sub-class defines the addMember method and has added the member to its collection it should call memberAdded to ensure that the member roles as defined within the Space are correctly established.

Parameters:
member - the object that has been added to the Space.
 o memberRemoved
 protected synchronized void memberRemoved(Object member) throws QTException
When the sub-class defines the removeMember method and has removed the member from its collection it should call memberRemoved to ensure that the member roles as defined within the Space are correctly maintained.

Parameters:
member - the object that has been added to the Space.
 o removeAllControllers
 public synchronized void removeAllControllers() throws QTException
This method will remove all of the controllers that are currently attached to the Space.

 o removeAllMembers
 public synchronized void removeAllMembers() throws QTException
This method will remove all of the members that are currently contained by the space.

 o finalize
 protected void finalize() throws Throwable
Overrides:
finalize in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index