From d61272185d04a36e15fb06edfd83893ab9e662f9 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 15 Dec 2023 15:52:47 +0100 Subject: [PATCH] Readme update. Added TOC and updated How To Use section. --- README.md | 90 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index b6cb47c..63521cc 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,20 @@ Every children of the node have a common string prefix associated with th The root node is associated with an empty string. +## Table Of Content + +- [Common Operations](#common-operations) + - [Legend](#legend) + - [Operation](#operation) +- [Applications](#applications) +- [Project Details](#project-details) +- [How To Use](#how-to-use) + - [Local dependency](#local-dependency) + - [Source code](#source-code) + - [Compilation](#compilation) +- [Author](#author) + + ## Common Operations Operations and structures were implemented following OOP paradigm. @@ -48,22 +62,54 @@ and enable faster searching when the set contains large number of shor ## How To Use +### Local dependency + +1. Download a jar file attached to the release: + [v1.0](https://github.com/lucasmalara/tries-impl-java/releases/tag/v1.0 "v1.0"). + +2. You can verify SHA of downloaded file (details are in the release description). + +3. Copy that jar file into a subdirectory of your project directory, +e.g.: `YourProject/libs/` and add as local dependency: + +- Gradle (Kotlin): + +Add into `dependencies` function in `build.gradle.kts`: + +```kotlin + implementation(files("./libs/Trie-1.0.jar")) +``` + +- Gradle (Groovy): + +Add into `dependencies` function in `build.gradle`: + +```groovy + implementation files('./libs/Trie-1.0.jar') +``` + +### Source code + +Copy files: `Trie.java` and `TrieNode.java` into a java package of your choice in your project. + +### Compilation + If you would like to use this implementation, you should know that at the moment when it was written -**(12.12.2023)** the code language level is set to `Java 21 Preview`. -Hence, if you are going to compile the code containing this implementation, -you should have JDK 21 or possible any newer and add a flag `--enable-preview`, e.g.: +**(12.12.2023)**, the code is written in `Java 21 Preview`. +Hence, if you are going to compile and run the project containing this implementation, +you should use JDK 21 or possible any newer and add a flag `--enable-preview`, e.g.: - Javac (Compile to bytecode) ```shell - javac --enable-preview Main.java + javac --enable-preview YourMainClass.java ``` - Java (Run) ```shell - java --enable-preview Main + java --enable-preview YourMainClass ``` - Gradle (Kotlin) @@ -72,11 +118,13 @@ you should have JDK 21 or possible any newer and add a flag `--enable-preview`, ```kotlin // ... + // NEEDED IF YOU HAVE TEST CLASSES tasks.test { // ... jvmArgs("--enable-preview") } + // REQUIRED tasks.withType { // ... options.compilerArgs.add("--enable-preview") @@ -89,40 +137,26 @@ you should have JDK 21 or possible any newer and add a flag `--enable-preview`, ```groovy // ... + // NEEDED IF YOU HAVE TEST CLASSES test { // ... jvmArgs(['--enable-preview']) } + // REQUIRED tasks.withType(JavaCompile).each { // ... it.options.compilerArgs.add('--enable-preview') } ``` -- Maven - -`pom.xml`: - -```xml - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 21 - 21 - - --enable-preview - - - - - -``` +- Compile & Run with IntelliJ: + +1. Open Run/Debug Configuration of your project. +2. Expand list: Modify options. +3. Add VM option -> shortcut: `ALT + V`. +4. Paste `--enable-preview` into the VM options. +5. Confirm by clicking OK. ## Author