Class Position

java.lang.Object
org.wmn4j.notation.access.Position

public final class Position extends Object
Represents the position of a Durational in a Score.

This class is immutable.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Position(int partIndex, int measureNumber, int voiceNumber, int indexInVoice)
    Constructor for position in a part with only a single staff.
    Position(int partIndex, int staffNumber, int measureNumber, int voiceNumber, int indexInVoice)
    Constructor for positions in parts with multiple staves.
    Position(int partIndex, int staffNumber, int measureNumber, int voiceNumber, int indexInVoice, int indexInChord)
    Constructor for positions that can be used to access a note in a chord.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if this position is equal to the given object.
    int
    Returns the index of the note in a chord to which this position points.
    int
    Returns the index in the voice to which this position points.
    int
    Returns the number of the measure to which this position points.
    int
    Returns the part number of this position.
    int
    Returns the staff number in the part pointed to by this position.
    int
    Returns the number of the voice to which this position points.
    int
     
    boolean
    Returns true if this position points to a note in a chord.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Position

      public Position(int partIndex, int staffNumber, int measureNumber, int voiceNumber, int indexInVoice)
      Constructor for positions in parts with multiple staves.
      Parameters:
      partIndex - the number (index) of the part in the the score
      staffNumber - the number of the staff in the part. For parts with a single staff use the constructor without the staffNumber parameter
      measureNumber - the measure number
      voiceNumber - the voice number in the measure
      indexInVoice - the index in the voice specified by voiceNumber
    • Position

      public Position(int partIndex, int staffNumber, int measureNumber, int voiceNumber, int indexInVoice, int indexInChord)
      Constructor for positions that can be used to access a note in a chord.
      Parameters:
      partIndex - The number (index) of the part in the score
      staffNumber - The number of the staff in the part. For single staff parts use the constructor without the staffNumber parameter
      measureNumber - The measure number
      voiceNumber - The voice number in the measure
      indexInVoice - The index in the voice specified by voiceNumber
      indexInChord - Starting from the bottom of the chord, the index of the note
    • Position

      public Position(int partIndex, int measureNumber, int voiceNumber, int indexInVoice)
      Constructor for position in a part with only a single staff.
      Parameters:
      partIndex - the number (index) of the part in the score
      measureNumber - the measure number
      voiceNumber - the voice number in the measure
      indexInVoice - the index in the voice specified by voiceNumber
  • Method Details

    • getPartIndex

      public int getPartIndex()
      Returns the part number of this position.
      Returns:
      The number (index) of the part in the score
    • getStaffNumber

      public int getStaffNumber()
      Returns the staff number in the part pointed to by this position.
      Returns:
      the number of the staff in the part
    • getMeasureNumber

      public int getMeasureNumber()
      Returns the number of the measure to which this position points.
      Returns:
      the measure number specified by this position
    • getVoiceNumber

      public int getVoiceNumber()
      Returns the number of the voice to which this position points.
      Returns:
      the number of the voice in the measure
    • getIndexInVoice

      public int getIndexInVoice()
      Returns the index in the voice to which this position points.
      Returns:
      the index in the voice to which this position points
    • isInChord

      public boolean isInChord()
      Returns true if this position points to a note in a chord.
      Returns:
      true if this position is for a note in a chord
    • getIndexInChord

      public int getIndexInChord()
      Returns the index of the note in a chord to which this position points.
      Returns:
      the index, counting from the bottom of the chord, of a note in a chord
    • equals

      public boolean equals(Object o)
      Returns true if this position is equal to the given object. Two positions are equal if and only if they are equal in all fields.
      Overrides:
      equals in class Object
      Parameters:
      o - Object with which this is compared for equality
      Returns:
      true if o is equal to this, false otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object