From: Robin Cheney Date: Tue, 25 Nov 2025 13:13:33 +0000 (+0100) Subject: javadoc X-Git-Url: https://git.eternal.ddnss.de/?a=commitdiff_plain;h=1452e3b2d7f1652d4c52e7d1851e44378e6314a2;p=utils.git javadoc --- diff --git a/src/main/java/de/ddnss/eternal/utils/io/input/Command.java b/src/main/java/de/ddnss/eternal/utils/io/input/Command.java index 9ba05fc..b76ad3f 100644 --- a/src/main/java/de/ddnss/eternal/utils/io/input/Command.java +++ b/src/main/java/de/ddnss/eternal/utils/io/input/Command.java @@ -15,15 +15,16 @@ public class Command { /** * The command to be executed. Must be passed as a runnable to the constructor * or if parameters are necessary, it must be a {@link Function} that takes a - * {@link GenericCommandOption} as the single parameter and always returns null + * {@link CommandOption} as the single parameter and always returns null */ final Function command; CommandOption arguments = new CommandOption(); /** + * Create a command from a function with no return value * - * @param command - * @param arguments + * @param command The result-less function + * @param arguments The arguments for the function as a {@link CommandOption} */ public Command(Function command, CommandOption arguments) { this.command = command; @@ -31,8 +32,9 @@ public class Command { } /** + * Create a command from a function with no return value * - * @param command A {@link Function} that takes a {@link GenericCommandOption} + * @param command A {@link Function} that takes a {@link CommandOption} */ public Command(Function command) { this.command = command; @@ -54,9 +56,9 @@ public class Command { * Execute the command with the previously provided arguments * * @apiNote This method has a shorthand property where you can provide - * {@link GenericCommandOption command options} - * @see #exec(GenericCommandOption) - * @see #bindArguments(GenericCommandOption) + * {@link CommandOption command options} + * @see #exec(CommandOption) + * @see #bindArguments(CommandOption) */ public void exec() { this.command.apply(arguments); @@ -65,7 +67,7 @@ public class Command { /** * Binds arguments to the command * - * @param args A {@link GenericCommandOption} object holding the command + * @param args A {@link CommandOption} object holding the command * arguments and * their values * @return the {@link Command} object itself @@ -89,9 +91,9 @@ public class Command { }; /** - * Executes a command with a {@link GenericCommandOption} + * Executes a command with a {@link CommandOption} * - * @param arguments A {@link GenericCommandOption} object holding necessary + * @param arguments A {@link CommandOption} object holding necessary * parameters * @throws InvalidArgumentsError */ diff --git a/src/main/java/de/ddnss/eternal/utils/io/input/user/CMDCommands.java b/src/main/java/de/ddnss/eternal/utils/io/input/user/CMDCommands.java index ed99671..099a7bd 100644 --- a/src/main/java/de/ddnss/eternal/utils/io/input/user/CMDCommands.java +++ b/src/main/java/de/ddnss/eternal/utils/io/input/user/CMDCommands.java @@ -18,6 +18,8 @@ public class CMDCommands { * Creates a scanner that can and will read input and try to evaluate it as a * {@link Command} * + * @param enumClass An enum that implements the {@link CommandEnumInterface} + * * @see AvailableCommands */ public static & CommandEnumInterface> void scan(Class enumClass) { diff --git a/src/main/java/de/ddnss/eternal/utils/threading/ParallelProcessor.java b/src/main/java/de/ddnss/eternal/utils/threading/ParallelProcessor.java index cea151d..b874250 100644 --- a/src/main/java/de/ddnss/eternal/utils/threading/ParallelProcessor.java +++ b/src/main/java/de/ddnss/eternal/utils/threading/ParallelProcessor.java @@ -6,8 +6,22 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; +/** + * Parallel batch processing utilities + * + * @since 1.4.0 + * + * @author Robin Cheney + */ public class ParallelProcessor { + /** + * Runs the given function ONCE in every thread using the given number of + * threads. + * + * @param function The {@link Runnable} to execute for this task. + * @param threads Max. number of threads to use + */ public static void run(Runnable function, int threads) { ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threads); for (int i = 0; i < threads; i++) { @@ -18,6 +32,12 @@ public class ParallelProcessor { /** * Runs the given task repeatedly using the given number of threads until * the provided condition becomes true. + * + * @param task The {@link Runnable} to execute for this task. + * @param threads Max. number of threads to use + * @param stopCondition stopping condition. pass a lambda function or a function + * reference to return a boolean value. {@code true} will + * stop execution, {@code false} will continue */ public static void runUntil(Runnable task, int threads, Supplier stopCondition) { ExecutorService executor = Executors.newFixedThreadPool(threads);