Package org.scijava.parse
Class Operator
- java.lang.Object
-
- org.scijava.parse.Token
-
- org.scijava.parse.Operator
-
- All Implemented Interfaces:
java.lang.Comparable<Operator>
public class Operator extends Token implements java.lang.Comparable<Operator>
A mathematical operator is a "verb": a special infix (in the case of binary or greater arity) or prefix (in the case of unary) symbol which defines a relation between "nouns" (i.e.: literals and variables).- Author:
- Curtis Rueden
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Operator.Associativity
-
Constructor Summary
Constructors Constructor Description Operator(java.lang.String symbol, int arity, Operator.Associativity associativity, double precedence)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Operator that)
int
getArity()
1 for unary, 2 for binary, etc.Operator.Associativity
getAssociativity()
double
getPrecedence()
Operator
instance()
boolean
isInfix()
True iff the operator is an infix operator (e.g.,a-b
).boolean
isLeftAssociative()
boolean
isPostfix()
True iff the operator is a postfix operator (e.g.,a'
).boolean
isPrefix()
True iff the operator is a prefix operator (e.g.,-a
).boolean
isRightAssociative()
-
-
-
Constructor Detail
-
Operator
public Operator(java.lang.String symbol, int arity, Operator.Associativity associativity, double precedence)
-
-
Method Detail
-
getArity
public int getArity()
1 for unary, 2 for binary, etc.
-
getAssociativity
public Operator.Associativity getAssociativity()
-
isLeftAssociative
public boolean isLeftAssociative()
-
isRightAssociative
public boolean isRightAssociative()
-
isInfix
public boolean isInfix()
True iff the operator is an infix operator (e.g.,a-b
).
-
isPrefix
public boolean isPrefix()
True iff the operator is a prefix operator (e.g.,-a
).
-
isPostfix
public boolean isPostfix()
True iff the operator is a postfix operator (e.g.,a'
).
-
getPrecedence
public double getPrecedence()
-
instance
public Operator instance()
-
-