edu.rit.slides
Class SlideShow

java.lang.Object
  extended by edu.rit.slides.SlideShow
All Implemented Interfaces:
Externalizable, Serializable

public class SlideShow
extends Object
implements Externalizable

Class SlideShow provides an object that holds a slide show in the Slides application. A slide show consists of a sequence of zero or more slide groups. A slide group consists of a set of zero or more slides which are displayed on the screen together at the same time in a certain order. Each slide is an instance of class Slide and consists of a number of individual SlideItems.

Class SlideShow provides methods for populating a slide show object with slide groups. Each separate slide in the slide show is assigned a unique slide ID, an instance of class Eoid. Class SlideShow provides methods for retrieving all the slide IDs and for retrieving a certain slide given the slide ID. Class SlideShow provides methods for retrieving the set of slide IDs in each slide display.

An instance of class SlideShow may be serialized. Class SlideShow provides static convenience methods to write a slide show to a file and read a slide show from a file. A slide show file is simply a binary file that contains a serialized slide show object.

Note: Class SlideShow is not multiple thread safe.

See Also:
Serialized Form

Constructor Summary
SlideShow()
          Construct a new, empty slide show.
 
Method Summary
 void addSlideGroup(Collection theSlides)
          Add the given slide group to the end of this slide show.
 void addSlideGroup(Slide[] theSlides)
          Add the given slide group to the end of this slide show.
 Slide getSlide(Eoid theSlideID)
          Obtain the slide with the given slide ID in this slide show.
 Eoid[] getSlideGroup(int index)
          Obtain the slide group at the given index in this slide show.
 int getSlideGroupCount()
          Returns the number of slide groups in this slide show.
 Eoid[] getSlideIDs()
          Obtain the slide IDs of all the slides in this slide show.
static SlideShow read(File theFile)
          Read a slide show from the given file.
 void readExternal(ObjectInput in)
          Read this slide show from the given object input stream.
static void write(SlideShow theSlideShow, File theFile)
          Write the given slide show to the given file.
 void writeExternal(ObjectOutput out)
          Write this slide show to the given object output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlideShow

public SlideShow()
Construct a new, empty slide show.

Method Detail

addSlideGroup

public void addSlideGroup(Collection theSlides)
Add the given slide group to the end of this slide show.

The slides are obtained by iterating over theSlides. The order of the slides returned by the iterator is the order of the slides for this slide group.

Parameters:
theSlides - Collection of zero or more slides in the slide group.
Throws:
NullPointerException - (unchecked exception) Thrown if theSlides is null or any element of theSlides is null.

addSlideGroup

public void addSlideGroup(Slide[] theSlides)
Add the given slide group to the end of this slide show.

Parameters:
theSlides - Array of zero or more slides in the slide group.
Throws:
NullPointerException - (unchecked exception) Thrown if theSlides is null or any element of theSlides is null.

getSlideGroupCount

public int getSlideGroupCount()
Returns the number of slide groups in this slide show.


getSlideGroup

public Eoid[] getSlideGroup(int index)
Obtain the slide group at the given index in this slide show. The return value is an array of zero or more slide IDs (type Eoid) that are assigned to the slides in the slide group.

Note: To assign the slide IDs, this method needs to access the device properties file. See class DeviceProperties for further information.

Parameters:
index - Slide group index in the range 0 .. getSlideGroupCount().
Returns:
Array of slide IDs.
Throws:
ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if index is not in the range 0 .. getSlideGroupCount().

getSlideIDs

public Eoid[] getSlideIDs()
Obtain the slide IDs of all the slides in this slide show. The return value is an array of zero or more slide IDs (type Eoid) that are assigned to the slides in this slide show.

Note: To assign the slide IDs, this method needs to access the device properties file. See class DeviceProperties for further information.

Returns:
Array of slide IDs.

getSlide

public Slide getSlide(Eoid theSlideID)
Obtain the slide with the given slide ID in this slide show.

Parameters:
theSlideID - Slide ID (type Eoid).
Returns:
Slide corresponding to theSlideID, or null if there is no such slide.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Write this slide show to the given object output stream.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - Object output stream.
Throws:
IOException - Thrown if an I/O error occurred.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Read this slide show from the given object input stream.

Specified by:
readExternal in interface Externalizable
Parameters:
in - Object input stream.
Throws:
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this slide show cannot be found.

write

public static void write(SlideShow theSlideShow,
                         File theFile)
                  throws IOException
Write the given slide show to the given file.

Parameters:
theSlideShow - Slide show.
theFile - File.
Throws:
IOException - Thrown if an I/O error occurred.

read

public static SlideShow read(File theFile)
                      throws IOException,
                             ClassNotFoundException
Read a slide show from the given file.

Parameters:
theFile - File.
Returns:
Slide show.
Throws:
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this slide show cannot be found.


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