import { Note } from "./Note" ; import { Fraction } from "../../Common/DataObjects/Fraction" ; import { PlacementEnum } from "./Expressions/AbstractExpression" ; /**
 * Tuplets create irregular rhythms; e.g. triplets, quadruplets, quintuplets, etc.
 */ export class Tuplet { constructor ( tupletLabelNumber , bracket = false ) { this . tupletLabelNumber = tupletLabelNumber ; this . bracket = bracket ; } private tupletLabelNumber : number ; public PlacementFromXml : boolean = false ; public tupletLabelNumberPlacement : PlacementEnum ; /** Notes contained in the tuplet, per VoiceEntry (list of VoiceEntries, which has a list of notes). */ private notes : Note [ ] [ ] = [ ] ; private fractions : Fraction [ ] = [ ] ; /** Whether this tuplet has a bracket. (e.g. showing |--3--| or just 3 for a triplet) */ private bracket : boolean ; public get TupletLabelNumber ( ) : number { return this . tupletLabelNumber ; } public set TupletLabelNumber ( value ) { this . tupletLabelNumber = value ; } public get Notes ( ) : Note [ ] [ ] { return this . notes ; } public set Notes ( value ) { this . notes = value ; } public get Fractions ( ) : Fraction [ ] { return this . fractions ; } public set Fractions ( value ) { this . fractions = value ; } public get Bracket ( ) : boolean { return this . bracket ; } public set Bracket ( value ) { this . bracket = value ; } param note returns { number } public getNoteIndex ( note ) { for ( let i = this . notes . length - 1 ; i >= 0 ; i -- ) { for ( let j = 0 ; j < this . notes [ i ] . length ; j ++ ) { if ( note === this . notes [ i ] [ j ] ) { return i ; } } } return 0 ; } }