Exact picture seems to work

This commit is contained in:
2025-09-02 21:53:03 +02:00
parent f15208fe6d
commit b2571c191f
137 changed files with 2487 additions and 797 deletions

View File

@@ -4,5 +4,4 @@ package ch.gtache.fro;
* {@link Provider} of {@link Bird}
*/
public interface BirdProvider extends Provider<Bird> {
}

View File

@@ -1,71 +0,0 @@
package ch.gtache.fro;
import ch.gtache.fro.practice.BirdPracticeParameters;
import java.nio.file.Path;
import java.time.Duration;
import java.util.Collection;
public interface Configuration {
/**
* Returns the root folder where the data is stored
*
* @return The root folder
*/
Path rootFolder();
/**
* Sets the root folder where the data is stored
*
* @param rootFolder The root folder
*/
void setRootFolder(final Path rootFolder);
/**
* Returns the duration to wait between two fetches
*
* @return The duration
*/
Duration waitBetweenFetch();
/**
* Sets the duration to wait between two fetches
*
* @param waitBetweenFetch The duration
*/
void setWaitBetweenFetch(final Duration waitBetweenFetch);
/**
* Returns the bird practice parameters
*
* @return The parameters
*/
Collection<BirdPracticeParameters> birdPracticeParameters();
/**
* Returns the bird practice parameters for a specific bird
*
* @param bird The bird
* @return The parameters
*/
BirdPracticeParameters birdPracticeParameters(final Bird bird);
/**
* Sets the bird practice parameters
*
* @param birdPracticeParameters The parameters
*/
default void setBirdPracticeParameters(final Collection<? extends BirdPracticeParameters> birdPracticeParameters) {
for (final var birdPracticeParameter : birdPracticeParameters) {
setBirdPracticeParameters(birdPracticeParameter);
}
}
/**
* Sets the bird practice parameters for a specific bird
*
* @param birdPracticeParameters The parameters
*/
void setBirdPracticeParameters(final BirdPracticeParameters birdPracticeParameters);
}

View File

@@ -0,0 +1,35 @@
package ch.gtache.fro;
import java.nio.file.Path;
import java.time.Duration;
public interface FetcherConfiguration {
/**
* Returns the root folder where the data is stored
*
* @return The root folder
*/
Path rootFolder();
/**
* Sets the root folder where the data is stored
*
* @param rootFolder The root folder
*/
void setRootFolder(final Path rootFolder);
/**
* Returns the duration to wait between two fetches
*
* @return The duration
*/
Duration waitBetweenFetch();
/**
* Sets the duration to wait between two fetches
*
* @param waitBetweenFetch The duration
*/
void setWaitBetweenFetch(final Duration waitBetweenFetch);
}

View File

@@ -0,0 +1,66 @@
package ch.gtache.fro.practice;
import ch.gtache.fro.Bird;
import java.util.Collection;
import java.util.Map;
public interface PracticeConfiguration {
/**
* Sets the number of unsuccessful guesses before a question is considered as failed
*
* @return The number of unsuccessful guesses
*/
int guessesNumber();
/**
* Sets the number of unsuccessful guesses before a question is considered as failed
*
* @param guessNumber The number of unsuccessful guesses
*/
void setGuessesNumber(final int guessNumber);
/**
* Returns the saved question rates
*
* @return The question rates
*/
Map<QuestionType, Double> questionRates();
/**
* Sets the question rates
*
* @param questionRates The question rates
*/
void setQuestionRates(final Map<QuestionType, Double> questionRates);
/**
* Returns the bird practice parameters
*
* @return The parameters
*/
Collection<BirdPracticeParameters> birdPracticeParameters();
/**
* Returns the bird practice parameters for a specific bird
*
* @param bird The bird
* @return The parameters
*/
BirdPracticeParameters birdPracticeParameters(final Bird bird);
/**
* Sets the bird practice parameters
*
* @param birdPracticeParameters The parameters
*/
void setBirdPracticeParameters(final Collection<? extends BirdPracticeParameters> birdPracticeParameters);
/**
* Sets the bird practice parameters for a specific bird
*
* @param birdPracticeParameters The parameters
*/
void setBirdPracticeParameters(final BirdPracticeParameters birdPracticeParameters);
}

View File

@@ -17,23 +17,30 @@ public interface PracticeParameters {
Map<Bird, BirdPracticeParameters> birdParameters();
/**
* Returns the practice type
* Returns the number of unsuccessful guesses before a question is considered as failed
*
* @return The practice type
* @return The number of unsuccessful guesses
*/
PracticeType practiceType();
int guessesNumber();
/**
* Returns the question type rates (chance of each type)
*
* @return The question types
*/
Map<QuestionType, Double> questionTypeRates();
/**
* Returns the number of questions in this practice
*
* @return The number of questions
*/
int questionsCount();
int questionsNumber();
/**
* Returns the number of propositions for a multichoice type
*
* @return The number of propositions
*/
int propositionsCount();
int propositionsNumber();
}

View File

@@ -13,4 +13,11 @@ public interface PracticeQuestion {
* @return The bird
*/
Bird bird();
/**
* Returns the type of this question
*
* @return The type
*/
QuestionType questionType();
}

View File

@@ -14,10 +14,37 @@ public interface PracticeResult {
*/
List<PracticeQuestion> correctQuestions();
/**
* Returns the total number of correct questions
*
* @return The total number of correct questions
*/
default int correctQuestionsCount() {
return correctQuestions().size();
}
/**
* Returns the failed questions
*
* @return The failed questions
*/
List<PracticeQuestion> failedQuestions();
/**
* Returns the total number of failed questions
*
* @return The total number of failed questions
*/
default int failedQuestionsCount() {
return failedQuestions().size();
}
/**
* Returns the total number of questions
*
* @return The total number of questions
*/
default int totalQuestions() {
return correctQuestions().size() + failedQuestions().size();
}
}

View File

@@ -41,4 +41,8 @@ public interface PracticeRun {
* @return The failed questions
*/
List<PracticeQuestion> failedQuestions();
default boolean isFinished() {
return currentQuestionIndex() == parameters().questionsNumber();
}
}

View File

@@ -1,10 +0,0 @@
package ch.gtache.fro.practice;
import ch.gtache.fro.Translator;
/**
* Translates a {@link PracticeType} to a string
*/
public interface PracticeTypeTranslator extends Translator<PracticeType> {
}

View File

@@ -3,7 +3,7 @@ package ch.gtache.fro.practice;
/**
* Represents the type of practice
*/
public enum PracticeType {
public enum QuestionType {
/**
* See an image, must write the bird name
*/

View File

@@ -0,0 +1,10 @@
package ch.gtache.fro.practice;
import ch.gtache.fro.Translator;
/**
* Translates a {@link QuestionType} to a string
*/
public interface QuestionTypeTranslator extends Translator<QuestionType> {
}