Example #1
0
  /** resets the workable list, optionally shuffling their order */
  private void refreshWorkable(boolean shuffle) {
    workable.clear();

    for (Exercise e : exercises)
      if (e.getDifficulty() == difficulty) workable.add(exercises.indexOf(e));

    if (shuffle) Collections.shuffle(workable);
  }
Example #2
0
  /** return percentage of correct marks for given difficulty */
  public float getScore(Difficulty difficulty) {
    float total = 0;
    float completed = 0;

    for (Exercise e : exercises)
      if (e.getDifficulty() == difficulty) {
        total++;
        if (e.getMark() == Mark.CORRECT) completed++;
      }

    return completed / total;
  }
Example #3
0
 /** loop through exercises and remove where the getQuestion() methods match */
 public void removeExercise(Exercise exercise) {
   for (Exercise e : exercises)
     if (exercise.getQuestion().equals(e.getQuestion())) exercises.remove(e);
 }