@@ -300,32 +300,14 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
300
300
*
301
301
* `df.`[select][select]` { `[first][first]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }`
302
302
*
303
- * `df.`[select][select]` { `[first][first]`() }`
304
- *
305
- * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to.
306
- * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the first column that adheres to the given [condition].
307
- * @throws [NoSuchElementException] if no column adheres to the given [condition].
308
- * @see [last]
309
- */
310
- public fun first (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
311
- all().first(condition)
312
-
313
- /* *
314
- * ## First
315
- * Returns the first column in this [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] or [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] that adheres to the given [condition].
316
- *
317
- * For example:
318
- *
319
- * `df.`[select][select]` { myColumnGroup.`[first][first]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }`
320
- *
321
303
* `df.`[select][select]` { myColumnGroup.`[first][first]`() }`
322
304
*
323
305
* @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to.
324
306
* @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the first column that adheres to the given [condition].
325
307
* @throws [NoSuchElementException] if no column adheres to the given [condition].
326
308
* @see [last]
327
309
*/
328
- public fun ColumnGroupReference .first (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
310
+ public fun SingleColumn<AnyRow> .first (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
329
311
all().first(condition)
330
312
331
313
/* *
@@ -406,32 +388,14 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
406
388
*
407
389
* `df.`[select][select]` { `[last][last]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }`
408
390
*
409
- * `df.`[select][select]` { `[first][last]`() }`
410
- *
411
- * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to.
412
- * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the last column that adheres to the given [condition].
413
- * @throws [NoSuchElementException] if no column adheres to the given [condition].
414
- * @see [first]
415
- */
416
- public fun last (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
417
- all().last(condition)
418
-
419
- /* *
420
- * ## Last
421
- * Returns the last column in this [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] or [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] that adheres to the given [condition].
422
- *
423
- * For example:
424
- *
425
- * `df.`[select][select]` { myColumnGroup.`[last][last]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }`
426
- *
427
391
* `df.`[select][select]` { myColumnGroup.`[last][last]`() }`
428
392
*
429
393
* @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to.
430
394
* @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the last column that adheres to the given [condition].
431
395
* @throws [NoSuchElementException] if no column adheres to the given [condition].
432
396
* @see [first]
433
397
*/
434
- public fun ColumnGroupReference .last (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
398
+ public fun SingleColumn<AnyRow> .last (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
435
399
all().last(condition)
436
400
437
401
/* *
@@ -512,32 +476,14 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
512
476
*
513
477
* `df.`[select][select]` { `[single][single]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }`
514
478
*
515
- * `df.`[select][select]` { `[single][single]`() }`
516
- *
517
- * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to.
518
- * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the single column that adheres to the given [condition].
519
- * @throws [NoSuchElementException] if no column adheres to the given [condition].
520
- * @throws [IllegalArgumentException] if more than one column adheres to the given [condition].
521
- */
522
- public fun single (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
523
- all().single(condition)
524
-
525
- /* *
526
- * ## Single
527
- * Returns the single column in this [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] or [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] that adheres to the given [condition].
528
- *
529
- * For example:
530
- *
531
- * `df.`[select][select]` { myColumnGroup.`[single][single]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }`
532
- *
533
479
* `df.`[select][select]` { myColumnGroup.`[single][single]`() }`
534
480
*
535
481
* @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to.
536
482
* @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the single column that adheres to the given [condition].
537
483
* @throws [NoSuchElementException] if no column adheres to the given [condition].
538
484
* @throws [IllegalArgumentException] if more than one column adheres to the given [condition].
539
485
*/
540
- public fun ColumnGroupReference .single (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
486
+ public fun SingleColumn<AnyRow> .single (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
541
487
all().single(condition)
542
488
543
489
/* *
@@ -572,18 +518,184 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
572
518
public fun KProperty <* >.single (condition : ColumnFilter <* > = { true }): SingleColumn <* > =
573
519
getColumnGroup(this ).single(condition)
574
520
521
+ /* * TODO */
575
522
public fun SingleColumn<AnyRow>.col (index : Int ): SingleColumn <Any ?> = getChildrenAt(index).singleImpl()
576
523
524
+ /* * TODO */
577
525
public operator fun <C > ColumnSet<C>.get (index : Int ): SingleColumn <C > = getAt(index)
578
526
527
+ /* * TODO */
579
528
public fun ColumnsContainer <* >.group (name : String ): ColumnGroupReference = name.toColumnOf()
580
529
530
+ /* *
531
+ * ## Subset of Columns
532
+ * Returns a [ColumnSet] containing all columns from [this\] to [endInclusive\].
533
+ *
534
+ * For example:
535
+ *
536
+ * `df.`[select][DataFrame.select]` { `{@includeArg [Example]}` }`
537
+ *
538
+ * @param [endInclusive\] The last column in the subset.
539
+ * @receiver The first column in the subset.
540
+ * @return A [ColumnSet] containing all columns from [this\] to [endInclusive\].
541
+ * @throws [IllegalArgumentException\] if the columns have different parents.
542
+ */
543
+ private interface CommonSubsetOfColumnsDocs {
544
+
545
+ /* * Examples key */
546
+ interface Example
547
+ }
548
+
549
+ /* *
550
+ * ## Subset of Columns
551
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
552
+ *
553
+ * For example:
554
+ *
555
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `"fromColumn".."toColumn"` }`
556
+ *
557
+ * @param [endInclusive] The last column in the subset.
558
+ * @receiver The first column in the subset.
559
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
560
+ * @throws [IllegalArgumentException] if the columns have different parents.
561
+ *
562
+ */
581
563
public operator fun String.rangeTo (endInclusive : String ): ColumnSet <* > =
582
564
toColumnAccessor().rangeTo(endInclusive.toColumnAccessor())
583
565
566
+ /* *
567
+ * ## Subset of Columns
568
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
569
+ *
570
+ * For example:
571
+ *
572
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `"fromColumn"..Type::toColumn` }`
573
+ *
574
+ * @param [endInclusive] The last column in the subset.
575
+ * @receiver The first column in the subset.
576
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
577
+ * @throws [IllegalArgumentException] if the columns have different parents.
578
+ *
579
+ */
580
+ public operator fun String.rangeTo (endInclusive : KProperty <* >): ColumnSet <* > =
581
+ toColumnAccessor().rangeTo(endInclusive.toColumnAccessor())
582
+
583
+ /* *
584
+ * ## Subset of Columns
585
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
586
+ *
587
+ * For example:
588
+ *
589
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `"fromColumn"..toColumn` }`
590
+ *
591
+ * @param [endInclusive] The last column in the subset.
592
+ * @receiver The first column in the subset.
593
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
594
+ * @throws [IllegalArgumentException] if the columns have different parents.
595
+ *
596
+ */
597
+ public operator fun String.rangeTo (endInclusive : AnyColumnReference ): ColumnSet <* > =
598
+ toColumnAccessor().rangeTo(endInclusive)
599
+
600
+ /* *
601
+ * ## Subset of Columns
602
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
603
+ *
604
+ * For example:
605
+ *
606
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `Type::fromColumn.."toColumn"` }`
607
+ *
608
+ * @param [endInclusive] The last column in the subset.
609
+ * @receiver The first column in the subset.
610
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
611
+ * @throws [IllegalArgumentException] if the columns have different parents.
612
+ *
613
+ */
614
+ public operator fun KProperty <* >.rangeTo (endInclusive : String ): ColumnSet <* > =
615
+ toColumnAccessor().rangeTo(endInclusive.toColumnAccessor())
616
+
617
+ /* *
618
+ * ## Subset of Columns
619
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
620
+ *
621
+ * For example:
622
+ *
623
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `Type::fromColumn..Type::toColumn` }`
624
+ *
625
+ * @param [endInclusive] The last column in the subset.
626
+ * @receiver The first column in the subset.
627
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
628
+ * @throws [IllegalArgumentException] if the columns have different parents.
629
+ *
630
+ */
584
631
public operator fun KProperty <* >.rangeTo (endInclusive : KProperty <* >): ColumnSet <* > =
585
632
toColumnAccessor().rangeTo(endInclusive.toColumnAccessor())
586
633
634
+ /* *
635
+ * ## Subset of Columns
636
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
637
+ *
638
+ * For example:
639
+ *
640
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `Type::fromColumn..toColumn` }`
641
+ *
642
+ * @param [endInclusive] The last column in the subset.
643
+ * @receiver The first column in the subset.
644
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
645
+ * @throws [IllegalArgumentException] if the columns have different parents.
646
+ *
647
+ */
648
+ public operator fun KProperty <* >.rangeTo (endInclusive : AnyColumnReference ): ColumnSet <* > =
649
+ toColumnAccessor().rangeTo(endInclusive)
650
+
651
+ /* *
652
+ * ## Subset of Columns
653
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
654
+ *
655
+ * For example:
656
+ *
657
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `fromColumn.."toColumn"` }`
658
+ *
659
+ * @param [endInclusive] The last column in the subset.
660
+ * @receiver The first column in the subset.
661
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
662
+ * @throws [IllegalArgumentException] if the columns have different parents.
663
+ *
664
+ */
665
+ public operator fun AnyColumnReference.rangeTo (endInclusive : String ): ColumnSet <* > =
666
+ rangeTo(endInclusive.toColumnAccessor())
667
+
668
+ /* *
669
+ * ## Subset of Columns
670
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
671
+ *
672
+ * For example:
673
+ *
674
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `fromColumn..Type::toColumn` }`
675
+ *
676
+ * @param [endInclusive] The last column in the subset.
677
+ * @receiver The first column in the subset.
678
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
679
+ * @throws [IllegalArgumentException] if the columns have different parents.
680
+ *
681
+ */
682
+ public operator fun AnyColumnReference.rangeTo (endInclusive : KProperty <* >): ColumnSet <* > =
683
+ rangeTo(endInclusive.toColumnAccessor())
684
+
685
+ /* *
686
+ * ## Subset of Columns
687
+ * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
688
+ *
689
+ * For example:
690
+ *
691
+ * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `fromColumn..toColumn` }`
692
+ *
693
+ * @param [endInclusive] The last column in the subset.
694
+ * @receiver The first column in the subset.
695
+ * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive].
696
+ * @throws [IllegalArgumentException] if the columns have different parents.
697
+ *
698
+ */
587
699
public operator fun AnyColumnReference.rangeTo (endInclusive : AnyColumnReference ): ColumnSet <* > =
588
700
object : ColumnSet <Any ?> {
589
701
override fun resolve (context : ColumnResolutionContext ): List <ColumnWithPath <Any ?>> {
0 commit comments