infix2postfix
Class Operator

java.lang.Object
  extended byinfix2postfix.Operator
Direct Known Subclasses:
BinaryOperator, UnaryOperator

public abstract class Operator
extends java.lang.Object

This object represents any operator in the expression. An operator must have a symbol (e.g. '+') and priority number (e.g. 1).

Author:
Maulin H. Vasavada

Field Summary
protected  int priority
          Priority number associated with this operator
protected  java.lang.String symbol
          Symbol to represent this operator
 
Constructor Summary
Operator(java.lang.String symbol, int priority)
          Constructor accepting symbol and priority
 
Method Summary
 boolean equals(java.lang.Object o)
          Equates two operators.
 int getPriority()
          Returns priority associated with this operator.
 java.lang.String getSymbol()
          Returns symbol associated with this operator.
 int hashCode()
          Defines hashcode for this operator.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symbol

protected java.lang.String symbol
Symbol to represent this operator


priority

protected int priority
Priority number associated with this operator

Constructor Detail

Operator

public Operator(java.lang.String symbol,
                int priority)
Constructor accepting symbol and priority

Method Detail

getSymbol

public java.lang.String getSymbol()
Returns symbol associated with this operator.


getPriority

public int getPriority()
Returns priority associated with this operator.


equals

public boolean equals(java.lang.Object o)
Equates two operators. Two operators are equal only if their symbols matches ignoring the case.


hashCode

public int hashCode()
Defines hashcode for this operator.