GraphicalStaffEntryLink.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. "use strict";
  2. var GraphicalStaffEntryLink = (function () {
  3. function GraphicalStaffEntryLink(staffEntryLink) {
  4. this.graphicalLinkedStaffEntries = [];
  5. this.staffEntryLink = staffEntryLink;
  6. this.initialize();
  7. }
  8. Object.defineProperty(GraphicalStaffEntryLink.prototype, "GetStaffEntryLink", {
  9. get: function () {
  10. return this.staffEntryLink;
  11. },
  12. enumerable: true,
  13. configurable: true
  14. });
  15. Object.defineProperty(GraphicalStaffEntryLink.prototype, "GraphicalLinkedStaffEntries", {
  16. get: function () {
  17. return this.graphicalLinkedStaffEntries;
  18. },
  19. set: function (value) {
  20. this.graphicalLinkedStaffEntries = value;
  21. },
  22. enumerable: true,
  23. configurable: true
  24. });
  25. GraphicalStaffEntryLink.prototype.isFilled = function () {
  26. for (var i = 0; i < this.graphicalLinkedStaffEntries.length; i++) {
  27. if (this.graphicalLinkedStaffEntries[i] === undefined) {
  28. return false;
  29. }
  30. }
  31. return true;
  32. };
  33. GraphicalStaffEntryLink.prototype.getLinkedStaffEntriesGraphicalNotes = function (graphicalStaffEntry) {
  34. if (this.graphicalLinkedStaffEntries.indexOf(graphicalStaffEntry) !== -1) {
  35. var notes = [];
  36. for (var idx = 0, len = this.graphicalLinkedStaffEntries.length; idx < len; ++idx) {
  37. var graphicalLinkedStaffEntry = this.graphicalLinkedStaffEntries[idx];
  38. for (var idx2 = 0, len2 = graphicalLinkedStaffEntry.notes.length; idx2 < len2; ++idx2) {
  39. var graphicalNotes = graphicalLinkedStaffEntry.notes[idx2];
  40. for (var idx3 = 0, len3 = graphicalNotes.length; idx3 < len3; ++idx3) {
  41. var graphicalNote = graphicalNotes[idx3];
  42. if (graphicalNote.sourceNote.ParentStaffEntry.Link !== undefined
  43. && graphicalNote.sourceNote.ParentVoiceEntry === this.staffEntryLink.GetVoiceEntry) {
  44. notes.push(graphicalNote);
  45. }
  46. }
  47. }
  48. }
  49. return notes;
  50. }
  51. return undefined;
  52. };
  53. GraphicalStaffEntryLink.prototype.initialize = function () {
  54. for (var idx = 0, len = this.staffEntryLink.LinkStaffEntries.length; idx < len; ++idx) {
  55. this.graphicalLinkedStaffEntries.push(undefined);
  56. }
  57. };
  58. return GraphicalStaffEntryLink;
  59. }());
  60. exports.GraphicalStaffEntryLink = GraphicalStaffEntryLink;