예제 #1
0
  public static void main(String[] args) {
    NoteList n = new NoteList();

    for (int i = 0; i < 10; i++) {
      try {
        n.addNote(Note.createNote("i1 " + i + " " + i + " 6." + i + " 4"));
      } catch (NoteParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }

    System.out.println("before: \n\n" + n + "\n\n");

    RetrogradeProcessor retro = new RetrogradeProcessor();
    retro.processNotes(n);

    System.out.println("after: \n\n" + n + "\n\n");
  }
예제 #2
0
  public final void processNotes(NoteList in) {
    in.sort();
    Note temp;
    int size = in.size();
    temp = in.getNote(in.size() - 1);
    float totalTime = temp.getStartTime() + temp.getSubjectiveDuration();

    for (int i = 0; i < size; i++) {
      temp = in.getNote(i);
      // System.out.println("obj: " + temp.getObjectiveDuration() + "
      // subj: " + temp.getSubjectiveDuration());
      temp.setStartTime(totalTime - (temp.getStartTime() + temp.getSubjectiveDuration()));
    }
  }
예제 #3
0
파일: ma.java 프로젝트: mcanthony/blue
  public float[] getValue(CybilNoteList cybilNoteList) {
    String ranType = (String) args.get(0);
    boolean isInteger = ranType.equals("i");

    float startMin = getFloatValue(args.get(1));
    float startMax = getFloatValue(args.get(2));
    float endMin = getFloatValue(args.get(3));
    float endMax = getFloatValue(args.get(4));

    float minDiff = endMin - startMin;
    float maxDiff = endMax - startMax;

    float timeValue = getTimeValue(args.get(5));
    boolean isTime = isTime(args.get(5));

    NoteList notes = cybilNoteList.notes;

    if (cybilNoteList.pfield == 2) {
      if (isTime) {

      } else {

      }
    } else {
      if (isTime) {
        Note currentNote = notes.getNote(cybilNoteList.index);
        float startTime = currentNote.getStartTime();
        float endTime = startTime + timeValue;

        int count = getCount(notes, cybilNoteList.index, endTime);

        for (int i = 0; i < count; i++) {

          float x = (currentNote.getStartTime() - startTime) / timeValue;

          float min = (minDiff * x) + startMin;
          float max = (maxDiff * x) + startMax;
          float diff = max - min;

          double val = (float) (Math.random() * diff) + min;

          String strVal = isInteger ? Integer.toString((int) val) : Double.toString(val);

          currentNote.setPField(strVal, cybilNoteList.pfield);

          cybilNoteList.index++;

          if (cybilNoteList.index >= notes.size()) {
            break;
          }
          currentNote = notes.getNote(cybilNoteList.index);
        }

      } else {
        for (int i = 0; i < timeValue; i++) {
          float x = i / timeValue;

          float min = (minDiff * x) + startMin;
          float max = (maxDiff * x) + startMax;
          float diff = max - min;

          double val = (Math.random() * diff) + min;

          String strVal = isInteger ? Integer.toString((int) val) : Double.toString(val);

          Note currentNote = notes.getNote(cybilNoteList.index);
          currentNote.setPField(strVal, cybilNoteList.pfield);
          cybilNoteList.index++;

          if (cybilNoteList.index >= notes.size()) {
            break;
          }
        }
      }
    }

    return null;
  }