quicktime.app.spaces
Interface Collection

All Known Subinterfaces:
CollectionController, DynamicCollection, QTDisplaySpace, Space
All Known Implementing Classes:
ImageDataSequence, MouseController, Protocol, QTMouseTargetController, TaskThread

public interface Collection

This interface provide an uniform means of dealing with a collection of Objects in QTJava. Particular implementations of this interface provide both their own storage mechanism and semantics about the default position and characteristics of the addMember method.

The isAppropriate method returns true if the object argument conforms to the type of object that the Collection is a collector of. The addMember implementation will call isAppropriate and returns true if the object is an appropriate member (and is therefore added to the collection).

The individual collection classes explain the customisations and restrictions on membership they enforce.

The type of object that a collection contains is statically determined by the isAppropriate () method. The DynamicCollection extension of Collection provides a mechanism for dynamically customising the membership requirments for individual collections.

See Also:
DynamicCollection

Method Summary
 boolean addMember(java.lang.Object member)
          Adds an object to the collection.
 boolean hasMember(java.lang.Object member)
          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.
 java.util.Enumeration members()
          Returns an enumeration to iterate over the current members of a collection.
 void removeMember(java.lang.Object member)
          If the object is a member of the collection it is removed.
 int size()
          Returns the number of members in the collection, ie.
 

Method Detail

addMember

public boolean addMember(java.lang.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.

hasMember

public boolean hasMember(java.lang.Object member)
Returns true if the provided object is a member of the collection.
Parameters:
member - the object to test for membership
Returns:
a boolean

isAppropriate

public boolean isAppropriate(java.lang.Object object)
Returns true if the provided object is an appropriate candidate for membership in a collection. The provided QTJava collections use this method to ensure a minimal requirement of Class or Interface instanceof tests to ensure the type of object that can be added to a collection. Some collections can have a protocol that allows an application to further refine and tighten the type of object that is allowed within an individual collection.
Parameters:
object - the object to test
Returns:
true if the supplied object is appropriate for this collection, or false if not
See Also:
DynamicCollection, Protocol

isEmpty

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

members

public java.util.Enumeration members()
Returns an enumeration to iterate over the current members of a collection.
Returns:
an enumeration

removeMember

public void removeMember(java.lang.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

size

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