*/
public class RangeStats
{
+ // MAYBE: Split into basic stats (quick to calculate, for detailsdisplay) and full stats (for other two)
private boolean _valid = false;
private int _numPoints = 0;
private int _startIndex = 0, _endIndex = 0;
private AltitudeRange _gentleAltitudeRange = null, _steepAltitudeRange = null;
private Timestamp _earliestTimestamp = null, _latestTimestamp = null;
private long _movingMilliseconds = 0L;
- private boolean _timestampsIncomplete = false;
+ private boolean _timesIncomplete = false;
+ private boolean _timesOutOfSequence = false;
private double _totalDistanceRads = 0.0, _movingDistanceRads = 0.0;
- // Note, maximum speed is not calculated here, use the SpeedData method instead
+ // Note, maximum speed is not calculated here, use the SpeedData class instead
private static final double STEEP_ANGLE = 0.15; // gradient steeper than 15% counts as steep
*/
private boolean calculateStats(Track inTrack, int inStartIndex, int inEndIndex)
{
- _startIndex = inStartIndex; _endIndex = inEndIndex;
+ _startIndex = inStartIndex;
+ _endIndex = inEndIndex;
_numPoints = inEndIndex - inStartIndex + 1;
_totalAltitudeRange = new AltitudeRange();
_movingAltitudeRange = new AltitudeRange();
// ignore all waypoints
if (p.isWaypoint()) continue;
- if (p.getSegmentStart()) {_numSegments++;}
+ if (p.getSegmentStart()) {
+ _numSegments++;
+ }
// Get the distance to the previous track point
if (prevPoint != null)
{
if (!p.getSegmentStart() && prevPoint != null && prevPoint.hasTimestamp())
{
long millisLater = p.getTimestamp().getMillisecondsSince(prevPoint.getTimestamp());
- if (millisLater < 0) {_timestampsIncomplete = true;}
- _movingMilliseconds += millisLater;
+ if (millisLater < 0) {_timesOutOfSequence = true;}
+ else {
+ _movingMilliseconds += millisLater;
+ }
}
}
- else if (!p.getSegmentStart()) {
- _timestampsIncomplete = true;
+ else {
+ _timesIncomplete = true;
}
prevPoint = p;
return _movingMilliseconds / 1000;
}
- /** @return true if any timestamps are missing or out of sequence */
+ /** @return true if any timestamps are missing */
public boolean getTimestampsIncomplete() {
- return _timestampsIncomplete;
+ return _timesIncomplete;
+ }
+
+ /** @return true if any timestamps are out of sequence */
+ public boolean getTimestampsOutOfSequence() {
+ return _timesOutOfSequence;
}
/** @return total distance in the current distance units (km or mi) */