-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into feature/dope-215-refactor-tests
# Conflicts: # core/src/test/kotlin/ch/ergon/dope/buildTest/NumberFunctionsTest.kt
- Loading branch information
Showing
51 changed files
with
1,507 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...n/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/AbsoluteExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class AbsoluteExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("ABS", value) | ||
|
||
fun abs(value: TypeExpression<NumberType>) = AbsoluteExpression(value) | ||
|
||
fun abs(value: Number) = abs(value.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
.../kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/ArcCosineExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class ArcCosineExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("ACOS", value) | ||
|
||
fun acos(value: TypeExpression<NumberType>) = ArcCosineExpression(value) | ||
|
||
fun acos(value: Number) = acos(value.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...in/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/ArcSineExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class ArcSineExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("ASIN", value) | ||
|
||
fun asin(value: TypeExpression<NumberType>) = ArcSineExpression(value) | ||
|
||
fun asin(value: Number) = asin(value.toDopeType()) |
16 changes: 16 additions & 0 deletions
16
...otlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/ArcTangent2Expression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class ArcTangent2Expression(divisor: TypeExpression<NumberType>, dividend: TypeExpression<NumberType>) : | ||
NumberFunctionExpression("ATAN2", divisor, dividend) | ||
|
||
fun atan2(divisor: TypeExpression<NumberType>, dividend: TypeExpression<NumberType>) = ArcTangent2Expression(divisor, dividend) | ||
|
||
fun atan2(divisor: TypeExpression<NumberType>, dividend: Number) = atan2(divisor, dividend.toDopeType()) | ||
|
||
fun atan2(divisor: Number, dividend: TypeExpression<NumberType>) = atan2(divisor.toDopeType(), dividend) | ||
|
||
fun atan2(divisor: Number, dividend: Number) = atan2(divisor.toDopeType(), dividend.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/ArcTangentExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class ArcTangentExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("ATAN", value) | ||
|
||
fun atan(value: TypeExpression<NumberType>) = ArcTangentExpression(value) | ||
|
||
fun atan(value: Number) = atan(value.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...in/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/CeilingExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class CeilingExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("CEIL", value) | ||
|
||
fun ceil(value: TypeExpression<NumberType>) = CeilingExpression(value) | ||
|
||
fun ceil(value: Number) = ceil(value.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...ain/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/CosineExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class CosineExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("COS", value) | ||
|
||
fun cos(value: TypeExpression<NumberType>) = CosineExpression(value) | ||
|
||
fun cos(value: Number) = cos(value.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...in/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/DegreesExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class DegreesExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("DEGREES", value) | ||
|
||
fun degrees(value: TypeExpression<NumberType>) = DegreesExpression(value) | ||
|
||
fun degrees(value: Number) = degrees(value.toDopeType()) |
14 changes: 14 additions & 0 deletions
14
...main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/EulerExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.DopeQuery | ||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class EulerExpression : TypeExpression<NumberType> { | ||
override fun toDopeQuery() = DopeQuery( | ||
queryString = "E()", | ||
parameters = emptyMap(), | ||
) | ||
} | ||
|
||
fun e() = EulerExpression() |
11 changes: 11 additions & 0 deletions
11
...n/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/ExponentExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class ExponentExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("EXP", value) | ||
|
||
fun exp(value: TypeExpression<NumberType>) = ExponentExpression(value) | ||
|
||
fun exp(value: Number) = exp(value.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/FloorExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class FloorExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("FLOOR", value) | ||
|
||
fun floor(value: TypeExpression<NumberType>) = FloorExpression(value) | ||
|
||
fun floor(value: Number) = floor(value.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...c/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/LogExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class LogExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("LOG", value) | ||
|
||
fun log(value: TypeExpression<NumberType>) = LogExpression(value) | ||
|
||
fun log(value: Number) = log(value.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...tlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/LogNaturalisExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class LogNaturalisExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("LN", value) | ||
|
||
fun ln(value: TypeExpression<NumberType>) = LogNaturalisExpression(value) | ||
|
||
fun ln(value: Number) = ln(value.toDopeType()) |
21 changes: 21 additions & 0 deletions
21
...in/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/NumberFunctionExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.DopeQuery | ||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.operator.FunctionOperator | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
sealed class NumberFunctionExpression( | ||
private val symbol: String, | ||
private val value: TypeExpression<NumberType>, | ||
private val extraValue: TypeExpression<NumberType>? = null, | ||
) : TypeExpression<NumberType>, FunctionOperator { | ||
override fun toDopeQuery(): DopeQuery { | ||
val valueDopeQuery = value.toDopeQuery() | ||
val extraValueDopeQuery = extraValue?.toDopeQuery() | ||
return DopeQuery( | ||
queryString = toFunctionQueryString(symbol = symbol, valueDopeQuery, extra = extraValueDopeQuery), | ||
parameters = valueDopeQuery.parameters + extraValueDopeQuery?.parameters.orEmpty(), | ||
) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...rc/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/PiExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.DopeQuery | ||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class PiExpression : TypeExpression<NumberType> { | ||
override fun toDopeQuery() = DopeQuery( | ||
queryString = "PI()", | ||
parameters = emptyMap(), | ||
) | ||
} | ||
|
||
fun pi() = PiExpression() |
16 changes: 16 additions & 0 deletions
16
...main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/PowerExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class PowerExpression(base: TypeExpression<NumberType>, exponent: TypeExpression<NumberType>) : | ||
NumberFunctionExpression("POWER", base, exponent) | ||
|
||
fun power(base: TypeExpression<NumberType>, exponent: TypeExpression<NumberType>) = PowerExpression(base, exponent) | ||
|
||
fun power(base: TypeExpression<NumberType>, exponent: Number) = power(base, exponent.toDopeType()) | ||
|
||
fun power(base: Number, exponent: TypeExpression<NumberType>) = power(base.toDopeType(), exponent) | ||
|
||
fun power(base: Number, exponent: Number) = power(base.toDopeType(), exponent.toDopeType()) |
11 changes: 11 additions & 0 deletions
11
...in/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/RadiansExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class RadiansExpression(value: TypeExpression<NumberType>) : NumberFunctionExpression("RADIANS", value) | ||
|
||
fun radians(value: TypeExpression<NumberType>) = RadiansExpression(value) | ||
|
||
fun radians(value: Number) = radians(value.toDopeType()) |
25 changes: 25 additions & 0 deletions
25
...ain/kotlin/ch/ergon/dope/resolvable/expression/unaliased/type/numeric/RandomExpression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ch.ergon.dope.resolvable.expression.unaliased.type.numeric | ||
|
||
import ch.ergon.dope.DopeQuery | ||
import ch.ergon.dope.resolvable.expression.TypeExpression | ||
import ch.ergon.dope.resolvable.expression.unaliased.type.toDopeType | ||
import ch.ergon.dope.resolvable.operator.FunctionOperator | ||
import ch.ergon.dope.validtype.NumberType | ||
|
||
class RandomExpression(private val value: TypeExpression<NumberType>? = null) : | ||
TypeExpression<NumberType>, FunctionOperator { | ||
override fun toDopeQuery() = | ||
value?.let { | ||
val valueDopeQuery = value.toDopeQuery() | ||
DopeQuery( | ||
queryString = toFunctionQueryString("RANDOM", valueDopeQuery.queryString), | ||
parameters = valueDopeQuery.parameters, | ||
) | ||
} ?: DopeQuery(queryString = "RANDOM()", parameters = emptyMap()) | ||
} | ||
|
||
fun random() = RandomExpression() | ||
|
||
fun random(value: TypeExpression<NumberType>) = RandomExpression(value) | ||
|
||
fun random(value: Number) = random(value.toDopeType()) |
Oops, something went wrong.