/** * Returns the best time this mode was ever completed in per Vocable. * * @return The time */ public final int getBestTime() { return data.getBestTime(); }
/** * Returns how many incorrect Answers were given. * * @return The amount of incorrect Answer */ public final int getIncorrect() { return data.getIncorrect(); }
/** * 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(); }
/** * Returns how often this Mode was played. * * @return The amount */ public final int getPlayed() { return data.getPlayed(); }
/** * Returns the ID of this Mode * * @return The ID */ public final int getId() { return data.getId(); }
/** Resets all the data of this Mode. The perfectInRow field will not be affected. */ public void reset() { data.reset(); }
/** * 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); }
/** * Returns the average time this mode was completed in per Vocable. * * @return The time */ public final int getAverageTime() { return data.getAverageTime(); }