예제 #1
0
 /**
  * Returns the best time this mode was ever completed in per Vocable.
  *
  * @return The time
  */
 public final int getBestTime() {
   return data.getBestTime();
 }
예제 #2
0
 /**
  * Returns how many incorrect Answers were given.
  *
  * @return The amount of incorrect Answer
  */
 public final int getIncorrect() {
   return data.getIncorrect();
 }
예제 #3
0
 /**
  * Returns how long the current streak of perfect Rounds is (Only correct Answers {@see
  * TestResultFragment}).
  *
  * @return The current streak
  */
 public int getPerfectInRow() {
   return data.getPerfectInRow();
 }
예제 #4
0
 /**
  * Returns how often this Mode was played.
  *
  * @return The amount
  */
 public final int getPlayed() {
   return data.getPlayed();
 }
예제 #5
0
 /**
  * Returns the ID of this Mode
  *
  * @return The ID
  */
 public final int getId() {
   return data.getId();
 }
예제 #6
0
 /** Resets all the data of this Mode. The perfectInRow field will not be affected. */
 public void reset() {
   data.reset();
 }
예제 #7
0
  /**
   * Processes a {@link TestResult} and updates the fields according to that.
   *
   * @param result The result
   */
  public final void processResult(TestResult result) {
    data.setPlayed(data.getPlayed() + 1);
    data.setCorrect(data.getCorrect() + result.getCorrect());
    data.setIncorrect(data.getIncorrect() + result.getIncorrect());

    if (result.getCorrect() >= getMinAmount() && result.getIncorrect() <= 0) {
      data.setPerfectInRow(data.getPerfectInRow() + 1);
    }

    int averageTime = result.getAverageTime();

    if (data.getBestTime() <= 0 || averageTime < data.getBestTime()) {
      data.setBestTime(averageTime);
    }

    int played = data.getPlayed();

    data.setAverageTime((data.getAverageTime() * (played - 1) + averageTime) / played);
  }
예제 #8
0
 /**
  * Returns the average time this mode was completed in per Vocable.
  *
  * @return The time
  */
 public final int getAverageTime() {
   return data.getAverageTime();
 }