Class Operators

java.lang.Object
  extended by Operators

public class Operators
extends java.lang.Object


Constructor Summary
Operators()
           
 
Method Summary
 int getPrecedence(java.lang.String op)
          Given a string, returns precedence of corresponding operator
 boolean isOperator(java.lang.String op)
          Given a string, returns true if that string is a defined operator ("+", "-", etc) and false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Operators

public Operators()
Method Detail

isOperator

public boolean isOperator(java.lang.String op)
Given a string, returns true if that string is a defined operator ("+", "-", etc) and false otherwise.

Parameters:
op - String representing an operator
Returns:
True if valid operator, false otherwise.

getPrecedence

public int getPrecedence(java.lang.String op)
Given a string, returns precedence of corresponding operator

Parameters:
op - String representing an operator
Returns:
integer precedence. 0 is lowest.
Throws:
java.lang.IllegalArgumentException - if the argument is not a valid operator