Skip to content
Snippets Groups Projects
Commit 231facb4 authored by Inseo Kim's avatar Inseo Kim
Browse files

Kotlin and gradle version has been updated. Please use it.

parent bda29819
No related branches found
No related tags found
1 merge request!16Upgraded UI with rich text editing and expanded functionalities
Pipeline #87649 passed
Showing with 14 additions and 238 deletions
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
<option value="$PROJECT_DIR$/app" /> <option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/buildSrc" /> <option value="$PROJECT_DIR$/buildSrc" />
<option value="$PROJECT_DIR$/console" /> <option value="$PROJECT_DIR$/console" />
<option value="$PROJECT_DIR$/list" />
<option value="$PROJECT_DIR$/utilities" /> <option value="$PROJECT_DIR$/utilities" />
</set> </set>
</option> </option>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="KotlinJpsPluginSettings"> <component name="KotlinJpsPluginSettings">
<option name="version" value="1.6.21" /> <option name="version" value="1.6.20" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -4,9 +4,14 @@ ...@@ -4,9 +4,14 @@
plugins { plugins {
id 'notes.multi.kotlin-application-conventions' id 'notes.multi.kotlin-application-conventions'
id 'notes.multi.kotlin-library-conventions'
id 'application'
id 'org.jetbrains.kotlin.jvm'
id 'org.openjfx.javafxplugin' version '0.0.13'
} }
dependencies { dependencies {
implementation group: 'org.fxmisc.richtext', name: 'richtextfx', version: '0.11.0'
implementation 'org.apache.commons:commons-text' implementation 'org.apache.commons:commons-text'
implementation project(':utilities') implementation project(':utilities')
testImplementation 'org.jetbrains.kotlin:kotlin-test' testImplementation 'org.jetbrains.kotlin:kotlin-test'
...@@ -17,6 +22,11 @@ application { ...@@ -17,6 +22,11 @@ application {
mainClass = 'notes.multi.app.AppKt' mainClass = 'notes.multi.app.AppKt'
} }
javafx {
version = '18.0.2'
modules = ['javafx.controls', 'javafx.graphics', 'javafx.web']
}
test { test {
useJUnitPlatform() useJUnitPlatform()
} }
...@@ -3,12 +3,5 @@ ...@@ -3,12 +3,5 @@
*/ */
package notes.multi.app package notes.multi.app
import notes.multi.utilities.StringUtils
import org.apache.commons.text.WordUtils
fun main() { fun main() {
val tokens = StringUtils.split(MessageUtils.getMessage())
val result = StringUtils.join(tokens)
println(WordUtils.capitalize(result))
} }
...@@ -14,5 +14,5 @@ repositories { ...@@ -14,5 +14,5 @@ repositories {
} }
dependencies { dependencies {
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31' implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20'
} }
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
id 'notes.multi.kotlin-library-conventions'
}
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package notes.multi.list
class LinkedList {
private var head: Node? = null
fun add(element: String) {
val newNode = Node(element)
val it = tail(head)
if (it == null) {
head = newNode
} else {
it.next = newNode
}
}
private fun tail(head: Node?): Node? {
var it: Node?
it = head
while (it?.next != null) {
it = it.next
}
return it
}
fun remove(element: String): Boolean {
var result = false
var previousIt: Node? = null
var it: Node? = head
while (!result && it != null) {
if (0 == element.compareTo(it.data)) {
result = true
unlink(previousIt, it)
break
}
previousIt = it
it = it.next
}
return result
}
private fun unlink(previousIt: Node?, currentIt: Node) {
if (currentIt == head) {
head = currentIt.next
} else {
previousIt?.next = currentIt.next
}
}
fun size(): Int {
var size = 0
var it = head
while (it != null) {
++size
it = it.next
}
return size
}
fun get(idx: Int): String {
var index = idx
var it = head
while (index > 0 && it != null) {
it = it.next
index--
}
if (it == null) {
throw IndexOutOfBoundsException("Index is out of range")
}
return it.data
}
private data class Node(val data: String) {
var next: Node? = null
}
}
/*
* This Kotlin source file was generated by the Gradle "init" task.
*/
package notes.multi.list
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*
class LinkedListTest {
@Test fun testConstructor() {
val list = LinkedList()
assertEquals(0, list.size())
}
@Test fun testAdd() {
val list = LinkedList()
list.add("one")
assertEquals(1, list.size())
assertEquals("one", list.get(0))
list.add("two")
assertEquals(2, list.size())
assertEquals("two", list.get(1))
}
@Test fun testRemove() {
val list = LinkedList()
list.add("one")
list.add("two")
assertTrue(list.remove("one"))
assertEquals(1, list.size())
assertEquals("two", list.get(0))
assertTrue(list.remove("two"))
assertEquals(0, list.size())
}
@Test fun testRemoveMissing() {
val list = LinkedList()
list.add("one")
list.add("two")
assertFalse(list.remove("three"))
assertEquals(2, list.size())
}
}
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
*/ */
rootProject.name = 'notes-multi' rootProject.name = 'notes-multi'
include('app', 'list', 'utilities', 'console') include('app', 'utilities', 'console')
...@@ -15,7 +15,6 @@ javafx { ...@@ -15,7 +15,6 @@ javafx {
} }
dependencies { dependencies {
api project(':list')
testImplementation 'org.jetbrains.kotlin:kotlin-test' testImplementation 'org.jetbrains.kotlin:kotlin-test'
} }
......
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package notes.multi.utilities
import notes.multi.list.LinkedList
class JoinUtils {
companion object {
fun join(source: LinkedList): String {
val result = StringBuilder()
for (i in 0 until source.size()) {
if (result.isNotEmpty()) {
result.append(" ")
}
result.append(source.get(i))
}
return result.toString()
}
}
}
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package notes.multi.utilities
import notes.multi.list.LinkedList
class SplitUtils {
companion object {
fun split(source: String): LinkedList {
var lastFind = 0
val result = LinkedList()
var currentFind = source.indexOf(" ", lastFind)
while (currentFind != -1) {
var token = source.substring(lastFind)
if (currentFind != -1) {
token = token.substring(0, currentFind - lastFind)
}
addIfValid(token, result)
lastFind = currentFind + 1
currentFind = source.indexOf(" ", lastFind)
}
val token = source.substring(lastFind)
addIfValid(token, result)
return result
}
private fun addIfValid(token: String, list: LinkedList) {
if (isTokenValid(token)) {
list.add(token)
}
}
private fun isTokenValid(token: String): Boolean {
return token.isNotEmpty()
}
}
}
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package notes.multi.utilities
import notes.multi.list.LinkedList
class StringUtils {
companion object {
fun join(source: LinkedList): String {
return JoinUtils.join(source)
}
fun split(source: String): LinkedList {
return SplitUtils.split(source)
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment