public final class ArityRange
extends java.lang.Object
ArityRange
class is used to specify a possible arity of an operator (unary, binary,
etc.). It is possible for an operator to be unary and binary at the same time or to have an
unlimited number of operands. The Range class allows specifying a range for the allowed number
of operands.Modifier and Type | Class and Description |
---|---|
static class |
ArityRange.Bound
The Bound enumeration contains constants for specifying most common bounds for the range of
allowed operand numbers.
|
Modifier and Type | Field and Description |
---|---|
static ArityRange |
BINARY
Binary operator range.
|
static ArityRange |
BINARY_UNBOUNDED
Range for operators that can have two (binary) or an unbounded number of operands.
|
static ArityRange |
TERNARY
Ternary operator range.
|
static ArityRange |
UNARY
Unary operator range.
|
static ArityRange |
UNARY_BINARY
Range for operators that can be unary and binary at the same time.
|
static ArityRange |
UNARY_UNBOUNDED
Range for operators that can have one (unary) or an unbounded number of operands.
|
Constructor and Description |
---|
ArityRange(ArityRange.Bound min,
ArityRange.Bound max)
Creates a range basing on the specified bounds.
|
ArityRange(int min,
int max)
Creates a range basing on the specified boundary values.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isWithinRange(int value)
Checks whether the specified value falls within the range of allowed values.
|
public static final ArityRange UNARY
public static final ArityRange BINARY
public static final ArityRange TERNARY
public static final ArityRange UNARY_BINARY
public static final ArityRange UNARY_UNBOUNDED
public static final ArityRange BINARY_UNBOUNDED
public ArityRange(ArityRange.Bound min, ArityRange.Bound max)
min
- Lower bound.max
- Upper bound.public ArityRange(int min, int max)
min
- Lower boundary value.max
- Upper boundary value.java.lang.IllegalArgumentException
- if the range is specified incorrectly.