Archived
1
0

build: updated gradle

refactor: if's to when's for '+'
This commit is contained in:
sweetbread
2023-05-03 22:46:14 +03:00
parent c0bd1dca2c
commit 896a3c596d
8 changed files with 61 additions and 31 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
<bytecodeTargetLevel target="17" />
</component>
</project>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="R52R200X4FM" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-05-03T19:34:02.904665521Z" />
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.7.20" />
</component>
</project>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
@@ -317,30 +317,34 @@ class MainActivity : AppCompatActivity() {
when (token.value) {
"+" -> {
tmp_buf = buffer.dropLast(ext.size - position + 2)
val res: Token =
if ((first is Double) and (second is Double))
Token(
Tokens.Number,
(first as Double + second as Double)
)
else if ((first is String) and (second is Double))
Token(
Tokens.Linear,
Linear(first as String, second as Double, 0.0)
)
else if ((first is Linear) and (second is Double))
Token(
Tokens.Linear, Linear(
(first as Linear).name,
(first as Linear).add + (second as Double),
(first as Linear).mul
)
)
else
Token(
Tokens.Linear,
Linear(second as String, first as Double, 0.0)
)
val res: Token = when (first) {
is Double -> {
when (second) {
is Double -> { Token(Tokens.Number, (first + second)) }
is String -> { Token(Tokens.Linear, Linear(second, first, 1.0)) }
is Linear -> { Token(Tokens.Linear,
Linear(second.name, second.add + first, second.mul))
}
else -> {Token(Tokens.Error, "")}
}
}
is String -> {
when (second) {
is Double -> { Token(Tokens.Linear, Linear(first, second, 1.0)) }
else -> { Token(Tokens.Error, "") }
}
}
is Linear -> {
when (second) {
is Double -> { Token(Tokens.Linear,
Linear(first.name, first.add + second, first.mul))
}
else -> { Token(Tokens.Error, "") }
}
}
else -> {Token(Tokens.Error, "")}
}
tmp_buf += res
tmp_buf += buffer.drop(position + 1)
}
@@ -500,7 +504,8 @@ enum class Tokens {
Constant,
Variable,
Linear,
Quadratic
Quadratic,
Error
}
class Token(val type: Tokens, val value: Any) {
+2 -2
View File
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
id 'com.android.application' version '8.0.0' apply false
id 'com.android.library' version '8.0.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}
+2
View File
@@ -22,3 +22,5 @@ kotlin.code.style=official
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
+1 -1
View File
@@ -1,6 +1,6 @@
#Wed Nov 16 21:17:09 MSK 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME