edu.tamu.bpaulson.marqs
Class Album

java.lang.Object
  extended by edu.tamu.bpaulson.marqs.Album
All Implemented Interfaces:
java.io.Serializable

public class Album
extends java.lang.Object
implements java.io.Serializable

Contains album objects and associated method

Author:
Paulson Brandon
See Also:
Serialized Form

Constructor Summary
Album(java.lang.String name)
          Constructor
 
Method Summary
 void add(AlbumObject x)
          Method used to add an object to the album
 void addFile(java.io.File f)
          Method used to add a file to the album
 void addFile(java.net.URL url)
          Method used to add a file to the album
 void addFiles(java.io.File[] files)
          Method used to add multiple files to the album
 void addSketch(Sketch s)
          Add a sketch to the list of sketches for this album
 boolean contains(AlbumObject x)
          Used to determine if the album already contains x
static Album getAlbumFromXML(org.w3c.dom.Element e)
          Read an album object from an XML element
 javax.swing.ImageIcon getImage(int i)
          Get the image for the picture at index i
 java.util.ArrayList<AlbumObject> getMusicFiles()
          Method used to get all the music files in the album
 java.util.Vector<java.lang.String> getMusicList()
          Get an array list of the names of the music files in the album
 java.lang.String getMusicPath(int i)
          Get the path of the object at index i in the music files list
 java.net.URL getMusicURL(int i)
          Get the URL path of the music object at index i
 java.lang.String getName()
          Method used to return the name of the album
 java.lang.String getPictureFilename(int i)
          Get the filename of the picture at index i
 java.lang.String getPicturePath(int i)
          Get the path of the object at index i in the pictures list
 java.util.ArrayList<AlbumObject> getPictures()
          Method used to get all the pictures in the album
 Sketch getSketch()
          Get the sketch associated with the album
 ExampleSet getSketchSet()
          Return the set of sketches associated with the album
 javax.swing.ImageIcon getThumbnail(int i)
          Get the thumbnail for the picture at index i
 org.w3c.dom.Element getXMLElement(org.w3c.dom.Document d)
          Return an XML-style element representing this album
 boolean musicContains(AlbumObject x)
          Used to determine if the music list already contains x
 int numMusicFiles()
          Return the number of music files in the album
 int numPictures()
          Return the number of pictures in the album
 boolean otherContains(AlbumObject x)
          Used to determine if the "others" list already contains x
 boolean pictureContains(AlbumObject x)
          Used to determine if the picture list already contains x
 void remove(java.util.ArrayList<AlbumObject> a)
          Remove a list of album objects from the album
 void removeAllSketches()
          Remove all the sketches associated with the album
 void removeSketch(int i)
          Remove the sketch at index i
 void setName(java.lang.String n)
          Method used to set the name of the album
 void setSketch(Sketch s)
          Set the sketch associated with this album
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Album

public Album(java.lang.String name)
Constructor

Parameters:
name - the name of the album
Method Detail

getName

public java.lang.String getName()
Method used to return the name of the album

Returns:
name of the album

setName

public void setName(java.lang.String n)
Method used to set the name of the album

Parameters:
n - new name for the album

add

public void add(AlbumObject x)
Method used to add an object to the album

Parameters:
x - album object to add to the album

addFiles

public void addFiles(java.io.File[] files)
Method used to add multiple files to the album

Parameters:
files - files to add to the album

addFile

public void addFile(java.io.File f)
Method used to add a file to the album

Parameters:
f - file to add to the album

addFile

public void addFile(java.net.URL url)
Method used to add a file to the album

Parameters:
url - url of the file

getMusicFiles

public java.util.ArrayList<AlbumObject> getMusicFiles()
Method used to get all the music files in the album

Returns:
music files in the album

getPictures

public java.util.ArrayList<AlbumObject> getPictures()
Method used to get all the pictures in the album

Returns:
pictures in the album

numPictures

public int numPictures()
Return the number of pictures in the album

Returns:
number of pictures in the album

numMusicFiles

public int numMusicFiles()
Return the number of music files in the album

Returns:
number of music files in the album

getThumbnail

public javax.swing.ImageIcon getThumbnail(int i)
Get the thumbnail for the picture at index i

Parameters:
i - index of the album object to get a thumbnail of
Returns:
thumbnail of picture at index i

getImage

public javax.swing.ImageIcon getImage(int i)
Get the image for the picture at index i

Parameters:
i - index of the album object to get an image of
Returns:
image of picture at index i

getMusicList

public java.util.Vector<java.lang.String> getMusicList()
Get an array list of the names of the music files in the album

Returns:
array list of the names of the music files in the album

getMusicPath

public java.lang.String getMusicPath(int i)
Get the path of the object at index i in the music files list

Parameters:
i - index of the music file to get the path for
Returns:
path of the music file at index i
Throws:
java.net.MalformedURLException

getMusicURL

public java.net.URL getMusicURL(int i)
                         throws java.net.MalformedURLException
Get the URL path of the music object at index i

Parameters:
i - index of the music object in the music list
Returns:
URL of the chosen music object
Throws:
java.net.MalformedURLException - when URL is invalid

getPicturePath

public java.lang.String getPicturePath(int i)
Get the path of the object at index i in the pictures list

Parameters:
i - index of the picture to get the path for
Returns:
path of the picture at index i

getPictureFilename

public java.lang.String getPictureFilename(int i)
Get the filename of the picture at index i

Parameters:
i - index of the picture
Returns:
name of the picture at index i

musicContains

public boolean musicContains(AlbumObject x)
Used to determine if the music list already contains x

Parameters:
x - album object to search for
Returns:
true if in music list; else false

pictureContains

public boolean pictureContains(AlbumObject x)
Used to determine if the picture list already contains x

Parameters:
x - album object to search for
Returns:
true if in picture list; else false

otherContains

public boolean otherContains(AlbumObject x)
Used to determine if the "others" list already contains x

Parameters:
x - album object to search for
Returns:
true if in others list; else false

contains

public boolean contains(AlbumObject x)
Used to determine if the album already contains x

Parameters:
x - album object to search for
Returns:
true if in album; else false

getSketch

public Sketch getSketch()
Get the sketch associated with the album

Returns:
sketch associated with the album

getSketchSet

public ExampleSet getSketchSet()
Return the set of sketches associated with the album

Returns:
set of sketches associated with album

setSketch

public void setSketch(Sketch s)
Set the sketch associated with this album

Parameters:
s - sketch to associate the album with

addSketch

public void addSketch(Sketch s)
Add a sketch to the list of sketches for this album

Parameters:
s - sketch to add to the example set

remove

public void remove(java.util.ArrayList<AlbumObject> a)
Remove a list of album objects from the album

Parameters:
a - list of album objects to remove

removeAllSketches

public void removeAllSketches()
Remove all the sketches associated with the album


removeSketch

public void removeSketch(int i)
Remove the sketch at index i

Parameters:
i - index

getXMLElement

public org.w3c.dom.Element getXMLElement(org.w3c.dom.Document d)
Return an XML-style element representing this album

Parameters:
d - document to write album to
Returns:
element representing this album

getAlbumFromXML

public static Album getAlbumFromXML(org.w3c.dom.Element e)
Read an album object from an XML element

Parameters:
e - xml element
Returns:
album object parsed from xml element