Add samples for coerceIn, coerceAtLeast, coerceAtMost for comparable types

#KT-20357
This commit is contained in:
Ilya Gorbunov
2018-01-10 17:46:52 +03:00
parent 17573a3c21
commit 8fc83e3ff5
5 changed files with 57 additions and 12 deletions
@@ -36,7 +36,7 @@ object ComparableOps : TemplateGroupBase() {
Ensures that this value is not less than the specified [minimumValue].
@return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.
@sample samples.comparisons.ComparableOps.coerceAtLeast
@sample samples.comparisons.ComparableOps.coerceAtLeast${if (f == Generic) "Comparable" else ""}
"""
}
body {
@@ -58,7 +58,7 @@ object ComparableOps : TemplateGroupBase() {
Ensures that this value is not greater than the specified [maximumValue].
@return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.
@sample samples.comparisons.ComparableOps.coerceAtMost
@sample samples.comparisons.ComparableOps.coerceAtMost${if (f == Generic) "Comparable" else ""}
"""
}
body {
@@ -80,7 +80,7 @@ object ComparableOps : TemplateGroupBase() {
Ensures that this value lies in the specified [range].
@return this value if it's in the [range], or `range.start` if this value is less than `range.start`, or `range.endInclusive` if this value is greater than `range.endInclusive`.
@sample samples.comparisons.ComparableOps.coerceIn
@sample samples.comparisons.ComparableOps.coerceIn${if (f == Generic) "Comparable" else ""}
"""
}
body(Generic) {
@@ -344,6 +344,7 @@ object ComparableOps : TemplateGroupBase() {
Ensures that this value lies in the specified range [minimumValue]..[maximumValue].
@return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].
@sample samples.comparisons.ComparableOps.coerceIn${if (f == Generic) "Comparable" else ""}
"""
}
body(Primitives) {