Skip to content

Commit a567efc

Browse files
authored
Merge pull request #1200 from Kotlin/unify-numbers-docs
Number unification docs
2 parents fc53fec + 1194f29 commit a567efc

21 files changed

+407
-71
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import org.jetbrains.kotlinx.dataframe.impl.UnifiedNumberTypeOptions
2727
* UByte Byte
2828
* \ /
2929
* \ /
30-
* Nothing?
30+
* Nothing
3131
* ```
3232
* For each number type in the graph, it holds that a number of that type can be expressed lossless by
3333
* a number of a more complex type (any of its parents).
@@ -40,6 +40,11 @@ import org.jetbrains.kotlinx.dataframe.impl.UnifiedNumberTypeOptions
4040
*
4141
* See [UnifiedNumberTypeOptions] for these settings.
4242
*
43-
* At the bottom of the graph is [Nothing]. This can be interpreted as `null`.
43+
* Nullability, while not displayed in the graph, is also taken into account.
44+
* This means that `Int?` and `Float` will be unified to `Double?`.
45+
*
46+
* At the bottom of the graph is [Nothing].
47+
* This can be interpreted as "no type" and can have no instance,
48+
* while [Nothing?][Nothing] can only be `null`.
4449
*/
4550
public interface UnifyingNumbers

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ internal annotation class ExcludeFromSources
5050
* @param stripReferences Whether to strip `[references]` from the HTML file. Default is `true`.
5151
* This is useful when you want to include the HTML file in a website, where the references are not
5252
* needed or would break.
53+
* @param includeResizeScript Whether to include a script that helps height recalculation inside iFrames.
54+
* This is useful inside WriterSide. Default is `true`.
5355
*/
5456
@Target(
5557
CLASS,
@@ -66,4 +68,8 @@ internal annotation class ExcludeFromSources
6668
TYPEALIAS,
6769
FILE,
6870
)
69-
internal annotation class ExportAsHtml(val theme: Boolean = true, val stripReferences: Boolean = true)
71+
internal annotation class ExportAsHtml(
72+
val theme: Boolean = true,
73+
val stripReferences: Boolean = true,
74+
val includeResizeScript: Boolean = true,
75+
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private val unifiedNumberTypeGraphs = mutableMapOf<UnifiedNumberTypeOptions, Dir
5252
* UByte Byte
5353
* \ /
5454
* \ /
55-
* Nothing?
55+
* Nothing
5656
* ```
5757
*
5858
* For any two numbers, we can find the nearest common ancestor in this graph
@@ -127,7 +127,7 @@ internal fun getUnifiedNumberTypeGraph(
127127
* UByte Byte
128128
* \ /
129129
* \ /
130-
* Nothing?
130+
* Nothing
131131
* ```
132132
*
133133
* For any two numbers, we can find the nearest common ancestor in this graph

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/types/UtilTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class UtilTests {
438438
* UByte Byte
439439
* \ /
440440
* \ /
441-
* Nothing?
441+
* Nothing
442442
* ```
443443
*/
444444
@Test

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/UnifyingNumbers.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ import org.jetbrains.kotlinx.dataframe.impl.UnifiedNumberTypeOptions
2222
*
2323
* See [UnifiedNumberTypeOptions] for these settings.
2424
*
25-
* At the bottom of the graph is [Nothing]. This can be interpreted as `null`.
25+
* Nullability, while not displayed in the graph, is also taken into account.
26+
* This means that `Int?` and `Float` will be unified to `Double?`.
27+
*
28+
* At the bottom of the graph is [Nothing].
29+
* This can be interpreted as "no type" and can have no instance,
30+
* while [Nothing?][Nothing] can only be `null`.
2631
*/
2732
public interface UnifyingNumbers {
2833

@@ -44,9 +49,10 @@ public interface UnifyingNumbers {
4449
* UByte Byte
4550
* \\ /
4651
* \\ /
47-
* Nothing?
52+
* Nothing
4853
* ```
4954
*/
5055
@ExcludeFromSources
56+
@ExportAsHtml
5157
private interface Graph
5258
}

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/utils.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ internal annotation class ExcludeFromSources
8282
* @param stripReferences Whether to strip `[references]` from the HTML file. Default is `true`.
8383
* This is useful when you want to include the HTML file in a website, where the references are not
8484
* needed or would break.
85+
* @param includeResizeScript Whether to include a script that helps height recalculation inside iFrames.
86+
* This is useful inside WriterSide. Default is `true`.
8587
*/
8688
@Target(
8789
CLASS,
@@ -98,4 +100,8 @@ internal annotation class ExcludeFromSources
98100
TYPEALIAS,
99101
FILE,
100102
)
101-
internal annotation class ExportAsHtml(val theme: Boolean = true, val stripReferences: Boolean = true)
103+
internal annotation class ExportAsHtml(
104+
val theme: Boolean = true,
105+
val stripReferences: Boolean = true,
106+
val includeResizeScript: Boolean = true,
107+
)

dataframe-csv/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DelimParams.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ internal object DelimParams {
9292
*
9393
* Fixed-width columns can occur, for instance, in multi-space delimited data, where the columns are separated
9494
* by multiple spaces instead of a single delimiter, so columns are visually aligned.
95-
* Columns widths are determined by the header in the data (if present), or manually by setting
95+
* Column widths are determined by the header in the data (if present), or manually by setting
9696
* [fixedColumnWidths].
9797
*/
9898
const val HAS_FIXED_WIDTH_COLUMNS: Boolean = false
@@ -163,7 +163,7 @@ internal object DelimParams {
163163
const val IGNORE_EMPTY_LINES: Boolean = false
164164

165165
/**
166-
* @param allowMissingColumns Wether to allow rows with fewer columns than the header. Default: `true`.
166+
* @param allowMissingColumns Whether to allow rows with fewer columns than the header. Default: `true`.
167167
*
168168
* If `true`, rows that are too short will be interpreted as _empty_ values.
169169
*/
@@ -201,7 +201,7 @@ internal object DelimParams {
201201
* @param parseParallel Whether to parse the data in parallel. Default: `true`.
202202
*
203203
* If `true`, the data will be read and parsed in parallel by the Deephaven parser.
204-
* This is usually faster, but can be turned off for debugging.
204+
* This is usually faster but can be turned off for debugging.
205205
*/
206206
const val PARSE_PARALLEL: Boolean = true
207207

dataframe-csv/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/io/readDelim.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ import kotlin.time.Duration
7979
*
8080
* Fixed-width columns can occur, for instance, in multi-space delimited data, where the columns are separated
8181
* by multiple spaces instead of a single delimiter, so columns are visually aligned.
82-
* Columns widths are determined by the header in the data (if present), or manually by setting
82+
* Column widths are determined by the header in the data (if present), or manually by setting
8383
* [fixedColumnWidths].
8484
* @param fixedColumnWidths The fixed column widths. Default: empty list.
8585
*
@@ -102,7 +102,7 @@ import kotlin.time.Duration
102102
* @param ignoreEmptyLines Whether to skip intermediate empty lines. Default: `false`.
103103
*
104104
* If `false`, empty lines will be interpreted as having _empty_ values if [allowMissingColumns].
105-
* @param allowMissingColumns Wether to allow rows with fewer columns than the header. Default: `true`.
105+
* @param allowMissingColumns Whether to allow rows with fewer columns than the header. Default: `true`.
106106
*
107107
* If `true`, rows that are too short will be interpreted as _empty_ values.
108108
* @param ignoreExcessColumns Whether to ignore rows with more columns than the header. Default: `true`.
@@ -120,7 +120,7 @@ import kotlin.time.Duration
120120
* @param parseParallel Whether to parse the data in parallel. Default: `true`.
121121
*
122122
* If `true`, the data will be read and parsed in parallel by the Deephaven parser.
123-
* This is usually faster, but can be turned off for debugging.
123+
* This is usually faster but can be turned off for debugging.
124124
* @param compression The compression of the data.
125125
* Default: [Compression.None], unless detected otherwise from the input file or url.
126126
* @param adjustCsvSpecs Optional extra [CsvSpecs] configuration. Default: `{ it }`.

dataframe-csv/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/readCsv.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ import kotlin.io.path.inputStream
8282
*
8383
* Fixed-width columns can occur, for instance, in multi-space delimited data, where the columns are separated
8484
* by multiple spaces instead of a single delimiter, so columns are visually aligned.
85-
* Columns widths are determined by the header in the data (if present), or manually by setting
85+
* Column widths are determined by the header in the data (if present), or manually by setting
8686
* [fixedColumnWidths].
8787
* @param fixedColumnWidths The fixed column widths. Default: empty list.
8888
*
@@ -119,7 +119,7 @@ import kotlin.io.path.inputStream
119119
* @param ignoreEmptyLines Whether to skip intermediate empty lines. Default: `false`.
120120
*
121121
* If `false`, empty lines will be interpreted as having _empty_ values if [allowMissingColumns].
122-
* @param allowMissingColumns Wether to allow rows with fewer columns than the header. Default: `true`.
122+
* @param allowMissingColumns Whether to allow rows with fewer columns than the header. Default: `true`.
123123
*
124124
* If `true`, rows that are too short will be interpreted as _empty_ values.
125125
* @param ignoreExcessColumns Whether to ignore rows with more columns than the header. Default: `true`.
@@ -137,7 +137,7 @@ import kotlin.io.path.inputStream
137137
* @param parseParallel Whether to parse the data in parallel. Default: `true`.
138138
*
139139
* If `true`, the data will be read and parsed in parallel by the Deephaven parser.
140-
* This is usually faster, but can be turned off for debugging.
140+
* This is usually faster but can be turned off for debugging.
141141
*/
142142
public fun DataFrame.Companion.readCsv(
143143
path: Path,
@@ -234,7 +234,7 @@ public fun DataFrame.Companion.readCsv(
234234
*
235235
* Fixed-width columns can occur, for instance, in multi-space delimited data, where the columns are separated
236236
* by multiple spaces instead of a single delimiter, so columns are visually aligned.
237-
* Columns widths are determined by the header in the data (if present), or manually by setting
237+
* Column widths are determined by the header in the data (if present), or manually by setting
238238
* [fixedColumnWidths].
239239
* @param fixedColumnWidths The fixed column widths. Default: empty list.
240240
*
@@ -271,7 +271,7 @@ public fun DataFrame.Companion.readCsv(
271271
* @param ignoreEmptyLines Whether to skip intermediate empty lines. Default: `false`.
272272
*
273273
* If `false`, empty lines will be interpreted as having _empty_ values if [allowMissingColumns].
274-
* @param allowMissingColumns Wether to allow rows with fewer columns than the header. Default: `true`.
274+
* @param allowMissingColumns Whether to allow rows with fewer columns than the header. Default: `true`.
275275
*
276276
* If `true`, rows that are too short will be interpreted as _empty_ values.
277277
* @param ignoreExcessColumns Whether to ignore rows with more columns than the header. Default: `true`.
@@ -289,7 +289,7 @@ public fun DataFrame.Companion.readCsv(
289289
* @param parseParallel Whether to parse the data in parallel. Default: `true`.
290290
*
291291
* If `true`, the data will be read and parsed in parallel by the Deephaven parser.
292-
* This is usually faster, but can be turned off for debugging.
292+
* This is usually faster but can be turned off for debugging.
293293
*/
294294
public fun DataFrame.Companion.readCsv(
295295
file: File,
@@ -386,7 +386,7 @@ public fun DataFrame.Companion.readCsv(
386386
*
387387
* Fixed-width columns can occur, for instance, in multi-space delimited data, where the columns are separated
388388
* by multiple spaces instead of a single delimiter, so columns are visually aligned.
389-
* Columns widths are determined by the header in the data (if present), or manually by setting
389+
* Column widths are determined by the header in the data (if present), or manually by setting
390390
* [fixedColumnWidths].
391391
* @param fixedColumnWidths The fixed column widths. Default: empty list.
392392
*
@@ -423,7 +423,7 @@ public fun DataFrame.Companion.readCsv(
423423
* @param ignoreEmptyLines Whether to skip intermediate empty lines. Default: `false`.
424424
*
425425
* If `false`, empty lines will be interpreted as having _empty_ values if [allowMissingColumns].
426-
* @param allowMissingColumns Wether to allow rows with fewer columns than the header. Default: `true`.
426+
* @param allowMissingColumns Whether to allow rows with fewer columns than the header. Default: `true`.
427427
*
428428
* If `true`, rows that are too short will be interpreted as _empty_ values.
429429
* @param ignoreExcessColumns Whether to ignore rows with more columns than the header. Default: `true`.
@@ -441,7 +441,7 @@ public fun DataFrame.Companion.readCsv(
441441
* @param parseParallel Whether to parse the data in parallel. Default: `true`.
442442
*
443443
* If `true`, the data will be read and parsed in parallel by the Deephaven parser.
444-
* This is usually faster, but can be turned off for debugging.
444+
* This is usually faster but can be turned off for debugging.
445445
*/
446446
public fun DataFrame.Companion.readCsv(
447447
url: URL,
@@ -538,7 +538,7 @@ public fun DataFrame.Companion.readCsv(
538538
*
539539
* Fixed-width columns can occur, for instance, in multi-space delimited data, where the columns are separated
540540
* by multiple spaces instead of a single delimiter, so columns are visually aligned.
541-
* Columns widths are determined by the header in the data (if present), or manually by setting
541+
* Column widths are determined by the header in the data (if present), or manually by setting
542542
* [fixedColumnWidths].
543543
* @param fixedColumnWidths The fixed column widths. Default: empty list.
544544
*
@@ -575,7 +575,7 @@ public fun DataFrame.Companion.readCsv(
575575
* @param ignoreEmptyLines Whether to skip intermediate empty lines. Default: `false`.
576576
*
577577
* If `false`, empty lines will be interpreted as having _empty_ values if [allowMissingColumns].
578-
* @param allowMissingColumns Wether to allow rows with fewer columns than the header. Default: `true`.
578+
* @param allowMissingColumns Whether to allow rows with fewer columns than the header. Default: `true`.
579579
*
580580
* If `true`, rows that are too short will be interpreted as _empty_ values.
581581
* @param ignoreExcessColumns Whether to ignore rows with more columns than the header. Default: `true`.
@@ -593,7 +593,7 @@ public fun DataFrame.Companion.readCsv(
593593
* @param parseParallel Whether to parse the data in parallel. Default: `true`.
594594
*
595595
* If `true`, the data will be read and parsed in parallel by the Deephaven parser.
596-
* This is usually faster, but can be turned off for debugging.
596+
* This is usually faster but can be turned off for debugging.
597597
*/
598598
public fun DataFrame.Companion.readCsv(
599599
fileOrUrl: String,
@@ -690,7 +690,7 @@ public fun DataFrame.Companion.readCsv(
690690
*
691691
* Fixed-width columns can occur, for instance, in multi-space delimited data, where the columns are separated
692692
* by multiple spaces instead of a single delimiter, so columns are visually aligned.
693-
* Columns widths are determined by the header in the data (if present), or manually by setting
693+
* Column widths are determined by the header in the data (if present), or manually by setting
694694
* [fixedColumnWidths].
695695
* @param fixedColumnWidths The fixed column widths. Default: empty list.
696696
*
@@ -727,7 +727,7 @@ public fun DataFrame.Companion.readCsv(
727727
* @param ignoreEmptyLines Whether to skip intermediate empty lines. Default: `false`.
728728
*
729729
* If `false`, empty lines will be interpreted as having _empty_ values if [allowMissingColumns].
730-
* @param allowMissingColumns Wether to allow rows with fewer columns than the header. Default: `true`.
730+
* @param allowMissingColumns Whether to allow rows with fewer columns than the header. Default: `true`.
731731
*
732732
* If `true`, rows that are too short will be interpreted as _empty_ values.
733733
* @param ignoreExcessColumns Whether to ignore rows with more columns than the header. Default: `true`.
@@ -745,7 +745,7 @@ public fun DataFrame.Companion.readCsv(
745745
* @param parseParallel Whether to parse the data in parallel. Default: `true`.
746746
*
747747
* If `true`, the data will be read and parsed in parallel by the Deephaven parser.
748-
* This is usually faster, but can be turned off for debugging.
748+
* This is usually faster but can be turned off for debugging.
749749
* @param adjustCsvSpecs Optional extra [CsvSpecs] configuration. Default: `{ it }`.
750750
*
751751
* Before instantiating the [CsvSpecs], the [CsvSpecs.Builder] will be passed to this lambda.

dataframe-csv/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/readCsvStr.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import org.jetbrains.kotlinx.dataframe.impl.io.readDelimImpl
7070
*
7171
* Fixed-width columns can occur, for instance, in multi-space delimited data, where the columns are separated
7272
* by multiple spaces instead of a single delimiter, so columns are visually aligned.
73-
* Columns widths are determined by the header in the data (if present), or manually by setting
73+
* Column widths are determined by the header in the data (if present), or manually by setting
7474
* [fixedColumnWidths].
7575
* @param fixedColumnWidths The fixed column widths. Default: empty list.
7676
*
@@ -107,7 +107,7 @@ import org.jetbrains.kotlinx.dataframe.impl.io.readDelimImpl
107107
* @param ignoreEmptyLines Whether to skip intermediate empty lines. Default: `false`.
108108
*
109109
* If `false`, empty lines will be interpreted as having _empty_ values if [allowMissingColumns].
110-
* @param allowMissingColumns Wether to allow rows with fewer columns than the header. Default: `true`.
110+
* @param allowMissingColumns Whether to allow rows with fewer columns than the header. Default: `true`.
111111
*
112112
* If `true`, rows that are too short will be interpreted as _empty_ values.
113113
* @param ignoreExcessColumns Whether to ignore rows with more columns than the header. Default: `true`.
@@ -125,7 +125,7 @@ import org.jetbrains.kotlinx.dataframe.impl.io.readDelimImpl
125125
* @param parseParallel Whether to parse the data in parallel. Default: `true`.
126126
*
127127
* If `true`, the data will be read and parsed in parallel by the Deephaven parser.
128-
* This is usually faster, but can be turned off for debugging.
128+
* This is usually faster but can be turned off for debugging.
129129
*/
130130
public fun DataFrame.Companion.readCsvStr(
131131
text: String,

0 commit comments

Comments
 (0)