Skip to content

Commit be1e9e9

Browse files
committed
improving kdocs all across the CS DSL: simplifying first line for clarity, specifying at which level they operate, mentioning scoping for except and improving examples.
1 parent 94e6f87 commit be1e9e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3411
-2386
lines changed

core/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ val processKDocsMain by creatingProcessDocTask(
205205
ARG_DOC_PROCESSOR,
206206
COMMENT_DOC_PROCESSOR,
207207
SAMPLE_DOC_PROCESSOR,
208+
// REMOVE_ESCAPE_CHARS_PROCESSOR,
208209
)
209210

210211
arguments += ARG_DOC_PROCESSOR_LOG_NOT_FOUND to false

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aliases.kt

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package org.jetbrains.kotlinx.dataframe
22

33
import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl
4-
import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDslLink
54
import org.jetbrains.kotlinx.dataframe.columns.BaseColumn
65
import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor
76
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
7+
import org.jetbrains.kotlinx.dataframe.columns.ColumnSet
88
import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath
99
import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver
1010
import org.jetbrains.kotlinx.dataframe.columns.SingleColumn
1111

1212
/**
1313
* ## Predicate
1414
*
15-
* [Predicate] is used to reach a [Boolean] result using the given instance of `T` as `it`.
15+
* [Predicate] is a lambda function expecting a [Boolean] result given an instance of `T` as `it`.
1616
*
1717
* Shorthand for:
1818
* ```kotlin
@@ -24,7 +24,7 @@ public typealias Predicate<T> = (it: T) -> Boolean
2424
/**
2525
* ## Selector
2626
*
27-
* [Selector] is used to express or select any instance of `R` using the given instance of `T` as `this` and `it`.
27+
* [Selector] is a lambda function expecting an `R` result given an instance of `T` as context (`this` and `it`).
2828
*
2929
* Shorthand for:
3030
* ```kotlin
@@ -38,8 +38,9 @@ public typealias Selector<T, R> = T.(it: T) -> R
3838
/**
3939
* ## DataFrame Expression
4040
*
41-
* [DataFrameExpression] is used to express or select any instance of `R` using the given instance of [DataFrame]`<T>`
42-
* as `this` and `it`.
41+
* [DataFrameExpression] is a lambda function expecting an `R` result given an instance of [DataFrame]`<T>` as context
42+
* (`this` and `it`).
43+
* `R` can be selected or expressed.
4344
*
4445
* Shorthand for:
4546
* ```kotlin
@@ -51,8 +52,8 @@ public typealias DataFrameExpression<T, R> = Selector<DataFrame<T>, R>
5152
/**
5253
* ## Row Expression
5354
*
54-
* [RowExpression] is used to express or select any instance of `R` using the given instance of [DataRow]`<T>` as
55-
* `this` and `it`.
55+
* [RowExpression] is a lambda function expecting an `R` result given an instance of [DataRow]`<T>` as context
56+
* (`this` and `it`). `R` can be selected or expressed.
5657
*
5758
* Shorthand for:
5859
* ```kotlin
@@ -64,8 +65,8 @@ public typealias RowExpression<T, R> = Selector<DataRow<T>, R>
6465
/**
6566
* ## Row Value Expression
6667
*
67-
* [RowValueExpression] is used to express or select any instance of `R` using the given value `it: C` and the given
68-
* instance of [DataRow]`<T>` as `this`.
68+
* [RowValueExpression] is a lambda function expecting an `R` result given the value `it: C` and an
69+
* instance of [DataRow]`<T>` as context (`this`). `R` can be selected or expressed.
6970
*
7071
* Shorthand for:
7172
* ```kotlin
@@ -77,8 +78,8 @@ public typealias RowValueExpression<T, C, R> = DataRow<T>.(it: C) -> R
7778
/**
7879
* ## Row Column Expression
7980
*
80-
* [RowColumnExpression] is used to express or select any instance of `R` using the given instances of
81-
* [DataRow]`<T>` as `row` and [DataColumn]`<C>` as `col`.
81+
* [RowColumnExpression] is a lambda function expecting an `R` result given an instance of [DataRow]`<T>` as
82+
* `row` and [DataColumn]`<C>` as `col`. `R` can be selected or expressed.
8283
*
8384
* Shorthand for:
8485
* ```kotlin
@@ -90,8 +91,8 @@ public typealias RowColumnExpression<T, C, R> = (row: DataRow<T>, col: DataColum
9091
/**
9192
* ## Column Expression
9293
*
93-
* [ColumnExpression] is used to express or select any instance of `R` using the given instance of [DataColumn]`<C>` as
94-
* `this` and `it`.
94+
* [ColumnExpression] is a lambda function expecting an `R` result given an instance of [DataColumn]`<C>` as context
95+
* (`this` and `it`). `R` can be selected or expressed.
9596
*
9697
* Shorthand for:
9798
* ```kotlin
@@ -103,8 +104,10 @@ public typealias ColumnExpression<C, R> = Selector<DataColumn<C>, R>
103104
/**
104105
* ## Column Selector
105106
*
106-
* A [ColumnSelector] is used to express or select a single column, represented by [SingleColumn]`<C>`, using the
107-
* context of [ColumnsSelectionDsl]`<T>` as `this` and `it`.
107+
* [ColumnSelector] is a lambda function expecting a [SingleColumn]<`C`> result given an instance of [ColumnsSelectionDsl]`<T>`
108+
* as context (`this` and `it`). [SingleColumn]`<C>` can be selected or expressed.
109+
*
110+
* See [Columns Selection DSL][ColumnsSelectionDsl] for more information.
108111
*
109112
* Shorthand for:
110113
* ```kotlin
@@ -116,8 +119,9 @@ public typealias ColumnSelector<T, C> = Selector<ColumnsSelectionDsl<T>, SingleC
116119
/**
117120
* ## Columns Selector
118121
*
119-
* A [ColumnsSelector] is used to express or select one or multiple columns, represented by [ColumnsResolver]`<C>`,
120-
* using the context of [ColumnsSelectionDsl]`<T>` as `this` and `it`.
122+
* [ColumnsSelector] is a lambda function expecting a [ColumnsResolver]<`C`> ([SingleColumn]<`C`> or [ColumnSet]<`C`>)
123+
* result given an instance of [ColumnsSelectionDsl]`<T>` as context (`this` and `it`).
124+
* [ColumnsResolver]<`C`> can be selected or expressed.
121125
*
122126
* See [Columns Selection DSL][ColumnsSelectionDsl] for more information.
123127
*
@@ -135,7 +139,9 @@ public typealias ColumnsSelector<T, C> = Selector<ColumnsSelectionDsl<T>, Column
135139
/**
136140
* ## Row Filter
137141
*
138-
* [RowFilter] is used to filter or find rows using the given instance of [DataRow]`<T>` as `this` and `it`.
142+
* [RowFilter] is a lambda function expecting a [Boolean] result given an instance of [DataRow]`<T>` as context
143+
* (`this` and `it`).
144+
*
139145
* Return `true` if the row should be included in the result.
140146
*
141147
* Shorthand for:
@@ -148,7 +154,9 @@ public typealias RowFilter<T> = RowExpression<T, Boolean>
148154
/**
149155
* ## Column Filter
150156
*
151-
* [ColumnFilter] is used to filter or find columns using the given instance of [ColumnWithPath]`<T>` as `it`.
157+
* [ColumnFilter] is a lambda function expecting a [Boolean] result given an instance of [DataColumn]`<C>` as context
158+
* (`this` and `it`).
159+
*
152160
* Return `true` if the column should be included in the result.
153161
*
154162
* Shorthand for:
@@ -161,8 +169,9 @@ public typealias ColumnFilter<T> = Predicate<ColumnWithPath<T>>
161169
/**
162170
* ## Row Value Filter
163171
*
164-
* [RowValueFilter] is used to filter or find rows using the given value of `it: C` and the given instance of
165-
* [DataRow]`<T>` as `this`.
172+
* [RowValueFilter] is a lambda function expecting a [Boolean] result given the value `it: C` and an instance
173+
* of [DataRow]`<T>` as context (`this`).
174+
*
166175
* Return `true` if the row should be included in the result.
167176
*
168177
* Shorthand for:

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
112112
// except(), allExcept {}, allColsExcept {}
113113
AllExceptColumnsSelectionDsl,
114114

115-
// nameContains(""), childrenNameContains(""), nameStartsWith(""), childrenNameEndsWith("")
115+
// nameContains(""), colsNameContains(""), nameStartsWith(""), childrenNameEndsWith("")
116116
ColumnNameFiltersColumnsSelectionDsl,
117117
// withoutNulls(), colsWithoutNulls()
118118
WithoutNullsColumnsSelectionDsl,
@@ -488,8 +488,11 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
488488
* ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]
489489
*
490490
* Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on
491-
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than [ColumnsSelectionDsl.cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], because all operations of
492-
* the DSL are at your disposal.
491+
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all
492+
* operations of the DSL are at your disposal.
493+
*
494+
* The scope of the new DSL instance is relative to
495+
* the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from.
493496
*
494497
* The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method.
495498
*
@@ -530,8 +533,11 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
530533
* ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]
531534
*
532535
* Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on
533-
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than [ColumnsSelectionDsl.cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], because all operations of
534-
* the DSL are at your disposal.
536+
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all
537+
* operations of the DSL are at your disposal.
538+
*
539+
* The scope of the new DSL instance is relative to
540+
* the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from.
535541
*
536542
* The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method.
537543
*
@@ -579,8 +585,11 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
579585
* ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]
580586
*
581587
* Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on
582-
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than [ColumnsSelectionDsl.cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], because all operations of
583-
* the DSL are at your disposal.
588+
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all
589+
* operations of the DSL are at your disposal.
590+
*
591+
* The scope of the new DSL instance is relative to
592+
* the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from.
584593
*
585594
* The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method.
586595
*
@@ -623,8 +632,11 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
623632
* ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]
624633
*
625634
* Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on
626-
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than [ColumnsSelectionDsl.cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], because all operations of
627-
* the DSL are at your disposal.
635+
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all
636+
* operations of the DSL are at your disposal.
637+
*
638+
* The scope of the new DSL instance is relative to
639+
* the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from.
628640
*
629641
* The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method.
630642
*
@@ -665,8 +677,11 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
665677
* ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]
666678
*
667679
* Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on
668-
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than [ColumnsSelectionDsl.cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], because all operations of
669-
* the DSL are at your disposal.
680+
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all
681+
* operations of the DSL are at your disposal.
682+
*
683+
* The scope of the new DSL instance is relative to
684+
* the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from.
670685
*
671686
* The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method.
672687
*

0 commit comments

Comments
 (0)