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 classOperator.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 intcompareTo(Operator that)intgetArity()1 for unary, 2 for binary, etc.Operator.AssociativitygetAssociativity()doublegetPrecedence()Operatorinstance()booleanisInfix()True iff the operator is an infix operator (e.g.,a-b).booleanisLeftAssociative()booleanisPostfix()True iff the operator is a postfix operator (e.g.,a').booleanisPrefix()True iff the operator is a prefix operator (e.g.,-a).booleanisRightAssociative()
-
-
-
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()
-
-