import { Fraction } from "../../Common/DataObjects/Fraction" ; import { GraphicalStaffEntry } from "./GraphicalStaffEntry" ; export class VerticalGraphicalStaffEntryContainer { constructor ( numberOfEntries , absoluteTimestamp ) { this . absoluteTimestamp = absoluteTimestamp ; this . staffEntries = new Array ( numberOfEntries ) ; } private index : number ; private absoluteTimestamp : Fraction ; private staffEntries : GraphicalStaffEntry [ ] = [ ] ; public get Index ( ) : number { return this . index ; } public set Index ( value ) { this . index = value ; } public get AbsoluteTimestamp ( ) : Fraction { return this . absoluteTimestamp ; } public get StaffEntries ( ) : GraphicalStaffEntry [ ] { return this . staffEntries ; } public set StaffEntries ( value ) { this . staffEntries = value ; } public static compareByTimestamp ( x , y ) { const xValue = x . absoluteTimestamp . RealValue ; const yValue = y . absoluteTimestamp . RealValue ; if ( xValue < yValue ) { return - 1 ; } else if ( xValue > yValue ) { return 1 ; } else { return 0 ; } } returns { any } public getFirstNonNullStaffEntry ( ) { for ( let idx = 0 , len = this . staffEntries . length ; idx < len ; ++ idx ) { const graphicalStaffEntry = this . staffEntries [ idx ] ; if ( graphicalStaffEntry ) { return graphicalStaffEntry ; } } return undefined ; } }