Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wang Guanlin] iP #468

Open
wants to merge 86 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
d839859
Add Gradle support
May 24, 2020
ab74434
Level-1: Added Greet, Echo, Exit functions for Duke
WangGLJoseph Aug 18, 2021
c8163cf
Included gitignore file, ignore all files with .class extension
WangGLJoseph Aug 18, 2021
7f6a9e4
Level-2: Added Add, List functions for Duke
WangGLJoseph Aug 18, 2021
073b8bc
Created a Task class to represent tasks added by user
WangGLJoseph Aug 18, 2021
94a2613
Changed Duke.java to represent userInputs as an ArrayList of Task obj…
WangGLJoseph Aug 18, 2021
29a7b43
Removed deprecated code representing userInputs as an ArrayList of St…
WangGLJoseph Aug 18, 2021
86734d8
Updated scanner to read userInput by using next() instead of nextLine()
WangGLJoseph Aug 18, 2021
0704af3
Level-3: Added Mark as Done function for Duke
WangGLJoseph Aug 18, 2021
840767d
Added field for task type and getter method for task type icon
WangGLJoseph Aug 18, 2021
bdeaad4
Updated instantiation of Task objects to include a taskType parameter
WangGLJoseph Aug 18, 2021
a792272
Abstracted out logic for beautifying task and list
WangGLJoseph Aug 18, 2021
1327162
Updated scanner to use nextLine after first command has been checked
WangGLJoseph Aug 18, 2021
541a1dd
Added constructor for Task that took in an additional string as remin…
WangGLJoseph Aug 18, 2021
c48c98d
Updated todo and deadline cases to be recognizable as userInput
WangGLJoseph Aug 18, 2021
57a57d3
Added task reminder for Deadline tasks
WangGLJoseph Aug 19, 2021
5b64f0e
Removed unnecesary use of delimiter for Deadline tasks
WangGLJoseph Aug 19, 2021
213d350
Updated listBeautify to use taskBeautify method
WangGLJoseph Aug 19, 2021
ff40331
Level-4: Added ToDos, Events, Deadlines functions for Duke
WangGLJoseph Aug 19, 2021
23a7854
Updated to use Inheritance to support multiple task types (ToDo, Even…
WangGLJoseph Aug 19, 2021
20904d1
Fixed bug where type of Event was displayed as [D]
WangGLJoseph Aug 19, 2021
abba5bc
A-TextUiTesting: Used the input/output redirection technique to semi-…
WangGLJoseph Aug 19, 2021
582d814
Removed deprecated method TaskBeautify() from Duke
WangGLJoseph Aug 19, 2021
0e724a6
Added DukeException to handle errors in Duke regarding invalid user i…
WangGLJoseph Aug 19, 2021
f854a11
Level-5: Added exceptions for unknown and incomplete user inputs
WangGLJoseph Aug 19, 2021
153032a
Level-6: Added Delete function to Duke, tasks stored in ArrayList<Task>
WangGLJoseph Aug 19, 2021
287a6b4
Updated text-ui-test to work with Duke Level-6
WangGLJoseph Aug 19, 2021
a008ab8
Change indentation for switch case to follow module coding standards
WangGLJoseph Aug 26, 2021
f2e7526
Add duke.txt with relative filePath
WangGLJoseph Aug 26, 2021
1a95507
Update Duke with filePath to duke.txt
WangGLJoseph Aug 26, 2021
51f6c23
Handle creation of folder and file if not already present
WangGLJoseph Aug 26, 2021
685755b
Add functinality to write to duke.txt
WangGLJoseph Aug 26, 2021
8688ae6
Add skeletal method for copying from duke.txt and parsing it
WangGLJoseph Aug 26, 2021
b12e45e
Updated constructor of various task types
WangGLJoseph Aug 26, 2021
845d1b1
Revert constructor of various task types
WangGLJoseph Aug 26, 2021
6da91b1
Add parse method to convert duke.txt to taskArrayList
WangGLJoseph Aug 26, 2021
54b588f
Fix bug where parse() was called twice incorrectly
WangGLJoseph Aug 26, 2021
d0a5a2e
Level-7: Add Save and Load duke.txt for Duke
WangGLJoseph Aug 26, 2021
bfb6cad
Update Deadline and Event to parse task description as string of date
WangGLJoseph Aug 27, 2021
609beb1
Level-8: Add Dates and Times functionality to Duke
WangGLJoseph Aug 27, 2021
ee37691
Increment Duke display level
WangGLJoseph Aug 27, 2021
281a595
Merge branch 'branch-Level-8'
WangGLJoseph Aug 27, 2021
9e9109a
Add skeletal classes for more OOP
WangGLJoseph Aug 27, 2021
7d0c2ff
Update skeletal class files to make Duke more OOP
WangGLJoseph Aug 31, 2021
6415efd
Put all classes into cs2103.duke package
WangGLJoseph Aug 31, 2021
1195f8d
Add JUnit Tests for Duke
WangGLJoseph Aug 31, 2021
9a5e6fc
Update duke.txt initialisation to enable use of .jar files
WangGLJoseph Aug 31, 2021
c276a32
Add complete JavaDoc for all classes in Duke
WangGLJoseph Aug 31, 2021
5524ba8
Remove unnecessary use of the 'this' keyword
WangGLJoseph Aug 31, 2021
c72dbd8
Level-9: Add find function for Duke
WangGLJoseph Aug 31, 2021
13d56db
Merge branch 'branch-A-CodingStandard'
WangGLJoseph Aug 31, 2021
596cb63
Merge branch 'branch-Level-9'
WangGLJoseph Aug 31, 2021
d6af729
Update README.md
WangGLJoseph Sep 1, 2021
e054745
Merge branch 'master' of https://github.com/WangGLJoseph/ip
WangGLJoseph Sep 2, 2021
0c633a2
Merge branch 'add-gradle-support' into branch-A-Gradle
WangGLJoseph Sep 2, 2021
613f9ce
Add DukeLauncher as part of JavaFX basics
WangGLJoseph Sep 2, 2021
60e607a
Update README.md
WangGLJoseph Sep 6, 2021
379ba30
Extract GUI logic out of Duke and into Main
WangGLJoseph Sep 8, 2021
1ac4e8f
Update README.md
WangGLJoseph Sep 8, 2021
40f61c6
Create new package for controllers
WangGLJoseph Sep 8, 2021
04bbebc
Merge branch 'master' of https://github.com/WangGLJoseph/ip
WangGLJoseph Sep 8, 2021
53dafd7
Level-10: Add GUI for Duke
WangGLJoseph Sep 8, 2021
8daf0b5
Merge branch 'branch-Level-10'
WangGLJoseph Sep 8, 2021
f83d529
Update Duke to use GUI
WangGLJoseph Sep 8, 2021
9c7e428
Set font in GUI as Courier New
WangGLJoseph Sep 18, 2021
b5c3742
Make Duke wait before closing the window
WangGLJoseph Sep 18, 2021
9821713
Add assertions for key assumptions in the code
WangGLJoseph Sep 19, 2021
3638fd6
Update method header comments to follow the coding standard
WangGLJoseph Sep 19, 2021
6af29d8
Update DialogBox to display more text
WangGLJoseph Sep 19, 2021
a70840f
TaskList class: Apply SLAP to shorten methods of adding tasks
WangGLJoseph Sep 19, 2021
c8a852a
Update .gitignore to ignore data/duke.txt
WangGLJoseph Sep 19, 2021
1e509d0
Remove data within data/duke.txt
WangGLJoseph Sep 19, 2021
bf8166f
DukeParser class: Apply SLAP to shorten methods of parsing data
WangGLJoseph Sep 19, 2021
0a6303e
Merge pull request #2 from WangGLJoseph/branch-A-Assertions
WangGLJoseph Sep 19, 2021
1d7cac7
Merge branch 'master' of https://github.com/WangGLJoseph/ip
WangGLJoseph Sep 19, 2021
b067a25
Merge branch 'master' into branch-A-CodeQuality
WangGLJoseph Sep 19, 2021
5721b1c
Merge pull request #3 from WangGLJoseph/branch-A-CodeQuality
WangGLJoseph Sep 19, 2021
e083605
Merge branch 'master' of https://github.com/WangGLJoseph/ip
WangGLJoseph Sep 19, 2021
75661c5
Add functionality to undo the last undo-able command
WangGLJoseph Sep 19, 2021
7f59eb6
Add Ui.png
WangGLJoseph Sep 19, 2021
49dca7b
Update user guide for Duke
WangGLJoseph Sep 19, 2021
e010b92
Set theme jekyll-theme-time-machine
WangGLJoseph Sep 19, 2021
5430e9f
Update formatting in user guide
WangGLJoseph Sep 19, 2021
86a2f73
Merge branch 'master' of https://github.com/WangGLJoseph/ip
WangGLJoseph Sep 19, 2021
4a7a59b
Remove emojis
WangGLJoseph Sep 19, 2021
cdb67d8
Update goodbye message
WangGLJoseph Sep 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ bin/

/text-ui-test/ACTUAL.txt
text-ui-test/EXPECTED-UNIX.TXT
*.class
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# Duke project template
# Duke v0.9.0
> *"Be not afraid of growing slowly, be afraid of standing still."* - Chinese proverb

This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
Duke offers you a:
- Hassle free
- Text based
- Minimalist
and completely **offline** experience of planning your tasks!

## Setting up in Intellij
## Setting up Duke
1. Download it [here](https://github.com/WangGLJoseph/ip/releases/download/A-Jar/ip.jar)
2. Double-click to run it
3. Add your tasks
4. Enjoy **mastery** over your tasks 😜

Prerequisites: JDK 11, update Intellij to the most recent version.

1. Open Intellij (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project first)
1. Open the project into Intellij as follows:
1. Click `Open`.
1. Select the project directory, and click `OK`.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 11** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).<br>
In the same dialog, set the **Project language level** field to the `SDK default` option.
3. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
A snippet of the workings of controlling your tasks. Behold, you've got the power!
```
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
public String finishTask(int index) throws DukeException {
if (index > taskArrayList.size()) {
throw new DukeException("This task index is not in the task list!");
}
taskArrayList.get(index - 1).markAsDone();
return (sandwich("Congratulations! You have finished this task: "
+ taskArrayList.get(index - 1).toString()));
}
```
46 changes: 46 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
plugins {
id 'java'
id 'application'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '5.1.0'
}

repositories {
mavenCentral()
}

dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
}

test {
useJUnitPlatform()

testLogging {
events "passed", "skipped", "failed"

showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
showStandardStreams = false
}
}

application {
mainClassName = "seedu.duke.Duke"
}

shadowJar {
archiveBaseName = "duke"
archiveClassifier = null
}

checkstyle {
toolVersion = '8.29'
}

run{
standardInput = System.in
}
3 changes: 3 additions & 0 deletions data/duke.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1.[T][ ] 1
2.[E][ ] 2 (at: 2022 02 02)
3.[D][ ] 3 (by: 2021 10 10)
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
183 changes: 183 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
echo "$*"
}

die () {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "$@"
103 changes: 103 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
Loading