org.scijava.sjep
Class DefaultOperator

java.lang.Object
  extended by org.scijava.sjep.AbstractToken
      extended by org.scijava.sjep.DefaultOperator
All Implemented Interfaces:
Comparable<Operator>, Operator, Token, Verb

public class DefaultOperator
extends AbstractToken
implements Operator

Default implementation of Operator.

Author:
Curtis Rueden

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.scijava.sjep.Operator
Operator.Associativity
 
Constructor Summary
DefaultOperator(String symbol, int arity, Operator.Associativity associativity, double precedence)
           
 
Method Summary
 int compareTo(Operator that)
           
 int getArity()
          1 for unary, 2 for binary, etc.
 Operator.Associativity getAssociativity()
           
 double getPrecedence()
           
 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()
           
 
Methods inherited from class org.scijava.sjep.AbstractToken
getToken, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.sjep.Token
getToken
 

Constructor Detail

DefaultOperator

public DefaultOperator(String symbol,
                       int arity,
                       Operator.Associativity associativity,
                       double precedence)
Method Detail

getAssociativity

public Operator.Associativity getAssociativity()
Specified by:
getAssociativity in interface Operator

isLeftAssociative

public boolean isLeftAssociative()
Specified by:
isLeftAssociative in interface Operator

isRightAssociative

public boolean isRightAssociative()
Specified by:
isRightAssociative in interface Operator

isInfix

public boolean isInfix()
Description copied from interface: Operator
True iff the operator is an infix operator (e.g., a-b).

Specified by:
isInfix in interface Operator

isPrefix

public boolean isPrefix()
Description copied from interface: Operator
True iff the operator is a prefix operator (e.g., -a).

Specified by:
isPrefix in interface Operator

isPostfix

public boolean isPostfix()
Description copied from interface: Operator
True iff the operator is a postfix operator (e.g., a').

Specified by:
isPostfix in interface Operator

getPrecedence

public double getPrecedence()
Specified by:
getPrecedence in interface Operator

getArity

public int getArity()
Description copied from interface: Verb
1 for unary, 2 for binary, etc.

Specified by:
getArity in interface Verb

compareTo

public int compareTo(Operator that)
Specified by:
compareTo in interface Comparable<Operator>


Copyright © 2015 SciJava. All rights reserved.