Skip to content

Commit

Permalink
input validation was added
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonAsmirko committed Mar 27, 2021
1 parent 5d7441f commit c1fe0dd
Show file tree
Hide file tree
Showing 65 changed files with 51 additions and 18 deletions.
Binary file modified .gradle/6.7.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/6.7.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/6.7.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/6.7.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ compose.desktop {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "HelloWorld"
packageName = "Optimizer-Visualizer"
}
}
}
Expand Down
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$1$1$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$10.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$11$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$12$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$13.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$14$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$15$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$2$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$3$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$4$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$5$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$6.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$7$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$8.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$9$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$2$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$3$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$4$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$5.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1.class
Binary file not shown.
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/build-history.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
14
2
24
12
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�K�F�7�-�(��������
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/last-build.bin
Binary file not shown.
9 changes: 6 additions & 3 deletions src/main/kotlin/composables/ButtonInBoxComposable.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package composables

import LeftViewType
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.*
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand Down Expand Up @@ -53,7 +52,11 @@ fun buttonInBox(
backgroundColor = if (!active.value) colors.secondary else colors.primaryVariant
)
) {
Text(text)
Text(
text = text,
modifier = Modifier.horizontalScroll(rememberScrollState()),
maxLines = 1
)
}
}
}
53 changes: 41 additions & 12 deletions src/main/kotlin/main.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Constants.BORDER_WIDTH
import androidx.compose.desktop.Window
import androidx.compose.foundation.*
import androidx.compose.foundation.gestures.scrollable
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.material.Text
Expand All @@ -13,6 +14,7 @@ import androidx.compose.ui.input.pointer.pointerMoveFilter
import androidx.compose.ui.layout.WithConstraints
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import composables.buttonInBox
import composables.fieldSpacer
import composables.plotView
Expand Down Expand Up @@ -85,7 +87,6 @@ fun main() = Window(
MaterialTheme.colors
) {
leftViewType = it
//TODO delete useless logger
optimizer = getOptimizer[p.first]?.invoke()
}
}
Expand Down Expand Up @@ -126,41 +127,62 @@ fun main() = Window(
}
fieldSpacer()
Text(
modifier = Modifier.padding(15.dp, 0.dp, 0.dp, 0.dp),
modifier = Modifier
.padding(15.dp, 0.dp, 0.dp, 0.dp)
.horizontalScroll(rememberScrollState()),
text = func,
style = TextStyle(color = MaterialTheme.colors.onSurface)
style = TextStyle(color = MaterialTheme.colors.onSurface),
maxLines = 1
)
fieldSpacer()
OutlinedTextField(
modifier = Modifier.padding(10.dp),
value = lBound,
inactiveColor = MaterialTheme.colors.secondary,
activeColor = MaterialTheme.colors.surface,
onValueChange = {
lBound = it
},
label = { Text("enter left bound of the function") },
label = {
Text(
"left bound",
fontSize = 10.sp
)
},
textStyle = TextStyle(color = MaterialTheme.colors.onSurface)
)
fieldSpacer()
OutlinedTextField(
modifier = Modifier.padding(10.dp),
value = rBound,
inactiveColor = MaterialTheme.colors.secondary,
activeColor = MaterialTheme.colors.surface,
onValueChange = {
rBound = it
},
label = { Text("enter right bound of function") },
label = {
Text(
"right bound",
fontSize = 10.sp
)
},
textStyle = TextStyle(color = MaterialTheme.colors.onSurface)
)
fieldSpacer()
OutlinedTextField(
modifier = Modifier.padding(10.dp),
value = numBlobs,
inactiveColor = MaterialTheme.colors.secondary,
activeColor = MaterialTheme.colors.surface,
onValueChange = {
numBlobs = it
},
label = { Text("enter number of blobs to be taken") },
label = {
Text(
"number of blobs",
fontSize = 10.sp
)
},
textStyle = TextStyle(color = MaterialTheme.colors.onSurface)
)
fieldSpacer()
Expand All @@ -178,19 +200,27 @@ fun main() = Window(
Text(
modifier = Modifier
.padding(30.dp)
.align(Alignment.CenterHorizontally),
.align(Alignment.CenterHorizontally)
.horizontalScroll(rememberScrollState()),
text = "Step (num iterations)",
color = MaterialTheme.colors.onPrimary
color = MaterialTheme.colors.onPrimary,
maxLines = 1
)
fieldSpacer()
OutlinedTextField(
modifier = Modifier.padding(10.dp),
value = stepSize,
inactiveColor = MaterialTheme.colors.secondary,
activeColor = MaterialTheme.colors.surface,
onValueChange = {
stepSize = it
},
label = { Text("enter step size") },
label = {
Text(
"enter step size",
fontSize = 10.sp
)
},
textStyle = TextStyle(color = MaterialTheme.colors.onSurface)
)
fieldSpacer()
Expand Down Expand Up @@ -314,6 +344,5 @@ fun main() = Window(
}
}

private fun validateInput(num: String): Boolean {
return true
}
private fun validateInput(num: String): Boolean = Regex("[+-]?\\d+(\\.\\d+)?([Ee][+-]?\\d+)?")
.matches(num)

0 comments on commit c1fe0dd

Please sign in to comment.