Skip to content

Commit 7ddeab1

Browse files
committed
Make KotlinNotebookPluginUtils an object instead of a class
1 parent dcffd2d commit 7ddeab1

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/KotlinNotebookPluginUtils.kt

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,24 @@ import org.jetbrains.kotlinx.dataframe.api.filter
1010
* The plugin sends Kotlin following code to the kernel to evaluate
1111
* DISPLAY(KotlinNotebooksPluginUtils.getRowsSubsetForRendering(Out[x], 0, 20), "")
1212
*/
13-
public class KotlinNotebookPluginUtils {
14-
public companion object {
15-
/**
16-
* Returns a subset of rows from the given dataframe for rendering.
17-
* It's used for example for dynamic pagination in Kotlin Notebook Plugin.
18-
*/
19-
public fun getRowsSubsetForRendering(
20-
dataFrameLike: Any?,
21-
startIdx: Int,
22-
endIdx: Int
23-
): DisableRowsLimitWrapper = when (dataFrameLike) {
24-
null -> throw IllegalArgumentException("Dataframe is null")
25-
else -> getRowsSubsetForRendering(convertToDataFrame(dataFrameLike), startIdx, endIdx)
26-
}
27-
28-
/**
29-
* Returns a subset of rows from the given dataframe for rendering.
30-
* It's used for example for dynamic pagination in Kotlin Notebook Plugin.
31-
*/
32-
public fun getRowsSubsetForRendering(df: AnyFrame, startIdx: Int, endIdx: Int): DisableRowsLimitWrapper =
33-
DisableRowsLimitWrapper(df.filter { it.index() in startIdx until endIdx })
13+
public object KotlinNotebookPluginUtils {
14+
/**
15+
* Returns a subset of rows from the given dataframe for rendering.
16+
* It's used for example for dynamic pagination in Kotlin Notebook Plugin.
17+
*/
18+
public fun getRowsSubsetForRendering(
19+
dataFrameLike: Any?,
20+
startIdx: Int,
21+
endIdx: Int
22+
): DisableRowsLimitWrapper = when (dataFrameLike) {
23+
null -> throw IllegalArgumentException("Dataframe is null")
24+
else -> getRowsSubsetForRendering(convertToDataFrame(dataFrameLike), startIdx, endIdx)
3425
}
26+
27+
/**
28+
* Returns a subset of rows from the given dataframe for rendering.
29+
* It's used for example for dynamic pagination in Kotlin Notebook Plugin.
30+
*/
31+
public fun getRowsSubsetForRendering(df: AnyFrame, startIdx: Int, endIdx: Int): DisableRowsLimitWrapper =
32+
DisableRowsLimitWrapper(df.filter { it.index() in startIdx until endIdx })
3533
}

0 commit comments

Comments
 (0)