Class StemEnd

java.lang.Object
eu.bandm.music.entities.StemEnd

public class StemEnd extends Object
Realisation of one junction point between stem and beams. Specifies numbers of flags, of right and left beams and "beam-lets". Immutable/algebraic data type. (Allows COMBINATION of flags and beams, which is NOT generated by our current MetricSplitter, but could be supported by some rendering back-end.)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final StemEnd
     
    protected final int
    Number of flags
    protected final int
    Number of long beams (going to the next stem) poiting to the left.
    protected final int
    Number of stemlets poiting to the left.
    protected final int
    Number of long beams (going to the next stem) poiting to the right.
    protected final int
    Number of stemlets poiting to the right.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StemEnd(int leftLong, int rightLong)
    Constructor where "flags" and left and right beamlets default to 0.
    StemEnd(int leftLong, int leftShort, int rightLong, int rightShort)
    Constructor where "flags" default to 0.
    StemEnd(int flags, int leftLong, int leftShort, int rightLong, int rightShort)
    Full constructor, setting all values.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(int leftLong, int rightLong)
    Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered.
    add(int leftLong, int leftShort, int rightLong, int rightShort)
    Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered.
    add(int flags, int leftLong, int leftShort, int rightLong, int rightShort)
    Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered.
    void
     
    int
    Return the comparison of the inveterd exponents (= counts of beam(let)s) on boht sides.
    cutDownLeft(int newLongs)
    Iff current long left beams are more than "newLongs", then convert the difference to short ones.
    cutDownRight(int newLongs)
    Iff current long right beams are more than "newLongs", then convert the difference to short ones.
    If only short beams are present, replace them by flags.
    boolean
    Evident
    boolean
    Evident
    int
    Return the maximum number of left beams plus beamlets and right beams plus beamlets, plus number of flags.
    int
    Evident
    int
    Evident
    int
    Evident
    int
    Evident
    int
    Evident
    int
    Evident
    makeLonger(int newFlags)
    Reduce the effective exponent to the given value.
    makeLongerBy(int difference)
    Reduce the effective exponent by the given difference value.
    boolean
     
     

    Methods inherited from class java.lang.Object

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

    • flags

      protected final int flags
      Number of flags
    • leftShort

      protected final int leftShort
      Number of stemlets poiting to the left.
    • leftLong

      protected final int leftLong
      Number of long beams (going to the next stem) poiting to the left.
    • rightShort

      protected final int rightShort
      Number of stemlets poiting to the right.
    • rightLong

      protected final int rightLong
      Number of long beams (going to the next stem) poiting to the right.
    • EMPTY

      public static final StemEnd EMPTY
  • Constructor Details

    • StemEnd

      public StemEnd(int flags, int leftLong, int leftShort, int rightLong, int rightShort)
      Full constructor, setting all values.
    • StemEnd

      public StemEnd(int leftLong, int leftShort, int rightLong, int rightShort)
      Constructor where "flags" default to 0.
    • StemEnd

      public StemEnd(int leftLong, int rightLong)
      Constructor where "flags" and left and right beamlets default to 0.
  • Method Details

    • equals

      public boolean equals(@Opt @Opt Object o)
      Evident
      Overrides:
      equals in class Object
    • equals

      public boolean equals(@Opt @Opt StemEnd o)
      Evident
    • hashCode

      public int hashCode()
      Evident
      Overrides:
      hashCode in class Object
    • add

      public StemEnd add(int flags, int leftLong, int leftShort, int rightLong, int rightShort)
      Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered.
    • add

      public StemEnd add(int leftLong, int leftShort, int rightLong, int rightShort)
      Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered. Flags stays unaltered.
    • add

      public StemEnd add(int leftLong, int rightLong)
      Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered.
    • cutDownLeft

      public StemEnd cutDownLeft(int newLongs)
      Iff current long left beams are more than "newLongs", then convert the difference to short ones.
    • cutDownRight

      public StemEnd cutDownRight(int newLongs)
      Iff current long right beams are more than "newLongs", then convert the difference to short ones.
    • cutToFlags

      public StemEnd cutToFlags()
      If only short beams are present, replace them by flags.
    • assertOnlyLongs

      public void assertOnlyLongs()
    • makeLongerBy

      public StemEnd makeLongerBy(int difference)
      Reduce the effective exponent by the given difference value.
    • makeLonger

      public StemEnd makeLonger(int newFlags)
      Reduce the effective exponent to the given value. First remove short beams on both side, afterwards the long, as necessary.
    • noBeams

      public boolean noBeams()
    • getFlags

      public int getFlags()
      Evident
    • getLeftLong

      public int getLeftLong()
      Evident
    • getLeftShort

      public int getLeftShort()
      Evident
    • getRightLong

      public int getRightLong()
      Evident
    • getRightShort

      public int getRightShort()
      Evident
    • getEffectiveExponent

      public int getEffectiveExponent()
      Return the maximum number of left beams plus beamlets and right beams plus beamlets, plus number of flags. This is always a number r>=0. If r>0, then power(2, -r-2) is the base duration of the note symbol.
      Returns:
      the total number of beams indicating the base duration.
    • compareSides

      public int compareSides()
      Return the comparison of the inveterd exponents (= counts of beam(let)s) on boht sides.
    • toString

      public String toString()
      Overrides:
      toString in class Object