Class Track

All Implemented Interfaces:
java.lang.AutoCloseable

public class Track
extends Composition
A class that holds a list of Composables.
  • Constructor Details

  • Method Details

    • getKind

      public java.lang.String getKind()
    • setKind

      public void setKind​(java.lang.String kind)
    • rangeOfChildAtIndex

      public TimeRange rangeOfChildAtIndex​(int index, ErrorStatus errorStatus)
    • trimmedRangeOfChildAtIndex

      public TimeRange trimmedRangeOfChildAtIndex​(int index, ErrorStatus errorStatus)
    • getAvailableRange

      public TimeRange getAvailableRange​(ErrorStatus errorStatus)
      Description copied from class: Item
      Implemented by child classes, available range of media.
      Overrides:
      getAvailableRange in class Item
      Parameters:
      errorStatus - errorStatus to report in case this is not implemented in a sub-class.
      Returns:
      available range of media
    • getHandlesOfChild

      public Pair<RationalTime,​RationalTime> getHandlesOfChild​(Composable child, ErrorStatus errorStatus)
      If media beyond the ends of this child are visible due to adjacent Transitions (only applicable in a Track) then this will return the head and tail offsets as a tuple of RationalTime objects. If no handles are present on either side, then None is returned instead of a RationalTime.
      Overrides:
      getHandlesOfChild in class Composition
      Parameters:
      child - child Composable to get handles
      errorStatus - errorStatus to report error while fetching handles
      Returns:
      head and tail offsets as a Pair of RationalTime objects
    • getNeighborsOf

      public Pair<Composable,​Composable> getNeighborsOf​(Composable item, ErrorStatus errorStatus)
    • getNeighborsOf

      public Pair<Composable,​Composable> getNeighborsOf​(Composable item, ErrorStatus errorStatus, Track.NeighborGapPolicy neighborGapPolicy)
      Returns the neighbors of the item as a Pair, (previous, next). Can optionally fill in gaps when transitions have no gaps next to them. with neighborGapPolicy == NeighborGapPolicy.never: [A, B, C] :: getNeighborsOf(B) -> (A, C) [A, B, C] :: getNeighborsOf(A) -> (null, B) [A, B, C] :: getNeighborsOf(C) -> (B, null) [A] :: getNeighborsOf(A) -> (null, null) with neighborGapPolicy == NeighborGapPolicy.around_transitions: (assuming A and C are transitions) [A, B, C] :: getNeighborsOf(B) -> (A, C) [A, B, C] :: getNeighborsOf(A) -> (Gap, B) [A, B, C] :: getNeighborsOf(C) -> (B, Gap) [A] :: getNeighborsOf(A) -> (Gap, Gap)
      Parameters:
      item - Composable whose neighbors are to be fetched
      errorStatus - errorStatus to report error while fetching neighbors
      neighborGapPolicy - optionally fill in gaps when transitions have no gaps next to them? [never, around_transitions]
      Returns:
      neighbors of the item as a Pair
    • getRangeOfAllChildren

      public java.util.HashMap<Composable,​TimeRange> getRangeOfAllChildren​(ErrorStatus errorStatus)
      Return a HashMap mapping children to their range in this track.
      Overrides:
      getRangeOfAllChildren in class Composition
      Parameters:
      errorStatus - errorStatus to report any error while fetching ranges
      Returns:
      a HashMap mapping children to their range in this track.
    • eachClip

      public java.util.stream.Stream<Clip> eachClip​(TimeRange searchRange, boolean shallowSearch, ErrorStatus errorStatus)
      Return a flat Stream of each clip, limited to the search_range.
      Parameters:
      searchRange - TimeRange to search in
      shallowSearch - should the algorithm recurse into compositions or not?
      errorStatus - errorStatus to report any error while iterating
      Returns:
      a Stream of all clips in the timeline (in the searchRange) in the order they are found
    • eachClip

      public java.util.stream.Stream<Clip> eachClip​(TimeRange searchRange, ErrorStatus errorStatus)
      Return a flat Stream of each clip, limited to the search_range. This recurses into compositions.
      Parameters:
      searchRange - TimeRange to search in
      errorStatus - errorStatus to report any error while iterating
      Returns:
      a Stream of all clips in the timeline (in the searchRange) in the order they are found