Skip to content

Commit ba88707

Browse files
committed
Added javadocs for Playlist
1 parent 346cb31 commit ba88707

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

src/main/java/com/xxmicloxx/NoteBlockAPI/model/Playlist.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ public Playlist(Song ...songs){
1111
this.songs.addAll(Arrays.asList(songs));
1212
}
1313

14+
/**
15+
* Add array of {@link Song} to playlist
16+
* @param songs
17+
*/
1418
public void add(Song ...songs){
1519
this.songs.addAll(Arrays.asList(songs));
1620
}
@@ -31,19 +35,38 @@ public void remove(Song ...songs){
3135
}
3236
}
3337

38+
/**
39+
* Get {@link Song} in playlist at specified index
40+
* @param songNumber - song index
41+
* @return
42+
*/
3443
public Song get(int songNumber){
3544
return songs.get(songNumber);
3645
}
3746

47+
/**
48+
* Get number of {@link Song} in playlist
49+
* @return
50+
*/
3851
public int getCount(){
3952
return songs.size();
4053
}
4154

55+
/**
56+
* Check whether {@link Song} is not last in playlist
57+
* @param songNumber
58+
* @return true if there is another {@link Song} after specified index
59+
*/
4260
public boolean hasNext(int songNumber){
4361
return songs.size() > (songNumber + 1);
4462
}
4563

46-
public boolean exits(int songNumber){
64+
/**
65+
* Check whether {@link Song} with specified index exists in playlist
66+
* @param songNumber
67+
* @return
68+
*/
69+
public boolean exist(int songNumber){
4770
return songs.size() > songNumber;
4871
}
4972
}

src/main/java/com/xxmicloxx/NoteBlockAPI/songplayer/SongPlayer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,14 +594,23 @@ public Playlist getPlaylist() {
594594
return playlist;
595595
}
596596

597+
/**
598+
* Get index of actually played {@link Song} in {@link Playlist}
599+
* @return
600+
*/
597601
public int getPlayedSongIndex(){
598602
return actualSong;
599603
}
600604

605+
/**
606+
* Start playing {@link Song} at specified index in {@link Playlist}
607+
* If there is no {@link Song} at this index, {@link SongPlayer} will continue playing current song
608+
* @param index
609+
*/
601610
public void playSong(int index){
602611
lock.lock();
603612
try {
604-
if (playlist.exits(index)){
613+
if (playlist.exist(index)){
605614
song = playlist.get(index);
606615
actualSong = index;
607616
tick = -1;

0 commit comments

Comments
 (0)