package bjc.pratt.commands; /** * A operator with fixed precedence. * * @author bjculkin * * @param * The key type of the tokens. * * @param * The value type of the tokens. * * @param * The state type of the parser. */ public abstract class BinaryPostCommand extends NonInitialCommand { private final int leftPower; /** * Create a new operator with fixed precedence. * * @param precedence * The precedence of the operator. */ public BinaryPostCommand(final int precedence) { if (precedence < 0) throw new IllegalArgumentException("Precedence must be non-negative"); leftPower = precedence; } @Override public int leftBinding() { return leftPower; } }