diff options
| author | Ben Culkin <scorpress@gmail.com> | 2020-04-13 18:40:41 -0400 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2020-04-13 18:40:41 -0400 |
| commit | d4ca769e542b2489b1e23cfcbdc3a0b7275b87cd (patch) | |
| tree | 1653a7399f97fb0c63ce62e3f60fd830d5c37f70 /base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java | |
| parent | 2ac2e31a56ae59ee582e43a90c3495f86dd9ee7a (diff) | |
Cleanup pass
Cleanup pass to uniformize things
Diffstat (limited to 'base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java')
| -rw-r--r-- | base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java b/base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java index 7e7550e..42a01a4 100644 --- a/base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java +++ b/base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java @@ -18,20 +18,21 @@ public class RuleBasedReaderPragmas { * Creates a pragma that takes a single integer argument * * @param <StateType> - * The type of state that goes along with this pragma + * The type of state that goes along with this pragma * @param name - * The name of this pragma, for error message purpose + * The name of this pragma, for error message purpose * @param consumer - * The function to invoke with the parsed integer + * The function to invoke with the parsed integer * @return A pragma that functions as described above. */ - public static <StateType> BiConsumer<FunctionalStringTokenizer, StateType> buildInteger(final String name, - final BiConsumer<Integer, StateType> consumer) { + public static <StateType> BiConsumer<FunctionalStringTokenizer, StateType> + buildInteger(final String name, + final BiConsumer<Integer, StateType> consumer) { return (tokenizer, state) -> { /* * Check our input is correct */ - if(!tokenizer.hasMoreTokens()) { + if (!tokenizer.hasMoreTokens()) { String fmt = "Pragma %s requires one integer argument"; throw new PragmaFormatException(String.format(fmt, name)); @@ -47,14 +48,15 @@ public class RuleBasedReaderPragmas { * Run the pragma */ consumer.accept(Integer.parseInt(token), state); - } catch(final NumberFormatException nfex) { + } catch (final NumberFormatException nfex) { /* * Tell the user their argument isn't correct */ - String fmt = "Argument %s to %s pragma isn't a valid integer, and this pragma requires an integer argument."; + String fmt + = "Argument %s to %s pragma isn't a valid integer, and this pragma requires an integer argument."; - final PragmaFormatException pfex = new PragmaFormatException( - String.format(fmt, token, name)); + final PragmaFormatException pfex + = new PragmaFormatException(String.format(fmt, token, name)); pfex.initCause(nfex); @@ -64,24 +66,25 @@ public class RuleBasedReaderPragmas { } /** - * Creates a pragma that takes any number of arguments and collapses - * them all into a single string + * Creates a pragma that takes any number of arguments and collapses them all + * into a single string * * @param <StateType> - * The type of state that goes along with this pragma + * The type of state that goes along with this pragma * @param name - * The name of this pragma, for error message purpose + * The name of this pragma, for error message purpose * @param consumer - * The function to invoke with the parsed string + * The function to invoke with the parsed string * @return A pragma that functions as described above. */ - public static <StateType> BiConsumer<FunctionalStringTokenizer, StateType> buildStringCollapser( - final String name, final BiConsumer<String, StateType> consumer) { + public static <StateType> BiConsumer<FunctionalStringTokenizer, StateType> + buildStringCollapser(final String name, + final BiConsumer<String, StateType> consumer) { return (tokenizer, state) -> { /* * Check our input */ - if(!tokenizer.hasMoreTokens()) { + if (!tokenizer.hasMoreTokens()) { String fmt = "Pragma %s requires one or more string arguments."; throw new PragmaFormatException(String.format(fmt, name)); |
