1 package tim.prune.data;
4 * Represents a range of altitudes, taking units into account.
5 * Values assumed to be >= 0.
7 public class AltitudeRange
9 private IntegerRange _range = new IntegerRange();
10 private Altitude.Format _format = Altitude.Format.NO_FORMAT;
14 * Clear the altitude range
19 _format = Altitude.Format.NO_FORMAT;
24 * Add a value to the range
25 * @param inAltitude value to add, only positive values considered
27 public void addValue(Altitude inAltitude)
29 if (inAltitude != null)
31 int altValue = inAltitude.getValue(_format);
32 _range.addValue(altValue);
33 if (_format == Altitude.Format.NO_FORMAT)
35 _format = inAltitude.getFormat();
42 * @return true if altitude range found
44 public boolean hasRange()
46 return _range.getMaximum() > _range.getMinimum();
51 * @return minimum value, or -1 if none found
53 public int getMinimum()
55 return _range.getMinimum();
60 * @return maximum value, or -1 if none found
62 public int getMaximum()
64 return _range.getMaximum();
69 * @return the altitude format used
71 public Altitude.Format getFormat()