Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## quicktime.app.spaces
Class Protocol

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

All Implemented Interfaces:
  Collection

public class Protocol
extends java.lang.Object
implements Collection

A Protocol is a collection of classes that are used to test an object against. The passProtocol (Object o) method uses the Class.instanceOf method on each of the classes in its collection. If the incoming object is not an instance of any of the classes in the Protocol then the passProtocol method returns false. If the incoming object is then it returns true.

For DynamicCollections an application can dynamically assign or add classes to a Protocol to tighten the membership requirements of its collection. When an object is added to a dynamic collection the dynamic collection will first test the object against its Protocol's passProtocol method. Only if it passes this test is the object allowed to be added to the Collection. This test is encapsulated in the DynamicCollection's isAppropriate method.

See Also:
  `DynamicCollection`

Constructor Summary
`Protocol(java.lang.Class defaultProtocol)` Creates a Protocol from the supplied class.
`Protocol(java.lang.Class[] defaultProtocols)` Creates a Protocol from the supplied classes.

Method Summary
`boolean` | `addMember(java.lang.Object member)` Adds a class object to this Protocol.
`java.util.Enumeration` | `defaultProtocol()` Returns an Enumeration that enables you to examine the default classes for this Protocol.
`boolean` | `hasMember(java.lang.Object object)` Returns true if the supplied class object is a member of this Protocol.
`boolean` | `isAppropriate(java.lang.Object object)` Returns true if this object is an instance of the Class class.
`boolean` | `isEmpty()` Returns true if the Protocol has no members, otherwise false
`java.util.Enumeration` | `members()` Returns an Enumeration to iterate over all of the members of the Protocol object.
`boolean` | `passProtocol(java.lang.Object object)` Returns true if the object is an instance of ALL of the class object members of the Protocol.
`void` | `removeMember(java.lang.Object member)` Removes a class object that was previously added to this Protocol.
`int` | `size()` Returns the number of class objects that are in this Protocol.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Protocol

    public Protocol(java.lang.Class[] defaultProtocols)

  Creates a Protocol from the supplied classes. These default classes cannot be removed from this Protocol once created.

### Protocol

    public Protocol(java.lang.Class defaultProtocol)

  Creates a Protocol from the supplied class. These default class cannot be removed from this Protocol once created.

Method Detail

### defaultProtocol

    public java.util.Enumeration defaultProtocol()

  Returns an Enumeration that enables you to examine the default classes for this Protocol.
  Returns:
    an Enumeration

### members

    public java.util.Enumeration members()

  Returns an Enumeration to iterate over all of the members of the Protocol object.
  Specified by:
    `members` in interface `Collection`
  Returns:
    an Enumeration

### isEmpty

    public boolean isEmpty()

  Returns true if the Protocol has no members, otherwise false
  Specified by:
    `isEmpty` in interface `Collection`
  Returns:
    a boolean

### hasMember

    public boolean hasMember(java.lang.Object object)

  Returns true if the supplied class object is a member of this Protocol.
  Specified by:
    `hasMember` in interface `Collection`
  Returns:
    a boolean

### size

    public int size()

  Returns the number of class objects that are in this Protocol.
  Specified by:
    `size` in interface `Collection`
  Returns:
    an int

### addMember

    public boolean addMember(java.lang.Object member)

  Adds a class object to this Protocol. The application can later remove any class objects that are added to a Protocol in this manner
  Specified by:
    `addMember` in interface `Collection`
  Returns:
    true if the class object was successfully added (or is already a member)

### removeMember

    public void removeMember(java.lang.Object member)

  Removes a class object that was previously added to this Protocol. The application cannot remove class objects that are part of the default protocol of this Protocol.
  Specified by:
    `removeMember` in interface `Collection`
  Following copied from interface: `quicktime.app.spaces.Collection`
  Parameters:
    `member` - the object to remove from the collection

### isAppropriate

    public boolean isAppropriate(java.lang.Object object)

  Returns true if this object is an instance of the Class class.
  Specified by:
    `isAppropriate` in interface `Collection`
  Parameters:
    `object` - the object to test
  Returns:
    a boolean

### passProtocol

    public boolean passProtocol(java.lang.Object object)

  Returns true if the object is an instance of ALL of the class object members of the Protocol. If the object is not an instance of any one of the member class objects the method returns false.
  Parameters:
    `object` - the Object to test
  Returns:
    a boolean

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD