Package com.tagtraum.audiokern
Class ListBackedPlayListIterator<T>
- java.lang.Object
-
- com.tagtraum.audiokern.ListBackedPlayListIterator<T>
-
- All Implemented Interfaces:
PlayListIterator<T>
,Iterator<T>
,ListIterator<T>
public class ListBackedPlayListIterator<T> extends Object implements PlayListIterator<T>
List-backedPlayListIterator
.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description ListBackedPlayListIterator(List<T> list)
ListBackedPlayListIterator(List<T> list, int startIndex)
ListBackedPlayListIterator(T... element)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T element)
int
currentIndex()
The index of the song last returned byListIterator.next()
orListIterator.previous()
.void
dispose()
Cleans up an resources held by this iterator.JComponent
getComponent()
The component the playlist is displayed in.List<T>
getList()
Long
getPlayListId()
Returns a persistent playlist id.boolean
hasNext()
boolean
hasPrevious()
T
next()
int
nextIndex()
T
previous()
int
previousIndex()
void
remove()
void
reset()
Resets the iterator so that the next call toListIterator.next()
returns the first element of the collection this iterator is based on.void
set(T element)
void
setComponent(JComponent component)
Set the component the playlists is played in.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Method Detail
-
getPlayListId
public Long getPlayListId()
Description copied from interface:PlayListIterator
Returns a persistent playlist id. Together withPlayListIterator.getComponent()
you may use this id to identify the playlist view or actual persistent playlist this iterator was created for.- Specified by:
getPlayListId
in interfacePlayListIterator<T>
- Returns:
- playlist id or null, if the playlist is not persistent
-
getComponent
public JComponent getComponent()
Description copied from interface:PlayListIterator
The component the playlist is displayed in. Together withPlayListIterator.getPlayListId()
you may use this component (most likely aJTable
) to identify the playlist view or actual persistent playlist this iterator was created for.- Specified by:
getComponent
in interfacePlayListIterator<T>
- Returns:
- component, may be null, if the playlist is currently not displayed
-
setComponent
public void setComponent(JComponent component)
Description copied from interface:PlayListIterator
Set the component the playlists is played in.- Specified by:
setComponent
in interfacePlayListIterator<T>
- Parameters:
component
- component- See Also:
PlayListIterator.getComponent()
-
currentIndex
public int currentIndex()
Description copied from interface:PlayListIterator
The index of the song last returned byListIterator.next()
orListIterator.previous()
. The index may change, as the underlying playlist is sorted, filtered or changed otherwise.- Specified by:
currentIndex
in interfacePlayListIterator<T>
- Returns:
- index
-
reset
public void reset()
Description copied from interface:PlayListIterator
Resets the iterator so that the next call toListIterator.next()
returns the first element of the collection this iterator is based on.- Specified by:
reset
in interfacePlayListIterator<T>
-
dispose
public void dispose()
Description copied from interface:PlayListIterator
Cleans up an resources held by this iterator. It is strongly recommended you call this method, once you don't need the iterator anymore.- Specified by:
dispose
in interfacePlayListIterator<T>
-
hasNext
public boolean hasNext()
-
next
public T next()
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPrevious
in interfaceListIterator<T>
-
previous
public T previous()
- Specified by:
previous
in interfaceListIterator<T>
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfaceListIterator<T>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfaceListIterator<T>
-
remove
public void remove()
-
set
public void set(T element)
- Specified by:
set
in interfaceListIterator<T>
-
add
public void add(T element)
- Specified by:
add
in interfaceListIterator<T>
-
-