Package com.tagtraum.beatunes.library
Class HibernatePlayListIterator
- java.lang.Object
-
- com.tagtraum.beatunes.library.HibernatePlayListIterator
-
- All Implemented Interfaces:
PlayListIterator<AudioSong>
,Iterator<AudioSong>
,ListIterator<AudioSong>
public class HibernatePlayListIterator extends Object implements PlayListIterator<AudioSong>
Hibernate-basedAudioSong
PlayListIterator
.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description HibernatePlayListIterator(HibernatePlayList playList, int firstNextFilteredIndex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(AudioSong audioSong)
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.Long
getPlayListId()
Returns a persistent playlist id.boolean
hasNext()
boolean
hasPrevious()
AudioSong
next()
int
nextIndex()
AudioSong
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(AudioSong audioSong)
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
-
-
-
-
Constructor Detail
-
HibernatePlayListIterator
public HibernatePlayListIterator(HibernatePlayList playList, int firstNextFilteredIndex)
-
-
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<AudioSong>
- 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<AudioSong>
- 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<AudioSong>
- 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<AudioSong>
- Returns:
- index
-
next
public AudioSong next()
-
previous
public AudioSong previous()
- Specified by:
previous
in interfaceListIterator<AudioSong>
-
hasNext
public boolean hasNext()
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPrevious
in interfaceListIterator<AudioSong>
-
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<AudioSong>
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfaceListIterator<AudioSong>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfaceListIterator<AudioSong>
-
remove
public void remove()
-
set
public void set(AudioSong audioSong)
- Specified by:
set
in interfaceListIterator<AudioSong>
-
add
public void add(AudioSong audioSong)
- Specified by:
add
in interfaceListIterator<AudioSong>
-
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<AudioSong>
-
-