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

java.lang.Object
  extended by uk.me.parabola.mkgmap.osmstyle.eval.ValueWithUnit
All Implemented Interfaces:
java.lang.Comparable<ValueWithUnit>

public class ValueWithUnit
extends java.lang.Object
implements java.lang.Comparable<ValueWithUnit>

Represents a number and the units it is in. We want ultimately to be able to do things like: is 10km/h > 8mph, and get the right answer by converting to a common unit. To start with we will just compare the numbers.

Author:
Steve Ratcliffe

Constructor Summary
ValueWithUnit(java.lang.String val)
           
 
Method Summary
 int compareTo(ValueWithUnit o)
          Compares this object with the specified object for order.
 boolean isValid()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueWithUnit

public ValueWithUnit(java.lang.String val)
Method Detail

compareTo

public int compareTo(ValueWithUnit o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. To start with, just compare the value and ignore the unit.

Specified by:
compareTo in interface java.lang.Comparable<ValueWithUnit>

isValid

public boolean isValid()

toString

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