@@ -20,6 +20,14 @@ class ByteInterval( start: Byte, isStartIncluded: Boolean, end: Byte, isEndInclu
2020 }
2121}
2222
23+ /* *
24+ * Create a [ByteInterval] representing the set of all [Byte] values lying between [start] and [end].
25+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
26+ */
27+ fun interval ( start : Byte , end : Byte , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
28+ ByteInterval ( start, isStartIncluded, end, isEndIncluded )
29+
30+
2331/* *
2432 * An [Interval] representing the set of all [Short] values lying between a provided [start] and [end] value.
2533 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -37,6 +45,14 @@ class ShortInterval( start: Short, isStartIncluded: Boolean, end: Short, isEndIn
3745 }
3846}
3947
48+ /* *
49+ * Create a [ShortInterval] representing the set of all [Short] values lying between [start] and [end].
50+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
51+ */
52+ fun interval ( start : Short , end : Short , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
53+ ShortInterval ( start, isStartIncluded, end, isEndIncluded )
54+
55+
4056/* *
4157 * An [Interval] representing the set of all [Int] values lying between a provided [start] and [end] value.
4258 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -54,6 +70,14 @@ class IntInterval( start: Int, isStartIncluded: Boolean, end: Int, isEndIncluded
5470 }
5571}
5672
73+ /* *
74+ * Create a [IntInterval] representing the set of all [Int] values lying between [start] and [end].
75+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
76+ */
77+ fun interval ( start : Int , end : Int , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
78+ IntInterval ( start, isStartIncluded, end, isEndIncluded )
79+
80+
5781/* *
5882 * An [Interval] representing the set of all [Long] values lying between a provided [start] and [end] value.
5983 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -71,6 +95,14 @@ class LongInterval( start: Long, isStartIncluded: Boolean, end: Long, isEndInclu
7195 }
7296}
7397
98+ /* *
99+ * Create a [LongInterval] representing the set of all [Long] values lying between [start] and [end].
100+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
101+ */
102+ fun interval ( start : Long , end : Long , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
103+ LongInterval ( start, isStartIncluded, end, isEndIncluded )
104+
105+
74106/* *
75107 * An [Interval] representing the set of all [Float] values lying between a provided [start] and [end] value.
76108 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -84,6 +116,14 @@ class FloatInterval( start: Float, isStartIncluded: Boolean, end: Float, isEndIn
84116 }
85117}
86118
119+ /* *
120+ * Create a [FloatInterval] representing the set of all [Float] values lying between [start] and [end].
121+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
122+ */
123+ fun interval ( start : Float , end : Float , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
124+ FloatInterval ( start, isStartIncluded, end, isEndIncluded )
125+
126+
87127/* *
88128 * An [Interval] representing the set of all [Double] values lying between a provided [start] and [end] value.
89129 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -99,6 +139,14 @@ class DoubleInterval( start: Double, isStartIncluded: Boolean, end: Double, isEn
99139 }
100140}
101141
142+ /* *
143+ * Create a [DoubleInterval] representing the set of all [Double] values lying between [start] and [end].
144+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
145+ */
146+ fun interval ( start : Double , end : Double , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
147+ DoubleInterval ( start, isStartIncluded, end, isEndIncluded )
148+
149+
102150/* *
103151 * An [Interval] representing the set of all [UByte] values lying between a provided [start] and [end] value.
104152 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -112,6 +160,14 @@ class UByteInterval( start: UByte, isStartIncluded: Boolean, end: UByte, isEndIn
112160 }
113161}
114162
163+ /* *
164+ * Create a [UByteInterval] representing the set of all [UByte] values lying between [start] and [end].
165+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
166+ */
167+ fun interval ( start : UByte , end : UByte , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
168+ UByteInterval ( start, isStartIncluded, end, isEndIncluded )
169+
170+
115171/* *
116172 * An [Interval] representing the set of all [UShort] values lying between a provided [start] and [end] value.
117173 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -125,6 +181,14 @@ class UShortInterval( start: UShort, isStartIncluded: Boolean, end: UShort, isEn
125181 }
126182}
127183
184+ /* *
185+ * Create a [UShortInterval] representing the set of all [UShort] values lying between [start] and [end].
186+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
187+ */
188+ fun interval ( start : UShort , end : UShort , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
189+ UShortInterval ( start, isStartIncluded, end, isEndIncluded )
190+
191+
128192/* *
129193 * An [Interval] representing the set of all [UInt] values lying between a provided [start] and [end] value.
130194 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -138,6 +202,14 @@ class UIntInterval( start: UInt, isStartIncluded: Boolean, end: UInt, isEndInclu
138202 }
139203}
140204
205+ /* *
206+ * Create a [UIntInterval] representing the set of all [UInt] values lying between [start] and [end].
207+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
208+ */
209+ fun interval ( start : UInt , end : UInt , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
210+ UIntInterval ( start, isStartIncluded, end, isEndIncluded )
211+
212+
141213/* *
142214 * An [Interval] representing the set of all [ULong] values lying between a provided [start] and [end] value.
143215 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -151,6 +223,14 @@ class ULongInterval( start: ULong, isStartIncluded: Boolean, end: ULong, isEndIn
151223 }
152224}
153225
226+ /* *
227+ * Create a [ULongInterval] representing the set of all [ULong] values lying between [start] and [end].
228+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
229+ */
230+ fun interval ( start : ULong , end : ULong , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
231+ ULongInterval ( start, isStartIncluded, end, isEndIncluded )
232+
233+
154234/* *
155235 * An [Interval] representing the set of all [Char] values lying between a provided [start] and [end] value.
156236 * The interval can be closed, open, or half-open, as determined by [isStartIncluded] and [isEndIncluded].
@@ -163,3 +243,10 @@ class CharInterval( start: Char, isStartIncluded: Boolean, end: Char, isEndInclu
163243 internal val Operations = createIntervalTypeOperations<Char , UShort > { it.code.toUShort() }
164244 }
165245}
246+
247+ /* *
248+ * Create a [CharInterval] representing the set of all [Char] values lying between [start] and [end].
249+ * To exclude endpoints, set [isStartIncluded] or [isEndIncluded] to false; a closed interval is created by default.
250+ */
251+ fun interval ( start : Char , end : Char , isStartIncluded : Boolean = true, isEndIncluded : Boolean = true ) =
252+ CharInterval ( start, isStartIncluded, end, isEndIncluded )
0 commit comments