agentland.device.intelliCD
Class SCollection
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.Vector
|
+--agentland.device.intelliCD.SongContainer
|
+--agentland.device.intelliCD.SCollection
- All Implemented Interfaces:
- Cloneable, Collection, List, Serializable, SongContainerElement
- Direct Known Subclasses:
- SQLCollection
- public class SCollection
- extends SongContainer
The SCollection is a SongContainer with some hashtables for fast
lookups.
- See Also:
SongContainer
,
Song
, Serialized Form
Methods inherited from class agentland.device.intelliCD.SongContainer |
add, add, addFromContainer, copyParent, copyParentTree, copySubtree, equals, getAuthor, getElement, getID, getName, getParent, getSCE, getSongsRecursive, getTitle, hashCode, iconName, init, lightweightCopy, lookup, lookupContainer, printWithPrefix, remove, set, setAuthor, setID, setParent, setTitle, shallowCopy, toString |
Methods inherited from class java.util.Vector |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, firstElement, get, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize |
SCollection
public SCollection()
addContainer
public void addContainer(SongContainer sc)
- Adds a song container to the collection.
lookupSong
public Song lookupSong(Song s)
- Looks up the given song. This method exists so that a song
`placeholder' consisting only of an ID can get the full details
from the SCollection.
- Overrides:
lookupSong
in class SongContainer
lookupContainer
public SongContainer lookupContainer(long l)
- Looks up the SongContainer given an id number.
- Overrides:
lookupContainer
in class SongContainer
containerIterator
public Iterator containerIterator()
- Returns an iterator for looping through all the SongContainers in
the SCollection.
songIterator
public Iterator songIterator()
- Returns an iterator for looping through all the Songs in the
SCollection.
addSong
public void addSong(Song s,
SongContainer parent)
throws IllegalArgumentException
- Inserts the given song into the collection with the given parent.
If the parent container is null, then the song is inserted into
the top level of the collection. Otherwise, the container must
be present in the collection, or an exception will be thrown.
- Parameters:
s
- The song to add.parent
- The parent container.- Throws:
IllegalArgumentException
- if the container argument is
an object that is not present in the collection.
addContainer
public void addContainer(SongContainer sc,
SongContainer parent)
throws IllegalArgumentException
- Inserts the given song into the collection with the given parent,
but does not descend through the SongContainer adding songs by
itself. If the parent container is null, then the container is
inserted into the top level of the collection. Otherwise, the
container must be present in the collection, or an exception will
be thrown.
- Parameters:
sc
- The song container to add.parent
- The parent container.- Throws:
IllegalArgumentException
- if the container argument is
an object that is not present in the collection.
prune
public int prune()
- Prunes off any empty containers. This is just to clean up the
collection a bit.
- Returns:
- The number of removed containers.