Class TrackIndexConverter

java.lang.Object
com.castlabs.android.downloader.TrackIndexConverter

public class TrackIndexConverter extends Object
Utility class used to store group and track indices within one integer.
Since:
4.0.0
  • Constructor Details

    • TrackIndexConverter

      public TrackIndexConverter()
  • Method Details

    • toTrackGroupFromCompositeIndex

      public static int toTrackGroupFromCompositeIndex(int compositeIndex)
      Extracts group index from the given integer value
      Parameters:
      compositeIndex - integer value holding group and track indices
      Returns:
      group index if the given integer is a valid composite, otherwise C.INDEX_UNSET
    • toTrackFromCompositeIndex

      public static int toTrackFromCompositeIndex(int compositeIndex)
      Extracts track index from the given integer value
      Parameters:
      compositeIndex - integer value holding group and track indices
      Returns:
      track index if the given integer is a valid composite, otherwise C.INDEX_UNSET
    • toCompositeIndex

      public static int toCompositeIndex(int trackGroupIndex, int trackIndex)
      Stores group and track indices into the integer value
      Parameters:
      trackGroupIndex - group index
      trackIndex - track index
      Returns:
      composite integer