forked from nusCS2113-AY1920S1/duke
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from CEGLincoln/master
Changed the command system
- Loading branch information
Showing
30 changed files
with
288 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
package duke.command; | ||
|
||
import duke.command.ingredientCommand.ExitCommand; | ||
import duke.dish.DishList; | ||
import duke.exception.DukeException; | ||
import duke.list.GenericList; | ||
import duke.storage.Storage; | ||
import duke.ingredient.IngredientsList; | ||
import duke.order.OrderList; | ||
import duke.storage.FridgeStorage; | ||
import duke.storage.OrderStorage; | ||
import duke.ui.Ui; | ||
|
||
import java.io.IOException; | ||
public abstract class Command { | ||
|
||
public void execute(IngredientsList il, DishList dl, OrderList ol, Ui ui, FridgeStorage fs, OrderStorage os) throws DukeException { | ||
throw new DukeException(" NANI??? Looks like one of our developer used the abstract class Cmd!"); | ||
} | ||
|
||
public abstract class Command<T> { | ||
public abstract void execute(GenericList<T> genlist, Ui ui, Storage storage) throws DukeException, IOException; | ||
/** | ||
* Returns the boolean indicating that it is( not) an {@link ExitCommand}. | ||
* | ||
* @return false by default | ||
*/ | ||
public boolean isExit() { | ||
return false; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
package duke.command; | ||
|
||
import duke.dish.DishList; | ||
import duke.exception.DukeException; | ||
import duke.ingredient.IngredientsList; | ||
import duke.list.GenericList; | ||
import duke.order.Order; | ||
import duke.order.OrderList; | ||
import duke.storage.FridgeStorage; | ||
import duke.storage.OrderStorage; | ||
import duke.storage.Storage; | ||
import duke.ui.Ui; | ||
|
||
public class ViewTodoListCommand extends Command<Order> { | ||
|
||
public ViewTodoListCommand() { | ||
} | ||
public class ViewTodoListCommand extends Command { | ||
|
||
@Override | ||
public void execute(GenericList<Order> orderList, Ui ui, Storage storage) throws DukeException { | ||
String info = ((OrderList)orderList).todoListToString(); | ||
public void execute(IngredientsList il, DishList dl, OrderList orderList, Ui ui, FridgeStorage fs, OrderStorage os) throws DukeException { | ||
String info = (orderList).todoListToString(); | ||
System.out.println(info); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 9 additions & 6 deletions
15
src/main/java/duke/command/dishesCommand/AddIngredient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.