From 56f07e9a3aaa873fe385d224f088f048dbafa8f7 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 10 Apr 2017 16:49:54 -0400 Subject: Cleanup --- .../main/java/bjc/pratt/commands/ChainCommand.java | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java') diff --git a/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java b/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java index 6ab126a..4e471d0 100644 --- a/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java +++ b/JPratt/src/main/java/bjc/pratt/commands/ChainCommand.java @@ -1,45 +1,45 @@ package bjc.pratt.commands; +import java.util.Set; + import bjc.pratt.ParserContext; import bjc.pratt.Token; import bjc.utils.data.ITree; import bjc.utils.data.Tree; import bjc.utils.parserutils.ParserException; -import java.util.Set; - /** * Create a new chained operator. - * + * * @author bjculkin * * @param * The key type of the tokens. - * + * * @param * The value type of the tokens. - * + * * @param * The state type of the parser. */ public class ChainCommand extends BinaryPostCommand { - private Set chainWith; + private final Set chainWith; - private Token chain; + private final Token chain; /** * Create a new chained operator. - * + * * @param precedence * The precedence of this operator. - * + * * @param chainSet * The operators to chain with. - * + * * @param chainMarker * The token to use as the node in the AST. */ - public ChainCommand(int precedence, Set chainSet, Token chainMarker) { + public ChainCommand(final int precedence, final Set chainSet, final Token chainMarker) { super(precedence); chainWith = chainSet; @@ -47,17 +47,18 @@ public class ChainCommand extends BinaryPostCommand { } @Override - public ITree> denote(ITree> operand, Token operator, ParserContext ctx) - throws ParserException { - ITree> tree = ctx.parse.parseExpression(1 + leftBinding(), ctx.tokens, ctx.state, false); + public ITree> denote(final ITree> operand, final Token operator, + final ParserContext ctx) throws ParserException { + final ITree> tree = ctx.parse.parseExpression(1 + leftBinding(), ctx.tokens, ctx.state, + false); - ITree> res = new Tree<>(operator, operand, tree); + final ITree> res = new Tree<>(operator, operand, tree); if (chainWith.contains(ctx.tokens.current().getKey())) { - Token tok = ctx.tokens.current(); + final Token tok = ctx.tokens.current(); ctx.tokens.next(); - ITree> other = denote(tree, tok, + final ITree> other = denote(tree, tok, new ParserContext<>(ctx.tokens, ctx.parse, ctx.state)); return new Tree<>(chain, res, other); -- cgit v1.2.3