File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
core/common/src/internal/format Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2019-2023 JetBrains s.r.o. and contributors.
3
+ * Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
4
+ */
5
+
6
+ package kotlinx.datetime.internal.format
7
+
8
+ /* *
9
+ * An append-only list of constituent formats. Can't be exposed directly due to the variance rules.
10
+ */
11
+ internal class AppendableFormatStructure <T > {
12
+ private val list: MutableList <NonConcatenatedFormatStructure <T >> = mutableListOf ()
13
+ fun build (): ConcatenatedFormatStructure <T > = ConcatenatedFormatStructure (list)
14
+ fun add (format : FormatStructure <T >) {
15
+ /* * TODO: use the caches present in [CachedFormatStructure]. */
16
+ when (format) {
17
+ is NonConcatenatedFormatStructure -> list.add(format)
18
+ is ConcatenatedFormatStructure -> format.formats.forEach { list.add(it) }
19
+ }
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments