X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FDoubleRange.java;h=4e361224f420ed32b72473edc1e5adf87d37a3f0;hp=b6b8a8fb9cb9c7f1b647c9ef20d1d5779bbad16c;hb=7f5ed2be62905bd37717376dc22d09e5ea7edb4d;hpb=b361869e590bbca32664c16ac24d6296926594a5 diff --git a/tim/prune/data/DoubleRange.java b/tim/prune/data/DoubleRange.java index b6b8a8f..4e36122 100644 --- a/tim/prune/data/DoubleRange.java +++ b/tim/prune/data/DoubleRange.java @@ -79,4 +79,22 @@ public class DoubleRange { return _max - _min; } + + /** + * @return mid value, halfway between min and max + */ + public double getMidValue() + { + return (_max + _min) / 2.0; + } + + /** + * Copy this range into a new object, which can then be modified without changing this one + * @return deep copy of this object + */ + public DoubleRange copy() + { + if (_empty) return new DoubleRange(); + return new DoubleRange(_min, _max); + } }