Ejemplo n.º 1
0
 /** Reads the given measure element. */
 private static MusicReaderContext readMeasure(
     MusicReaderContext context, MxlMeasure mxlMeasure, int measureIndex) {
   // begin a new measure
   context = context.beginNewMeasure(measureIndex);
   // list all elements
   PVector<MxlMusicDataContent> content = mxlMeasure.getMusicData().getContent();
   for (int i = 0; i < content.size(); i++) {
     MxlMusicDataContent mxlMDC = content.get(i);
     switch (mxlMDC.getMusicDataContentType()) {
       case Note:
         {
           // collect all directly following notes with have a chord-element
           PVector<MxlNote> mxlNotes = pvec((MxlNote) mxlMDC);
           for (int i2 = i + 1; i2 < content.size(); i2++) {
             boolean found = false;
             MxlMusicDataContent mxlMDC2 = content.get(i2);
             if (mxlMDC2.getMusicDataContentType() == MxlMusicDataContentType.Note) {
               MxlNote mxlNote2 = (MxlNote) mxlMDC2;
               if (mxlNote2.getContent().getNoteContentType() == MxlNoteContentType.Normal) {
                 if (((MxlNormalNote) mxlNote2.getContent()).getFullNote().isChord()) {
                   mxlNotes = mxlNotes.plus(mxlNote2);
                   i++;
                   found = true;
                 }
               }
             }
             if (!found) break;
           }
           context = readChord(context, mxlNotes);
           break;
         }
       case Attributes:
         context = readAttributes(context, (MxlAttributes) mxlMDC);
         break;
       case Backup:
         context = readBackup(context, (MxlBackup) mxlMDC);
         break;
       case Forward:
         context = readForward(context, (MxlForward) mxlMDC);
         break;
       case Print:
         context = readPrint(context, (MxlPrint) mxlMDC);
         break;
       case Direction:
         context = readDirection(context, (MxlDirection) mxlMDC);
         break;
       case Barline:
         context = readBarline(context, (MxlBarline) mxlMDC);
         break;
     }
   }
   return context;
 }
Ejemplo n.º 2
0
 /** Gets the index of the last measure, or -1 if there are no measures. */
 public int getEndMeasureIndex() {
   if (systems.size() == 0) return -1;
   else return systems.getLast().getEndMeasureIndex();
 }
Ejemplo n.º 3
0
 /** Returns a copy of this object, but with the given {@link SystemArrangement} added. */
 public FrameArrangement plusSystem(SystemArrangement system) {
   return new FrameArrangement(systems.plus(system), usableSize);
 }
Ejemplo n.º 4
0
 /** Gets the index of the first measure, or -1 if there are no measures. */
 public int getStartMeasureIndex() {
   if (systems.size() == 0) return -1;
   else return systems.getFirst().getStartMeasureIndex();
 }
Ejemplo n.º 5
0
 /**
  * Returns a copy of this object, but with the given {@link SystemArrangement} at the given
  * position.
  */
 public FrameArrangement withSystem(SystemArrangement system, int systemIndex) {
   return new FrameArrangement(systems.with(systemIndex, system), usableSize);
 }