Class TempoRange

java.lang.Object
org.jjazz.rhythm.api.TempoRange
All Implemented Interfaces:
Serializable, Cloneable

public final class TempoRange extends Object implements Cloneable, Serializable
A range of tempo.
See Also:
  • Field Details

  • Constructor Details

    • TempoRange

      public TempoRange(int min, int max, String name)
      Parameters:
      min -
      max -
      name -
    • TempoRange

      public TempoRange(TempoRange tr)
  • Method Details

    • getStandardTempoRanges

      public static List<TempoRange> getStandardTempoRanges()
    • contains

      public boolean contains(int tempo)
      Parameters:
      tempo -
      Returns:
      True if tempo is included in the bounds of this TempoRange.
    • getMax

      public int getMax()
    • getMin

      public int getMin()
    • getName

      public String getName()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      Parameters:
      o -
      Returns:
      True if both TempoRanges share same min and max values (name is not used).
    • hashCode

      public int hashCode()
      Use only min and max values, name is not used.
      Overrides:
      hashCode in class Object
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • computeSimilarityLevel

      public float computeSimilarityLevel(TempoRange tr)
      Compute a percentage that say how similar are this object's tempo bounds with tr's tempo bounds.

      Return value = (tempo range of the intersection of both objects)/(tempo range of the union of both objects)
      Examples: this = [60,80], tr=[90,100] => return value = 0 this = [60,80], tr=[70,90] => return value = 10/30 = 0.33 this = [60,80], tr=[58,85] => return value = 20/27 = 0.74 this = [60,80], tr=[60,80] => return value = 20/20 = 1

      Parameters:
      tr - TempoRange
      Returns:
      A value between 0 and 1.
    • checkTempo

      public static boolean checkTempo(int t)