Skip to content

Commit 0ce4deb

Browse files
committed
chore: rename SourceBase.metadata to outputMetadata_
1 parent 0856b2e commit 0ce4deb

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

examples/src/main/kotlin/dev/silenium/libs/flows/examples/Simple.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ data class MyMetadata(val negativeNumbers: Boolean)
1515
class MySource : SourceBase<MyData, MyMetadata>() {
1616
init {
1717
// Create two output pads, one for positive numbers and one for negative numbers
18-
metadata[0u] = MyMetadata(false)
19-
metadata[1u] = MyMetadata(true)
18+
outputMetadata_[0u] = MyMetadata(false)
19+
outputMetadata_[1u] = MyMetadata(true)
2020
}
2121

2222
// Publish numbers from 0 to 100
2323
// Publishing can be done from any thread/coroutine, as the flow is thread-safe
2424
suspend fun run() {
2525
for (i in 0..100) {
2626
if (i % 2 == 0) {
27-
publish(FlowItem(0u, metadata[0u]!!, MyData(i)))
27+
publish(FlowItem(0u, outputMetadata_[0u]!!, MyData(i)))
2828
} else {
29-
publish(FlowItem(1u, metadata[1u]!!, MyData(i)))
29+
publish(FlowItem(1u, outputMetadata_[1u]!!, MyData(i)))
3030
}
3131
}
3232
}
@@ -39,7 +39,7 @@ class MyTransformer : Transformer<MyData, MyMetadata, MyData, MyMetadata>, Sourc
3939

4040
override fun configure(pad: UInt, metadata: MyMetadata): Result<Unit> {
4141
inputMetadata_[pad] = metadata
42-
this.metadata[pad] = metadata
42+
this.outputMetadata_[pad] = metadata
4343
return Result.success(Unit)
4444
}
4545

src/main/kotlin/dev/silenium/libs/flows/base/SourceBase.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import java.util.*
88
/**
99
* A base class for [Source] implementations.
1010
* It provides a [CloningFlow] to publish flow items.
11-
* It also provides a [metadata] map to store metadata for each output pad.
11+
* It also provides a [outputMetadata_] map to store metadata for each output pad.
1212
* It implements the [Source] interface.
1313
* It is an [AutoCloseable] resource.
1414
*/
1515
abstract class SourceBase<T, P> : Source<T, P> {
16-
override val outputMetadata: Map<UInt, P> get() = metadata.toMap()
16+
override val outputMetadata: Map<UInt, P> get() = outputMetadata_.toMap()
1717
override val flow = CloningFlow<FlowItem<T, P>>()
18-
protected val metadata: MutableMap<UInt, P> = Collections.synchronizedMap(mutableMapOf<UInt, P>())
18+
protected val outputMetadata_: MutableMap<UInt, P> = Collections.synchronizedMap(mutableMapOf<UInt, P>())
1919

2020
protected suspend fun publish(item: FlowItem<T, P>) = flow.publish(item)
2121

src/test/kotlin/dev/silenium/libs/flows/test/Base64Decoder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Base64Decoder : SourceBase<ByteArray, DataType>(), Transformer<Base64Buffe
3131
override fun configure(pad: UInt, metadata: DataType): Result<Unit> {
3232
check(metadata == DataType.BASE64) { "metadata must be BASE64" }
3333
this.inputMetadata[pad] = metadata
34-
this.metadata[pad] = DataType.PLAIN
34+
this.outputMetadata_[pad] = DataType.PLAIN
3535
return Result.success(Unit)
3636
}
3737

0 commit comments

Comments
 (0)