public class Operator extends Token implements Comparable<Operator>
| Modifier and Type | Class and Description |
|---|---|
static class |
Operator.Associativity |
| Constructor and Description |
|---|
Operator(String symbol,
int arity,
Operator.Associativity associativity,
double precedence) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Operator that) |
int |
getArity()
Gets the operator's arity.
|
Operator.Associativity |
getAssociativity()
Gets the operator's associativity.
|
double |
getPrecedence()
Gets the operator precedence.
|
Operator |
instance()
Gets an instance of the operator, using this one as a template.
|
boolean |
isInfix()
Gets whether the operator is an infix operator (e.g.,
a-b). |
boolean |
isLeftAssociative()
Gets whether the operator is left associative.
|
boolean |
isPostfix()
Gets whether the operator is a postfix operator (e.g.,
a'). |
boolean |
isPrefix()
Gets whether the operator is a prefix operator (e.g.,
-a). |
boolean |
isRightAssociative()
Gets whether the operator is right associative.
|
public Operator(String symbol, int arity, Operator.Associativity associativity, double precedence)
public int getArity()
public Operator.Associativity getAssociativity()
public boolean isLeftAssociative()
Operator.Associativity.LEFT
or Operator.Associativity.EITHER.public boolean isRightAssociative()
Operator.Associativity.RIGHT or Operator.Associativity.EITHER.public boolean isInfix()
a-b).public boolean isPrefix()
-a).public boolean isPostfix()
a').public double getPrecedence()
public Operator instance()
For stateless operators, no copy will be made. But for operators with state
(e.g. Group), a new instance will be returned.
this or a new instance, depending on the type of operator.public int compareTo(Operator that)
compareTo in interface Comparable<Operator>Copyright © 2015–2021 SciJava. All rights reserved.