Package com.tagtraum.audiokern
Class IndexedId
- java.lang.Object
-
- com.tagtraum.audiokern.IndexedId
-
- All Implemented Interfaces:
Comparable<IndexedId>
public class IndexedId extends Object implements Comparable<IndexedId>
Represents an id that is part of an order indicated by an associated index. It is used byPlayList
.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description IndexedId(long id, int index)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(IndexedId that)
boolean
equals(Object o)
long
getId()
int
getIndex()
int
hashCode()
static IndexedId[]
invert(IndexedId[] ids)
Invert the mapping between sort indices (given by the array order) and natural indices (given bygetIndex()
.static long[]
toSortedIds(IndexedId[] indexedSongIds)
Extracts those ids that belong to an index >=0 and returns them in the order of the (positive) indices.String
toString()
-
-
-
Method Detail
-
getId
public long getId()
-
getIndex
public int getIndex()
-
toSortedIds
public static long[] toSortedIds(IndexedId[] indexedSongIds)
Extracts those ids that belong to an index >=0 and returns them in the order of the (positive) indices.- Parameters:
indexedSongIds
- indexed song ids- Returns:
- sorted ids
-
invert
public static IndexedId[] invert(IndexedId[] ids)
Invert the mapping between sort indices (given by the array order) and natural indices (given bygetIndex()
.- Parameters:
ids
- indexed song ids- Returns:
- sorted indices
-
compareTo
public int compareTo(IndexedId that)
- Specified by:
compareTo
in interfaceComparable<IndexedId>
-
-