Skip to content

Commit

Permalink
Add more comments to the public methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaukov committed Feb 20, 2024
1 parent 370af38 commit b97e073
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions src/main/java/org/paukov/combinatorics3/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,64 @@
*/
public class Generator {

/**
* Creates a combination generator for a given set of arguments.
* @param args A list of arguments (elements) for the generator.
* @param <T> A type of the arguments.
* @return An instance of the CombinationGenerator with the provided elements.
*/
@SafeVarargs
public static <T> CombinationGenerator<T> combination(T... args) {
return new CombinationGenerator<>(asList(args));
}

/**
* Creates a combination generator for a given set of arguments.
* @param collection A collection of the elements for the generator.
* @param <T> A type of the elements.
* @return An instance of the CombinationGenerator with the provided elements.
*/
public static <T> CombinationGenerator<T> combination(Collection<T> collection) {
return new CombinationGenerator<>(collection);
}

/**
* Creates a permutation generator for a given set of arguments.
* @param args A list of arguments (elements) for the generator.
* @param <T> A type of the arguments.
* @return An instance of the PermutationGenerator with the provided elements.
*/
@SafeVarargs
public static <T> PermutationGenerator<T> permutation(T... args) {
return new PermutationGenerator<>(asList(args));
}

/**
* Creates a permutation generator for a given collection of the elements.
* @param collection A collection of the elements for the generator.
* @param <T> A type of the elements.
* @return An instance of the PermutationGenerator with the provided elements.
*/
public static <T> PermutationGenerator<T> permutation(Collection<T> collection) {
return new PermutationGenerator<>(collection);
}

/**
* Creates a subset generator for a given collection of the elements.
* @param collection A collection of the elements for the generator.
* @param <T> A type of the elements.
* @return An instance of the generator that produces subsets of the elements.
*/
public static <T> SubSetGenerator<T> subset(Collection<T> collection) {
return new SubSetGenerator<>(collection);
}

/**
* Creates a subset generator for a given list of the arguments.
* @param args A list of the arguments for the generator.
* @param <T> A type of the elements.
* @return An instance of the generator that produces subsets of the elements.
*/
@SafeVarargs
public static <T> SubSetGenerator<T> subset(T... args) {
return new SubSetGenerator<>(asList(args));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/**
* A generator for iterating over the subsets.
* @param <T> Type of the elements in the sebsets.
* @param <T> Type of the elements in the subsets.
*/
public class SubSetGenerator<T> {

Expand Down

0 comments on commit b97e073

Please sign in to comment.