Extension contains for ranges: rename parameter item to value.

This commit is contained in:
Ilya Gorbunov
2015-11-27 18:02:41 +03:00
parent b4256f0c89
commit f7a780f32c
2 changed files with 186 additions and 186 deletions
+180 -180
View File
@@ -67,513 +67,513 @@ public fun Short.`-until`(to: Short): ShortRange {
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun Range<Int>.contains(item: Byte): Boolean { public operator fun Range<Int>.contains(value: Byte): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun ClosedRange<Int>.contains(item: Byte): Boolean { public operator fun ClosedRange<Int>.contains(value: Byte): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun Range<Long>.contains(item: Byte): Boolean { public operator fun Range<Long>.contains(value: Byte): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun ClosedRange<Long>.contains(item: Byte): Boolean { public operator fun ClosedRange<Long>.contains(value: Byte): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun Range<Short>.contains(item: Byte): Boolean { public operator fun Range<Short>.contains(value: Byte): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun ClosedRange<Short>.contains(item: Byte): Boolean { public operator fun ClosedRange<Short>.contains(value: Byte): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun Range<Double>.contains(item: Byte): Boolean { public operator fun Range<Double>.contains(value: Byte): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun ClosedRange<Double>.contains(item: Byte): Boolean { public operator fun ClosedRange<Double>.contains(value: Byte): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun Range<Float>.contains(item: Byte): Boolean { public operator fun Range<Float>.contains(value: Byte): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun ClosedRange<Float>.contains(item: Byte): Boolean { public operator fun ClosedRange<Float>.contains(value: Byte): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun Range<Int>.contains(item: Double): Boolean { public operator fun Range<Int>.contains(value: Double): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun ClosedRange<Int>.contains(item: Double): Boolean { public operator fun ClosedRange<Int>.contains(value: Double): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun Range<Long>.contains(item: Double): Boolean { public operator fun Range<Long>.contains(value: Double): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun ClosedRange<Long>.contains(item: Double): Boolean { public operator fun ClosedRange<Long>.contains(value: Double): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun Range<Byte>.contains(item: Double): Boolean { public operator fun Range<Byte>.contains(value: Double): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun ClosedRange<Byte>.contains(item: Double): Boolean { public operator fun ClosedRange<Byte>.contains(value: Double): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun Range<Short>.contains(item: Double): Boolean { public operator fun Range<Short>.contains(value: Double): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun ClosedRange<Short>.contains(item: Double): Boolean { public operator fun ClosedRange<Short>.contains(value: Double): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun Range<Float>.contains(item: Double): Boolean { public operator fun Range<Float>.contains(value: Double): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun ClosedRange<Float>.contains(item: Double): Boolean { public operator fun ClosedRange<Float>.contains(value: Double): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun Range<Int>.contains(item: Float): Boolean { public operator fun Range<Int>.contains(value: Float): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun ClosedRange<Int>.contains(item: Float): Boolean { public operator fun ClosedRange<Int>.contains(value: Float): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun Range<Long>.contains(item: Float): Boolean { public operator fun Range<Long>.contains(value: Float): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun ClosedRange<Long>.contains(item: Float): Boolean { public operator fun ClosedRange<Long>.contains(value: Float): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun Range<Byte>.contains(item: Float): Boolean { public operator fun Range<Byte>.contains(value: Float): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun ClosedRange<Byte>.contains(item: Float): Boolean { public operator fun ClosedRange<Byte>.contains(value: Float): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun Range<Short>.contains(item: Float): Boolean { public operator fun Range<Short>.contains(value: Float): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun ClosedRange<Short>.contains(item: Float): Boolean { public operator fun ClosedRange<Short>.contains(value: Float): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun Range<Double>.contains(item: Float): Boolean { public operator fun Range<Double>.contains(value: Float): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun ClosedRange<Double>.contains(item: Float): Boolean { public operator fun ClosedRange<Double>.contains(value: Float): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun Range<Long>.contains(item: Int): Boolean { public operator fun Range<Long>.contains(value: Int): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun ClosedRange<Long>.contains(item: Int): Boolean { public operator fun ClosedRange<Long>.contains(value: Int): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun Range<Byte>.contains(item: Int): Boolean { public operator fun Range<Byte>.contains(value: Int): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun ClosedRange<Byte>.contains(item: Int): Boolean { public operator fun ClosedRange<Byte>.contains(value: Int): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun Range<Short>.contains(item: Int): Boolean { public operator fun Range<Short>.contains(value: Int): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun ClosedRange<Short>.contains(item: Int): Boolean { public operator fun ClosedRange<Short>.contains(value: Int): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun Range<Double>.contains(item: Int): Boolean { public operator fun Range<Double>.contains(value: Int): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun ClosedRange<Double>.contains(item: Int): Boolean { public operator fun ClosedRange<Double>.contains(value: Int): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun Range<Float>.contains(item: Int): Boolean { public operator fun Range<Float>.contains(value: Int): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun ClosedRange<Float>.contains(item: Int): Boolean { public operator fun ClosedRange<Float>.contains(value: Int): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun Range<Int>.contains(item: Long): Boolean { public operator fun Range<Int>.contains(value: Long): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun ClosedRange<Int>.contains(item: Long): Boolean { public operator fun ClosedRange<Int>.contains(value: Long): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun Range<Byte>.contains(item: Long): Boolean { public operator fun Range<Byte>.contains(value: Long): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun ClosedRange<Byte>.contains(item: Long): Boolean { public operator fun ClosedRange<Byte>.contains(value: Long): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun Range<Short>.contains(item: Long): Boolean { public operator fun Range<Short>.contains(value: Long): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("shortRangeContains") @kotlin.jvm.JvmName("shortRangeContains")
public operator fun ClosedRange<Short>.contains(item: Long): Boolean { public operator fun ClosedRange<Short>.contains(value: Long): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun Range<Double>.contains(item: Long): Boolean { public operator fun Range<Double>.contains(value: Long): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun ClosedRange<Double>.contains(item: Long): Boolean { public operator fun ClosedRange<Double>.contains(value: Long): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun Range<Float>.contains(item: Long): Boolean { public operator fun Range<Float>.contains(value: Long): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun ClosedRange<Float>.contains(item: Long): Boolean { public operator fun ClosedRange<Float>.contains(value: Long): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun Range<Int>.contains(item: Short): Boolean { public operator fun Range<Int>.contains(value: Short): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("intRangeContains") @kotlin.jvm.JvmName("intRangeContains")
public operator fun ClosedRange<Int>.contains(item: Short): Boolean { public operator fun ClosedRange<Int>.contains(value: Short): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun Range<Long>.contains(item: Short): Boolean { public operator fun Range<Long>.contains(value: Short): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("longRangeContains") @kotlin.jvm.JvmName("longRangeContains")
public operator fun ClosedRange<Long>.contains(item: Short): Boolean { public operator fun ClosedRange<Long>.contains(value: Short): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun Range<Byte>.contains(item: Short): Boolean { public operator fun Range<Byte>.contains(value: Short): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("byteRangeContains") @kotlin.jvm.JvmName("byteRangeContains")
public operator fun ClosedRange<Byte>.contains(item: Short): Boolean { public operator fun ClosedRange<Byte>.contains(value: Short): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun Range<Double>.contains(item: Short): Boolean { public operator fun Range<Double>.contains(value: Short): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("doubleRangeContains") @kotlin.jvm.JvmName("doubleRangeContains")
public operator fun ClosedRange<Double>.contains(item: Short): Boolean { public operator fun ClosedRange<Double>.contains(value: Short): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.") @Deprecated("Range<T> is deprecated. Use ClosedRange<T> instead.")
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun Range<Float>.contains(item: Short): Boolean { public operator fun Range<Float>.contains(value: Short): Boolean {
return start <= item && item <= end return start <= value && value <= end
} }
/** /**
* Checks if the specified [item] belongs to this range. * Checks if the specified [value] belongs to this range.
*/ */
@kotlin.jvm.JvmName("floatRangeContains") @kotlin.jvm.JvmName("floatRangeContains")
public operator fun ClosedRange<Float>.contains(item: Short): Boolean { public operator fun ClosedRange<Float>.contains(value: Short): Boolean {
return start <= item && item <= endInclusive return start <= value && value <= endInclusive
} }
/** /**
@@ -238,7 +238,7 @@ fun ranges(): List<GenericFunction> {
templates addAll integralPermutations.map { until(it.first, it.second) } templates addAll integralPermutations.map { until(it.first, it.second) }
templates addAll listOf(PrimitiveType.Byte, PrimitiveType.Short).permutations().map { untilDeprecated(it.first, it.second) } templates addAll listOf(PrimitiveType.Byte, PrimitiveType.Short).permutations().map { untilDeprecated(it.first, it.second) }
fun containsDeprecated(rangeType: PrimitiveType, itemType: PrimitiveType) = f("contains(item: $itemType)") { fun containsDeprecated(rangeType: PrimitiveType, itemType: PrimitiveType) = f("contains(value: $itemType)") {
operator(true) operator(true)
deprecate("Range<T> is deprecated. Use ClosedRange<T> instead.") deprecate("Range<T> is deprecated. Use ClosedRange<T> instead.")
@@ -248,11 +248,11 @@ fun ranges(): List<GenericFunction> {
onlyPrimitives(Ranges, rangeType) onlyPrimitives(Ranges, rangeType)
platformName("${rangeType.name.decapitalize()}RangeContains") platformName("${rangeType.name.decapitalize()}RangeContains")
returns("Boolean") returns("Boolean")
doc { "Checks if the specified [item] belongs to this range." } doc { "Checks if the specified [value] belongs to this range." }
body { "return start <= item && item <= end" } body { "return start <= value && value <= end" }
} }
fun contains(rangeType: PrimitiveType, itemType: PrimitiveType) = f("contains(item: $itemType)") { fun contains(rangeType: PrimitiveType, itemType: PrimitiveType) = f("contains(value: $itemType)") {
operator(true) operator(true)
check(rangeType.isNumeric() == itemType.isNumeric()) { "Required rangeType and itemType both to be numeric or both not, got: $rangeType, $itemType" } check(rangeType.isNumeric() == itemType.isNumeric()) { "Required rangeType and itemType both to be numeric or both not, got: $rangeType, $itemType" }
@@ -261,8 +261,8 @@ fun ranges(): List<GenericFunction> {
customReceiver("ClosedRange<T>") customReceiver("ClosedRange<T>")
platformName("${rangeType.name.decapitalize()}RangeContains") platformName("${rangeType.name.decapitalize()}RangeContains")
returns("Boolean") returns("Boolean")
doc { "Checks if the specified [item] belongs to this range." } doc { "Checks if the specified [value] belongs to this range." }
body { "return start <= item && item <= endInclusive" } body { "return start <= value && value <= endInclusive" }
} }