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"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" /> <bytecodeTargetLevel target="17" />
</component> </component>
</project> </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"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <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" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
@@ -317,30 +317,34 @@ class MainActivity : AppCompatActivity() {
when (token.value) { when (token.value) {
"+" -> { "+" -> {
tmp_buf = buffer.dropLast(ext.size - position + 2) tmp_buf = buffer.dropLast(ext.size - position + 2)
val res: Token = val res: Token = when (first) {
if ((first is Double) and (second is Double)) is Double -> {
Token( when (second) {
Tokens.Number, is Double -> { Token(Tokens.Number, (first + second)) }
(first as Double + second as Double) is String -> { Token(Tokens.Linear, Linear(second, first, 1.0)) }
) is Linear -> { Token(Tokens.Linear,
else if ((first is String) and (second is Double)) Linear(second.name, second.add + first, second.mul))
Token( }
Tokens.Linear, else -> {Token(Tokens.Error, "")}
Linear(first as String, second as Double, 0.0) }
) }
else if ((first is Linear) and (second is Double)) is String -> {
Token( when (second) {
Tokens.Linear, Linear( is Double -> { Token(Tokens.Linear, Linear(first, second, 1.0)) }
(first as Linear).name, else -> { Token(Tokens.Error, "") }
(first as Linear).add + (second as Double), }
(first as Linear).mul }
) is Linear -> {
) when (second) {
else is Double -> { Token(Tokens.Linear,
Token( Linear(first.name, first.add + second, first.mul))
Tokens.Linear, }
Linear(second as String, first as Double, 0.0) else -> { Token(Tokens.Error, "") }
) }
}
else -> {Token(Tokens.Error, "")}
}
tmp_buf += res tmp_buf += res
tmp_buf += buffer.drop(position + 1) tmp_buf += buffer.drop(position + 1)
} }
@@ -500,7 +504,8 @@ enum class Tokens {
Constant, Constant,
Variable, Variable,
Linear, Linear,
Quadratic Quadratic,
Error
} }
class Token(val type: Tokens, val value: Any) { 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. // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '7.4.1' apply false id 'com.android.application' version '8.0.0' apply false
id 'com.android.library' version '7.4.1' apply false id 'com.android.library' version '8.0.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' 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 # thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
android.enableJetifier=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 #Wed Nov 16 21:17:09 MSK 2022
distributionBase=GRADLE_USER_HOME 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 distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME