Package eu.bandm.music.entities
Class BarRelativeRationalPosition
java.lang.Object
eu.bandm.music.entities.BarRelativeRationalPosition
Models the position in a measure, relative to the starting time of the measure
(which is the timepoint of the barline at its beginning).
CURRENTLY NOT YET USED ANYWHERE !?!?!? FIXME
-
Field Summary
Modifier and TypeFieldDescriptionprotected final BigDecimal
The number of the measure in which the this time position lies.protected final Map<BigDecimal,
Rational> Maps measure numbers / bar line numberings to rational durations.protected final Rational
The offset of this time position after the initial barline. -
Constructor Summary
ConstructorDescriptionBarRelativeRationalPosition
(Map<BigDecimal, Rational> barnum2startpos, BigDecimal barnum, Rational offset) Models the position in a measure, relative to its left side measure bar. -
Method Summary
Modifier and TypeMethodDescriptionReturn the (nominal) number of the measure.Return the offset to the measure start.protected static BarRelativeRationalPosition
rat2rel
(SortedMap<Rational, BigDecimal> startpos2barnum, SortedMap<BigDecimal, Rational> barnum2startpos, Rational rat) Find the lowest measure containing the Rational value, and convert this into aBarRelativeRationalPosition
.ratonal2relative
(SortedMap<BigDecimal, Rational> barnum2startpos, SortedMap<Rational, BigDecimal> startpos2barnum) Combine both directions of vonversion into one object.protected Rational
rel2rat()
Return the absolute position as given by index and the mapbarnum2startpos
of measure starting poins.
-
Field Details
-
barnum2startpos
Maps measure numbers / bar line numberings to rational durations. -
barnum
The number of the measure in which the this time position lies. -
offset
The offset of this time position after the initial barline.
-
-
Constructor Details
-
BarRelativeRationalPosition
public BarRelativeRationalPosition(Map<BigDecimal, Rational> barnum2startpos, BigDecimal barnum, Rational offset) Models the position in a measure, relative to its left side measure bar. A map from measure numbers to the starting points of the corresponding measures must be provided explicitly, when creating. This map must not be complete, but cover the explicitly given measure number.
-
-
Method Details
-
get_offset
Return the offset to the measure start. -
get_barnum
Return the (nominal) number of the measure. -
rel2rat
Return the absolute position as given by index and the mapbarnum2startpos
of measure starting poins. -
rat2rel
protected static BarRelativeRationalPosition rat2rel(SortedMap<Rational, BigDecimal> startpos2barnum, SortedMap<BigDecimal, Rational> barnum2startpos, Rational rat) Find the lowest measure containing the Rational value, and convert this into aBarRelativeRationalPosition
. Maps for both directions must be provided.- Throws:
IllegalArgumentException
- if Rational not found in map, i.e. lies before the startpoint of the earliest measure.
-
ratonal2relative
public static InvertibleFunction<Rational,BarRelativeRationalPosition> ratonal2relative(SortedMap<BigDecimal, Rational> barnum2startpos, SortedMap<Rational, BigDecimal> startpos2barnum) Combine both directions of vonversion into one object. Invertible functions are those for which holds: "invert o apply = apply o invert = identity"
-