]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/data/AltitudeRange.java
Version 7, February 2009
[GpsPrune.git] / tim / prune / data / AltitudeRange.java
index 5b606f4574eac372d9fdd6850ff0a3d248307513..98fa20edd5295f0e8097ec3407c98856a8fa0f53 100644 (file)
@@ -7,12 +7,22 @@ package tim.prune.data;
 public class AltitudeRange
 {
        private IntegerRange _range = new IntegerRange();
-       private int _format = Altitude.FORMAT_NONE;
+       private Altitude.Format _format = Altitude.Format.NO_FORMAT;
+
+
+       /**
+        * Clear the altitude range
+        */
+       public void clear()
+       {
+               _range.clear();
+               _format = Altitude.Format.NO_FORMAT;
+       }
 
 
        /**
         * Add a value to the range
-        * @param inValue value to add, only positive values considered
+        * @param inAltitude value to add, only positive values considered
         */
        public void addValue(Altitude inAltitude)
        {
@@ -20,7 +30,7 @@ public class AltitudeRange
                {
                        int altValue = inAltitude.getValue(_format);
                        _range.addValue(altValue);
-                       if (_format == Altitude.FORMAT_NONE)
+                       if (_format == Altitude.Format.NO_FORMAT)
                        {
                                _format = inAltitude.getFormat();
                        }
@@ -29,11 +39,11 @@ public class AltitudeRange
 
 
        /**
-        * @return true if positive data values were found
+        * @return true if altitude range found
         */
-       public boolean hasData()
+       public boolean hasRange()
        {
-               return (_range.hasData());
+               return _range.getMaximum() > _range.getMinimum();
        }
 
 
@@ -58,7 +68,7 @@ public class AltitudeRange
        /**
         * @return the altitude format used
         */
-       public int getFormat()
+       public Altitude.Format getFormat()
        {
                return _format;
        }