VerticalSourceStaffEntryContainer.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {SourceMeasure} from "./SourceMeasure";
  2. import {Fraction} from "../../Common/DataObjects/Fraction";
  3. import {SourceStaffEntry} from "./SourceStaffEntry";
  4. export class VerticalSourceStaffEntryContainer {
  5. constructor(parentMeasure: SourceMeasure, timestamp: Fraction, size: number) {
  6. this.timestamp = timestamp;
  7. this.size = size;
  8. this.staffEntries = new Array(size);
  9. this.parentMeasure = parentMeasure;
  10. }
  11. private timestamp: Fraction;
  12. private size: number;
  13. private staffEntries: SourceStaffEntry[] = [];
  14. private comments: Comment[] = [];
  15. private parentMeasure: SourceMeasure;
  16. public $get$(index: number): SourceStaffEntry {
  17. return this.staffEntries[index];
  18. }
  19. public $set$(index: number, value: SourceStaffEntry): void {
  20. this.staffEntries[index] = value;
  21. }
  22. public get Timestamp(): Fraction {
  23. return this.timestamp;
  24. }
  25. public set Timestamp(value: Fraction) {
  26. this.timestamp = value;
  27. }
  28. public get StaffEntries(): SourceStaffEntry[] {
  29. return this.staffEntries;
  30. }
  31. public set StaffEntries(value: SourceStaffEntry[]) {
  32. this.staffEntries = value;
  33. }
  34. public get Comments(): Comment[] {
  35. return this.comments;
  36. }
  37. public set Comments(value: Comment[]) {
  38. this.comments = value;
  39. }
  40. public get ParentMeasure(): SourceMeasure {
  41. return this.parentMeasure;
  42. }
  43. public set ParentMeasure(value: SourceMeasure) {
  44. this.parentMeasure = value;
  45. }
  46. public getAbsoluteTimestamp(): Fraction {
  47. return Fraction.plus(this.timestamp, this.parentMeasure.AbsoluteTimestamp);
  48. }
  49. }