public class BarRelativeRationalPosition extends Object
Modifier and Type | Field and Description |
---|---|
protected BigDecimal |
barnum
The number of the measure in which the this time position lies.
|
protected Map<BigDecimal,Rational> |
barnum2startpos
Maps measure numbers / bar line numberings to rational durations.
|
protected Rational |
offset
The offset of this time position after the initial barline.
|
Constructor and Description |
---|
BarRelativeRationalPosition(Map<BigDecimal,Rational> barnum2startpos,
BigDecimal barnum,
Rational offset)
Models the position in a measure, relative to its left side measure bar.
|
Modifier and Type | Method and Description |
---|---|
BigDecimal |
get_barnum()
Return the (nominal) number of the measure.
|
Rational |
get_offset()
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 a
BarRelativeRationalPosition . |
static InvertibleFunction<Rational,BarRelativeRationalPosition> |
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 map
barnum2startpos
of measure starting poins. |
protected final Map<BigDecimal,Rational> barnum2startpos
protected final BigDecimal barnum
protected final Rational offset
public BarRelativeRationalPosition(Map<BigDecimal,Rational> barnum2startpos, BigDecimal barnum, Rational offset)
public Rational get_offset()
public BigDecimal get_barnum()
protected Rational rel2rat()
barnum2startpos
of measure starting poins.protected static BarRelativeRationalPosition rat2rel(SortedMap<Rational,BigDecimal> startpos2barnum, SortedMap<BigDecimal,Rational> barnum2startpos, Rational rat)
BarRelativeRationalPosition
.
Maps for both directions must be provided.IllegalArgumentException
- if Rational not found in map, i.e. lies
before the startpoint of the earliest measure.public static InvertibleFunction<Rational,BarRelativeRationalPosition> ratonal2relative(SortedMap<BigDecimal,Rational> barnum2startpos, SortedMap<Rational,BigDecimal> startpos2barnum)