max()/minI() supported

This commit is contained in:
Valentin Kipyatkov
2016-08-17 18:49:13 +03:00
parent 26cdd0d5d5
commit 930f7960ea
16 changed files with 295 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
fun getMaxLineWidth(lineCount: Int): Float {
var max_width = 0.0f
<caret>for (i in 0..lineCount - 1) {
val width = getLineWidth(i)
if (width > max_width) {
max_width = width
}
}
return max_width
}
fun getLineWidth(i: Int): Float = TODO()
+12
View File
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.max()
?: 0.0f
return max_width
}
fun getLineWidth(i: Int): Float = TODO()
+13
View File
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.max()
?: 0.0f
return max_width
}
fun getLineWidth(i: Int): Float = TODO()
+15
View File
@@ -0,0 +1,15 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
fun getMaxLineWidth(lineCount: Int): Float {
var max_width = 0.0f
<caret>for (i in 0..lineCount - 1) {
val width = getLineWidth(i)
if (max_width < width) {
max_width = width
}
}
return max_width
}
fun getLineWidth(i: Int): Float = TODO()
+12
View File
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.max()
?: 0.0f
return max_width
}
fun getLineWidth(i: Int): Float = TODO()
+13
View File
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.max()
?: 0.0f
return max_width
}
fun getLineWidth(i: Int): Float = TODO()
+15
View File
@@ -0,0 +1,15 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
fun getMinLineWidth(lineCount: Int): Double {
var min_width = Double.MAX_VALUE
<caret>for (i in 0..lineCount - 1) {
val width = getLineWidth(i)
if (width < min_width) {
min_width = width
}
}
return min_width
}
fun getLineWidth(i: Int): Double = TODO()
+12
View File
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.min()
?: Double.MAX_VALUE
return min_width
}
fun getLineWidth(i: Int): Double = TODO()
+13
View File
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.min()
?: Double.MAX_VALUE
return min_width
}
fun getLineWidth(i: Int): Double = TODO()
+15
View File
@@ -0,0 +1,15 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
fun getMinLineWidth(lineCount: Int): Double {
var min_width = Double.MAX_VALUE
<caret>for (i in 0..lineCount - 1) {
val width = getLineWidth(i)
if (min_width > width) {
min_width = width
}
}
return min_width
}
fun getLineWidth(i: Int): Double = TODO()
+12
View File
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.min()
?: Double.MAX_VALUE
return min_width
}
fun getLineWidth(i: Int): Double = TODO()
+13
View File
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.min()
?: Double.MAX_VALUE
return min_width
}
fun getLineWidth(i: Int): Double = TODO()