Class Selection



  • public final class Selection
    extends Range<java.lang.Integer>
    A selection on integer values
    • Constructor Summary

      Constructors 
      Constructor and Description
      Selection(int start, int scaleFactor) 
      Selection(int start, int end, int scaleFactor)
      Constructs a new instance of LoopPoints from the bound values passed as argument.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean contains(int p)
      Returns true if p is contained in the selection ( p is greater than getStart() and smaller than getEnd() ).
      static int convertFactor(int position, int fromFactor, int toFactor) 
      static Selection convertFactor(Selection s, int newFactor)
      Convert a selection to another selection with a new scale factor.
      java.lang.Integer getEnd()
      Returns the end value of the loop
      int getScaleFactor()
      Returns the scale factor of this selection
      boolean isOpen()
      Checks whether the selection defines an open or closed interval.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ZERO_SELECTION

        public static Selection ZERO_SELECTION
    • Constructor Detail

      • Selection

        public Selection(int start,
                         int scaleFactor)
      • Selection

        public Selection(int start,
                         int end,
                         int scaleFactor)
        Constructs a new instance of LoopPoints from the bound values passed as argument. The lower value is assigned to the start of the loop, whereas the higher value is assigned to the end of the loop. If the two values are equals the loop is assumed to have no end but only a starting point.
        Parameters:
        start - the start of the range, it must be greater or equal than 0
        end - the end of the range, it must be either greater or equal than 0 or equal to NO_POSITION
        scaleFactor -
        Throws:
        java.lang.IndexOutOfBoundsException - whether start is a negative value or end is a negative value different from NO_POSITION
        java.lang.IllegalArgumentException - if end is greater than start
    • Method Detail

      • getEnd

        public final java.lang.Integer getEnd()
        Returns the end value of the loop
        Overrides:
        getEnd in class Range<java.lang.Integer>
        Returns:
        the end point or -1 if the loop has only the start and no end to indicate the final frame. This value is consistent with the Clip interface
        See Also:
        Clip.setLoopPoints(int, int)
      • getScaleFactor

        public int getScaleFactor()
        Returns the scale factor of this selection
        Returns:
        the scale factor of this selection
      • isOpen

        public boolean isOpen()
        Checks whether the selection defines an open or closed interval. The selection is open is the end is equal to NO_POSITION.
        Returns:
        true is the selection is open, false otherwise
      • contains

        public boolean contains(int p)
        Returns true if p is contained in the selection ( p is greater than getStart() and smaller than getEnd() ). If the selection is open, false is returned.
        Parameters:
        p - the integer vale to check for
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Range<java.lang.Integer>
      • convertFactor

        public static Selection convertFactor(Selection s,
                                              int newFactor)
        Convert a selection to another selection with a new scale factor. The start and end of the selection are changed accordingly.
        Parameters:
        s - the selection to convert
        newFactor - the factor of the converted selection
        Returns:
        s if newFactor is already the scale factor of s, a new selection
      • convertFactor

        public static int convertFactor(int position,
                                        int fromFactor,
                                        int toFactor)