From efd38f4c11b140a2fdb8ec232656d0afb18b2078 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 8 May 2022 22:21:01 +0300 Subject: [PATCH] Move to DF 0.6.0-dev-6 --- build.gradle.kts | 8 +++++++- .../kotlin/ru/mipt/spc/magprog/DataSetPageContext.kt | 4 ++-- .../kotlin/ru/mipt/spc/magprog/SnarkPageContext.kt | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 819da13..8d32850 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ application { } -val dataforgeVersion by extra("0.6.0-dev-5") +val dataforgeVersion by extra("0.6.0-dev-6") val ktorVersion = KScienceVersions.ktorVersion dependencies { @@ -42,6 +42,12 @@ dependencies { kotlin { explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Disabled + sourceSets.all { + languageSettings { + languageVersion = "1.7" + apiVersion = "1.7" + } + } } diff --git a/src/main/kotlin/ru/mipt/spc/magprog/DataSetPageContext.kt b/src/main/kotlin/ru/mipt/spc/magprog/DataSetPageContext.kt index afa45a9..0fd159a 100644 --- a/src/main/kotlin/ru/mipt/spc/magprog/DataSetPageContext.kt +++ b/src/main/kotlin/ru/mipt/spc/magprog/DataSetPageContext.kt @@ -96,7 +96,7 @@ class DataSetPageContext( @DFInternal override fun resolveAll(type: KType, predicate: (name: Name, meta: Meta) -> Boolean): DataSet = - dataSet.filterIsInstance(type, predicate = predicate) + dataSet.filterByType(type, predicate = predicate) override fun resolveHtml(name: Name): HtmlData? = runBlocking { resolve(name)?.takeIf { it.published }?.toHtmlBlock() @@ -104,7 +104,7 @@ class DataSetPageContext( override fun resolveAllHtml(filter: (name: Name, meta: Meta) -> Boolean): Map = runBlocking { buildMap { - resolveAll(filter).dataSequence().filter { it.published }.forEach { + resolveAll(filter).traverse().filter { it.published }.forEach { put(it.name, it.toHtmlBlock()) } } diff --git a/src/main/kotlin/ru/mipt/spc/magprog/SnarkPageContext.kt b/src/main/kotlin/ru/mipt/spc/magprog/SnarkPageContext.kt index 8c817a1..dbd33ca 100644 --- a/src/main/kotlin/ru/mipt/spc/magprog/SnarkPageContext.kt +++ b/src/main/kotlin/ru/mipt/spc/magprog/SnarkPageContext.kt @@ -4,8 +4,8 @@ import space.kscience.dataforge.actions.invoke import space.kscience.dataforge.context.Context import space.kscience.dataforge.data.Data import space.kscience.dataforge.data.DataSet -import space.kscience.dataforge.data.filterIsInstance -import space.kscience.dataforge.data.selectOne +import space.kscience.dataforge.data.filterByType +import space.kscience.dataforge.data.getByType import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.misc.DFInternal import space.kscience.dataforge.names.Name @@ -30,14 +30,14 @@ class SnarkPageContext( private val parsedData: DataSet by lazy { snarkPlugin.parseAction(directoryDataTree) } @DFInternal - override fun resolve(type: KType, name: Name): Data? = parsedData.selectOne(type, name) + override fun resolve(type: KType, name: Name): Data? = parsedData.getByType(type, name) @DFInternal override fun resolveAll(type: KType, predicate: (name: Name, meta: Meta) -> Boolean): DataSet = - parsedData.filterIsInstance(type, predicate) + parsedData.filterByType(type, predicate) override fun resolveHtml(name: Name): HtmlData? = resolve(name) override fun resolveAllHtml(filter: (name: Name, meta: Meta) -> Boolean): Map = - resolveAll(filter).dataSequence().filter { it.published }.associate { it.name to it.data } + resolveAll(filter).traverse().filter { it.published }.associate { it.name to it.data } } \ No newline at end of file