Remove 'nearly_stateless' category, do not mention statefulness for terminal operations.
#KT-16994
This commit is contained in:
@@ -37,7 +37,6 @@ fun filtering(): List<GenericFunction> {
|
||||
templates add f("drop(n: Int)") {
|
||||
val n = "\$n"
|
||||
doc { "Returns a list containing all elements except first [n] elements." }
|
||||
sequenceClassification(nearly_stateless)
|
||||
returns("List<T>")
|
||||
body {
|
||||
"""
|
||||
@@ -108,7 +107,6 @@ fun filtering(): List<GenericFunction> {
|
||||
templates add f("take(n: Int)") {
|
||||
val n = "\$n"
|
||||
doc { "Returns a list containing first [n] elements." }
|
||||
sequenceClassification(nearly_stateless)
|
||||
returns("List<T>")
|
||||
body {
|
||||
"""
|
||||
@@ -769,10 +767,10 @@ fun filtering(): List<GenericFunction> {
|
||||
|
||||
val terminalOperationPattern = Regex("^\\w+To")
|
||||
templates.forEach { with (it) {
|
||||
if (sequenceClassification.isEmpty()) {
|
||||
sequenceClassification(if (signature.contains("index", ignoreCase = true)) nearly_stateless else stateless)
|
||||
}
|
||||
sequenceClassification.add(0, if (terminalOperationPattern in signature) terminal else intermediate)
|
||||
if (terminalOperationPattern in signature)
|
||||
sequenceClassification(terminal)
|
||||
else
|
||||
sequenceClassification(intermediate, stateless)
|
||||
} }
|
||||
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ fun generators(): List<GenericFunction> {
|
||||
"""
|
||||
}
|
||||
doc(Sequences) { "Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element]." }
|
||||
sequenceClassification(intermediate, nearly_stateless)
|
||||
sequenceClassification(intermediate, stateless)
|
||||
|
||||
returns("List<T>")
|
||||
returns("SELF", Sets, Sequences)
|
||||
@@ -308,7 +308,7 @@ fun generators(): List<GenericFunction> {
|
||||
|
||||
|
||||
doc(Sequences) { "Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element]." }
|
||||
sequenceClassification(intermediate, nearly_stateless)
|
||||
sequenceClassification(intermediate, stateless)
|
||||
body(Sequences) {
|
||||
"""
|
||||
return object: Sequence<T> {
|
||||
|
||||
@@ -301,7 +301,7 @@ fun mapping(): List<GenericFunction> {
|
||||
@sample samples.collections.Collections.Transformations.groupBy
|
||||
"""
|
||||
}
|
||||
sequenceClassification(terminal, stateful)
|
||||
sequenceClassification(terminal)
|
||||
typeParam("K")
|
||||
returns("Map<K, List<T>>")
|
||||
body { "return groupByTo(LinkedHashMap<K, MutableList<T>>(), keySelector)" }
|
||||
@@ -323,7 +323,7 @@ fun mapping(): List<GenericFunction> {
|
||||
@sample samples.collections.Collections.Transformations.groupBy
|
||||
"""
|
||||
}
|
||||
sequenceClassification(terminal, stateful)
|
||||
sequenceClassification(terminal)
|
||||
returns("M")
|
||||
body {
|
||||
"""
|
||||
@@ -352,7 +352,7 @@ fun mapping(): List<GenericFunction> {
|
||||
@sample samples.collections.Collections.Transformations.groupByKeysAndValues
|
||||
"""
|
||||
}
|
||||
sequenceClassification(terminal, stateful)
|
||||
sequenceClassification(terminal)
|
||||
typeParam("K")
|
||||
typeParam("V")
|
||||
returns("Map<K, List<V>>")
|
||||
@@ -379,7 +379,7 @@ fun mapping(): List<GenericFunction> {
|
||||
@sample samples.collections.Collections.Transformations.groupByKeysAndValues
|
||||
"""
|
||||
}
|
||||
sequenceClassification(terminal, stateful)
|
||||
sequenceClassification(terminal)
|
||||
returns("M")
|
||||
body {
|
||||
"""
|
||||
@@ -425,8 +425,10 @@ fun mapping(): List<GenericFunction> {
|
||||
val terminalOperationPattern = Regex("^\\w+To")
|
||||
templates.forEach { with (it) {
|
||||
if (sequenceClassification.isEmpty()) {
|
||||
sequenceClassification(if (terminalOperationPattern in signature) terminal else intermediate)
|
||||
sequenceClassification(if (signature.contains("index", ignoreCase = true)) nearly_stateless else stateless)
|
||||
if (terminalOperationPattern in signature)
|
||||
sequenceClassification(terminal)
|
||||
else
|
||||
sequenceClassification(intermediate, stateless)
|
||||
}
|
||||
} }
|
||||
return templates
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package templates
|
||||
|
||||
import templates.Family.*
|
||||
import templates.SequenceClass.intermediate
|
||||
import templates.SequenceClass.stateful
|
||||
import templates.SequenceClass.*
|
||||
|
||||
fun ordering(): List<GenericFunction> {
|
||||
val templates = arrayListOf<GenericFunction>()
|
||||
|
||||
@@ -80,7 +80,6 @@ enum class SequenceClass {
|
||||
terminal,
|
||||
intermediate,
|
||||
stateless,
|
||||
nearly_stateless,
|
||||
stateful
|
||||
}
|
||||
|
||||
@@ -457,7 +456,7 @@ class GenericFunction(val signature: String, val keyword: String = "fun") {
|
||||
}
|
||||
if (f == Sequences && sequenceClassification.isNotEmpty()) {
|
||||
builder.append(" *\n")
|
||||
builder.append(" * The operation is ${sequenceClassification.joinToString(" and ") { "_${it.toString().replace('_', ' ')}_" }}.\n")
|
||||
builder.append(" * The operation is ${sequenceClassification.joinToString(" and ") { "_${it}_" }}.\n")
|
||||
}
|
||||
builder.append(" */\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user