Skip to content

Commit 0f9856e

Browse files
remove unnecessary crossinline
1 parent 2472d17 commit 0f9856e

File tree

17 files changed

+39
-57
lines changed

17 files changed

+39
-57
lines changed

core/api/core.api

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ public final class org/jetbrains/kotlinx/dataframe/DataFrameKt {
104104
public static final fun get (Lorg/jetbrains/kotlinx/dataframe/DataFrame;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
105105
public static final fun get (Lorg/jetbrains/kotlinx/dataframe/DataFrame;Lkotlin/ranges/ClosedRange;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
106106
public static final fun get (Lorg/jetbrains/kotlinx/dataframe/DataFrame;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
107-
public static final fun getIndices (Lorg/jetbrains/kotlinx/dataframe/DataFrame;)Lkotlin/ranges/IntRange;
108107
public static final fun size (Lorg/jetbrains/kotlinx/dataframe/DataFrame;)Lorg/jetbrains/kotlinx/dataframe/impl/DataFrameSize;
109108
}
110109

@@ -164,10 +163,6 @@ public final class org/jetbrains/kotlinx/dataframe/DataRow$Companion {
164163
public final fun getEmpty ()Lorg/jetbrains/kotlinx/dataframe/DataRow;
165164
}
166165

167-
public final class org/jetbrains/kotlinx/dataframe/DataRowKt {
168-
public static final fun getIndex (Lorg/jetbrains/kotlinx/dataframe/DataRow;)I
169-
}
170-
171166
public abstract interface class org/jetbrains/kotlinx/dataframe/aggregation/Aggregatable {
172167
}
173168

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataFrame.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ public operator fun <T> DataFrame<T>.get(columnRange: ClosedRange<String>): Data
135135

136136
internal val ColumnsContainer<*>.ncol get() = columnsCount()
137137
internal val AnyFrame.nrow get() = rowsCount()
138-
139-
@PublishedApi
140138
internal val AnyFrame.indices get() = indices()
141139
internal val AnyFrame.size: DataFrameSize get() = size()
142140

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataRow.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ public interface DataRow<out T> {
149149
}
150150

151151
internal val AnyRow.values: List<Any?> get() = values()
152-
153-
@PublishedApi
154152
internal val AnyRow.index: Int get() = index()
155153
internal val <T> DataRow<T>.prev: DataRow<T>? get() = this.prev()
156154
internal val <T> DataRow<T>.next: DataRow<T>? get() = this.next()

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ internal interface DiffOrNullDocs
111111
*/
112112
@OptIn(ExperimentalTypeInference::class)
113113
@OverloadResolutionByLambdaReturnType
114-
public inline fun <T> DataRow<T>.diff(
115-
firstRowResult: Double,
116-
crossinline expression: RowExpression<T, Double>,
117-
): Double =
114+
public inline fun <T> DataRow<T>.diff(firstRowResult: Double, expression: RowExpression<T, Double>): Double =
118115
prev()?.let { p -> expression(this, this) - expression(p, p) }
119116
?: firstRowResult
120117

@@ -124,21 +121,21 @@ public inline fun <T> DataRow<T>.diff(
124121
@OptIn(ExperimentalTypeInference::class)
125122
@OverloadResolutionByLambdaReturnType
126123
// required to resolve `diff(0) { intValue }`
127-
public inline fun <T> DataRow<T>.diff(firstRowResult: Int, crossinline expression: RowExpression<T, Int>): Int =
124+
public inline fun <T> DataRow<T>.diff(firstRowResult: Int, expression: RowExpression<T, Int>): Int =
128125
prev()?.let { p -> expression(this, this) - expression(p, p) }
129126
?: firstRowResult
130127

131128
/**
132129
* @include [DiffDocs]
133130
*/
134-
public inline fun <T> DataRow<T>.diff(firstRowResult: Long, crossinline expression: RowExpression<T, Long>): Long =
131+
public inline fun <T> DataRow<T>.diff(firstRowResult: Long, expression: RowExpression<T, Long>): Long =
135132
prev()?.let { p -> expression(this, this) - expression(p, p) }
136133
?: firstRowResult
137134

138135
/**
139136
* @include [DiffDocs]
140137
*/
141-
public inline fun <T> DataRow<T>.diff(firstRowResult: Float, crossinline expression: RowExpression<T, Float>): Float =
138+
public inline fun <T> DataRow<T>.diff(firstRowResult: Float, expression: RowExpression<T, Float>): Float =
142139
prev()?.let { p -> expression(this, this) - expression(p, p) }
143140
?: firstRowResult
144141

@@ -147,25 +144,25 @@ public inline fun <T> DataRow<T>.diff(firstRowResult: Float, crossinline express
147144
*/
148145
@OptIn(ExperimentalTypeInference::class)
149146
@OverloadResolutionByLambdaReturnType
150-
public inline fun <T> DataRow<T>.diffOrNull(crossinline expression: RowExpression<T, Double>): Double? =
147+
public inline fun <T> DataRow<T>.diffOrNull(expression: RowExpression<T, Double>): Double? =
151148
prev()?.let { p -> expression(this, this) - expression(p, p) }
152149

153150
/**
154151
* @include [DiffOrNullDocs]
155152
*/
156-
public inline fun <T> DataRow<T>.diffOrNull(crossinline expression: RowExpression<T, Int>): Int? =
153+
public inline fun <T> DataRow<T>.diffOrNull(expression: RowExpression<T, Int>): Int? =
157154
prev()?.let { p -> expression(this, this) - expression(p, p) }
158155

159156
/**
160157
* @include [DiffOrNullDocs]
161158
*/
162-
public inline fun <T> DataRow<T>.diffOrNull(crossinline expression: RowExpression<T, Long>): Long? =
159+
public inline fun <T> DataRow<T>.diffOrNull(expression: RowExpression<T, Long>): Long? =
163160
prev()?.let { p -> expression(this, this) - expression(p, p) }
164161

165162
/**
166163
* @include [DiffOrNullDocs]
167164
*/
168-
public inline fun <T> DataRow<T>.diffOrNull(crossinline expression: RowExpression<T, Float>): Float? =
165+
public inline fun <T> DataRow<T>.diffOrNull(expression: RowExpression<T, Float>): Float? =
169166
prev()?.let { p -> expression(this, this) - expression(p, p) }
170167

171168
public fun AnyRow.columnsCount(): Int = df().ncol

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/all.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public fun AnyRow.allNA(): Boolean = owner.columns().all { it[index()].isNA }
5151
// region DataFrame
5252

5353
/** Returns `true` if all [rows] match the given [predicate] or [rows] is empty. */
54-
public inline fun <T> DataFrame<T>.all(crossinline predicate: RowFilter<T>): Boolean = rows().all { predicate(it, it) }
54+
public inline fun <T> DataFrame<T>.all(predicate: RowFilter<T>): Boolean = rows().all { predicate(it, it) }
5555

5656
// endregion
5757

@@ -1243,7 +1243,7 @@ internal inline fun ColumnsResolver<*>.allFromInternal(crossinline colByPredicat
12431243
* @return a new ColumnSet containing all columns that come before the first column that satisfies the given predicate
12441244
*/
12451245
@PublishedApi
1246-
internal fun ColumnsResolver<*>.allBeforeInternal(colByPredicate: ColumnFilter<*>): ColumnSet<*> {
1246+
internal inline fun ColumnsResolver<*>.allBeforeInternal(crossinline colByPredicate: ColumnFilter<*>): ColumnSet<*> {
12471247
var take = true
12481248
return colsInternal {
12491249
if (!take) {

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/any.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ public fun <T> DataColumn<T>.any(predicate: Predicate<T>): Boolean = values.any(
1414

1515
// region DataFrame
1616

17-
public inline fun <T> DataFrame<T>.any(crossinline predicate: RowFilter<T>): Boolean = rows().any { predicate(it, it) }
17+
public inline fun <T> DataFrame<T>.any(predicate: RowFilter<T>): Boolean = rows().any { predicate(it, it) }
1818

1919
// endregion

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/associate.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import org.jetbrains.kotlinx.dataframe.RowExpression
66

77
// region DataFrame
88

9-
public inline fun <T, V> DataFrame<T>.associateBy(crossinline transform: RowExpression<T, V>): Map<V, DataRow<T>> =
9+
public inline fun <T, V> DataFrame<T>.associateBy(transform: RowExpression<T, V>): Map<V, DataRow<T>> =
1010
rows().associateBy { transform(it, it) }
1111

12-
public inline fun <T, K, V> DataFrame<T>.associate(crossinline transform: RowExpression<T, Pair<K, V>>): Map<K, V> =
12+
public inline fun <T, K, V> DataFrame<T>.associate(transform: RowExpression<T, Pair<K, V>>): Map<K, V> =
1313
rows().associate { transform(it, it) }
1414

1515
// endregion

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/count.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ public fun <T> DataColumn<T>.count(predicate: Predicate<T>? = null): Int =
2525

2626
public fun AnyRow.count(): Int = columnsCount()
2727

28-
public inline fun AnyRow.count(crossinline predicate: Predicate<Any?>): Int = values().count(predicate)
28+
public inline fun AnyRow.count(predicate: Predicate<Any?>): Int = values().count(predicate)
2929

3030
// endregion
3131

3232
// region DataFrame
3333

3434
public fun <T> DataFrame<T>.count(): Int = rowsCount()
3535

36-
public inline fun <T> DataFrame<T>.count(crossinline predicate: RowFilter<T>): Int = rows().count { predicate(it, it) }
36+
public inline fun <T> DataFrame<T>.count(predicate: RowFilter<T>): Int = rows().count { predicate(it, it) }
3737

3838
// endregion
3939

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/drop.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import kotlin.reflect.KProperty
2323

2424
// region DataColumn
2525

26-
public inline fun <T> DataColumn<T>.drop(crossinline predicate: Predicate<T>): DataColumn<T> = filter { !predicate(it) }
26+
public inline fun <T> DataColumn<T>.drop(predicate: Predicate<T>): DataColumn<T> = filter { !predicate(it) }
2727

2828
public fun <T> DataColumn<T>.drop(n: Int): DataColumn<T> =
2929
when {
@@ -61,14 +61,13 @@ public fun <T> DataFrame<T>.dropLast(n: Int = 1): DataFrame<T> {
6161
/**
6262
* Returns a DataFrame containing all rows except rows that satisfy the given [predicate].
6363
*/
64-
public inline fun <T> DataFrame<T>.drop(crossinline predicate: RowFilter<T>): DataFrame<T> =
65-
filter { !predicate(it, it) }
64+
public inline fun <T> DataFrame<T>.drop(predicate: RowFilter<T>): DataFrame<T> = filter { !predicate(it, it) }
6665

6766
/**
6867
* Returns a DataFrame containing all rows except first rows that satisfy the given [predicate].
6968
*/
7069
public inline fun <T> DataFrame<T>.dropWhile(crossinline predicate: RowFilter<T>): DataFrame<T> =
71-
firstOrNull { !predicate(it, it) }?.let { drop(it.index) } ?: this
70+
firstOrNull { !predicate(it, it) }?.let { drop(it.index()) } ?: this
7271

7372
// endregion
7473

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/filter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import kotlin.reflect.KProperty
2424

2525
// region DataColumn
2626

27-
public inline fun <T> DataColumn<T>.filter(crossinline predicate: Predicate<T>): DataColumn<T> =
27+
public inline fun <T> DataColumn<T>.filter(predicate: Predicate<T>): DataColumn<T> =
2828
indices
2929
.filter { predicate(get(it)) }
3030
.let { get(it) }
@@ -33,8 +33,8 @@ public inline fun <T> DataColumn<T>.filter(crossinline predicate: Predicate<T>):
3333

3434
// region DataFrame
3535

36-
public inline fun <T> DataFrame<T>.filter(crossinline predicate: RowFilter<T>): DataFrame<T> =
37-
indices.filter {
36+
public inline fun <T> DataFrame<T>.filter(predicate: RowFilter<T>): DataFrame<T> =
37+
indices().filter {
3838
val row = get(it)
3939
predicate(row, row)
4040
}.let { get(it) }

0 commit comments

Comments
 (0)