X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FRangeStats.java;h=37d061bf66cb3318c68a41829f1f286c2a855cd5;hp=0ed8fc7a4588f69e712525ad19cf232b532e1cb2;hb=326f489e36aa7f235bc19409a57bf4955cd50f24;hpb=8c8868ae29b3252f02e094c02307384cf61ba667 diff --git a/tim/prune/data/RangeStats.java b/tim/prune/data/RangeStats.java index 0ed8fc7..37d061b 100644 --- a/tim/prune/data/RangeStats.java +++ b/tim/prune/data/RangeStats.java @@ -9,6 +9,7 @@ import tim.prune.config.Config; */ 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; @@ -17,7 +18,8 @@ public class RangeStats 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 @@ -123,12 +125,14 @@ public class RangeStats 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; @@ -207,9 +211,14 @@ public class RangeStats 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) */