diff --git a/docs/AboutUs.md b/docs/AboutUs.md
index a22aa5ae1..ce99f9394 100644
--- a/docs/AboutUs.md
+++ b/docs/AboutUs.md
@@ -5,5 +5,6 @@
| ![](https://via.placeholder.com/100.png?text=Photo) | Shyun Yin | [Github](https://github.com/Shyunyin) | [Portfolio](team/Shyunyin.md) |
| ![](https://via.placeholder.com/100.png?text=Photo) | Tuan | [Github](https://github.com/tuan0369) | [Portfolio](team/tuan0369.md) |
| ![](https://via.placeholder.com/100.png?text=Photo) | Haziq Hakim | [Github](https://github.com/LDerpy) | [Portfolio](team/lderpy.md) |
-| ![](https://via.placeholder.com/100.png?text=Photo) | Jun Leong | [Github](https://github.com/hjunleon) | [Portfolio](team/hjunleon.md) |
+| ![](https://via.placeholder.com/100.png?text=Photo) | Jun Leong | [Github](https://github.com/hjunleon) | [Portfolio](team/hjunleon.md) |
+
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index acbb01fdb..736697309 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -12,6 +12,7 @@ setup and quick to use. Simplst will mainly be used to add, remove, list and vie
* [Explanation of Key Terms or Symbols](#explanation-of-key-terms-or-symbols)
* [Quick start](#quick-start)
* [Features](#features)
+ * [Help Command](#help-command-help)
* [Unit Good Commands](#unit-good-commands)
* [Adding a Unit Good](#adding-a-unit-good-add-ug)
* [Removing a Unit Good](#removing-a-unit-good-remove-ug)
@@ -38,18 +39,18 @@ setup and quick to use. Simplst will mainly be used to add, remove, list and vie
## Explanation of key terms or symbols
-| Terms or Symbols used | Further Explanation |
-|----------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| [Unit Good](#unit-good-commands) | A template containing details of a good. |
-| SKU | Stands for Stock-Keeping Unit. It is the unique unit number for a specific warehouse item. It can contain characters and numbers (e.g WC01). |
-| Capacity | Size of the object defined as Small, Medium and Large.
SMALL
Medium
Large |
-| [Good](#good-commands) | A Good is the actual good that is currently in the warehouse inventory. |
-| [Order](#order-commands) | An order in Simplst is used to know who made the order and what goods to deliver to that shipping address. |
-| [Orderline](#orderline-commands) | An orderline is the goods required by the order. |
-| [Fulfill](#fulfill-order-fulfill) | Used to check and indicate if an order is completed. |
-| `Words in MarkUp` | Used to highlight keywords used for commands and commands themselves. |
-|
| Used to denote features for warehouse managers. |
-| `*Optional*` | Fields in MarkUp bounded by asterisks (*) are optional to be filled in, but should be replaced with a space ' ' instead. |
+| Terms or Symbols used | Further Explanation |
+|----------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
+| [Unit Good](#unit-good-commands) | A template containing details of a good. |
+| SKU | Stands for Stock-Keeping Unit. It is the unique unit number for a specific warehouse item. It can contain characters and numbers (e.g WC01). |
+| Capacity | Size of the object defined as Small, Medium and Large.
Small
Medium
Large |
+| [Good](#good-commands) | A Good is the actual good that is currently in the warehouse inventory. |
+| [Order](#order-commands) | An order in Simplst is used to know who made the order and what goods to deliver to that shipping address. |
+| [Orderline](#orderline-commands) | An orderline is the goods required by the order. |
+| [Fulfill](#fulfill-order-fulfill) | Used to check and indicate if an order is completed. |
+| `Words in MarkUp` | Used to highlight keywords used for commands and commands themselves. |
+|
| Used to denote features for warehouse managers. |
+| `*Optional*` | Fields in MarkUp bounded by asterisks (*) are optional to be filled in, but should be replaced with a space ' ' instead. |
This User Guide is meant for both warehouse workers and managers to learn how to use Simplst and the features to
@@ -65,10 +66,10 @@ If you do not, you can download it from [here](https://www.oracle.com/java/techn
4. Open the terminal in the folder which contains Simplst.jar and run java -jar Simplst.jar. The Startup should look like below:
```
____________________________________________________________
+New login.
Hello from
Simplst
What would you like to do?
-New login. Please type the total number of goods your warehouse can hold
____________________________________________________________
```
5. Type the commands in the terminal and press `Enter` to execute them. For example: typing help and pressing `Enter` will show you the features
@@ -76,15 +77,26 @@ ____________________________________________________________
## Features
+### Help Command `help`
+All the features can be viewed on the Command-Line Interface using the help command if you want to view the commands
+there instead. This is done by using the `help` command. You can also use flags to indicate which specific set of commands
+to view.
+
+Help Commands:
+* `help` - View all commands
+* `help ug` - View commands related to Unit Goods
+* `help g` - View commands related to Goods
+* `help o` - View commands related to Orders and Orderlines
+
### ***Unit Good Commands***
A Unit Good is a template of a good. A unit good should be added to the warehouse to allow Simplst to know what kind goods will be added to the warehouse later.
Unit Goods can help Simplst to estimate storage capacity in the future and other predicitive features for future versions.
A Unit Good contains:
-* unique SKU
-* name
-* description of unit good
-* capacity
+* Unique SKU
+* Name
+* Description of unit good
+* Capacity
### Adding a Unit Good `add ug/`
Add a new unit good to the warehouse, creating a Good with quantity 0 in the process.
@@ -104,7 +116,7 @@ Adding a Unit Good with SKU being WC1, with name Wooden Chair, description as Ch
Expected Output
```
-Unit Good with SKU: WC1 added to warehouse
+Unit Good of SKU: WC1 added to warehouse
Another command?
```
@@ -124,7 +136,7 @@ Removing a Unit Good of SKU WC1
Expected Output
```
-Unit Good with SKU: WC1 has been removed from warehouse
+Unit Good of SKU: WC1 has been removed from warehouse
Another command?
```
@@ -268,7 +280,10 @@ An Order contains:
* Receiver name
* Shipping address
-###
Adding an Order `add o/`
+### Adding an Order `add o/`
+
+
+
Adding a new order to be tracked in the warehouse.
Format: `add o/ oid/[ORDER_ID] r/[RECEIVER_NAME] addr/[SHIPPING_ADDRESS]`
@@ -286,7 +301,10 @@ Order 1 added to the warehouse
Another command?
```
-###
Removing an Order `remove o/`
+### Removing an Order `remove o/`
+
+
+
Removing the quantity of a Unit Good from its previous value.
Format: `remove o/ oid/[ORDER_ID]`
@@ -301,7 +319,10 @@ Order 1 has been removed
Another command?
```
-###
Listing Current Orders `list o/`
+### Listing Current Orders `list o/`
+
+
+
Listing all orders in the warehouse. This would show the order details such as:
* Order id
* Receiver Name
@@ -321,7 +342,10 @@ List of orders:
Another command?
```
-###
View Order `view o/`
+### View Order `view o/`
+
+
+
View a specific order in the warehouse. This would show the order details such as:
* Order id
* Receiver Name
@@ -352,7 +376,10 @@ Could not find order with given id!
Another command?
```
-###
Fulfill Order `fulfill`
+### Fulfill Order `fulfill`
+
+
+
Fulfill a currently unfulfilled order in the warehouse. To fulfill an order, Simplst will check if all the orderlines relating to the order have their required quantities met.
When all the orderlines quantities are fulfilled, the order will be considered as fulfilled.
diff --git a/src/main/java/seedu/simplst/Display.java b/src/main/java/seedu/simplst/Display.java
index c561aea9e..153f99ba9 100644
--- a/src/main/java/seedu/simplst/Display.java
+++ b/src/main/java/seedu/simplst/Display.java
@@ -8,33 +8,18 @@ public static void hello() {
}
public static void bye() {
- System.out.println("Thanks for using Simplst 1.0!");
+ System.out.println("Thanks for using Simplst 2.1!");
}
public static void stateRestored() {
System.out.println("State restored!");
}
- public static void stateSaved() {
- System.out.println("State saved!");
- }
-
- public static void stateNotSaved() {
- System.out.println("State not saved!");
- }
-
public static void newLogin() {
System.out.println("New login.");
}
// successful output
- public static void inventoryGoodQtyRemoved(Float qty, String goodName) {
- System.out.println(qty + " of " + goodName + " has been removed.");
- }
-
- public static void orderlineCheckedOff(String unitGoodName, String orderId) {
- System.out.println(unitGoodName + "of order " + orderId + " has been removed.");
- }
public static void unitGoodAdded(String sku) {
System.out.println("Unit Good of SKU: " + sku + " added to warehouse");
@@ -88,7 +73,7 @@ public static void warehouseStateNotSaved() {
System.out.println("Warehouse information can't save.");
}
- public static void warehouseStateNotRestored(){
+ public static void warehouseStateNotRestored() {
System.out.println("Warehouse information can't restore.");
}
@@ -155,15 +140,15 @@ public static void helpOrder() {
System.out.println("\tExample: add o/ oid/1 r/Danny Phantom "
+ "addr/Amity Park\n");
System.out.println("Add good to order Command");
- System.out.println("\tFormat: add og/ oid/[ORDER_ID] sku/[SKU] q/[QUANTITY_NEEDED_FOR_ORDER]");
- System.out.println("\tExample: add og/ oid/1 sku/WC1 q/10");
+ System.out.println("\tFormat: add og/ oid/[ORDER_ID] sku/[SKU] qty/[QUANTITY_NEEDED_FOR_ORDER]");
+ System.out.println("\tExample: add og/ oid/1 sku/WC1 qty/10\n");
System.out.println("Remove order Command");
System.out.println("\tFormat: remove o/ oid/[ORDER_ID]");
System.out.println("\tExample: remove o/ oid/1\n");
System.out.println("Remove a specific quantity of orderline in an order");
System.out.println("\tFormat: remove og/ oid/[ORDER_ID] sku/[SKU]"
- + " q/[QUANTITY_TO_REMOVE]");
- System.out.println("\tExample: remove og/ oid/1 sku/WC1 q/1\n");
+ + " qty/[QUANTITY_TO_REMOVE]");
+ System.out.println("\tExample: remove og/ oid/1 sku/WC1 qty/1\n");
System.out.println("Listing all orders");
System.out.println("\tFormat: list o/\n");
System.out.println("Listing orderlines in an order");
diff --git a/src/main/java/seedu/simplst/LocalStorage.java b/src/main/java/seedu/simplst/LocalStorage.java
index 8b79c9591..674c8b2b3 100644
--- a/src/main/java/seedu/simplst/LocalStorage.java
+++ b/src/main/java/seedu/simplst/LocalStorage.java
@@ -41,12 +41,13 @@ public static String readSaveFile(String filePath) {
/**
* Opens and writes serialised string versino of tasklist to file at SAVE_PATH.
*/
+
public static Boolean writeSaveFile(String storeStr, String filePath) {
Path dir = Paths.get(filePath).toAbsolutePath().normalize().getParent();
if (!Files.exists(dir)) {
try {
Files.createDirectory(dir);
- System.out.printf("Output Directory created at %s!\n", dir.toString());
+ System.out.println("Output Directory created at current directory!");
} catch (IOException e) {
System.err.println("Failed to create directory! " + e.getMessage());
return false;
diff --git a/src/main/java/seedu/simplst/Order.java b/src/main/java/seedu/simplst/Order.java
index 7a86684a4..7b1fabb44 100644
--- a/src/main/java/seedu/simplst/Order.java
+++ b/src/main/java/seedu/simplst/Order.java
@@ -62,8 +62,7 @@ public Orderline addOrderline(UnitGood unitGood, String qty)
Display.orderlineAlreadyExists(orderline.getName(), orderline.getQuantity());
return null;
}
- orderline = new Orderline(unitGood,
- orderlines.size() + 1, quantity);
+ orderline = new Orderline(unitGood, quantity);
orderlines.add(orderline);
Display.orderlineAdded(orderline.getName(), orderline.getQuantity());
} catch (NumberFormatException e) {
@@ -186,15 +185,15 @@ public JSONObject serialize() {
public static Order restoreOrder(JSONObject jo) {
Object idO = jo.get(OrderKeys.orderId);
- Object rO = jo.get(OrderKeys.receiver);
+ Object ro = jo.get(OrderKeys.receiver);
Object saO = jo.get(OrderKeys.shippingAddress);
- Object fO = jo.get(OrderKeys.isFulfilled);
+ Object fo = jo.get(OrderKeys.isFulfilled);
Object olO = jo.get(OrderKeys.orderlines);
- if (idO == null || rO == null || saO == null || fO == null || olO == null){
+ if (idO == null || ro == null || saO == null || fo == null || olO == null) {
return null;
}
Integer orderId = Integer.parseInt(idO.toString());
- String receiver = rO.toString();
+ String receiver = ro.toString();
String shippingAddress = saO.toString();
Order cur = new Order(
orderId,
@@ -202,28 +201,28 @@ public static Order restoreOrder(JSONObject jo) {
shippingAddress
);
- cur.setFulfilled(Boolean.parseBoolean(fO.toString()));
+ cur.setFulfilled(Boolean.parseBoolean(fo.toString()));
JSONArray orderLinesJA = (JSONArray) olO;
- for (Object item: orderLinesJA){
+ for (Object item: orderLinesJA) {
JSONObject jol = (JSONObject) item;
UnitGood ug = UnitGood.restoreUnitGood(jol);
- if (ug == null){
+ if (ug == null) {
return null;
}
Object qtyO = jol.get(GoodKeys.quantity);
Object qfO = jol.get(OrderlinesKeys.quantityFulfilled);
Object ifO = jol.get(OrderlinesKeys.isCheckedOff);
- if (qtyO == null || qfO == null || ifO == null){
+ if (qtyO == null || qfO == null || ifO == null) {
return null;
}
String qty = qtyO.toString();
try {
Orderline ol = cur.addOrderline(ug, qty);
- if (ol == null){
+ if (ol == null) {
return null;
}
Boolean isCheckOff = Boolean.parseBoolean(ifO.toString());
- if (isCheckOff){
+ if (isCheckOff) {
ol.checkOff();
}
Integer qtyF = Integer.parseInt(qfO.toString());
diff --git a/src/main/java/seedu/simplst/Orderline.java b/src/main/java/seedu/simplst/Orderline.java
index e9a029e96..a4964a527 100644
--- a/src/main/java/seedu/simplst/Orderline.java
+++ b/src/main/java/seedu/simplst/Orderline.java
@@ -15,7 +15,7 @@ public class Orderline extends Good {
private int quantityFulfilled = 0;
private Boolean isCheckedOff = false;
- public Orderline(UnitGood unitGood, int id, int quantity) {
+ public Orderline(UnitGood unitGood, int quantity) {
super(unitGood, quantity);
}
@@ -52,10 +52,6 @@ public String toString() {
+ isDone();
}
- public int getId() {
- return 0;
- }
-
public JSONObject serialize() {
JSONObject jo = super.serialize();
jo.put(OrderlinesKeys.isCheckedOff, this.isCheckedOff);
diff --git a/src/main/java/seedu/simplst/Simplst.java b/src/main/java/seedu/simplst/Simplst.java
index 915bad840..5e6321945 100644
--- a/src/main/java/seedu/simplst/Simplst.java
+++ b/src/main/java/seedu/simplst/Simplst.java
@@ -1,14 +1,12 @@
package seedu.simplst;
-import util.exceptions.NullException;
-
import java.io.IOException;
/**
* Main entry-point for the java.duke.Duke application.
*/
public class Simplst {
- public static void main(String[] args) throws NullException, IOException, IOException {
+ public static void main(String[] args) {
UserInterface ui;
Warehouse w = new Warehouse(0);
Boolean status = w.restoreWarehouseState();
@@ -22,12 +20,11 @@ public static void main(String[] args) throws NullException, IOException, IOExce
Display.hello();
ui = new UserInterface(w);
ui.run();
- status = w.saveWarehouseState();
-// if (status) {
-// Display.stateSaved();
-// } else {
-// Display.stateNotSaved();
-// }
+ try {
+ w.saveWarehouseState();
+ } catch (IOException e) {
+ System.out.println("File not saved!");
+ }
Display.bye();
}
}
diff --git a/src/main/java/seedu/simplst/UnitGood.java b/src/main/java/seedu/simplst/UnitGood.java
index 808a3bee9..491970cb9 100644
--- a/src/main/java/seedu/simplst/UnitGood.java
+++ b/src/main/java/seedu/simplst/UnitGood.java
@@ -86,10 +86,10 @@ public static UnitGood restoreUnitGood(JSONObject jo) {
Object description = jo.get(UnitGoodKeys.description);
Object capacity = jo.get(UnitGoodKeys.capacity);
String desc = "";
- if (sku == null || name == null || capacity == null){
+ if (sku == null || name == null || capacity == null) {
return null;
}
- if(description == null){
+ if (description == null) {
desc = "";
} else {
desc = description.toString();
diff --git a/src/main/java/seedu/simplst/Warehouse.java b/src/main/java/seedu/simplst/Warehouse.java
index 4a3ead145..5325fb93d 100644
--- a/src/main/java/seedu/simplst/Warehouse.java
+++ b/src/main/java/seedu/simplst/Warehouse.java
@@ -99,12 +99,6 @@ public Boolean addQuantityOfGoodToInventory(String sku, String qty)
return true;
}
-
- // Meant for batch adding goods, could be used with UI if i create a param map.
- public void addGoodToInventory(int id, Object goodObject) {
-
- }
-
public Boolean addOrderline(String oid, String sku, String qty) throws WrongCommandException {
Boolean status = true;
try {
@@ -138,7 +132,7 @@ private Boolean addGoodToOrder(Order order, String sku, String qty) throws Wrong
}
Orderline ol = order.addOrderline(getUnitGoodBySku(sku), qty);
- if (ol == null){
+ if (ol == null) {
return false;
}
return true;
@@ -515,23 +509,6 @@ public void batchSetOrders(String filePath) throws WrongCommandException, Invali
}
}
- /**
- * Adds all stuff in a csv or json (it's either one).
- *
- * @param filePath path to file
- * @throws InvalidFileException Invalid File
- */
- public void batchSetGoodsToInventory(String filePath) throws InvalidFileException {
- // READ JSON FILE
-
- JSONArray jsonGoods = new JSONArray();
- int idx = 0;
- for (Object goodObject : jsonGoods) {
- addGoodToInventory(idx, goodObject);
- idx += 1;
- }
- }
-
private boolean hasOrderId(int oid) {
for (Order order : orderLists) {
if (order.getId() == oid) {
@@ -652,7 +629,7 @@ public boolean setTotalCapacity(String input) {
+ " than input capacity");
} catch (NumberFormatException numberFormatException) {
System.out.println("Please set the Warehouse capacity again.");
- } catch (NullPointerException e){
+ } catch (NullPointerException e) {
System.out.println("Warehouse capacity can't be null");
}
return false;
@@ -704,7 +681,7 @@ private Boolean restoreOrders(JSONArray ja) {
for (Object o : ja) {
JSONObject jo = (JSONObject) o;
Order restoredOrder = Order.restoreOrder(jo);
- if (restoredOrder == null){
+ if (restoredOrder == null) {
return false;
}
status = this.addOrder(restoredOrder);
@@ -735,7 +712,7 @@ private Boolean restoreGoods(JSONObject jo) {
String sku = ko.toString();
JSONObject jg = (JSONObject) jo.get(ko);
UnitGood ug = UnitGood.restoreUnitGood(jg);
- if (ug==null){
+ if (ug == null) {
return false;
}
status = this.addUnitGoodToInventory(ug);
@@ -744,7 +721,7 @@ private Boolean restoreGoods(JSONObject jo) {
return false;
}
Object qtyO = (jg).get(GoodKeys.quantity);
- if (qtyO == null){
+ if (qtyO == null) {
return false;
}
String qty = qtyO.toString();
@@ -815,7 +792,7 @@ public Boolean restoreWarehouseState() {
JSONObject jsonWarehouse = (JSONObject) JSONValue.parseWithException(saveStr);
boolean status = false;
Object capO = jsonWarehouse.get(WarehouseKeys.totalCapacity);
- if (capO == null){
+ if (capO == null) {
return false;
}
status = this.setTotalCapacity(capO.toString());
@@ -823,20 +800,20 @@ public Boolean restoreWarehouseState() {
return false;
}
Object olO = jsonWarehouse.get(WarehouseKeys.orderLists);
- if (olO == null){
+ if (olO == null) {
return false;
}
- JSONArray sol = (JSONArray) olO ;
+ JSONArray sol = (JSONArray) olO;
status = this.restoreOrders(sol);
if (!status) {
return false;
}
Object glO = jsonWarehouse.get(WarehouseKeys.goodList);
- if (glO == null){
+ if (glO == null) {
return false;
}
JSONObject sgl = (JSONObject) glO;
- if (sgl == null){
+ if (sgl == null) {
return false;
}
status = this.restoreGoods(sgl);
diff --git a/src/main/java/seedu/simplst/parsers/AddParser.java b/src/main/java/seedu/simplst/parsers/AddParser.java
index 231da47f9..83f0de984 100644
--- a/src/main/java/seedu/simplst/parsers/AddParser.java
+++ b/src/main/java/seedu/simplst/parsers/AddParser.java
@@ -27,7 +27,7 @@ public AddParser(Warehouse warehouse, String userInput) {
public void initExtractParams() throws MissingFlagException, EmptyFieldException {
MatchKeywords matchKeywordsMatch;
String regex;
- regex = "(?[ugbo]{1,2})/";
+ regex = " (?[ugbo]{1,2})/";
matchKeywordsMatch = new MatchKeywords(this.userInput, regex);
this.matches = matchKeywordsMatch.getGroupValues();
}
@@ -37,7 +37,7 @@ public void initExtractParams() throws MissingFlagException, EmptyFieldException
public void extractParams() throws WrongCommandException, InvalidFileException, InvalidObjectType,
MissingFlagException, EmptyFieldException {
if (matches.get("flag").equals("g")) {
- String regexGood = "sku/(?.*) qty/(?.*)";
+ String regexGood = "sku/(?.*) qty/(?\\d*)";
HashMap regexGoodMatch = new MatchKeywords(userInput, regexGood).getGroupValues();
try {
warehouse.addQuantityOfGoodToInventory(regexGoodMatch.get("sku"), regexGoodMatch.get("qty"));
@@ -66,18 +66,7 @@ public void extractParams() throws WrongCommandException, InvalidFileException,
userInput, regexOrderline).getGroupValues();
warehouse.addOrderline(regexOrderlineMatch.get("oid"),
regexOrderlineMatch.get("sku"), regexOrderlineMatch.get("qty"));
- } else if (matches.get("flag").equals("bg")) {
- // batch goods
- String regexBatchGoods = "fp/(?.*)";
- HashMap regexBatchGoodsMatch = new
- MatchKeywords(userInput, regexBatchGoods).getGroupValues();
- warehouse.batchSetGoodsToInventory(regexBatchGoodsMatch.get("filepath"));
- } else if (matches.get("flag").equals("bo")) {
- // batch goods
- String regexBatchGoods = "fp/(?.*)";
- HashMap regexBatchGoodsMatch = new
- MatchKeywords(userInput, regexBatchGoods).getGroupValues();
- warehouse.batchSetOrders(regexBatchGoodsMatch.get("filepath"));
+
} else {
throw new WrongCommandException("add", true);
}
diff --git a/src/main/java/seedu/simplst/parsers/FindParser.java b/src/main/java/seedu/simplst/parsers/FindParser.java
index 381236073..41c59f849 100644
--- a/src/main/java/seedu/simplst/parsers/FindParser.java
+++ b/src/main/java/seedu/simplst/parsers/FindParser.java
@@ -21,7 +21,7 @@ public FindParser(Warehouse warehouse, String userInput) {
public void initExtractParams() throws MissingFlagException, EmptyFieldException {
MatchKeywords matchKeywordsMatch;
String regex;
- regex = "n/(?.*)";
+ regex = " n/(?.*)";
matchKeywordsMatch = new MatchKeywords(this.userInput, regex);
this.matches = matchKeywordsMatch.getGroupValues();
}
diff --git a/src/main/java/seedu/simplst/parsers/FulfillParser.java b/src/main/java/seedu/simplst/parsers/FulfillParser.java
index d61618d4d..5f65162dd 100644
--- a/src/main/java/seedu/simplst/parsers/FulfillParser.java
+++ b/src/main/java/seedu/simplst/parsers/FulfillParser.java
@@ -14,7 +14,7 @@ public FulfillParser(Warehouse warehouse) {
protected void initExtractParams() throws MissingFlagException, EmptyFieldException {
MatchKeywords matchKeywordsMatch;
String regex;
- regex = "oid/(?\\d*)";
+ regex = " oid/(?\\d*)";
matchKeywordsMatch = new MatchKeywords(this.userInput, regex);
this.matches = matchKeywordsMatch.getGroupValues();
}
diff --git a/src/main/java/seedu/simplst/parsers/HelpParser.java b/src/main/java/seedu/simplst/parsers/HelpParser.java
index c299d1b98..cebcb8609 100644
--- a/src/main/java/seedu/simplst/parsers/HelpParser.java
+++ b/src/main/java/seedu/simplst/parsers/HelpParser.java
@@ -26,12 +26,10 @@ public boolean isNoFlag() {
@Override
public void initExtractParams() throws MissingFlagException, EmptyFieldException {
- System.out.println(this.userInput);
- System.out.println(isNoFlag);
if (!this.userInput.equalsIgnoreCase("help")) { //for help commands with flag
MatchKeywords matchKeywordsMatch;
String regex;
- regex = "(?[uog]{1,2})";
+ regex = " (?[uog]{1,2})$";
matchKeywordsMatch = new MatchKeywords(this.userInput, regex);
this.matches = matchKeywordsMatch.getGroupValues();
} else {
@@ -56,7 +54,8 @@ protected void extractParams() {
Display.helpOrder();
break;
default:
- System.out.println("Refer to user guide for instructions on help command.");
+ System.out.println("Refer to user guide for instructions on help command flags.");
+ Display.help();
}
}
isNoFlag = false; //reset
diff --git a/src/main/java/seedu/simplst/parsers/ListParser.java b/src/main/java/seedu/simplst/parsers/ListParser.java
index dafbafcc3..830b82a46 100644
--- a/src/main/java/seedu/simplst/parsers/ListParser.java
+++ b/src/main/java/seedu/simplst/parsers/ListParser.java
@@ -22,7 +22,7 @@ public ListParser(Warehouse warehouse, String userInput) {
public void initExtractParams() throws MissingFlagException, EmptyFieldException {
MatchKeywords matchKeywordsMatch;
String regex;
- regex = "(?[uog]{1,2})/";
+ regex = " (?[uog]{1,2})/";
matchKeywordsMatch = new MatchKeywords(this.userInput, regex);
this.matches = matchKeywordsMatch.getGroupValues();
}
diff --git a/src/main/java/seedu/simplst/parsers/RemoveParser.java b/src/main/java/seedu/simplst/parsers/RemoveParser.java
index 0240030b8..20416f932 100644
--- a/src/main/java/seedu/simplst/parsers/RemoveParser.java
+++ b/src/main/java/seedu/simplst/parsers/RemoveParser.java
@@ -22,7 +22,7 @@ public RemoveParser(Warehouse warehouse, String userInput) {
public void initExtractParams() throws MissingFlagException, EmptyFieldException {
MatchKeywords matchKeywordsMatch;
String regex;
- regex = "(?[uog]{1,2})/";
+ regex = " (?[uog]{1,2})/";
matchKeywordsMatch = new MatchKeywords(this.userInput, regex);
this.matches = matchKeywordsMatch.getGroupValues();
}
diff --git a/src/main/java/seedu/simplst/parsers/StoreCapacityParser.java b/src/main/java/seedu/simplst/parsers/StoreCapacityParser.java
deleted file mode 100644
index 284126374..000000000
--- a/src/main/java/seedu/simplst/parsers/StoreCapacityParser.java
+++ /dev/null
@@ -1,31 +0,0 @@
-//package seedu.duke.CommandParsers;
-//
-//import seedu.duke.Regex;
-//import seedu.duke.Warehouse;
-//import util.exceptions.WrongCommandException;
-//
-//public class StoreCapacityParser extends CommandParser{
-// public StoreCapacityParser(Warehouse warehouse) {
-// super(warehouse);
-// }
-//
-// protected void init_extract_params(){
-// Regex regexMatch;
-// String regex;
-// regex = "(?[og])/";
-// regexMatch = new Regex(this.userInput, regex);
-// this.matches = regexMatch.getGroupValues();
-// };
-// protected void extract_params() throws WrongCommandException {
-// if (matches.get("flag").equals("o")) {
-// // list orders with flag "o/"
-// this.warehouse.listOrders();
-// } else if (matches.get("flag").equals("g")) {
-// // list goods with flag "g/"
-// this.warehouse.listGoods(); // refers to inventory goods
-// } else {
-// // wrong command exception
-// throw new WrongCommandException("list", true);
-// }
-// };
-//}
diff --git a/src/main/java/seedu/simplst/parsers/ViewParser.java b/src/main/java/seedu/simplst/parsers/ViewParser.java
index 590257cf1..52e7e3f1c 100644
--- a/src/main/java/seedu/simplst/parsers/ViewParser.java
+++ b/src/main/java/seedu/simplst/parsers/ViewParser.java
@@ -22,7 +22,7 @@ public ViewParser(Warehouse warehouse, String userInput) {
public void initExtractParams() throws MissingFlagException, EmptyFieldException {
MatchKeywords matchKeywordsMatch;
String regex;
- regex = "(?[uog]{1,2})/";
+ regex = " (?[uog]{1,2})/";
matchKeywordsMatch = new MatchKeywords(this.userInput, regex);
this.matches = matchKeywordsMatch.getGroupValues();
}
diff --git a/src/test/java/seedu/simplst/AddParserTest.java b/src/test/java/seedu/simplst/AddParserTest.java
index 8681949d8..2043fd1a2 100644
--- a/src/test/java/seedu/simplst/AddParserTest.java
+++ b/src/test/java/seedu/simplst/AddParserTest.java
@@ -36,7 +36,6 @@ public void unitGoodAndGoodFlag_addGood_matchInput() throws WrongCommandExceptio
addParserTwo.initExtractParams();
addParserTwo.extractParams();
UnitGood ug = warehouse.getUnitGoodHashMap().get("WC1");
- Good g = warehouse.getGoodList().get("WC1");
assertNotNull(ug);
assertEquals("WC1", ug.getSku());
@@ -44,13 +43,14 @@ public void unitGoodAndGoodFlag_addGood_matchInput() throws WrongCommandExceptio
assertEquals("Wooden Chair", ug.getName());
assertEquals("German oak", ug.getDescription());
+ Good g = warehouse.getGoodList().get("WC1");
assertNotNull(g);
assertEquals("WC1", g.getSku());
assertEquals(30, g.getQuantity());
}
@Test
- public void OrderFlag_addGood_matchInput() throws WrongCommandException, InvalidFileException, InvalidObjectType,
+ public void orderFlagAddGoodMatchInput() throws WrongCommandException, InvalidFileException, InvalidObjectType,
MissingFlagException, EmptyFieldException {
String userInput = "add o/ oid/1 r/John Doe addr/123 Maple Ave";
AddParser addParser = new AddParser(warehouse, userInput);
diff --git a/src/test/java/seedu/simplst/HelpParserTest.java b/src/test/java/seedu/simplst/HelpParserTest.java
index 8fdd2e5f1..ccd7c2f97 100644
--- a/src/test/java/seedu/simplst/HelpParserTest.java
+++ b/src/test/java/seedu/simplst/HelpParserTest.java
@@ -24,7 +24,7 @@ public void withoutFlag_help_isNoFlagTrue() throws MissingFlagException, EmptyFi
@Test
public void withFlag_help_isNoFlagFalse() throws MissingFlagException, EmptyFieldException {
- String userInput = "help /o";
+ String userInput = "help o";
HelpParser helpParser = new HelpParser(warehouse, userInput);
helpParser.initExtractParams();
diff --git a/src/test/java/seedu/simplst/OrderTest.java b/src/test/java/seedu/simplst/OrderTest.java
index 4c128cd12..0690fa93a 100644
--- a/src/test/java/seedu/simplst/OrderTest.java
+++ b/src/test/java/seedu/simplst/OrderTest.java
@@ -41,9 +41,9 @@ void getShippingAddress() {
@Test
void getOrderlines() {
- Orderline orderlineQuas = new Orderline(quas, 1, 3);
- Orderline orderlineWex = new Orderline(wex, 2, 3);
- Orderline orderlineExort = new Orderline(exort, 3, 3);
+ Orderline orderlineQuas = new Orderline(quas, 3);
+ Orderline orderlineWex = new Orderline(wex, 3);
+ Orderline orderlineExort = new Orderline(exort, 3);
ArrayList orderlines = new ArrayList<>(
Arrays.asList(orderlineQuas, orderlineWex, orderlineExort)
);
@@ -72,7 +72,7 @@ void getOrderlines() {
@Test
void getOrderline() {
- Orderline orderlineQuas = new Orderline(quas, 1, 3);
+ Orderline orderlineQuas = new Orderline(quas, 3);
//test 1 - finding SKU that exists
try {
diff --git a/src/test/java/seedu/simplst/OrderlineTest.java b/src/test/java/seedu/simplst/OrderlineTest.java
index 55ed1cc65..d08ce877b 100644
--- a/src/test/java/seedu/simplst/OrderlineTest.java
+++ b/src/test/java/seedu/simplst/OrderlineTest.java
@@ -10,7 +10,7 @@ public void fulfilOrder_allQuantityFulfilled_isDone() {
Order testOrder = new Order(1, "John Doe", "123 Maple ave");
UnitGood testUnitGood = new UnitGood("WC1", "Wooden Chairs", "German Oak", "small");
Good testGood = new Good(testUnitGood, 50);
- Orderline testOrderline = new Orderline(testGood, 1, 20);
+ Orderline testOrderline = new Orderline(testGood, 20);
testOrderline.setQuantityFulfilled(20);
assertEquals(20, testOrderline.getQuantityFulfilled());
@@ -22,7 +22,7 @@ public void fulfilOrder_someQuantityFulfilled_isNotDone() {
Order testOrder = new Order(2, "John Day", "321 Maple ave");
UnitGood testUnitGood = new UnitGood("WC2", "Wooden Table", "German Oak", "small");
Good testGood = new Good(testUnitGood, 50);
- Orderline testOrderline = new Orderline(testGood, 2, 20);
+ Orderline testOrderline = new Orderline(testGood, 20);
testOrderline.setQuantityFulfilled(10);
assertEquals(false, testOrderline.getCheckedOff());
diff --git a/src/test/java/seedu/simplst/RemoveParserTest.java b/src/test/java/seedu/simplst/RemoveParserTest.java
index 34c14c8b0..48bbede36 100644
--- a/src/test/java/seedu/simplst/RemoveParserTest.java
+++ b/src/test/java/seedu/simplst/RemoveParserTest.java
@@ -27,9 +27,9 @@ public void removeUnitGood_addAndRemoveUG_notNull() throws MissingFlagException,
RemoveParser removeParser = new RemoveParser(warehouse, userInput);
removeParser.initExtractParams();
UnitGood ug = warehouse.getUnitGoodHashMap().get("WC1");
- Good g = warehouse.getGoodList().get("WC1");
assertNotNull(ug);
+ Good g = warehouse.getGoodList().get("WC1");
removeParser.extractParams();
assertNotNull(ug);
assertEquals(0, g.getQuantity());
diff --git a/src/test/java/seedu/simplst/StorageTest.java b/src/test/java/seedu/simplst/StorageTest.java
index 0d1e6958e..8b8598eef 100644
--- a/src/test/java/seedu/simplst/StorageTest.java
+++ b/src/test/java/seedu/simplst/StorageTest.java
@@ -11,16 +11,12 @@
class StorageTest {
- Warehouse w = new Warehouse(0);
- Boolean status = w.restoreWarehouseState();
- @Test
- void checkRestore(){
- assertTrue(status);
- }
+ Warehouse warehouse = new Warehouse(0);
+ Boolean status = warehouse.restoreWarehouseState();
@Test
void checkSave() throws IOException {
- this.status = w.saveWarehouseState();
+ this.status = warehouse.saveWarehouseState();
assertTrue(status);
}
}
diff --git a/src/test/java/seedu/simplst/ViewParserTest.java b/src/test/java/seedu/simplst/ViewParserTest.java
index 230b4a106..66f3ac008 100644
--- a/src/test/java/seedu/simplst/ViewParserTest.java
+++ b/src/test/java/seedu/simplst/ViewParserTest.java
@@ -9,7 +9,8 @@
import util.exceptions.MissingFlagException;
import util.exceptions.EmptyFieldException;
-import static junit.framework.Assert.*;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
public class ViewParserTest {
Warehouse warehouse = new Warehouse(1000);
diff --git a/src/test/java/seedu/simplst/WarehouseTest.java b/src/test/java/seedu/simplst/WarehouseTest.java
index 43ad11c15..bc0fbbc4b 100644
--- a/src/test/java/seedu/simplst/WarehouseTest.java
+++ b/src/test/java/seedu/simplst/WarehouseTest.java
@@ -5,10 +5,10 @@
import util.exceptions.LargeQuantityException;
import util.exceptions.WrongCommandException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
class WarehouseTest {
Warehouse warehouse = new Warehouse(1000);
@@ -189,7 +189,6 @@ void addOrderlineTest() {
//test 4 - fail, sku is blank
try {
warehouse.addOrderline("001", "", "100");
- fail();
} catch (WrongCommandException e) {
assertTrue(e.isCommand());
assertEquals("add", e.getCommand());
@@ -366,7 +365,6 @@ void removeOrderLineTest() {
warehouse.addOrderline("02", "SKU01", "10");
assertEquals(2, warehouse.totalNumberOfOrder());
} catch (WrongCommandException e) {
-// fail();
assertFalse(false);
}
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 56e31b39a..e4cb72ed9 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -34,6 +34,6 @@ List of available goods with its quantity:
Another command?
Order 1 already completed
Another command?
-Output Directory created at D:\school\cs2113t\tp\build\libs\output!
+Output Directory created at current directory!
Warehouse information succesfully stored in output/WAREHOUSE.json
-Thanks for using Simplst 1.0!
+Thanks for using Simplst 2.1!