From ead332a15d73299e3ccb03e8d10bae40aa53ddfe Mon Sep 17 00:00:00 2001 From: Kai Zhe Date: Wed, 11 Sep 2019 19:24:23 +0800 Subject: [PATCH] Completed A-Assertions, A-CodeQuality --- src/main/java/Duke.java | 12 +- src/main/java/MainWindow.java | 1 + src/main/java/command/AddCommand.java | 29 +--- src/main/java/command/Command.java | 10 -- src/main/java/command/DeleteCommand.java | 29 +--- src/main/java/command/DoneCommand.java | 29 +--- src/main/java/command/ExitCommand.java | 25 --- src/main/java/command/FindCommand.java | 27 +--- src/main/java/command/ListCommand.java | 25 --- src/main/java/data/duke.txt | Bin 91 -> 289 bytes src/main/java/duke/Duke.class | Bin 2393 -> 1784 bytes src/main/java/duke/MainWindow.class | Bin 2139 -> 2139 bytes src/main/java/duke/command/AddCommand.class | Bin 1528 -> 1292 bytes src/main/java/duke/command/Command.class | Bin 462 -> 358 bytes .../java/duke/command/DeleteCommand.class | Bin 1760 -> 1472 bytes src/main/java/duke/command/DoneCommand.class | Bin 1722 -> 1431 bytes src/main/java/duke/command/ExitCommand.class | Bin 715 -> 492 bytes src/main/java/duke/command/FindCommand.class | Bin 1761 -> 1540 bytes src/main/java/duke/command/ListCommand.class | Bin 1240 -> 1017 bytes src/main/java/duke/util/Parser.class | Bin 4445 -> 4108 bytes src/main/java/duke/util/Storage.class | Bin 1253 -> 1253 bytes src/main/java/duke/util/Ui.class | Bin 2028 -> 2183 bytes src/main/java/util/Parser.java | 153 ++++++++++-------- src/main/java/util/Storage.java | 1 + src/main/java/util/Ui.java | 9 +- 25 files changed, 126 insertions(+), 224 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 9a55bbca74..19682dbb69 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -11,6 +11,8 @@ * Application class for Duke. */ public class Duke { + private static final String SAVE_PATH = "data/duke.txt"; + private Storage storage; private TaskList tasks; private Ui ui; @@ -19,7 +21,7 @@ public class Duke { * Constructor of Duke class without parameters. */ public Duke() { - this("data/duke.txt"); + this(SAVE_PATH); } /** @@ -44,7 +46,7 @@ public Duke(String filePath) { * @param args Arguments entered when main method is executed. */ public static void main(String[] args) { - Duke duke = new Duke("data/duke.txt"); + Duke duke = new Duke(SAVE_PATH); duke.run(); } @@ -61,12 +63,6 @@ public String getResponse(String input) { * Run method of Duke. */ public void run() { - String logo = " ____ _ \n" - + "| _ \\ _ _| | _____ \n" - + "| | | | | | | |/ / _ \\\n" - + "| |_| | |_| | < __/\n" - + "|____/ \\__,_|_|\\_\\___|\n"; - System.out.println("Hello from\n" + logo); this.ui.showWelcome(); boolean isExit = false; diff --git a/src/main/java/MainWindow.java b/src/main/java/MainWindow.java index 94f610adc5..4d89bb9823 100644 --- a/src/main/java/MainWindow.java +++ b/src/main/java/MainWindow.java @@ -7,6 +7,7 @@ import javafx.scene.image.Image; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.VBox; + /** * Controller for MainWindow. Provides the layout for the other controls. */ diff --git a/src/main/java/command/AddCommand.java b/src/main/java/command/AddCommand.java index 91533794a3..4caa7d5d49 100644 --- a/src/main/java/command/AddCommand.java +++ b/src/main/java/command/AddCommand.java @@ -11,31 +11,17 @@ * Command containing method for adding Task to TaskList. */ public class AddCommand extends Command { - /** - * Constructor for AddCommand without parameters. - */ - public AddCommand() { - this(""); - } + private Task task; /** - * Constructor for AddCommand with String parameter. + * Constructor for AddCommand. * - * @param fullCommand Input entered by user. + * @param task Task to be added. */ - public AddCommand(String fullCommand) { - this.fullCommand = fullCommand; + public AddCommand(Task task) { + this.task = task; } - /** - * Returns an AddCommand as initialized by the constructor. - * - * @param fullCommand Input entered by user. - */ - public Command clone(String fullCommand) { - return new AddCommand(fullCommand); - } - /** * Adds a Task to the TaskList. * @@ -44,10 +30,9 @@ public Command clone(String fullCommand) { * @param storage Storage that stores the modified TaskList. */ public void execute(TaskList tasks, Ui ui, Storage storage) throws DukeException { - Task task = Parser.parseTask(this.fullCommand); - tasks.add(task); + tasks.add(this.task); ui.printResponse("Got it. I've added this task:\n " - + task.toString() + "\n" + + this.task.toString() + "\n" + "Now you have " + tasks.size() + " tasks in the list."); } diff --git a/src/main/java/command/Command.java b/src/main/java/command/Command.java index 8d5aa357c4..29494fbea7 100644 --- a/src/main/java/command/Command.java +++ b/src/main/java/command/Command.java @@ -10,16 +10,6 @@ * interacting with TaskList, Ui and Storage objects based on input. */ public abstract class Command { - protected String fullCommand; - - /** - * Public method to initialize Command objects. - * - * @param fullCommand Input entered by user. - * @return Command object initialized by constructor. - */ - public abstract Command clone(String fullCommand); - /** * Interacts with TaskList, Ui and Storage objects based on input. * diff --git a/src/main/java/command/DeleteCommand.java b/src/main/java/command/DeleteCommand.java index 8b64cd95e5..d08b076a01 100644 --- a/src/main/java/command/DeleteCommand.java +++ b/src/main/java/command/DeleteCommand.java @@ -11,29 +11,15 @@ * Command containing method for deleting Task from TaskList. */ public class DeleteCommand extends Command { - /** - * Constructor for DeleteCommand without parameters. - */ - public DeleteCommand() { - this(""); - } + private int itemId; /** - * Constructor for DeleteCommand with String parameter. - * - * @param fullCommand Input entered by user. - */ - public DeleteCommand(String fullCommand) { - this.fullCommand = fullCommand; - } - - /** - * Returns a DeleteCommand as initialized by the constructor. + * Constructor for DeleteCommand. * - * @param fullCommand Input entered by user. + * @param itemId Id of item to be deleted. */ - public Command clone(String fullCommand) { - return new DeleteCommand(fullCommand); + public DeleteCommand(int itemId) { + this.itemId = itemId; } /** @@ -44,14 +30,13 @@ public Command clone(String fullCommand) { * @param storage Storage that stores the modified TaskList. */ public void execute(TaskList tasks, Ui ui, Storage storage) throws DukeException { - int itemId = Parser.parseDelete(this.fullCommand); try { - Task item = tasks.remove(itemId); + Task item = tasks.remove(this.itemId); ui.printResponse("Noted. I've removed this task: \n " + item.toString() + "\n" + "Now you have " + tasks.size() + " tasks in the list."); } catch (IndexOutOfBoundsException e) { - throw new DukeException("☹ OOPS!!! There is no item " + itemId + "."); + throw new DukeException("☹ OOPS!!! There is no item " + this.itemId + "."); } } diff --git a/src/main/java/command/DoneCommand.java b/src/main/java/command/DoneCommand.java index 3cfef136f1..6c004e1d67 100644 --- a/src/main/java/command/DoneCommand.java +++ b/src/main/java/command/DoneCommand.java @@ -11,31 +11,17 @@ * Command containing method for marking Task from TaskList as done. */ public class DoneCommand extends Command { - /** - * Constructor for DoneCommand without parameters. - */ - public DoneCommand() { - this(""); - } + private int itemId; /** - * Constructor for DoneCommand with String parameter. + * Constructor for DoneCommand. * - * @param fullCommand Input entered by user. + * @param itemId Id of item to be marked done. */ - public DoneCommand(String fullCommand) { - this.fullCommand = fullCommand; + public DoneCommand(int itemId) { + this.itemId = itemId; } - /** - * Returns a DoneCommand as initialized by the constructor. - * - * @param fullCommand Input entered by user. - */ - public Command clone(String fullCommand) { - return new DoneCommand(fullCommand); - } - /** * Marks a Task from the TaskList as done. * @@ -44,14 +30,13 @@ public Command clone(String fullCommand) { * @param storage Storage that stores the modified TaskList. */ public void execute(TaskList tasks, Ui ui, Storage storage) throws DukeException { - int itemId = Parser.parseDone(this.fullCommand); try { - tasks.markAsDone(itemId); + tasks.markAsDone(this.itemId); } catch (IndexOutOfBoundsException e) { throw new DukeException("☹ OOPS!!! There is no item " + itemId + "."); } ui.printResponse("Nice! I've marked this task as done: \n " - + tasks.get(itemId).toString()); + + tasks.get(this.itemId).toString()); } /** diff --git a/src/main/java/command/ExitCommand.java b/src/main/java/command/ExitCommand.java index bf8712bafb..d0260def77 100644 --- a/src/main/java/command/ExitCommand.java +++ b/src/main/java/command/ExitCommand.java @@ -8,31 +8,6 @@ * Command containing method for exiting program. */ public class ExitCommand extends Command { - /** - * Constructor for ExitCommand without parameters. - */ - public ExitCommand() { - this(""); - } - - /** - * Constructor for ExitCommand with String parameter. - * - * @param fullCommand Input entered by user. - */ - public ExitCommand(String fullCommand) { - this.fullCommand = fullCommand; - } - - /** - * Returns an ExitCommand as initialized by the constructor. - * - * @param fullCommand Input entered by user. - */ - public Command clone(String fullCommand) { - return new ExitCommand(fullCommand); - } - /** * Exits program. * diff --git a/src/main/java/command/FindCommand.java b/src/main/java/command/FindCommand.java index de85afba73..01b153f07b 100644 --- a/src/main/java/command/FindCommand.java +++ b/src/main/java/command/FindCommand.java @@ -11,31 +11,17 @@ * Command containing method for finding Tasks in TaskList. */ public class FindCommand extends Command { - /** - * Constructor for FindCommand without parameters. - */ - public FindCommand() { - this(""); - } + private String query; /** - * Constructor for DeleteCommand with String parameter. + * Constructor for FindCommand. * - * @param fullCommand Input entered by user. + * @param query Query to be matched. */ - public FindCommand(String fullCommand) { - this.fullCommand = fullCommand; + public FindCommand(String query) { + this.query = query; } - /** - * Returns a FindCommand as initialized by the constructor. - * - * @param fullCommand Input entered by user. - */ - public Command clone(String fullCommand) { - return new FindCommand(fullCommand); - } - /** * Finds Tasks from the TaskList that matches the query. * @@ -45,9 +31,8 @@ public Command clone(String fullCommand) { */ public void execute(TaskList tasks, Ui ui, Storage storage) throws DukeException { TaskList tempList = new TaskList(); - String query = Parser.parseFind(this.fullCommand); for (Task task : tasks) { - if (task.toString().contains(query)) { + if (task.toString().contains(this.query)) { tempList.add(task); } } diff --git a/src/main/java/command/ListCommand.java b/src/main/java/command/ListCommand.java index a5a500f038..b52dd18adf 100644 --- a/src/main/java/command/ListCommand.java +++ b/src/main/java/command/ListCommand.java @@ -8,31 +8,6 @@ * Command containing method for listing Tasks in TaskList. */ public class ListCommand extends Command { - /** - * Constructor for ListCommand without parameters. - */ - public ListCommand() { - this(""); - } - - /** - * Constructor for ListCommand with String parameter. - * - * @param fullCommand Input entered by user. - */ - public ListCommand(String fullCommand) { - this.fullCommand = fullCommand; - } - - /** - * Returns a ListCommand as initialized by the constructor. - * - * @param fullCommand Input entered by user. - */ - public Command clone(String fullCommand) { - return new ListCommand(fullCommand); - } - /** * List Tasks in TaskList. * diff --git a/src/main/java/data/duke.txt b/src/main/java/data/duke.txt index 026c0d8e3cdb2221fa23e836110bf4284e572eff..94d96a3a40a72533fe051eaf1225e11703a13c29 100644 GIT binary patch delta 213 zcma!E$TT6ip0S*Tfq{XsxQKx-r8GNLuOzWJTQ4L(C4c7<T&U;w!XWQrch6g`kB8Ci{t l-jOAe%s}@Plyd;xoU6bxIjW+Bfi1NtF-0M%gn==n0sz%)Llpo3 delta 14 TcmZ3;6g?rBgQ1*-0SGDp8o>hH diff --git a/src/main/java/duke/Duke.class b/src/main/java/duke/Duke.class index 7bdec8b6c8d361fced9b48b0837103d3a3c3ca9c..9207882f15c2ec658485c51cbada758b635e3ac8 100644 GIT binary patch literal 1784 zcmZuyYf~Cm7=8{QE6V}~FG+JPu_%2(w_AP$K!4K7L3vYB?(O@ZLK%1x6| zZ`>@K_M(70GLaSVtW*lzAe1!AM!H_wHEJ9BZjq7x$mbMgK_Fx6`Tdk$b#MyS*`uVJ zWr2ancIOiRo?*WY1qbV4R7#P!w$aJ zpd+hcSCY+x68E%cV{P}Hk+&~|n&U!YiWR*eRiEg5{XNzXl^>JDaJUk+TBRo7m!Vfi zF<&WBEq~3>3oDgUNiVZcAN#cTJ)6m%wn*!G%`(`ft11nFXvd3m@Z3OljkUUS?D{&z zIpW5Fk+0kAHW%r1jEmEI&inKhI5TYN@7dvU#|{$UHLb*fNf|lwTbw1%W6H2B=hgB_ zObSbu`<+~hHQM^K~D-=H?& zKZ16MffPNZfglkff_oVK$Yw)iF~QG|%h_%mJ~q9^=A-<6U1#26imq_5N7!_W?CF$WGLB(P9Sp5xssC&TxuUK=p5k=4|x|s++$e`w_C*{ zES1IHC~LwWXf*|qx&iZCC6}gpzml(q(bf@r-SMGcu-rUvUux=i^rxrkX)?keH5rf( z8EWA2bOTr7ho}EI)l&^zZD8>5^e-t+01vTnCe8y|z%mr9@|+2JPtecL_aL58oaeZY z7sRJok;EcWjHYR=J7W3a{ue%BQKTRn^IdOo|EYD6vy-Hmnv$IO>p=4mq4NwSsDYsm tYy)1{*cr`x3gNRWZ|7*<>s~;Bu^NNoYG_dE25iF>N_ka79AX=-3?z@maUP4car7V=k17 z8>Y8vY}l0ajAkAgJBDr>&L;QtEN3$<434b?Mt(bMltMijpAn;ISdN6=(R+&Cfr_^< zE}BsZ>LF*hEfr@mBH{RSBz9@bS1VOYXIsABHs%~D{wj((lcb1!EqJ{QoP zp-vs)^ePkzbro-8RK+`(l;CSQ{%N(pR|BP@X*q43ANz_{3AJ(>#dZI>rVBM84z;3I z)23;a)0K+A*0uFqZX(B}^&CgJiX!8_iX0wD=(y&(fggBADQgB>ZozL)z-YmSiaaJ| z6jYdkuZP0jO>D^^QID`K!&Xs*qryc=#TW2Y_}Eer2<TM|Vv-?-p5U zt=yw9>lTZK!!WuT#$njCLqU(j#D|A-$?$xWK{S`dKtifvv4{HHK%nY1bRNy_MsoUQ z?wa{>K(vdajaaNd;YVgKZ;J4o`^F9t`Whk#g@onL?OLRn_X5wf!ZVvSeLuW@l7f?3 zdXijNEC;1>AY)gQQANV=At{!#f-gF$(o3#z! zH<^_mkMdN*h${95IkHWEI5JGX&i@ffo#EG~#W8BMQMsMcCj>i5Z^rl}#lr1IkR<3J!B3%`5uBv&Bca9+*M~95%XON5Pf)81 zu@^Lr$>@-A4w4MDlji54*L>8&@PYQ{=vWKm%8XZW{4lt-Fa(`JUf{DjNwW)KD;OE1 zM{qZUWX7*qFwIJ5dRq~Mous` diff --git a/src/main/java/duke/MainWindow.class b/src/main/java/duke/MainWindow.class index 0b1722d2fe10de90148fa51cfa7ce71ef3815348..58e1408b78bead3c6d690fd81e3957a93359a096 100644 GIT binary patch delta 93 zcmcaDa9d!56FVm#0}F!`g9L;0WN&tJR(S?N28GG(K$bECD}&19!|bWXIt&~PxoZ!ELjEy1~vvp200+j2;?&`FfkYd0K5JRZU6uP diff --git a/src/main/java/duke/command/AddCommand.class b/src/main/java/duke/command/AddCommand.class index 7973b4cdcd693ca099fcb1257802296cfb80d85d..33019d9a780d985356f41de4154e398079bc50e6 100644 GIT binary patch delta 511 zcmZ9I%}-N76vcn@-m|X^BLbEx)dDS`?JMy7MlFK6At5C(YH-~|LkgxbT3neJ_imcm zxpHg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diff --git a/src/main/java/duke/command/Command.class b/src/main/java/duke/command/Command.class index 61eccb1dc2c345a0eb1f682cea6f4304ede28920..e5fcc3e53f851b0f4cf81d8c5363e2d1d417768f 100644 GIT binary patch delta 117 zcmX@d{ESKT)W2Q(7#JAL8AP}km>C4v83frGgeF>OO`IOYC_M3%E*lF2DQB0p5sGAMQV_@K6VPxQ7-~_U{fIJo;%?%XcVE}3ZviX1{ H69Yd0)g%rc delta 213 zcmaFHbdK5L)W2Q(7#JAL86>zEm>ERa8ARC`#26X4(@Jx4obz*Y6Z29S8H9YY63Y_x za}x8?^@B@_GV{`{CyHtrvnJ={=cO_-XlY=|Yx<;=W~b^WLyXXe8f87vHiS`p;v`*W zHU{>Ihk`^I8CZaj73cyM21W*;AduvktjH*4&IuG_1M(Occvu)2xEQ#BN*Eb<7} diff --git a/src/main/java/duke/command/DeleteCommand.class b/src/main/java/duke/command/DeleteCommand.class index 71cf32e34ac98aba78e632b3db32beb5ffb5fdac..565dc6dff3e2d88c89ab8a98aeeb6b4d8e287ff7 100644 GIT binary patch delta 654 zcmXAmSx*yT6o#K~X6UrTl%-Z=DI!a;3t9m;Di#FXjs3_#6Bs#52RqS>N-X_dDOe_^;kKe@?qUfLm-?#7V`l8MnB|gvBK$ zgJ>!t{aK64WK6Oqxde(iix^i-u9_4S5!Z8S<*GuJC0Tasu2)hRnR5H}c>CnJKdnj| zHUnI<>7(Cd-e!SClj}A&xM|Dw+lqnJM#F1)dzI!B$9vzXw)!J1MJd|cVcF!aO^Fr% zuiDJt3rhC`!WG46b$`bxyld2Im3pJVZYvTY(yO#~3NOTL zxh>ECtyT0@*8H6QF=dDSeb3!3ymS@u=AK*ko;j^%qu%nrXv1pTKhc*X>%sPie$2?K zNB*L5WIR@+{ijCSAMBYqu;q%#fwbVI66q2TFeo-SV@~Rtcq?~|%8ebN9fs(0V*3OO z=P?+P+g^}~q-0t+_d$9+(p}8wzM*x{i^klD(ZR@f=;;!H4(2C@iU-DbVy^;F7YmN* z{dp)%kYa+UumziDg&(E_FfD3lL|vK@iBn_*HOr*@^#WPZ0Vdj8lW0N&A<~qLDuxAq t_MlPm0llVw7OPka_#A8{y#UrVe9|^ delta 953 zcmZuwOH&g;5dJ3n7_w{vL{{acVh~}2th|wz2>3vPA_&LzKe*9h11mF{NV~Gdiy021D(X z=lOX*XJ_Xf|B08%*QmHzg z9o!98L$9NeEKS>Abn;ox%{xJpG^Q?yZtn-{QYTvpUP&L>YA`M*3ksdNcoaHH8YRgS zw2C7{7QoFI+e2uVOon=r8Udg%mBK`VQBE+)FA&Y#gJdQ?LayXQAraCDnXXWnE)T;= zoGRxPS_u@1;R7gZ399v;7NuG$X`qedX*5ufXzUGztE7j`50F1W9h4J>Tm&Ccx*C)s zsuD$n_o+)1QT-P6Bgz3HYlgg!D6of`FT1o`nCP|B^$8K90$_@8Smf>@LcQedqk{c7 zM|PZkk9G{uuP{i~Fp&^MLchtWaPc;AG;_2tFb=&IX9$<6M1;Pxv_ol{jid#Yko1n^ j-{dB{iBGG5a2`vfHG=P98H>cYo7Pc6Eb?7Gk^_GLP#vcf diff --git a/src/main/java/duke/command/DoneCommand.class b/src/main/java/duke/command/DoneCommand.class index 2296ecbc4332770468b42bbc6d0411f0eaa706f8..0e76f3984c6e19e6ffe2ed280b984e33348db7a4 100644 GIT binary patch delta 617 zcmXAm&rTCj6vlsdX4+||(^^U?N=1dX&_BRb5UWr@6x50w~?)QD?oO{l_z3BVMt6%?m-+>D27EvyTu^F|v z!c~)NCSwWlauxw5d~wnuPa%P#WHH6G$&87k2)gaYUTsUEYC@`R(`_#)jC`&0ao&6tcpub@(p-oeHuK!{{ff;kZksIFEK&_|$9I-YmTm4*@!qJk zu1I#iB!db)U)c0!wBfk5S3lfYX|3)z8x||v^L}fasiFLn*Y&q`XSd$mb~f6FZgYE4 z@~8EWIeY79r{Ns6-CgIItB4+m*?!t+9qcz-4U_x+oe#Y~dO_8^LF3eTtjKv~Bj^1! zvd6YO60*PMFCr&h&T$3={g*0=u1U0tXQ*QO6z!y+Jt!EHTo}S2MVMi!ND9;Xb??Lr zh&xv*ensn|eolO_73iu*BPut_+ zNaBV2(seR!cHLPl=F{2r@n}-OznaNqQv&w?@PzkGG>Gw?SIdUPsKjN7v7H|iV*;>H zkFXLU3*(p&XjdliSj^?!b#keC zzMaV&?=BGfm$*RPN!q-dFQoDU#+Fi4;{ugw*?*5~PQcuB^BdEJqbNNx7fqVDhx?w; zl3q@G+gQED$rcwY)R0DEkQv5gH&c$O#Oi7jas{ zd`H;6qM-d^fM2SwRiaIzT|h_#>u`p+UMVkd7U!s`c3ZeA5}NNl<)5@BNu&e(r!<_$ YB0-bz11w{KTrbeBA##yEry_@b1I}=o;s5{u diff --git a/src/main/java/duke/command/ExitCommand.class b/src/main/java/duke/command/ExitCommand.class index 667e8cc4ba2a6075d99fdbf65367c1cec3f46ce8..3d6cbcff942d248cb5710d54071d15d63e5c01ab 100644 GIT binary patch delta 251 zcmX@j`i5Ed)W2Q(7#JAL86>$FSQ!L37zDW(gcyX`8AR9_L?>!#OSrNmQWhT zS`i-p5AToCa}f>oWWv=b+Rt*2!4nr^m>QzJXlHi}PtKzw3VoTFUe-&EjHCDRZZ$A^ z#>Zl=?8@ZLg*0>LCk*~Tr?a7WE3Mlli{yHH);9yHsGw$pU&RgrhUPtYcNh%8>r1g0 zywg(=7#$=+1eZDu_?Sx-BwDMMhgKDjQDa!SHzn6(SooO6@t>;k@A4R`b7uZZhT4>t zY7Rv*)hZEa(QlRM7eSd>*Ay41+C_m*fEPB{4GN#>NTVqF1ORooSeg@RIU%IJMf~sv z#jx`Q&MjvVMMBo#ph*(z#8{*WnNW)`%d31x>9|8u*HmOuE@hBIS~QmP>(-Y;U9a14 jzrwrK$b5Cl*HgOMz=NEyLD`NeI9GoSen$Nji(vIP(vXZS diff --git a/src/main/java/duke/command/FindCommand.class b/src/main/java/duke/command/FindCommand.class index 1148b71e9ff8e0eb1ce195261e200b43ea6cdafc..259b81d9d09fa509a75db483d9bd2bb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-a)W|ZWnhh`_12Sf}3!fJ||Adv@f z(_jaX_Q+*8L#R;#FlcI(g@WK|fl22gqnQVg&B#8K-!-L>DRUMIYT!dHRfH%ieze(0 zNm1xKhG#xPf4!ri_?Jo+XeO+oDycwhm#mjgXO5xHAArXc^F5S9cw?SO9=@0wQa?ar z*hZ`H{0yI<$9Rb6Q4;dxQMwI(ND*P#+|JK0?VBMbkMbi_0C^aKvsBP&l2X7TzMZ7D z3mxc296d;&m*yX(LHAKRqnJiN>gc8c`2;}@m7|`c!Tdq*oTGDv*f-KXPc1Df7RrS# kNq$S%`=``l>P53i;R5E#YIJc94{@Iw)=ROM;wbIDU+or_?EnA( diff --git a/src/main/java/duke/command/ListCommand.class b/src/main/java/duke/command/ListCommand.class index da52629dc3c015f928ea7f06df47993c1f1f032b..448c2b0f0985e76469862718d1289c70aabedf50 100644 GIT binary patch delta 351 zcmYk0y)Hvx9L9g|In}p4&M7_ppsi9A{o-H|F?wuDEnREB}HYqQFi?W%5Y3ZuMN_eXEih7np;Rz-u zLr-uTU(lZJ;*b!|blM}Fu^2HT@uvwV+nikG#Un>RL6iZRU;SZO3Y+D)kAnY$s$w={ VH_Xx&w!uv{X;Bh0Cf{1K;t%hDC-MLQ delta 617 zcmZva%}x_h7>1uS({_FsrZ9*U{J{z>bXph+iXuB)S`rfz6B0Hft%#P6p@UnNuF2en z3ta#SBwm15;H|hZey21cMi=w_z3+Rzch1Z&>!;KF@%!>S@PubJQ!aT*E)LU9$;H2K}rMn6|TznlyJStQbrN7v%gMK5q?%w)8&!3$KCEwuL%A%pHmSYW}K_bCUf= z{hY!j7Mx?>>1XA6@CU7RTWfeCXVGiQ=e zP1Sg}ttL%18f&$-7OTBr(n2h2X`kA)+NZwy*wvT5_|nz2TwRIw+vm){K(NVb51hTv z-uvJG|Ly;}=g*)2{v!bQ;+lpo98+Ov7{Zu>s0Obbn+hxqiu^n-m&Ro?p(3W@go;TO zaTN&_NevxH$!1D6CuNgXkWpc4s6@7y<5LPwY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ugMP7|!oAJPBubhK-CDWNliM~>Ay+8VxSyiUcPHAC5#4^lRk%YaZ059J z%eZR}n0N6Z{=($kkYq{ay8`E>dhFx{_@D0kBdJQfrL|JMOM4AAh~{r!f{GX z;4~h?Sv-z6@dTw$@H+Y=wLeAuCu!kn{1wmO?|2p;;W_*Zr*H$$vszEn>I;&F7o~E% zB(25EwDO9y8LzswLeotY$@u&Y z6x{`5A^f=-g`S;x?PRc`y|KNKX%~qvstc7fGycZTO>@Ih{Qm;*I-Bzi4#-G$)_1!j zk8K>hAp0lb_g%ue%h+=X6*Jg75ZX75)=StbP67|`VpnJxN(p>9;TCfsfC6nd fPii)nU^DRtzE!&RJNyy9C)2Z}#X0j8{+|0UC4y!m diff --git a/src/main/java/duke/util/Storage.class b/src/main/java/duke/util/Storage.class index 78d564f96386317f9663b544a937c171a6e79a7f..d6b5296468369213161cb92739e3e6cbe26b717c 100644 GIT binary patch delta 13 UcmaFL`IK|Rb{0mf$vaqd0Vp5@{{R30 delta 13 UcmaFL`IK|Rb{0m<$vaqd0Vo>;{r~^~ diff --git a/src/main/java/duke/util/Ui.class b/src/main/java/duke/util/Ui.class index c4b4ba472a43c849d105c4ae53081d2871a5b2fe..a4c15be5b8ac3991a6a5e4cc6df355a7dd1c6e31 100644 GIT binary patch delta 899 zcmZuuO-~b16g_WfXQq!Ql?Jfd3J)u-w6%jp0TomV(y9n5h+maaw5SP$M0cj93m3Yd z|Dh5UlP>%LCMNz6x4M&f?+j^OIFq@b=ghn3-Jj7n-HmU%&94B)@l4_%3KDTRF)EB& zI4KcA!NMsC6Ju<~*-XSBFv`6%oSx-ql6g}RGUp;Vj|&phC~-8ykXaiSV=$N$N7+Wj z!X*or1#I%W6b+um>+)` zDXt{bx1Y?=6ROjX3QIv;x7h zDT+`;H%PXhGWLReIQs=++XoJiHT|MZ5nUL?49(F>4Dy}X+zyN;I)D$93NWFIQz!!L zgCq}L5EH%Ka9Ip^b7m%y3J`zLZ6RdAOi-T``>3~Ono#e}-eMXVt`N38+b2ZZM+LJn z?N|Wyew(RAdk6=e7{Pv=AjEJ>Xkl;qu2|1}HrGTiu!Fv~;y}Oz$(SMu)5OgNqxn(- z&_C?kwYjR?8cVJT|xtyiYuRNWvHlEbiHsTJmE|(0KNe4ewp_F96Fvq;% z3ckyN;VO%UYqrF7e8WM~hW#ASEE#TaQ?qQiWwUN`$B^W%!Vlg={HP(zK=3V8^zLzA z@gglxuo#|tHyd77uI7R5x*Gh745_t1M?a`)@FhA|>XCawu0Yu?V#UOg4Fpr-rJ4*x z^Pf;#O<|v)BVlmmmHDhRSa5n%mgyiYXb70h9Kh5W!GuK8a)`ZW$*(yn}w4C^MqZ|8KB_thU`@?+zJd j=}?hd8 keywordToCommand = createMap(); protected static SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy HHmm"); - static HashMap createMap() { - HashMap keywordToCommand = new HashMap<>(); - keywordToCommand.put("bye", new ExitCommand()); - keywordToCommand.put("list", new ListCommand()); - keywordToCommand.put("done", new DoneCommand()); - keywordToCommand.put("delete", new DeleteCommand()); - keywordToCommand.put("todo", new AddCommand()); - keywordToCommand.put("deadline", new AddCommand()); - keywordToCommand.put("event", new AddCommand()); - keywordToCommand.put("find", new FindCommand()); - return keywordToCommand; - } - /** * Returns the command as specified by the input. * If input cannot be parsed, throws DukeException. @@ -46,17 +33,29 @@ static HashMap createMap() { * @throws DukeException If input cannot be parsed. */ public static Command parse(String input) throws DukeException { - if (keywordToCommand.containsKey(input)) { - return keywordToCommand.get(input); - } else { - String keyword = input.split(" ")[0]; - Command command; - if (keywordToCommand.containsKey(keyword)) { - command = keywordToCommand.get(keyword).clone(input); - } else { - throw new DukeException("☹ OOPS!!! I'm sorry, but I don't know what that means :-("); - } - return command; + if (input.equals("bye")) { + return new ExitCommand(); + } + if (input.equals("list")) { + return new ListCommand(); + } + + String keyword = input.split(" ")[0]; + switch (keyword) { + case "done": + return parseDone(input); + case "delete": + return parseDelete(input); + case "todo": + return parseTask(input); + case "deadline": + return parseTask(input); + case "event": + return parseTask(input); + case "find": + return parseFind(input); + default: + throw new DukeException("☹ OOPS!!! I'm sorry, but I don't know what that means :-("); } } @@ -68,18 +67,18 @@ public static Command parse(String input) throws DukeException { * @return itemId for object to be marked done. * @throws DukeException If input has incorrect format. */ - public static int parseDone(String input) throws DukeException { + public static DoneCommand parseDone(String input) throws DukeException { String[] words = input.split(" "); int itemId; try { assert (words.length == 2); String command = words[0]; - assert (command.equals("done")); itemId = Integer.parseInt(words[1]); - } catch (AssertionError e) { + } catch (AssertionError | NumberFormatException e) { throw new DukeException("☹ OOPS!!! Incorrect format for done command."); } - return itemId; + + return new DoneCommand(itemId); } /** @@ -90,18 +89,18 @@ public static int parseDone(String input) throws DukeException { * @return itemId for object to be marked done. * @throws DukeException If input has incorrect format. */ - public static int parseDelete(String input) throws DukeException { + public static DeleteCommand parseDelete(String input) throws DukeException { String[] words = input.split(" "); int itemId; try { assert (words.length == 2); String command = words[0]; - assert (command.equals("delete")); itemId = Integer.parseInt(words[1]); - } catch (AssertionError e) { + } catch (AssertionError | NumberFormatException e) { throw new DukeException("☹ OOPS!!! Incorrect format for delete command."); } - return itemId; + + return new DeleteCommand(itemId); } /** @@ -112,41 +111,59 @@ public static int parseDelete(String input) throws DukeException { * @return Task to be added. * @throws DukeException If input has incorrect format. */ - public static Task parseTask(String input) throws DukeException { + public static AddCommand parseTask(String input) throws DukeException { String[] words = input.split(" "); String type = words[0]; - - String info = input.substring((type + " ").length()); - try { - switch (type) { - case "todo": - if (info.equals("")) { - throw new DukeException("☹ OOPS!!! The description of a todo cannot be empty."); - } - return new Todo(info); - case "deadline": - String[] args = info.split("/by"); - String description = args[0].trim(); - Date date; - try { - date = dateFormatter.parse(args[1].trim()); - } catch (ParseException e) { - throw new DukeException("☹ OOPS!!! Incorrect date format."); - } - return new Deadline(description, date); - case "event": - args = info.split("/at"); - description = args[0].trim(); - try { - date = dateFormatter.parse(args[1].trim()); - } catch (ParseException e) { - throw new DukeException("☹ OOPS!!! Incorrect date format."); - } - return new Event(description, date); - default: - throw new DukeException("Invalid task input."); + + String info = input.substring(type.length()).trim(); + + Task task = null; + switch (type) { + case "todo": + String description = info; + if (description.equals("")) { + throw new DukeException("☹ OOPS!!! The description of a todo cannot be empty."); + } + + return new AddCommand(new Todo(description)); + case "deadline": + String[] args = info.split("/by"); + if (args.length != 2) { + throw new DukeException("☹ OOPS!!! A deadline must include a description and date."); + } + + description = args[0].trim(); + if (description.equals("")) { + throw new DukeException("☹ OOPS!!! The description of a deadline cannot be empty."); + } + + Date date; + try { + date = dateFormatter.parse(args[1].trim()); + } catch (ParseException e) { + throw new DukeException("☹ OOPS!!! Incorrect date format."); + } + + return new AddCommand(new Deadline(description, date)); + case "event": + args = info.split("/at"); + if (args.length != 2) { + throw new DukeException("☹ OOPS!!! A event must include a description and date."); } - } catch (IndexOutOfBoundsException e) { + + description = args[0].trim(); + if (description.equals("")) { + throw new DukeException("☹ OOPS!!! The description of an event cannot be empty."); + } + + try { + date = dateFormatter.parse(args[1].trim()); + } catch (ParseException e) { + throw new DukeException("☹ OOPS!!! Incorrect date format."); + } + + return new AddCommand(new Event(description, date)); + default: throw new DukeException("Invalid task input."); } } @@ -157,8 +174,8 @@ public static Task parseTask(String input) throws DukeException { * @param input Input entered by user. * @return String containing query. */ - public static String parseFind(String input) { - String phrase = input.split("find")[1]; - return phrase; + public static FindCommand parseFind(String input) { + String query = input.split("find")[1]; + return new FindCommand(query); } } \ No newline at end of file diff --git a/src/main/java/util/Storage.java b/src/main/java/util/Storage.java index b99057110f..0631999446 100644 --- a/src/main/java/util/Storage.java +++ b/src/main/java/util/Storage.java @@ -54,6 +54,7 @@ public TaskList load() throws DukeException { } catch (Exception e) { throw new DukeException("Save data not found."); } + return list; } } \ No newline at end of file diff --git a/src/main/java/util/Ui.java b/src/main/java/util/Ui.java index c22ca0bea3..7156a94dd2 100644 --- a/src/main/java/util/Ui.java +++ b/src/main/java/util/Ui.java @@ -53,7 +53,14 @@ public String readCommand() { * Shows welcome message of Duke. */ public void showWelcome() { - this.printResponse("Hello! I'm Duke\n" + String logo = " ____ _ \n" + + "| _ \\ _ _| | _____ \n" + + "| | | | | | | |/ / _ \\\n" + + "| |_| | |_| | < __/\n" + + "|____/ \\__,_|_|\\_\\___|\n"; + this.printResponse("Hello from\n" + + logo + + "Hello! I'm Duke\n" + "What can I do for you?"); }