Add *Range.isEmpty(), *Progression.isEmpty()

This commit is contained in:
Alexander Udalov
2014-06-16 18:50:16 +04:00
parent 07378a74d3
commit 751f062f23
8 changed files with 90 additions and 0 deletions
@@ -71,6 +71,8 @@ class GenerateProgressions(out: PrintWriter) : BuiltInsSourceGenerator(out) {
override fun iterator(): ${t}Iterator = ${t}ProgressionIterator(start, end, increment)
public fun isEmpty(): Boolean = if (increment > 0) start > end else start < end
override fun equals(other: Any?): Boolean =
other is $progression && ${compare("start")} && ${compare("end")} && ${compare("increment")}
@@ -66,6 +66,8 @@ class GenerateRanges(out: PrintWriter) : BuiltInsSourceGenerator(out) {
override fun iterator(): ${t}Iterator = ${t}ProgressionIterator(start, end, $increment)
override fun isEmpty(): Boolean = start > end
override fun equals(other: Any?): Boolean =
other is $range && ${compare("start")} && ${compare("end")}