Package eu.bandm.music.entities
Class StemEnd
java.lang.Object
eu.bandm.music.entities.StemEnd
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
Modifier and TypeFieldDescriptionstatic final StemEnd
protected final int
Number of flagsprotected 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
ConstructorDescriptionStemEnd
(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 TypeMethodDescriptionadd
(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
Evidentboolean
Evidentint
Return the maximum number of left beams plus beamlets and right beams plus beamlets, plus number of flags.int
getFlags()
Evidentint
Evidentint
Evidentint
Evidentint
Evidentint
hashCode()
EvidentmakeLonger
(int newFlags) Reduce the effective exponent to the given value.makeLongerBy
(int difference) Reduce the effective exponent by the given difference value.boolean
noBeams()
toString()
-
Field Details
-
flags
protected final int flagsNumber of flags -
leftShort
protected final int leftShortNumber of stemlets poiting to the left. -
leftLong
protected final int leftLongNumber of long beams (going to the next stem) poiting to the left. -
rightShort
protected final int rightShortNumber of stemlets poiting to the right. -
rightLong
protected final int rightLongNumber of long beams (going to the next stem) poiting to the right. -
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
Evident -
equals
Evident -
hashCode
public int hashCode()Evident -
add
Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered. -
add
Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered. Flags stays unaltered. -
add
Return a new instance with field values increased by the parameter with the corresponding name, otherwise unaltered. -
cutDownLeft
Iff current long left beams are more than "newLongs", then convert the difference to short ones. -
cutDownRight
Iff current long right beams are more than "newLongs", then convert the difference to short ones. -
cutToFlags
If only short beams are present, replace them by flags. -
assertOnlyLongs
public void assertOnlyLongs() -
makeLongerBy
Reduce the effective exponent by the given difference value. -
makeLonger
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 numberr>=0
. Ifr>0
, thenpower(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
-