uk.me.parabola.mkgmap.osmstyle.eval
Class NumericOp

java.lang.Object
  extended by uk.me.parabola.mkgmap.osmstyle.eval.AbstractOp
      extended by uk.me.parabola.mkgmap.osmstyle.eval.AbstractBinaryOp
          extended by uk.me.parabola.mkgmap.osmstyle.eval.NumericOp
All Implemented Interfaces:
BinaryOp, Op
Direct Known Subclasses:
GTEOp, GTOp, LTEOp, LTOp

public abstract class NumericOp
extends AbstractBinaryOp

Class for numeric operations. This may include Equals at some point so that you can do max_speed=20mph even when the tag doesn't include mph etc.

Author:
Steve Ratcliffe

Field Summary
 
Fields inherited from class uk.me.parabola.mkgmap.osmstyle.eval.AbstractOp
first
 
Fields inherited from interface uk.me.parabola.mkgmap.osmstyle.eval.Op
AND, CLOSE_PAREN, EQUALS, EXISTS, GT, GTE, LT, LTE, NOT, NOT_EQUALS, NOT_EXISTS, OPEN_PAREN, OR, REGEX, VALUE
 
Constructor Summary
NumericOp()
           
 
Method Summary
protected abstract  boolean doesCompare(int result)
          This is passed the result of a compareTo and the subclass returns true or false depending on the operation.
 boolean eval(Element el)
          This evaluation routine works for all numeric tests.
 int priority()
           
 java.lang.String toString()
           
 
Methods inherited from class uk.me.parabola.mkgmap.osmstyle.eval.AbstractBinaryOp
getSecond, setSecond
 
Methods inherited from class uk.me.parabola.mkgmap.osmstyle.eval.AbstractOp
createOp, getFirst, getType, hasHigherPriority, isType, setFirst, value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uk.me.parabola.mkgmap.osmstyle.eval.Op
getFirst, getType, hasHigherPriority, isType, setFirst, value
 

Constructor Detail

NumericOp

public NumericOp()
Method Detail

doesCompare

protected abstract boolean doesCompare(int result)
This is passed the result of a compareTo and the subclass returns true or false depending on the operation.


priority

public int priority()

eval

public final boolean eval(Element el)
This evaluation routine works for all numeric tests. Implement the doesCompare(int) routine instead of this.

Parameters:
el - The OSM element to be tested.
Returns:
True if the expression is true for the given element.

toString

public java.lang.String toString()
Overrides:
toString in class AbstractBinaryOp