All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class quicktime.app.actions.TickleList

java.lang.Object
   |
   +----quicktime.app.actions.TickleList

public class TickleList
extends Object
implements TicklishController, CollectionController
An TickleList is a list that contains Ticklish members. Each time the TickleList is tickled (it itself implements the Ticklish interface and can be a member of a TickleList) it will tickle all of its members. If the member's tickle method returns true the Ticklish member is kept active. If the tickle method returns false the member must be re-enabled for it to be tickled. A TickleList's tickle method will return false if the list is empty.

Members of a TickleList are kept in a TickleNode object which is where the active state of the node is kept. This information is only relevant for the list itself. When a Ticklish member is added to a TickleList the addMember method calls the makeTickleNode method. A subclass can define this method to make a subclass of TickleNode to store extra information about Ticklish members in a TickleList.

A singly-linked list is used to implement the TickleList. A list is used for fast iteration through the list whenever the tickle method is called. Insertion and Removal of members is of course a more expensive operation.

The TickleList also implements the TicklishController interface thus enabling it to be added to a Space as a controller for objects in that space. It implements the Collection interface to indicate that it contains a collection of objects. The TicklishController aspect of the TickleList is generally used to schedule PeriodicActions that control required aspects of the Space's members.


Variable Index

 o list
This TickleNode is the head of the singly-linked list.

Constructor Index

 o TickleList()
Construct an empty TickleList.

Method Index

 o addedToSpace(Space)
This method is called by the Space when a Controller is being addedTo the Space s.
 o addMember(Object)
Adds an object to the collection.
 o findNode(Object)
This method returns the TickleNode that corresponds to the member object.
 o hasMember(Object)
Returns true if the provided object is a member of the collection.
 o isAppropriate(Object)
Returns true if the provided object is an appropriate candidate for membership in a collection.
 o isEmpty()
Returns true if the collection contains no members, or false if it has one or more members.
 o isMemberActive(Ticklish)
Returns the current active state of the supplied member.
 o isWholespace()
Returns the current setting of the wholespace flag.
 o makeTickleNode(Ticklish)
Used by the addMember method to make a TickleNode that holds the supplied Ticklish object in the TickleList.
 o members()
Return an Enumeration that is capable of enumerating through the actions that have been added to the action list.
 o nodes()
Returns an Enumeration that is capable of enumerating over the nodes of a list.
 o removedFromSpace()
Called by the Space when a Controller is being removed from a Space.
 o removeMember(Object)
If the object is a member of the collection it is removed.
 o setMemberActive(Ticklish, boolean)
Sets the active state of a member of the Ticklish list.
 o setWholespace(boolean)
This sets the wholespace characteristic.
 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 timeChanged(int)
Invoked by the timer when a time condition of its time base has changed.
 o toString()
Returns a string representation of this class.

Variables

 o list
 protected TickleNode list
This TickleNode is the head of the singly-linked list. If this member is null then the list is empty.

Constructors

 o TickleList
 public TickleList()
Construct an empty TickleList.

Methods

 o addedToSpace
 public void addedToSpace(Space s)
This method is called by the Space when a Controller is being addedTo the Space s. If the Controller is not an appropriate controller for that kind of Space this method can throw an exception and the controller won't be added to the Space.

Parameters:
s - the Space being added to
 o removedFromSpace
 public void removedFromSpace()
Called by the Space when a Controller is being removed from a Space. This is only called by the Space on controllers that have previously been added, thus the space they are being removed from is the space they were added to.

 o timeChanged
 public synchronized 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 synchronized boolean tickle(float effectiveRate,
                                    int currentTime) throws QTException
The Timer invokes the tickle method when the invocation constraints of the Timer are reached.

Parameters:
er - the effective rate of the Timer when the time condition matches
time - the time that the Timer invoked the tickle method.
 o members
 public Enumeration members()
Return an Enumeration that is capable of enumerating through the actions that have been added to the action list. The objects of this enumeration are the Ticklish members.

Returns:
an Enumeration object
 o isEmpty
 public boolean isEmpty()
Returns true if the collection contains no members, or false if it has one or more members.

Returns:
a boolean
 o size
 public int size()
Returns the number of members in the collection, ie. the collection's size.

Returns:
the size of the collection.
 o addMember
 public synchronized 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. The candidate member must implement the Ticklish interface.

Parameters:
member - the object that should be added as a member to the collection
Returns:
a boolean.
 o makeTickleNode
 protected TickleNode makeTickleNode(Ticklish t)
Used by the addMember method to make a TickleNode that holds the supplied Ticklish object in the TickleList. Subclasses can subclass the TickleNode and return their subclass if required.

Parameters:
t - the new Ticklish member of the list.
Returns:
the TickleNode that is used to hold the Ticklish member in the list
 o setMemberActive
 public void setMemberActive(Ticklish member,
                             boolean flag)
Sets the active state of a member of the Ticklish list. This state is only viable whilst the supplied member is a member of the list.

Parameters:
member - the member of the list.
flag - if true the member is active and will be tickled, if false it is inactive and it won't be tickled when the list is tickled.
 o isMemberActive
 public boolean isMemberActive(Ticklish member)
Returns the current active state of the supplied member. If the member is not a member of the list this call returns false.

Parameters:
member - a Ticklish member of this list
Returns:
a boolean indicative the active state of the member
 o hasMember
 public boolean hasMember(Object object)
Returns true if the provided object is a member of the collection.

Parameters:
member - the object to test for membership
Returns:
a boolean
 o findNode
 public TickleNode findNode(Object object)
This method returns the TickleNode that corresponds to the member object. If the object is not a member this returns null.

Returns:
a TickleNode
 o nodes
 public Enumeration nodes()
Returns an Enumeration that is capable of enumerating over the nodes of a list.

Returns:
an Enumeration
 o removeMember
 public synchronized void removeMember(Object member)
If the object is a member of the collection it is removed.

Parameters:
member - the object to remove from the collection
 o isAppropriate
 public boolean isAppropriate(Object object)
Returns true if the provided object is an appropriate candidate for membership in a collection. The object must implement the Ticklish interface. Subclasses can refine this test to ensure a specialized type of Ticklish interface.

Parameters:
object - the object to test
Returns:
true if the supplied object implements the Ticklish interface.
 o isWholespace
 public boolean isWholespace()
Returns the current setting of the wholespace flag.

Returns:
true if any member of the Space is a candidate for being controlled by this controller. If false then objects must be explicitly added to the space.
 o setWholespace
 public void setWholespace(boolean flag)
This sets the wholespace characteristic. If the TickleList is added to a Space and wholspace is true, then the Space will query the list with existing and new members, and if appropriate, they will be added as members to this Controller.

Parameters:
flag - the wholespace flag
See Also:
CollectionController
 o toString
 public String toString()
Returns a string representation of this class.

Returns:
a String
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index