VerticalGraphicalStaffEntryContainer.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. "use strict";
  2. var VerticalGraphicalStaffEntryContainer = (function () {
  3. function VerticalGraphicalStaffEntryContainer(numberOfEntries, absoluteTimestamp) {
  4. this.staffEntries = [];
  5. this.absoluteTimestamp = absoluteTimestamp;
  6. for (var i = 0; i < numberOfEntries; i++) {
  7. this.staffEntries.push(undefined);
  8. }
  9. }
  10. Object.defineProperty(VerticalGraphicalStaffEntryContainer.prototype, "Index", {
  11. get: function () {
  12. return this.index;
  13. },
  14. set: function (value) {
  15. this.index = value;
  16. },
  17. enumerable: true,
  18. configurable: true
  19. });
  20. Object.defineProperty(VerticalGraphicalStaffEntryContainer.prototype, "AbsoluteTimestamp", {
  21. get: function () {
  22. return this.absoluteTimestamp;
  23. },
  24. enumerable: true,
  25. configurable: true
  26. });
  27. Object.defineProperty(VerticalGraphicalStaffEntryContainer.prototype, "StaffEntries", {
  28. //
  29. //public set AbsoluteTimestamp(value: Fraction) {
  30. // this.absoluteTimestamp = value;
  31. //}
  32. get: function () {
  33. return this.staffEntries;
  34. },
  35. set: function (value) {
  36. this.staffEntries = value;
  37. },
  38. enumerable: true,
  39. configurable: true
  40. });
  41. VerticalGraphicalStaffEntryContainer.compareByTimestamp = function (x, y) {
  42. var xValue = x.absoluteTimestamp.RealValue;
  43. var yValue = y.absoluteTimestamp.RealValue;
  44. if (xValue < yValue) {
  45. return -1;
  46. }
  47. else if (xValue > yValue) {
  48. return 1;
  49. }
  50. else {
  51. return 0;
  52. }
  53. };
  54. VerticalGraphicalStaffEntryContainer.prototype.getFirstNonNullStaffEntry = function () {
  55. for (var idx = 0, len = this.staffEntries.length; idx < len; ++idx) {
  56. var graphicalStaffEntry = this.staffEntries[idx];
  57. if (graphicalStaffEntry !== undefined) {
  58. return graphicalStaffEntry;
  59. }
  60. }
  61. return undefined;
  62. };
  63. return VerticalGraphicalStaffEntryContainer;
  64. }());
  65. exports.VerticalGraphicalStaffEntryContainer = VerticalGraphicalStaffEntryContainer;