quicktime.app.actions
Class TickleList

java.lang.Object
  |
  +--quicktime.app.actions.TickleList
All Implemented Interfaces:
Collection, CollectionController, Controller, Ticklish, TicklishController
Direct Known Subclasses:
SimpleActionList

Deprecated. since QTJava 6.1

public class TickleList
extends java.lang.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.


Field Summary
protected  TickleNode list
          Deprecated. since QTJava 6.1
 
Fields inherited from interface quicktime.app.time.Ticklish
kScale
 
Constructor Summary
TickleList()
          Deprecated. since QTJava 6.1
 
Method Summary
 void addedToSpace(Space s)
          Deprecated. since QTJava 6.1
 boolean addMember(java.lang.Object member)
          Deprecated. since QTJava 6.1
 TickleNode findNode(java.lang.Object object)
          Deprecated. since QTJava 6.1
 boolean hasMember(java.lang.Object object)
          Deprecated. since QTJava 6.1
 boolean isAppropriate(java.lang.Object object)
          Deprecated. since QTJava 6.1
 boolean isEmpty()
          Deprecated. since QTJava 6.1
 boolean isMemberActive(Ticklish member)
          Deprecated. since QTJava 6.1
 boolean isWholespace()
          Deprecated. since QTJava 6.1
protected  TickleNode makeTickleNode(Ticklish t)
          Deprecated. since QTJava 6.1
 java.util.Enumeration members()
          Deprecated. since QTJava 6.1
 java.util.Enumeration nodes()
          Deprecated. since QTJava 6.1
 void removedFromSpace()
          Deprecated. since QTJava 6.1
 void removeMember(java.lang.Object member)
          Deprecated. since QTJava 6.1
 void setMemberActive(Ticklish member, boolean flag)
          Deprecated. since QTJava 6.1
 void setWholespace(boolean flag)
          Deprecated. since QTJava 6.1
 int size()
          Deprecated. since QTJava 6.1
 boolean tickle(float effectiveRate, int currentTime)
          Deprecated. since QTJava 6.1
 void timeChanged(int newTime)
          Deprecated. since QTJava 6.1
 java.lang.String toString()
          Deprecated. since QTJava 6.1
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list

protected TickleNode list
Deprecated. since QTJava 6.1

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

Constructor Detail

TickleList

public TickleList()
Deprecated. since QTJava 6.1

Construct an empty TickleList.

Method Detail

addedToSpace

public void addedToSpace(Space s)
Deprecated. since QTJava 6.1

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.

Specified by:
addedToSpace in interface Controller
Parameters:
s - the Space being added to

removedFromSpace

public void removedFromSpace()
Deprecated. since QTJava 6.1

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.

Specified by:
removedFromSpace in interface Controller

timeChanged

public void timeChanged(int newTime)
                 throws QTException
Deprecated. since QTJava 6.1

Invoked by the timer when a time condition of its time base has changed.

Specified by:
timeChanged in interface Ticklish
QTException

tickle

public boolean tickle(float effectiveRate,
                      int currentTime)
               throws QTException
Deprecated. since QTJava 6.1

The Timer invokes the tickle method when the invocation constraints of the Timer are reached.

Specified by:
tickle in interface Ticklish
Parameters:
effectiveRate - the effective rate of the Timer when the time condition matches
currentTime - 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.
QTException

members

public java.util.Enumeration members()
Deprecated. since QTJava 6.1

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.

Specified by:
members in interface Collection
Returns:
an Enumeration object

isEmpty

public boolean isEmpty()
Deprecated. since QTJava 6.1

Returns true if the collection contains no members, or false if it has one or more members.

Specified by:
isEmpty in interface Collection
Returns:
a boolean

size

public int size()
Deprecated. since QTJava 6.1

Returns the number of members in the collection, ie. the collection's size.

Specified by:
size in interface Collection
Returns:
the size of the collection.

addMember

public boolean addMember(java.lang.Object member)
                  throws QTException
Deprecated. since QTJava 6.1

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.

Specified by:
addMember in interface Collection
Parameters:
member - the object that should be added as a member to the collection
Returns:
a boolean.
QTException

makeTickleNode

protected TickleNode makeTickleNode(Ticklish t)
Deprecated. since QTJava 6.1

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

setMemberActive

public void setMemberActive(Ticklish member,
                            boolean flag)
Deprecated. since QTJava 6.1

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.

isMemberActive

public boolean isMemberActive(Ticklish member)
Deprecated. since QTJava 6.1

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

hasMember

public boolean hasMember(java.lang.Object object)
Deprecated. since QTJava 6.1

Returns true if the provided object is a member of the collection.

Specified by:
hasMember in interface Collection
Parameters:
object - the object to test for membership
Returns:
a boolean

findNode

public TickleNode findNode(java.lang.Object object)
Deprecated. since QTJava 6.1

This method returns the TickleNode that corresponds to the member object. If the object is not a member this returns null.

Returns:
a TickleNode

nodes

public java.util.Enumeration nodes()
Deprecated. since QTJava 6.1

Returns an Enumeration that is capable of enumerating over the nodes of a list.

Returns:
an Enumeration

removeMember

public void removeMember(java.lang.Object member)
Deprecated. since QTJava 6.1

If the object is a member of the collection it is removed.

Specified by:
removeMember in interface Collection
Parameters:
member - the object to remove from the collection

isAppropriate

public boolean isAppropriate(java.lang.Object object)
Deprecated. since QTJava 6.1

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.

Specified by:
isAppropriate in interface Collection
Parameters:
object - the object to test
Returns:
true if the supplied object implements the Ticklish interface.
See Also:
DynamicCollection, Protocol

isWholespace

public boolean isWholespace()
Deprecated. since QTJava 6.1

Returns the current setting of the wholespace flag.

Specified by:
isWholespace in interface CollectionController
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.

setWholespace

public void setWholespace(boolean flag)
Deprecated. since QTJava 6.1

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

toString

public java.lang.String toString()
Deprecated. since QTJava 6.1

Returns a string representation of this class.

Overrides:
toString in class java.lang.Object
Returns:
a String