Class: PianoFilesCountTree

@bldr/songbook-intermediate-files~PianoFilesCountTree

An object that groups songs that have the same number of piano files.

This tree object is an helper object. It is necessary to avoid page breaks on multipage piano scores.


{
  "1": [ 1-page-song, 1-page-song ... ],
  "2": [ 2-page-song ... ],
  "3": [ 3-page-song ... ]
  "3": [ 3-page-song ... ]
}

new PianoFilesCountTree (songs)

Name Type Description
songs module:@bldr/songbook-intermediate-files~songs

An array of song objects.

Methods

build_ (songs) private

Name Type Description
songs module:@bldr/songbook-intermediate-files~songs

An array of song objects.

checkCount_ (count) private

Name Type Description
count number

1, 2, 3, 4

isEmpty ()boolean

Return true if the count tree has no songs.

Returns:
Type Description
boolean

Shift the array of songs that has ”count” number of piano files.

Name Type Description
count number

1, 2, 3, 4

Returns:
Type Description
module:@bldr/songbook-intermediate-files~Song

sum ()

Sum up the number of all songs in all count categories.

sumFiles ()

Sum up the number of files of all songs in all count categories.