|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractList | +--java.util.Vector | +--agentland.device.intelliCD.SongContainer
A song container can hold songs or it can hold nested SongContainers. This is subclassed from Vector so that it can handle the List and Collection methods natively, but still have all the methods synchronized. Additional methods are defined to make accessing elements slightly easier. Try to use the List methods whenever possible.
To make things more straightforward, SongContainers maintain the parents of their children. When an element is added to the container, the parent of the item should be set.
Serializable
,
SongContainerElement
, Serialized FormField Summary | |
protected String |
author
|
protected long |
id
|
protected SongContainer |
parent
|
protected String |
title
|
Fields inherited from class java.util.Vector |
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary | |
SongContainer()
|
|
SongContainer(SongContainer sc)
Creates a new song container by copying the contents of an existing container. |
|
SongContainer(String t,
String a,
long id)
Creates a new empty song container with the given parameters. |
Method Summary | |
void |
add(int i,
SongContainerElement el)
Inserts an element at the given index. |
void |
add(SongContainerElement el)
|
void |
addFromContainer(SongContainer sc)
Load all the stuff in the song container into the object. |
protected SongContainer |
copyParent(SongContainer parent,
SongContainerElement childCopy)
|
SongContainerElement |
copyParentTree()
Creates a cheap-and-dirty copy of the song container and its parents. |
SongContainerElement |
copySubtree()
Make a copy of the element and all elements below it. |
boolean |
equals(Object obj)
|
String |
getAuthor()
|
SongContainerElement |
getElement(SongContainerElement elt)
Returns the object specified by the given element (possibly a placeholder). |
long |
getID()
|
String |
getName()
|
SongContainer |
getParent()
|
SongContainerElement |
getSCE(int i)
Gets the element at the given index. |
List |
getSongsRecursive()
Returns all songs in the container (even from nested SongContainers) |
String |
getTitle()
|
int |
hashCode()
|
String |
iconName()
|
protected void |
init()
|
SongContainerElement |
lightweightCopy()
Creates a very lightweight copy of this object. |
SongContainerElement |
lookup(SongContainerElement sce)
|
SongContainer |
lookupContainer(long l)
Lookup a container given an ID. |
SongContainer |
lookupContainer(SongContainer sc)
Look up a song container given an ID. |
Song |
lookupSong(Song s)
Look up a song given an ID. |
void |
printWithPrefix(String prefix)
|
Object |
remove(int i)
Returns a copy of the element at index i, then removes the element from the container. |
void |
set(int i,
SongContainerElement el)
Adds an element at the given index. |
void |
setAuthor(String a)
|
protected void |
setID(long l)
|
void |
setParent(SongContainer elt)
|
void |
setTitle(String t)
|
protected SongContainerElement |
shallowCopy(boolean copyKids)
Creates a cheap-and-dirty copy of the song container and its parents. |
String |
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 |
Methods inherited from class java.util.AbstractList |
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
iterator, listIterator, listIterator |
Field Detail |
protected String title
protected String author
protected long id
protected SongContainer parent
Constructor Detail |
public SongContainer()
public SongContainer(String t, String a, long id)
t
- the title for the new container.a
- the author name for the new container.id
- the new identification value.public SongContainer(SongContainer sc)
sc
- the container to be copied.Method Detail |
public int hashCode()
hashCode
in class Vector
protected void init()
public void setParent(SongContainer elt)
setParent
in interface SongContainerElement
public SongContainer getParent()
getParent
in interface SongContainerElement
public String getTitle()
public void setTitle(String t)
public String getAuthor()
public void setAuthor(String a)
public long getID()
getID
in interface SongContainerElement
protected void setID(long l)
public boolean equals(Object obj)
equals
in class Vector
public String toString()
toString
in class Vector
public String getName()
getName
in interface SongContainerElement
public void set(int i, SongContainerElement el)
Vector.set(int, java.lang.Object)
public void add(int i, SongContainerElement el)
Vector.add(int,Object)
public void add(SongContainerElement el)
public Object remove(int i)
remove
in class Vector
i
- the index of the element to be removed.public SongContainerElement getSCE(int i)
Vector.get(int)
public Song lookupSong(Song s)
public SongContainer lookupContainer(SongContainer sc)
public SongContainer lookupContainer(long l)
public SongContainerElement lookup(SongContainerElement sce)
public List getSongsRecursive()
public SongContainerElement getElement(SongContainerElement elt)
public void printWithPrefix(String prefix)
public void addFromContainer(SongContainer sc)
sc
- the container whose elements will be added.
# @see #addElementpublic SongContainerElement lightweightCopy()
lightweightCopy
in interface SongContainerElement
public SongContainerElement copyParentTree()
copyParentTree
in interface SongContainerElement
protected SongContainerElement shallowCopy(boolean copyKids)
protected SongContainer copyParent(SongContainer parent, SongContainerElement childCopy)
public SongContainerElement copySubtree()
copySubtree
in interface SongContainerElement
SongContainerElement
valuepublic String iconName()
iconName
in interface SongContainerElement
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |