Specify when the range is empty in KDoc
This commit is contained in:
committed by
Anastasia Shadrina
parent
60f2f85be7
commit
94c4d1c23e
@@ -82,7 +82,12 @@ public open class $progression
|
||||
|
||||
override fun iterator(): ${t}Iterator = ${t}ProgressionIterator(first, last, step)
|
||||
|
||||
/** Checks if the progression is empty. */
|
||||
/**
|
||||
* Checks if the progression is empty.
|
||||
|
||||
* Progression with a positive step is empty if its first element is greater than the last element.
|
||||
* Progression with a negative step is empty if its first element is less than the last element.
|
||||
*/
|
||||
public open fun isEmpty(): Boolean = if (step > 0) first > last else first < last
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
|
||||
@@ -58,6 +58,11 @@ public class $range(start: $t, endInclusive: $t) : ${t}Progression(start, endInc
|
||||
|
||||
override fun contains(value: $t): Boolean = first <= value && value <= last
|
||||
|
||||
/**
|
||||
* Checks whether the range is empty.
|
||||
|
||||
* The range is empty if its start value is greater than the end value.
|
||||
*/
|
||||
override fun isEmpty(): Boolean = first > last
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
|
||||
@@ -587,6 +587,11 @@ public class ${elementType}Range(start: $elementType, endInclusive: $elementType
|
||||
|
||||
override fun contains(value: $elementType): Boolean = first <= value && value <= last
|
||||
|
||||
/**
|
||||
* Checks if the range is empty.
|
||||
|
||||
* The range is empty if its start value is greater than the end value.
|
||||
*/
|
||||
override fun isEmpty(): Boolean = first > last
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
@@ -637,7 +642,12 @@ internal constructor(
|
||||
|
||||
override fun iterator(): ${elementType}Iterator = ${elementType}ProgressionIterator(first, last, step)
|
||||
|
||||
/** Checks if the progression is empty. */
|
||||
/**
|
||||
* Checks if the progression is empty.
|
||||
|
||||
* Progression with a positive step is empty if its first element is greater than the last element.
|
||||
* Progression with a negative step is empty if its first element is less than the last element.
|
||||
*/
|
||||
public open fun isEmpty(): Boolean = if (step > 0) first > last else first < last
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
|
||||
Reference in New Issue
Block a user