Interface OptionallyPitched

All Known Implementing Classes:
GraceNote, Note

public interface OptionallyPitched
Interface for notation elements that can have pitch and are positioned on a staff.
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    Returns an integer that specifies if this has higher, lower, or equal pitch to the given pitched notation element.
    Returns the pitch that indicates the staff position of the notation element.
    Returns the concert pitch of the notation element if present.
    boolean
    Returns true if this has a pitch, otherwise false.
  • Method Details

    • hasPitch

      boolean hasPitch()
      Returns true if this has a pitch, otherwise false.
      Returns:
      true if this has a pitch
    • getPitch

      Optional<Pitch> getPitch()
      Returns the concert pitch of the notation element if present. For unpitched notation elements returns empty.
      Returns:
      concert pitch of the notation element if present
    • getDisplayPitch

      Pitch getDisplayPitch()
      Returns the pitch that indicates the staff position of the notation element.
      Returns:
      the pitch that indicates the staff position of the notation element
    • compareByPitch

      default int compareByPitch(OptionallyPitched other)
      Returns an integer that specifies if this has higher, lower, or equal pitch to the given pitched notation element. For unpitched elements defaults to display pitch.
      Parameters:
      other - the piched element to which this is compared for pitch
      Returns:
      negative integer if this is lower than other, positive integer if this is higher than other, 0 if this and other are (enharmonically) of same pitch height.