|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--quicktime.app.actions.TickleList
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
This TickleNode is the head of the singly-linked list. |
Fields inherited from interface quicktime.app.time.Ticklish |
kScale |
Constructor Summary | |
TickleList()
Construct an empty TickleList. |
Method Summary | |
void |
addedToSpace(Space s)
This method is called by the Space when a Controller is being addedTo the Space s. |
boolean |
addMember(java.lang.Object member)
Adds an object to the collection. |
TickleNode |
findNode(java.lang.Object object)
This method returns the TickleNode that corresponds to the member object. |
boolean |
hasMember(java.lang.Object object)
Returns true if the provided object is a member of the collection. |
boolean |
isAppropriate(java.lang.Object object)
Returns true if the provided object is an appropriate candidate for membership in a collection. |
boolean |
isEmpty()
Returns true if the collection contains no members, or false if it has one or more members. |
boolean |
isMemberActive(Ticklish member)
Returns the current active state of the supplied member. |
boolean |
isWholespace()
Returns the current setting of the wholespace flag. |
protected TickleNode |
makeTickleNode(Ticklish t)
Used by the addMember method to make a TickleNode that holds the supplied Ticklish object in the TickleList. |
java.util.Enumeration |
members()
Return an Enumeration that is capable of enumerating through the actions that have been added to the action list. |
java.util.Enumeration |
nodes()
Returns an Enumeration that is capable of enumerating over the nodes of a list. |
void |
removedFromSpace()
Called by the Space when a Controller is being removed from a Space. |
void |
removeMember(java.lang.Object member)
If the object is a member of the collection it is removed. |
void |
setMemberActive(Ticklish member,
boolean flag)
Sets the active state of a member of the Ticklish list. |
void |
setWholespace(boolean flag)
This sets the wholespace characteristic. |
int |
size()
Returns the number of members in the collection, ie. |
boolean |
tickle(float effectiveRate,
int currentTime)
The Timer invokes the tickle method when the invocation constraints of the Timer are reached. |
void |
timeChanged(int newTime)
Invoked by the timer when a time condition of its time base has changed. |
java.lang.String |
toString()
Returns a string representation of this class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected TickleNode list
Constructor Detail |
public TickleList()
Method Detail |
public void addedToSpace(Space s)
addedToSpace
in interface Controller
s
- the Space being added topublic void removedFromSpace()
removedFromSpace
in interface Controller
public void timeChanged(int newTime) throws QTException
timeChanged
in interface Ticklish
the
- newTime of the time base resulting from the changed time line
of the timerpublic boolean tickle(float effectiveRate, int currentTime) throws QTException
tickle
in interface Ticklish
er
- the effective rate of the Timer when the time condition matchestime
- the time that the Timer invoked the tickle method.public java.util.Enumeration members()
members
in interface Collection
public boolean isEmpty()
isEmpty
in interface Collection
public int size()
size
in interface Collection
public boolean addMember(java.lang.Object member) throws QTException
addMember
in interface Collection
member
- the object that should be added as a member to the collectionprotected TickleNode makeTickleNode(Ticklish t)
t
- the new Ticklish member of the list.public void setMemberActive(Ticklish member, boolean flag)
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.public boolean isMemberActive(Ticklish member)
member
- a Ticklish member of this listpublic boolean hasMember(java.lang.Object object)
hasMember
in interface Collection
member
- the object to test for membershippublic TickleNode findNode(java.lang.Object object)
public java.util.Enumeration nodes()
public void removeMember(java.lang.Object member)
removeMember
in interface Collection
member
- the object to remove from the collectionpublic boolean isAppropriate(java.lang.Object object)
isAppropriate
in interface Collection
object
- the object to testpublic boolean isWholespace()
isWholespace
in interface CollectionController
public void setWholespace(boolean flag)
flag
- the wholespace flagCollectionController
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |