From 75fd9207352c2cdbd4ad4de1275a0f8639f83f76 Mon Sep 17 00:00:00 2001 From: Gleb Minaev <43728100+lounres@users.noreply.github.com> Date: Wed, 16 Mar 2022 23:22:51 +0300 Subject: [PATCH] Deleted suddenly missed region marks and unused error classes --- .../kmath/functions/LabeledPolynomial.kt | 15 -------- .../functions/LabeledRationalFunction.kt | 15 -------- .../kmath/functions/NumberedPolynomial.kt | 17 +-------- .../functions/NumberedRationalFunction.kt | 15 -------- .../kscience/kmath/functions/Polynomial.kt | 37 ------------------- .../kmath/functions/RationalFunction.kt | 15 -------- 6 files changed, 1 insertion(+), 113 deletions(-) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/LabeledPolynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/LabeledPolynomial.kt index f4dd74b94..d263b7102 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/LabeledPolynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/LabeledPolynomial.kt @@ -48,21 +48,6 @@ internal constructor( override fun toString(): String = "LabeledPolynomial$coefficients" } -/** - * Represents internal [LabeledPolynomial] errors. - */ -internal class LabeledPolynomialError: Error { - constructor(): super() - constructor(message: String): super(message) - constructor(message: String?, cause: Throwable?): super(message, cause) - constructor(cause: Throwable?): super(cause) -} - -/** - * Throws an [LabeledPolynomialError] with the given [message]. - */ -internal fun labeledPolynomialError(message: Any): Nothing = throw LabeledPolynomialError(message.toString()) - /** * Returns the same degrees description of the monomial, but without zero degrees. */ diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/LabeledRationalFunction.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/LabeledRationalFunction.kt index 3908933e6..9b5022f85 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/LabeledRationalFunction.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/LabeledRationalFunction.kt @@ -17,21 +17,6 @@ public class LabeledRationalFunction( override fun toString(): String = "LabeledRationalFunction${numerator.coefficients}/${denominator.coefficients}" } -/** - * Represents internal [LabeledRationalFunction] errors. - */ -internal class LabeledRationalFunctionError : Error { - constructor(): super() - constructor(message: String): super(message) - constructor(message: String?, cause: Throwable?): super(message, cause) - constructor(cause: Throwable?): super(cause) -} - -/** - * Throws an [LabeledRationalFunctionError] with the given [message]. - */ -internal fun labeledRationalFunctionError(message: Any): Nothing = throw LabeledRationalFunctionError(message.toString()) - // Waiting for context receivers :( TODO: Replace with context receivers when they will be available //context(RationalFunctionSpace) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/NumberedPolynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/NumberedPolynomial.kt index fe6bb597d..307b78f29 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/NumberedPolynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/NumberedPolynomial.kt @@ -48,22 +48,7 @@ internal constructor( } /** - * Represents internal [Polynomial] errors. - */ -internal class NumberedPolynomialError : Error { - constructor(): super() - constructor(message: String): super(message) - constructor(message: String?, cause: Throwable?): super(message, cause) - constructor(cause: Throwable?): super(cause) -} - -/** - * Throws an [PolynomialError] with the given [message]. - */ -internal fun numberedPolynomialError(message: Any): Nothing = throw PolynomialError(message.toString()) - -/** - * Returns the same degrees description of the monomial, but without extra zero degrees on the end. + * Returns the same degrees' description of the monomial, but without extra zero degrees on the end. */ internal fun List.cleanUp() = subList(0, indexOfLast { it != 0U } + 1) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/NumberedRationalFunction.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/NumberedRationalFunction.kt index 745df10e8..8e3b3b1c5 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/NumberedRationalFunction.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/NumberedRationalFunction.kt @@ -16,21 +16,6 @@ public class NumberedRationalFunction internal constructor( override fun toString(): String = "NumberedRationalFunction${numerator.coefficients}/${denominator.coefficients}" } -/** - * Represents internal [NumberedRationalFunction] errors. - */ -internal class NumberedRationalFunctionError : Error { - constructor(): super() - constructor(message: String): super(message) - constructor(message: String?, cause: Throwable?): super(message, cause) - constructor(cause: Throwable?): super(cause) -} - -/** - * Throws an [NumberedRationalFunctionError] with the given [message]. - */ -internal fun numberedRationalFunctionError(message: Any): Nothing = throw NumberedRationalFunctionError(message.toString()) - // Waiting for context receivers :( TODO: Replace with context receivers when they will be available //context(RationalFunctionSpace) diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt index 3f3838f53..c6f649fe8 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt @@ -43,27 +43,6 @@ public data class Polynomial( override fun toString(): String = "Polynomial$coefficients" } -// region Internal utilities - -/** - * Represents internal [Polynomial] errors. - */ -internal class PolynomialError : Error { - constructor(): super() - constructor(message: String): super(message) - constructor(message: String?, cause: Throwable?): super(message, cause) - constructor(cause: Throwable?): super(cause) -} - -/** - * Throws an [PolynomialError] with the given [message]. - */ -internal fun polynomialError(message: Any): Nothing = throw PolynomialError(message.toString()) - -// endregion - -// region Constructors and converters - /** * Returns a [Polynomial] instance with given [coefficients]. The collection of coefficients will be reversed if * [reverse] parameter is true. @@ -82,8 +61,6 @@ public fun Polynomial(vararg coefficients: C, reverse: Boolean = false): Pol public fun C.asPolynomial() : Polynomial = Polynomial(listOf(this)) -// endregion - /** * Space of univariate polynomials constructed over ring. * @@ -94,8 +71,6 @@ public fun C.asPolynomial() : Polynomial = Polynomial(listOf(this)) public open class PolynomialSpace>( public override val ring: A, ) : AbstractPolynomialSpaceOverRing, A> { - - // region Polynomial-integer relation /** * Returns sum of the polynomial and the integer represented as polynomial. * @@ -152,9 +127,7 @@ public open class PolynomialSpace>( .subList(0, degree + 1) .map { it * other } ) - // endregion - // region Integer-polynomial relation /** * Returns sum of the integer represented as polynomial and the polynomial. * @@ -213,9 +186,7 @@ public open class PolynomialSpace>( .subList(0, other.degree + 1) .map { it * this } ) - // endregion - // region Constant-polynomial relation /** * Returns sum of the constant represented as polynomial and the polynomial. */ @@ -270,9 +241,7 @@ public open class PolynomialSpace>( .subList(0, other.degree + 1) .map { it * this } ) - // endregion - // region Polynomial-constant relation /** * Returns sum of the constant represented as polynomial and the polynomial. */ @@ -325,9 +294,7 @@ public open class PolynomialSpace>( .subList(0, degree + 1) .map { it * other } ) - // endregion - // region Polynomial-polynomial relation /** * Returns negation of the polynomial. */ @@ -425,9 +392,7 @@ public open class PolynomialSpace>( else false } } - // endregion - // region Polynomial properties /** * Degree of the polynomial, [see also](https://en.wikipedia.org/wiki/Degree_of_a_polynomial). If the polynomial is * zero, degree is -1. @@ -466,8 +431,6 @@ public open class PolynomialSpace>( public inline operator fun Polynomial.invoke(argument: C): C = this.substitute(ring, argument) @Suppress("NOTHING_TO_INLINE") public inline operator fun Polynomial.invoke(argument: Polynomial): Polynomial = this.substitute(ring, argument) - - // endregion } /** diff --git a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/RationalFunction.kt b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/RationalFunction.kt index 5ff3edd2e..f4ae64e81 100644 --- a/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/RationalFunction.kt +++ b/kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/RationalFunction.kt @@ -18,21 +18,6 @@ public data class RationalFunction internal constructor ( override fun toString(): String = "RationalFunction${numerator.coefficients}/${denominator.coefficients}" } -/** - * Represents internal [RationalFunction] errors. - */ -internal class RationalFunctionError : Error { - constructor(): super() - constructor(message: String): super(message) - constructor(message: String?, cause: Throwable?): super(message, cause) - constructor(cause: Throwable?): super(cause) -} - -/** - * Throws an [RationalFunction] with the given [message]. - */ -internal fun rationalFunctionError(message: Any): Nothing = throw RationalFunctionError(message.toString()) - // Waiting for context receivers :( TODO: Replace with context receivers when they will be available //context(RationalFunctionSpace)