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 voidadd(T element)intcurrentIndex()The index of the song last returned byListIterator.next()orListIterator.previous().voiddispose()Cleans up an resources held by this iterator.JComponentgetComponent()The component the playlist is displayed in.List<T>getList()LonggetPlayListId()Returns a persistent playlist id.booleanhasNext()booleanhasPrevious()Tnext()intnextIndex()Tprevious()intpreviousIndex()voidremove()voidreset()Resets the iterator so that the next call toListIterator.next()returns the first element of the collection this iterator is based on.voidset(T element)voidsetComponent(JComponent component)Set the component the playlists is played in.StringtoString()-
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:PlayListIteratorReturns 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:
getPlayListIdin interfacePlayListIterator<T>- Returns:
- playlist id or null, if the playlist is not persistent
-
getComponent
public JComponent getComponent()
Description copied from interface:PlayListIteratorThe 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:
getComponentin interfacePlayListIterator<T>- Returns:
- component, may be null, if the playlist is currently not displayed
-
setComponent
public void setComponent(JComponent component)
Description copied from interface:PlayListIteratorSet the component the playlists is played in.- Specified by:
setComponentin interfacePlayListIterator<T>- Parameters:
component- component- See Also:
PlayListIterator.getComponent()
-
currentIndex
public int currentIndex()
Description copied from interface:PlayListIteratorThe 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:
currentIndexin interfacePlayListIterator<T>- Returns:
- index
-
reset
public void reset()
Description copied from interface:PlayListIteratorResets the iterator so that the next call toListIterator.next()returns the first element of the collection this iterator is based on.- Specified by:
resetin interfacePlayListIterator<T>
-
dispose
public void dispose()
Description copied from interface:PlayListIteratorCleans 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:
disposein interfacePlayListIterator<T>
-
hasNext
public boolean hasNext()
-
next
public T next()
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPreviousin interfaceListIterator<T>
-
previous
public T previous()
- Specified by:
previousin interfaceListIterator<T>
-
nextIndex
public int nextIndex()
- Specified by:
nextIndexin interfaceListIterator<T>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndexin interfaceListIterator<T>
-
remove
public void remove()
-
set
public void set(T element)
- Specified by:
setin interfaceListIterator<T>
-
add
public void add(T element)
- Specified by:
addin interfaceListIterator<T>
-
-