edu.rit.slides
Class SlideSet

java.lang.Object
  extended by edu.rit.slides.SlideSet

public class SlideSet
extends Object

Class SlideSet provides a set of Slides. Individual SlideDescriptors can be added to and removed from the set. A Slide is associated with each SlideDescriptor; the associated slide may be null if the slide has not arrived across the network yet. The slide set provides an iterator for visiting all the slides in the order in which they were added.

Note: Class SlideSet is multiple thread safe.


Constructor Summary
SlideSet()
          Construct a new, empty slide set.
SlideSet(SlideSet theSlideSet)
          Construct a new slide set that contains the same slide descriptors and slides as the given slide set.
 
Method Summary
 void add(SlideDescriptor theSlideDescriptor, Slide theSlide)
          Add the given slide descriptor and associated slide to this slide set.
 void clear()
          Clear this slide set.
 boolean contains(SlideDescriptor theSlideDescriptor)
          Determine whether this slide set contains the given slide descriptor.
 boolean isEmpty()
          Determine if this slide set is empty.
 SlideIterator iterator()
          Obtain an iterator for visiting all the non-null slides in this slide set.
 int remove(Projector theProjector)
          Remove all slide descriptors for the given projector object, and associated slides if any, from this slide set.
 int remove(SlideDescriptor theSlideDescriptor)
          Remove the given slide descriptor, and associated slide if any, from this slide set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlideSet

public SlideSet()
Construct a new, empty slide set.


SlideSet

public SlideSet(SlideSet theSlideSet)
Construct a new slide set that contains the same slide descriptors and slides as the given slide set. The elements of the given slide set are added to the new slide set in the order in which they appear in the given slide set.

Parameters:
theSlideSet - Slide set to copy.
Throws:
NullPointerException - (unchecked exception) Thrown if theSlideSet is null.
Method Detail

isEmpty

public boolean isEmpty()
Determine if this slide set is empty.

Returns:
True if this slide set is empty, false otherwise.

clear

public void clear()
Clear this slide set.


add

public void add(SlideDescriptor theSlideDescriptor,
                Slide theSlide)
Add the given slide descriptor and associated slide to this slide set. If the given slide descriptor is not a member of this slide set, the slide descriptor and slide are added to the end. If the given slide descriptor is already a member of this slide set, the add() method changes the associated slide but does not change the order of the slides.

Parameters:
theSlideDescriptor - Slide descriptor.
theSlide - Associated slide, or null if there is no associated slide.
Throws:
NullPointerException - (unchecked exception) Thrown if theSlideDescriptor is null.

remove

public int remove(SlideDescriptor theSlideDescriptor)
Remove the given slide descriptor, and associated slide if any, from this slide set. If the given slide descriptor is not a member of this slide set, the remove() method does nothing and returns 0

Parameters:
theSlideDescriptor - Slide descriptor.
Returns:
The number of non-null slides that were removed (0 or 1).

remove

public int remove(Projector theProjector)
Remove all slide descriptors for the given projector object, and associated slides if any, from this slide set. If this slide set has no slide descriptors for the given projector, the remove() method does nothing and returns 0.

Parameters:
theProjector - Unihandle for the projector object.
Returns:
The number of non-null slides that were removed (0 or more).

contains

public boolean contains(SlideDescriptor theSlideDescriptor)
Determine whether this slide set contains the given slide descriptor.

Parameters:
theSlideDescriptor - Slide descriptor.
Returns:
True if this slide set contains theSlideDescriptor, false otherwise.

iterator

public SlideIterator iterator()
Obtain an iterator for visiting all the non-null slides in this slide set. The slides are visited in the order they were added to this slide set. If this slide set is changed while an iteration is in progress, the iterator's behavior is not specified.

Returns:
Slide iterator.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.