From e364f4e94b3afff4a874479c0b416e504b7df2ca Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Wed, 20 Sep 2017 13:22:18 -0700 Subject: [PATCH] Have the NumberInterface provide the Kotlin rangeTo method. --- .../org/nwapw/abacus/number/NumberInterface.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/main/java/org/nwapw/abacus/number/NumberInterface.java b/core/src/main/java/org/nwapw/abacus/number/NumberInterface.java index e37c4fb..bcccddb 100755 --- a/core/src/main/java/org/nwapw/abacus/number/NumberInterface.java +++ b/core/src/main/java/org/nwapw/abacus/number/NumberInterface.java @@ -238,4 +238,16 @@ public abstract class NumberInterface implements Comparable { */ public abstract NumberInterface getMaxError(); + /** + * Returns a NumberRangeBuilder object, which is used to create a range. + * The reason that this returns a builder and not an actual range is that + * the NumberRange needs to promote values passed to it, which + * requires an abacus instance. + * @param other the value at the bottom of the range. + * @return the resulting range builder. + */ + public NumberRangeBuilder rangeTo(NumberInterface other){ + return new NumberRangeBuilder(this, other); + } + }