|
YAACC - UPNP Client and Server
|
The order in which the items of a playlist are played, and which item follows or precedes another. More...

Public Member Functions | |
| PlayOrder (Random random) | |
| synchronized void | reset (int size, int firstIndex, boolean shuffle) |
| Creates the order of a new playlist. | |
| synchronized void | setShuffle (boolean shuffle, int currentIndex) |
| Switches shuffle on or off. | |
| synchronized void | fit (int size, int currentIndex) |
| Adapts the order to a playlist of another size without touching the part that is already played. | |
| synchronized void | insert (int index, int count, int currentIndex) |
Makes room for items that were put into the middle of the list: the items of the order at index and after it move up by count, the new items are index to index + count - 1. | |
| synchronized boolean | isShuffle () |
| synchronized int | size () |
| synchronized int | first () |
| synchronized int[] | toArray () |
| synchronized int | next (int currentIndex, PlayMode.RepeatMode repeat, boolean autoAdvance) |
| Which item plays after the current one. | |
| synchronized int | following (int currentIndex) |
| synchronized int | preceding (int currentIndex) |
| synchronized int | previous (int currentIndex) |
| Which item plays when somebody skips back. | |
| synchronized int | positionOf (int index) |
| synchronized int | itemAt (int position) |
| synchronized boolean | move (int fromPosition, int toPosition) |
Moves the item at fromPosition to toPosition; the items in between move up or down by one (what a drag in a list does). | |
| synchronized boolean | remove (int index) |
| Takes an item that was removed from the playlist out of the order. | |
| synchronized boolean | isAtOrBeforeCurrent (int position, int currentIndex) |
Static Public Attributes | |
| static final int | NONE = -1 |
Result of next, previous and following when there is no such item. | |
The order in which the items of a playlist are played, and which item follows or precedes another.
Plain JVM, thread safe (the timer thread, the UI and the UPnP threads all ask).
Without shuffle the order is the list order. With shuffle it is a random permutation that is created once (when the playlist is set, shuffle is switched on, or the player is stopped) and then kept, so previous walks back through the order next walked along. A created order starts with the item that is playing, so every other item is still ahead: the list is played through once whatever the item was.
The position in the order is never stored: it is looked up from the index of the current item, which the player owns (an engine can change it too). A playlist that grew or shrank is adapted by fit.
| de.yaacc.player.PlayOrder.PlayOrder | ( | Random | random | ) |
| random | the source of the shuffle; a seeded one makes the order reproducible in tests |
| synchronized int de.yaacc.player.PlayOrder.first | ( | ) |
NONE for an empty playlist Referenced by de.yaacc.player.AbstractPlayer.setItems().

| synchronized void de.yaacc.player.PlayOrder.fit | ( | int | size, |
| int | currentIndex ) |
Adapts the order to a playlist of another size without touching the part that is already played.
New items (added to the end of the list) are appended, or with shuffle inserted at a random place behind the current item. A smaller list creates the order again, current item first.
Referenced by de.yaacc.player.AbstractPlayer.getNextItemIndex(), de.yaacc.player.AbstractPlayer.getPlayOrder(), de.yaacc.player.AbstractPlayer.getPreviousItemIndex(), de.yaacc.player.AbstractPlayer.insertItems(), de.yaacc.player.AbstractPlayer.isPlaylistPositionLocked(), de.yaacc.player.AbstractPlayer.playItemAt(), de.yaacc.player.AbstractPlayer.removeItem(), de.yaacc.imageviewer.ImageViewerViewModel.setPlayMode(), and de.yaacc.player.AbstractPlayer.setPlayMode().


| synchronized int de.yaacc.player.PlayOrder.following | ( | int | currentIndex | ) |
NONE at the end of the order (no wrap around); the first item for a current item that is not in the playlist Referenced by de.yaacc.player.AbstractPlayer.getNextItemIndex(), and de.yaacc.player.PlayOrder.next().


| synchronized void de.yaacc.player.PlayOrder.insert | ( | int | index, |
| int | count, | ||
| int | currentIndex ) |
Makes room for items that were put into the middle of the list: the items of the order at index and after it move up by count, the new items are index to index + count - 1.
Without shuffle they take their place in the list order, with shuffle each one is placed at a random place behind the current item (what has been played stays).
| index | where the new items start in the list; clamped to the list |
| count | how many items; nothing happens for zero or less |
| currentIndex | the current item, before the insert |
Referenced by de.yaacc.player.AbstractPlayer.insertItems().


| synchronized boolean de.yaacc.player.PlayOrder.isAtOrBeforeCurrent | ( | int | position, |
| int | currentIndex ) |
Referenced by de.yaacc.player.AbstractPlayer.isPlaylistPositionLocked().


| synchronized int de.yaacc.player.PlayOrder.itemAt | ( | int | position | ) |
NONE for a position outside the order | synchronized boolean de.yaacc.player.PlayOrder.move | ( | int | fromPosition, |
| int | toPosition ) |
Moves the item at fromPosition to toPosition; the items in between move up or down by one (what a drag in a list does).
Only the order changes, the items keep their indexes.
Referenced by de.yaacc.player.AbstractPlayer.moveInPlayOrder().

| synchronized int de.yaacc.player.PlayOrder.next | ( | int | currentIndex, |
| PlayMode.RepeatMode | repeat, | ||
| boolean | autoAdvance ) |
Which item plays after the current one.
| currentIndex | the item that plays now |
| repeat | the repeat mode |
| autoAdvance | true when the current item ended by itself, false when somebody skips to the next one. Repeat one only repeats an ended item; skipping goes on (and, like in ExoPlayer, treats repeat one as off: it does not wrap around at the end) |
NONE at the end of the order unless the repeat mode is all 
| synchronized int de.yaacc.player.PlayOrder.positionOf | ( | int | index | ) |
Referenced by de.yaacc.player.PlayOrder.fit(), de.yaacc.player.PlayOrder.following(), de.yaacc.player.PlayOrder.isAtOrBeforeCurrent(), de.yaacc.player.PlayOrder.next(), de.yaacc.player.PlayOrder.preceding(), de.yaacc.player.PlayOrder.remove(), and de.yaacc.player.AbstractPlayer.removeItem().

| synchronized int de.yaacc.player.PlayOrder.preceding | ( | int | currentIndex | ) |
NONE before the first one (no wrap around) Referenced by de.yaacc.player.AbstractPlayer.getPreviousItemIndex(), and de.yaacc.player.PlayOrder.previous().


| synchronized int de.yaacc.player.PlayOrder.previous | ( | int | currentIndex | ) |
Which item plays when somebody skips back.
Before the first item it goes to the last one (what the players always did); NONE only for an empty playlist.

| synchronized boolean de.yaacc.player.PlayOrder.remove | ( | int | index | ) |
Takes an item that was removed from the playlist out of the order.
The order of the other items is kept (unlike fit, which creates a shuffled order again), their indexes behind the removed one move down by one like the list does.
| index | the index of the removed item |
Referenced by de.yaacc.player.AbstractPlayer.removeItem().


| synchronized void de.yaacc.player.PlayOrder.reset | ( | int | size, |
| int | firstIndex, | ||
| boolean | shuffle ) |
Creates the order of a new playlist.
| size | the number of items |
| firstIndex | the item that comes first, NONE (or out of range) for a random first one (a shuffled playlist that starts playing); ignored without shuffle |
| shuffle | true for a random order |
Referenced by de.yaacc.player.AbstractPlayer.adoptDeviceState(), de.yaacc.player.PlayOrder.fit(), de.yaacc.player.AbstractPlayer.resetPlayOrder(), de.yaacc.player.AbstractPlayer.setItems(), and de.yaacc.player.PlayOrder.setShuffle().


| synchronized void de.yaacc.player.PlayOrder.setShuffle | ( | boolean | shuffle, |
| int | currentIndex ) |
Switches shuffle on or off.
The current item stays the current one: switched on, it becomes the first of a new random order; switched off, the items go on in list order after it.
Referenced by de.yaacc.imageviewer.ImageViewerViewModel.setPlayMode(), and de.yaacc.player.AbstractPlayer.setPlayMode().


| synchronized int[] de.yaacc.player.PlayOrder.toArray | ( | ) |
Referenced by de.yaacc.player.PlayOrder.fit(), de.yaacc.player.AbstractPlayer.getPlayOrder(), de.yaacc.player.PlayOrder.insert(), and de.yaacc.player.PlayOrder.reset().
