Skip to content

Commit

Permalink
Add missing JavaDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
mkutz committed Jul 10, 2024
1 parent d4d7d4c commit 9061e08
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
19 changes: 19 additions & 0 deletions modules/random/src/main/java/org/stubit/random/DigitSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,44 @@
/** Represents a digit system (a list of digits). */
public class DigitSystem {

/** The (western) Arabic digit system. */
public static final DigitSystem ARABIC =
new DigitSystem(List.of('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'));

/** The Eastern Arabic digit system. */
public static final DigitSystem EASTERN_ARABIC =
new DigitSystem(List.of('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'));

/** The Persian digit system. */
public static final DigitSystem PERSIAN =
new DigitSystem(List.of('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'));

/** The Chinese digit system. */
public static final DigitSystem CHINESE =
new DigitSystem(List.of('〇', '一', '二', '三', '四', '五', '六', '七', '八', '九'));

/** The Japanese digit system. */
public static final DigitSystem JAPANESE =
new DigitSystem(List.of('〇', '一', '二', '三', '四', '五', '六', '七', '八', '九'));

/** The roman digit system. */
public static final DigitSystem ROMAN =
new DigitSystem(List.of('Ⅰ', 'Ⅴ', 'Ⅹ', 'Ⅼ', 'Ⅽ', 'Ⅾ', 'Ⅿ'));

private final List<Character> digits;

/**
* Creates a digit system with the provided list of digits.
*
* @param digits the list of digits in this digit system
*/
public DigitSystem(List<Character> digits) {
this.digits = digits;
}

/**
* @return the list of digit characters in this digit system
*/
public List<Character> digits() {
return digits;
}
Expand Down
16 changes: 2 additions & 14 deletions modules/random/src/main/java/org/stubit/random/RandomChoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/** Randomly select an element from a collection of choices. */
public class RandomChoice {
Expand Down Expand Up @@ -49,10 +47,6 @@ public static <T> T anyOf(T... choices) {
return aChoiceFrom(choices).build();
}

public static <T> T anyOf(Stream<T> choices) {
return aChoiceFrom(choices).build();
}

/**
* Randomly selects an element from the values of the provided choices {@link Enum} class.
*
Expand Down Expand Up @@ -102,14 +96,6 @@ public static <T extends Enum<?>> Builder<T> aChoiceFromValuesOf(Class<? extends
return aChoiceFrom(Arrays.asList(enumType.getEnumConstants()));
}

public static <T> Builder<T> aChoiceFrom(Stream<T> choices) {
return new Builder<>(choices.toList());
}

public static Builder<Integer> aChoiceFrom(IntStream choices) {
return new Builder<>(choices.boxed().toList());
}

/** Randomly selects an element from a collection of choices. */
public static class Builder<T> {

Expand All @@ -128,6 +114,7 @@ private Builder(Collection<T> choices) {
* Add the provided additional choices to the selection
*
* @param additionalChoices the additional choices
* @return this
*/
public Builder<T> and(Collection<T> additionalChoices) {
this.choices.addAll(additionalChoices);
Expand All @@ -138,6 +125,7 @@ public Builder<T> and(Collection<T> additionalChoices) {
* Add the provided additional choices to the selection
*
* @param additionalChoices the additional choices
* @return this
*/
@SafeVarargs
public final Builder<T> and(T... additionalChoices) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.security.SecureRandom;

/** Generates random integers. */
public class RandomInt {

private RandomInt() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static String aLetterFrom(Alphabet alphabet) {
}

/**
* @param number the number of letters to generate
* @param alphabet the {@link Alphabet} to select a character from
* @return a randomly selected character from the provided {@link Alphabet}.
*/
Expand Down

0 comments on commit 9061e08

Please sign in to comment.