From ccf03fb633791028a0be2898f8ea88423d04cc69 Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Fri, 13 Oct 2017 15:41:17 +0200 Subject: [PATCH] param.BigRational: add lessThan, lessThanEquals, greaterThan, greaterThanEquals --- prism/src/param/BigRational.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/prism/src/param/BigRational.java b/prism/src/param/BigRational.java index d0a6bafa..90cb9c20 100644 --- a/prism/src/param/BigRational.java +++ b/prism/src/param/BigRational.java @@ -700,6 +700,30 @@ public final class BigRational extends Number implements Comparable return this.compareTo(new BigRational(i)); } + /** Returns true if this number is less than the other number */ + public boolean lessThan(BigRational other) + { + return this.compareTo(other) < 0; + } + + /** Returns true if this number is less than or equal the other number */ + public boolean lessThanEquals(BigRational other) + { + return this.compareTo(other) <= 0; + } + + /** Returns true if this number is greater than the other number */ + public boolean greaterThan(BigRational other) + { + return this.compareTo(other) > 0; + } + + /** Returns true if this number is greater than or equal the other number */ + public boolean greaterThanEquals(BigRational other) + { + return this.compareTo(other) >= 0; + } + /** * Return numerator of this BigRational as a BigInteger. *