blob: 60dbb97a5dc8dafad6b9725d2413d099a12d75ad [file] [log] [blame]
Roman Elizarov43918972017-10-07 21:00:06 +03001/*
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
17package kotlinx.coroutines.experimental.channels
18
19enum class TestBroadcastChannelKind {
20 ARRAY_1 {
Vsevolod Tolstopyatov96191342018-04-20 18:13:33 +030021 override fun <T> create(): BroadcastChannel<T> = ArrayBroadcastChannel(1)
Roman Elizarov43918972017-10-07 21:00:06 +030022 override fun toString(): String = "ArrayBroadcastChannel(1)"
23 },
24 ARRAY_10 {
Vsevolod Tolstopyatov96191342018-04-20 18:13:33 +030025 override fun <T> create(): BroadcastChannel<T> = ArrayBroadcastChannel(10)
Roman Elizarov43918972017-10-07 21:00:06 +030026 override fun toString(): String = "ArrayBroadcastChannel(10)"
27 },
28 CONFLATED {
Vsevolod Tolstopyatov96191342018-04-20 18:13:33 +030029 override fun <T> create(): BroadcastChannel<T> = ConflatedBroadcastChannel()
Roman Elizarov43918972017-10-07 21:00:06 +030030 override fun toString(): String = "ConflatedBroadcastChannel"
31 override val isConflated: Boolean get() = true
32 }
33 ;
34
Roman Elizarov45c85652017-10-13 14:46:22 +030035 abstract fun <T> create(): BroadcastChannel<T>
Roman Elizarov43918972017-10-07 21:00:06 +030036 open val isConflated: Boolean get() = false
37}