Roman Elizarov | 4391897 | 2017-10-07 21:00:06 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-2017 JetBrains s.r.o. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package kotlinx.coroutines.experimental.channels |
| 18 | |
| 19 | enum class TestBroadcastChannelKind { |
| 20 | ARRAY_1 { |
Vsevolod Tolstopyatov | 9619134 | 2018-04-20 18:13:33 +0300 | [diff] [blame] | 21 | override fun <T> create(): BroadcastChannel<T> = ArrayBroadcastChannel(1) |
Roman Elizarov | 4391897 | 2017-10-07 21:00:06 +0300 | [diff] [blame] | 22 | override fun toString(): String = "ArrayBroadcastChannel(1)" |
| 23 | }, |
| 24 | ARRAY_10 { |
Vsevolod Tolstopyatov | 9619134 | 2018-04-20 18:13:33 +0300 | [diff] [blame] | 25 | override fun <T> create(): BroadcastChannel<T> = ArrayBroadcastChannel(10) |
Roman Elizarov | 4391897 | 2017-10-07 21:00:06 +0300 | [diff] [blame] | 26 | override fun toString(): String = "ArrayBroadcastChannel(10)" |
| 27 | }, |
| 28 | CONFLATED { |
Vsevolod Tolstopyatov | 9619134 | 2018-04-20 18:13:33 +0300 | [diff] [blame] | 29 | override fun <T> create(): BroadcastChannel<T> = ConflatedBroadcastChannel() |
Roman Elizarov | 4391897 | 2017-10-07 21:00:06 +0300 | [diff] [blame] | 30 | override fun toString(): String = "ConflatedBroadcastChannel" |
| 31 | override val isConflated: Boolean get() = true |
| 32 | } |
| 33 | ; |
| 34 | |
Roman Elizarov | 45c8565 | 2017-10-13 14:46:22 +0300 | [diff] [blame] | 35 | abstract fun <T> create(): BroadcastChannel<T> |
Roman Elizarov | 4391897 | 2017-10-07 21:00:06 +0300 | [diff] [blame] | 36 | open val isConflated: Boolean get() = false |
| 37 | } |