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

[wingho]IP #196

Open
wants to merge 90 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
cfa100b
Change the dukes speech
Sep 1, 2021
58398a4
Add a echo functions that repeat commands entered by the user and exi…
Sep 1, 2021
7b1d074
Add the ability to store text input into a list and display it back w…
Sep 1, 2021
1d74b39
Add the ability to mark task as done
Sep 1, 2021
eed209d
Add catergory to the task, todo,deadlines and events
Sep 2, 2021
f4fecb4
Refactor the code to remove duplcated functions
Sep 4, 2021
b8ad62d
Added the ability to add mutiple task in the same line and the abilit…
Sep 5, 2021
37abf0d
Added a way to print words like what was printed for duke but based o…
Sep 5, 2021
1e6963b
Added testing
Sep 6, 2021
2f491b7
Add a lot of exceptions to prevent any errors
Sep 6, 2021
4a08901
Changing some Strings
Sep 6, 2021
50ed25d
Further fixes to the String printed
Sep 6, 2021
64b7752
Merge branch 'branch-Level-5'
Sep 7, 2021
2305316
Minimal packaging
Sep 7, 2021
57771c8
More packages
Sep 7, 2021
a9d7713
Fix packages
Sep 7, 2021
1a2a6ac
Merge branch 'branch-A-Packages'
Sep 7, 2021
c383114
Add a delete function to class ListManager and class inputhandler whe…
Sep 15, 2021
5ee47d4
Some formatting words changes
Sep 15, 2021
6ee2be3
Add the save function to txt files
Sep 15, 2021
f714fce
Merge branch 'branch-Level-7'
Sep 15, 2021
ec11a9f
remove some bugged files
Sep 15, 2021
6d21d77
debugging the file update when there is no task in the array
Sep 15, 2021
8565495
Change all the commands into their own class
Sep 25, 2021
80e1c4e
Added a find date command that find task with a specific date
Sep 26, 2021
71fb4c5
Added Find Keyword to search the list
Sep 27, 2021
cf3394a
Merge pull request #1 from kum-wh/branch-Level-8
kum-wh Sep 28, 2021
3f53d4e
Merge pull request #2 from kum-wh/branch-Level-9
kum-wh Sep 28, 2021
30a5c96
Added Comment to All function and classes
Sep 28, 2021
1f8f273
Merge branch 'master' of https://github.com/kum-wh/ip
Sep 28, 2021
4fb78e6
Merge pull request #3 from kum-wh/branch-A-JavaDoc
kum-wh Sep 28, 2021
05c358f
Merge branch 'branch-A-JavaDoc'
Sep 28, 2021
9a88e1b
Level-8
Sep 28, 2021
668659b
Level-9
Sep 28, 2021
8c59d4d
JavaDoc
Sep 28, 2021
9060af4
no message
Sep 28, 2021
dc1ab66
Merge branch 'branch-A-JavaDoc'
Sep 28, 2021
2b9947c
Merge commit '668659beb25f93f3be1f67d4b3ea7b0d964ae7b9'
Sep 28, 2021
6ca401f
Merge commit '9a88e1b9b936bff54c9ed02dbd7763db87c9cd6b'
Sep 28, 2021
27f1319
Merge branch 'master' of https://github.com/kum-wh/ip
Sep 28, 2021
1c84ea0
Levvel-7 fix
Sep 28, 2021
899cb14
Merge branch 'branch-Level-7'
Sep 28, 2021
1915741
Level-8-fix
Sep 28, 2021
2bb73dd
Level9 fix
Sep 28, 2021
88be32e
A-JavaDoc
Sep 28, 2021
6ffc9fd
Merge pull request #4 from kum-wh/branch-Level-8
kum-wh Sep 28, 2021
fd4bc0a
Merge branch 'master' into branch-Level-9
kum-wh Sep 28, 2021
125df38
Merge pull request #5 from kum-wh/branch-Level-9
kum-wh Sep 28, 2021
2ecd0a6
Merge branch 'master' into branch-A-JavaDoc
kum-wh Sep 28, 2021
d22def0
Merge pull request #6 from kum-wh/branch-A-JavaDoc
kum-wh Sep 28, 2021
5d5f795
Merge branch 'master' of https://github.com/kum-wh/ip
Sep 28, 2021
1bbc6f5
Level8
Sep 28, 2021
7022461
Level9
Sep 28, 2021
78d2e29
JavaDoc
Sep 28, 2021
15cfa13
Branch level8
Sep 28, 2021
b349f2e
Branch Level9
Sep 28, 2021
6a5eff9
A-JavaDoc
Sep 28, 2021
0303cbe
Merge pull request #7 from kum-wh/branch-Level-8
kum-wh Sep 28, 2021
52b947b
Merge branch 'master' into branch-Level-9
kum-wh Sep 28, 2021
b097c6f
Merge pull request #8 from kum-wh/branch-Level-9
kum-wh Sep 28, 2021
025d7c0
Merge branch 'master' into branch-A-JavaDoc
kum-wh Sep 28, 2021
c922374
Merge pull request #9 from kum-wh/branch-A-JavaDoc
kum-wh Sep 28, 2021
ecceb76
Level:8
Sep 28, 2021
8e59389
Level:9
Sep 28, 2021
887ddf1
A-JavaDoc
Sep 28, 2021
b184fca
Merge pull request #10 from kum-wh/branch-Level-8
kum-wh Sep 28, 2021
2989450
Merge branch 'branch-A-JavaDoc'
Sep 28, 2021
d07b2aa
Solving merge conflict
Sep 28, 2021
bd7aca4
Merge branch 'branch-Level-9'
Sep 28, 2021
f3317e1
Merging PRS
Sep 28, 2021
264344e
Fix Exception Messages and add more comments to functions
Sep 29, 2021
21ea138
Fix a bug that invalid date keep throwing parsing error
Sep 29, 2021
19b892c
Update README.md
kum-wh Sep 29, 2021
8e97fa8
Set theme jekyll-theme-cayman
kum-wh Sep 29, 2021
41d7353
Update README.md
kum-wh Sep 29, 2021
5d3bffc
Create README.md
kum-wh Sep 29, 2021
4339745
Update README.md
kum-wh Sep 29, 2021
7576a85
Update README.md
kum-wh Sep 29, 2021
3f424fc
Update README.md
kum-wh Sep 29, 2021
5cbdada
Update README.md
kum-wh Sep 30, 2021
0ec1b61
Update README.md
kum-wh Sep 30, 2021
28c7be4
Update README.md
kum-wh Sep 30, 2021
e4d14a7
Update README.md
kum-wh Sep 30, 2021
4054b00
Update README.md
kum-wh Sep 30, 2021
bc4554c
Update README.md
kum-wh Sep 30, 2021
1816abe
Update README.md
kum-wh Sep 30, 2021
e29bcf7
Update README.md
kum-wh Sep 30, 2021
cee51f8
Update README.md
kum-wh Sep 30, 2021
bba48ca
Fix ArtBot null pointer
Sep 30, 2021
f2c2a13
Merge branch 'master' of https://github.com/kum-wh/ip
Sep 30, 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
495 changes: 481 additions & 14 deletions docs/README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-cayman
5 changes: 5 additions & 0 deletions duke.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[T];[X];watch twitch videos
[D];[X];homework1;11:59
[E];[ ];g2 vs en;09:00
[E];[ ];100t vs gambit; 2021-08-01
[E];[ ];paperex vs bren;08:00 2021-08-01
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: duke.Duke

215 changes: 215 additions & 0 deletions src/main/java/duke/ArtBot/ArtBot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
package duke.ArtBot;

import duke.ErrorHandling.CommandException;
import duke.ErrorHandling.ErrorStaticString;
import java.util.ArrayList;

/**
* Convert string into graffiti form and print it
*/
public class ArtBot implements ArtInterface {

private static final int SIZE_OF_ARRAY = 5;
private final String userInput;

/**
* Constructor for ArtBot
* Assign string to draw
*
* @param userInput String to be drawn
*/
public ArtBot(String userInput){
this.userInput = userInput;
}

/**
* Each Drawn version of a letter take up 5 line
* Convert letter into drawn version of string stored in Logo Class
* Split each drawn version into array of 5 string separated by each line
*
* @param letter Letter to convert into array of string
* @return Array of string representing a letter
*/
private String[] getLogo(String letter){
String[] letterArt;
switch(letter) {
case "A":
letterArt = Logo.A.split("\n");
break;
case "B":
letterArt = Logo.B.split("\n");
break;
case "C":
letterArt = Logo.C.split("\n");
break;
case "D":
letterArt = Logo.D.split("\n");
break;
case "E":
letterArt = Logo.E.split("\n");
break;
case "F":
letterArt = Logo.F.split("\n");
break;
case "G":
letterArt = Logo.G.split("\n");
break;
case "H":
letterArt = Logo.H.split("\n");
break;
case "I":
letterArt = Logo.I.split("\n");
break;
case "J":
letterArt = Logo.J.split("\n");
break;
case "K":
letterArt = Logo.K.split("\n");
break;
case "L":
letterArt = Logo.L.split("\n");
break;
case "M":
letterArt = Logo.M.split("\n");
break;
case "N":
letterArt = Logo.N.split("\n");
break;
case "O":
letterArt = Logo.O.split("\n");
break;
case "P":
letterArt = Logo.P.split("\n");
break;
case "Q":
letterArt = Logo.Q.split("\n");
break;
case "R":
letterArt = Logo.R.split("\n");
break;
case "S":
letterArt = Logo.S.split("\n");
break;
case "T":
letterArt = Logo.T.split("\n");
break;
case "U":
letterArt = Logo.U.split("\n");
break;
case "V":
letterArt = Logo.V.split("\n");
break;
case "W":
letterArt = Logo.W.split("\n");
break;
case "X":
letterArt = Logo.X.split("\n");
break;
case "Y":
letterArt = Logo.Y.split("\n");
break;
case "Z":
letterArt = Logo.Z.split("\n");
break;
case "0":
letterArt = Logo.ZERO.split("\n");
break;
case "1":
letterArt = Logo.One.split("\n");
break;
case "2":
letterArt = Logo.Two.split("\n");
break;
case "3":
letterArt = Logo.THREE.split("\n");
break;
case "4":
letterArt = Logo.FOUR.split("\n");
break;
case "5":
letterArt = Logo.FIVE.split("\n");
break;
case "6":
letterArt = Logo.SIX.split("\n");
break;
case "7":
letterArt = Logo.SEVEN.split("\n");
break;
case "8":
letterArt = Logo.EIGHT.split("\n");
break;
case "9":
letterArt = Logo.NINE.split("\n");
break;
default:
letterArt = null;
break;
}
return letterArt;
}

/**
* Convert each letter of string into drawn form
*
* @param inputArrayOfLetter array of Char(letters)
* @return list of string array where each string array is drawn version of a letter
* @throws CommandException if char is anything other than A-Z,0-9
*/
private ArrayList<String[]> getLetterInArtForm(String[] inputArrayOfLetter) throws CommandException{
ArrayList<String[]> listToStoreLetterInArtForm = new ArrayList<>();
for(String s:inputArrayOfLetter){
String[] letterInArtForm = getLogo(s);
if(letterInArtForm == null){
throw new CommandException(ErrorStaticString.ERROR_ARTBOT_LETTER_NOT_FOUND);
}
listToStoreLetterInArtForm.add(letterInArtForm);
}
return listToStoreLetterInArtForm;
}

/**
* Merge same index of string in each string array
* First String in First String Array with First String in Second String Array and so on...
*
* @param arrayToMerge list of String Array to merge
* @return String Array of 5 String after all have been merged
*/
private String[] mergeArray(ArrayList<String[]> arrayToMerge){
String[] arrayToReturn = new String[5];
for(int i = 0; i < 5; i++){
StringBuilder sb = new StringBuilder();
for (String[] strings : arrayToMerge) {
String temp = strings[i];
sb.append(temp);
}
arrayToReturn[i] = sb.toString();
}
return arrayToReturn;
}

/**
* Print a array of 5 Strings
*
* @param array Array to print
*/
private void printArray(String[] array){
for(int i = 0; i < SIZE_OF_ARRAY; i++){
System.out.println(array[i]);
}
}

/**
* Handle interaction of other classes to echo a string in drawn form
*/
public void drawArt() {
String[] letterArray = userInput.split("(?!^)");
ArrayList<String[]> letterInArtFormList = null;
try {
letterInArtFormList = getLetterInArtForm(letterArray);
} catch (CommandException e) {
e.handleException();
}
String[] mergeLetterHorizontallyArray = mergeArray(letterInArtFormList);
printArray(mergeLetterHorizontallyArray);
}
}
7 changes: 7 additions & 0 deletions src/main/java/duke/ArtBot/ArtInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package duke.ArtBot;

import duke.ErrorHandling.CommandException;

public interface ArtInterface {
void drawArt() throws CommandException;
}
Loading