diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-10 16:49:54 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-10 16:49:54 -0400 |
| commit | 56f07e9a3aaa873fe385d224f088f048dbafa8f7 (patch) | |
| tree | 64fae78f95fd1c233689ecf3dda2e2b645bb8d33 /JPratt/src/main/java/bjc/pratt/commands/NonInitialCommands.java | |
| parent | 251419e1f0ab8eb04d21287b708b06a552f4c58a (diff) | |
Cleanup
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/commands/NonInitialCommands.java')
| -rw-r--r-- | JPratt/src/main/java/bjc/pratt/commands/NonInitialCommands.java | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/commands/NonInitialCommands.java b/JPratt/src/main/java/bjc/pratt/commands/NonInitialCommands.java index b7eda95..48922b7 100644 --- a/JPratt/src/main/java/bjc/pratt/commands/NonInitialCommands.java +++ b/JPratt/src/main/java/bjc/pratt/commands/NonInitialCommands.java @@ -1,139 +1,140 @@ package bjc.pratt.commands; +import java.util.Set; + import bjc.pratt.NonInitialCommand; import bjc.pratt.ParseBlock; import bjc.pratt.Token; import bjc.pratt.blocks.SimpleParseBlock; -import java.util.Set; - /** * Contains factory methods for producing common implementations of * {@link NonInitialCommand} - * + * * @author EVE * */ public class NonInitialCommands { /** * Create a left-associative infix operator. - * + * * @param precedence * The precedence of the operator. - * + * * @return A command implementing that operator. */ - public static <K, V, C> NonInitialCommand<K, V, C> infixLeft(int precedence) { + public static <K, V, C> NonInitialCommand<K, V, C> infixLeft(final int precedence) { return new LeftBinaryCommand<>(precedence); } /** * Create a right-associative infix operator. - * + * * @param precedence * The precedence of the operator. - * + * * @return A command implementing that operator. */ - public static <K, V, C> NonInitialCommand<K, V, C> infixRight(int precedence) { + public static <K, V, C> NonInitialCommand<K, V, C> infixRight(final int precedence) { return new RightBinaryCommand<>(precedence); } /** * Create a non-associative infix operator. - * + * * @param precedence * The precedence of the operator. - * + * * @return A command implementing that operator. */ - public static <K, V, C> NonInitialCommand<K, V, C> infixNon(int precedence) { + public static <K, V, C> NonInitialCommand<K, V, C> infixNon(final int precedence) { return new NonBinaryCommand<>(precedence); } /** * Create a chained operator. - * + * * @param precedence * The precedence of the operator. - * + * * @param chainSet * The operators it forms a chain with. - * + * * @param marker * The token to use as the AST node for the chained * operators. - * + * * @return A command implementing that operator. */ - public static <K, V, C> NonInitialCommand<K, V, C> chain(int precedence, Set<K> chainSet, Token<K, V> marker) { + public static <K, V, C> NonInitialCommand<K, V, C> chain(final int precedence, final Set<K> chainSet, + final Token<K, V> marker) { return new ChainCommand<>(precedence, chainSet, marker); } /** * Create a postfix operator. - * + * * @param precedence * The precedence of the operator. - * + * * @return A command implementing that operator. */ - public static <K, V, C> NonInitialCommand<K, V, C> postfix(int precedence) { + public static <K, V, C> NonInitialCommand<K, V, C> postfix(final int precedence) { return new PostfixCommand<>(precedence); } /** * Create a post-circumfix operator. - * + * * This is an operator in form similar to array indexing. - * + * * @param precedence * The precedence of this operator - * + * * @param insidePrecedence * The precedence of the expression inside the operator - * + * * @param closer * The token that closes the circumfix. - * + * * @param marker * The token to use as the AST node for the operator. - * + * * @return A command implementing that operator. */ - public static <K, V, C> NonInitialCommand<K, V, C> postCircumfix(int precedence, int insidePrecedence, K closer, - Token<K, V> marker) { - ParseBlock<K, V, C> innerBlock = new SimpleParseBlock<>(insidePrecedence, closer, null); + public static <K, V, C> NonInitialCommand<K, V, C> postCircumfix(final int precedence, + final int insidePrecedence, final K closer, final Token<K, V> marker) { + final ParseBlock<K, V, C> innerBlock = new SimpleParseBlock<>(insidePrecedence, closer, null); return new PostCircumfixCommand<>(precedence, innerBlock, marker); } /** * Create a ternary operator. - * + * * This is like C's ?: operator. - * + * * @param precedence * The precedence of the operator. - * + * * @param insidePrecedence * The precedence of the inner section of the operator. - * + * * @param closer * The token that marks the end of the inner section. - * + * * @param marker * The token to use as the AST node for the operator. - * + * * @param nonassoc * True if the command is non-associative, false * otherwise. - * + * * @return A command implementing this operator. */ - public static <K, V, C> NonInitialCommand<K, V, C> ternary(int precedence, int insidePrecedence, K closer, - Token<K, V> marker, boolean nonassoc) { - ParseBlock<K, V, C> innerBlock = new SimpleParseBlock<>(insidePrecedence, closer, null); + public static <K, V, C> NonInitialCommand<K, V, C> ternary(final int precedence, final int insidePrecedence, + final K closer, final Token<K, V> marker, final boolean nonassoc) { + final ParseBlock<K, V, C> innerBlock = new SimpleParseBlock<>(insidePrecedence, closer, null); return new TernaryCommand<>(precedence, innerBlock, marker, nonassoc); } |
