Пример #1
0
 /**
  * Adds the specified Part to the Score.
  *
  * @param part Part to add
  */
 public void addPart(MelodyPart part) {
   Trace.log(2, "adding existing melody part to score");
   if (length < part.size()) {
     setLength(part.size());
   }
   partList.add(part);
 }
Пример #2
0
  /**
   * Returns a copy of the Score.
   *
   * @return Score a copy of the Score
   */
  public Score copy() {
    // Trace.log(2, "copying Score of size " + size());
    Score newScore = new Score(title, tempo);
    newScore.setMetre(metre[0], metre[1]);
    PartList newPartList = new PartList(partList.size());
    ListIterator<MelodyPart> i = partList.listIterator();

    while (i.hasNext()) newPartList.add(i.next().copy());

    newScore.partList = newPartList;
    newScore.chordProg = chordProg.copy();

    newScore.setChordInstrument(getChordInstrument());
    newScore.setBassInstrument(getBassInstrument());

    newScore.setBassMuted(getBassMuted());
    newScore.setDrumMuted(getDrumMuted());
    newScore.setChordMuted(getChordMuted());
    newScore.setMelodyMuted(getMelodyMuted());
    newScore.setMasterVolumeMuted(getMasterVolumeMuted());

    newScore.setBassVolume(getBassVolume());
    newScore.setDrumVolume(getDrumVolume());
    newScore.setChordVolume(getChordVolume());
    newScore.setMelodyVolume(getMelodyVolume());
    newScore.setMasterVolume(getMasterVolume());

    newScore.countInProg = countInProg == null ? null : countInProg.copy();

    return newScore;
  }
Пример #3
0
 /**
  * Adds the specified number of empty Parts to the Score.
  *
  * @param parts the number of Parts to add
  */
 public void addParts(int parts) {
   // Trace.log(0, "adding " + parts + " new parts to score");
   for (int i = 0; i < parts; i++) {
     MelodyPart mp = new MelodyPart(length);
     if (partList.size() > 0) {
       mp.setInstrument(partList.get(0).getInstrument());
     }
     partList.add(mp);
   }
 }
Пример #4
0
  public void testBuilder() throws Exception {
    MockRequest request = new MockRequest();

    request.setTarget("/path?a=query_A&b=query_B&c=query_C&d=query_D");
    request.setContentType("application/x-www-form-urlencoded");
    request.setContent("a=post_A&c=post_C&e=post_E");

    MockBody body = new MockBody();
    MockEntity entity = new MockEntity(body);
    FormCreator builder = new FormCreator(request, entity);
    PartList list = body.getParts();

    list.add(new MockPart("a", "part_A", false));
    list.add(new MockPart("b", "part_B", false));
    list.add(new MockPart("c", "part_C", false));
    list.add(new MockPart("f", "part_F", true));
    list.add(new MockPart("g", "part_G", false));

    Form form = builder.getInstance();

    assertEquals(form.getAll("a").size(), 3);
    assertEquals(form.getAll("b").size(), 2);
    assertEquals(form.getAll("c").size(), 3);
    assertEquals(form.getAll("e").size(), 1);
    assertEquals(form.getPart("a").getContent(), "part_A");
    assertEquals(form.getPart("b").getContent(), "part_B");
    assertEquals(form.getPart("c").getContent(), "part_C");
    assertEquals(form.getPart("f").getContent(), "part_F");
    assertEquals(form.getPart("g").getContent(), "part_G");
    assertEquals(form.get("a"), "query_A");
    assertEquals(form.get("b"), "query_B");
    assertEquals(form.get("c"), "query_C");
    assertEquals(form.get("d"), "query_D");
    assertEquals(form.get("e"), "post_E");
    assertEquals(form.get("f"), null);
    assertEquals(form.get("g"), "part_G");
  }