Skip to content

Commit

Permalink
Revert "List Inventory"
Browse files Browse the repository at this point in the history
  • Loading branch information
IronBiscuit authored Oct 4, 2020
1 parent cb63615 commit d770ca6
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 302 deletions.
4 changes: 2 additions & 2 deletions docs/AboutUs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layout: page
title: About Us
---

We are a team based in the [School of Computing, National University of Singapore](http://www.comp.nus.edu.sg), formed
We are a team based in the [School of Computing, National University of Singapore](http://www.comp.nus.edu.sg), formed
to fulfill the team project requirements of [CS2103T](https://nusmods.com/modules/CS2103T/software-engineering)

You can reach us at the email `seer[at]comp.nus.edu.sg`
Expand Down Expand Up @@ -64,7 +64,7 @@ You can reach us at the email `seer[at]comp.nus.edu.sg`

<img src="images/howtoosee.png" width="200px">

[[github](https://github.com/howtoosee)]
[[github](https://github.com/howtoosee)]
[[portfolio](team/xihao.md)]

* Role: Developer
Expand Down
20 changes: 10 additions & 10 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
### Use cases
For all use cases (unless specified otherwise):
- The **System** is `NUStorage`
- The **Actor** is `User`
- The **Actor** is `User`


**Use case: Add an inventory item**
Expand All @@ -277,7 +277,7 @@ For all use cases (unless specified otherwise):
4. NUStorage adds the item to the list

Use case ends.

**Use case: Remove an inventory item**

**MSS**
Expand Down Expand Up @@ -330,7 +330,7 @@ For all use cases (unless specified otherwise):
* 3a1. NUStorage shows an error message.

Use case resumes at step 2.

**Use case: List finance/inventory records**

**MSS**
Expand All @@ -341,7 +341,7 @@ For all use cases (unless specified otherwise):
* 2a. The list is empty.

Use case ends.

**Use case: Save finance / inventory records**

**MSS**
Expand All @@ -356,7 +356,7 @@ For all use cases (unless specified otherwise):
1. User requests to exit NUStorage
2. NUStorage saves both finance and inventory records and shows a goodbye message
3. NUStorage terminates after 1.5 seconds



### Non-Functional Requirements
Expand All @@ -371,7 +371,7 @@ For all use cases (unless specified otherwise):

* **Mainstream OS**: Windows, Linux, Unix, OS-X
* **Inventory**: An item that a user wishes to record. An inventory item can refer to any existing object
* **Finances**: A record that allows a user to monitor his earnings and spending.
* **Finances**: A record that allows a user to monitor his earnings and spending.

--------------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -403,7 +403,7 @@ testers are expected to do more *exploratory* testing.
1. Shutting Down

1. If you would like to save your records prior to shutting down, remember to enter the `save` command

1. Close the app by simply clicking on the close button or enter the `exit` command.

### Deleting a record
Expand All @@ -426,13 +426,13 @@ testers are expected to do more *exploratory* testing.
1. Adding a financial/inventory record.

1. Prerequisites: None

1. Test case: `add_inventory i/MacBook n/10`<br>
Expected: An inventory item 'MacBook' is added with the quantity of 10. Details of the added record shown in the status message.

1. Test case: `add_finance op/in amt/1000`
Expected: A finance record of an increase by $1000.00 is added. Details of the added record shown in status message.

1. Other incorrect add commands to try: `add`, `add_record`, `add_inventory i/MacBook` <br>
Expected: No record is added. Error details shown in the status message.

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/nustorage/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import nustorage.logic.parser.exceptions.ParseException;
import nustorage.model.ReadOnlyAddressBook;
import nustorage.model.person.Person;
import nustorage.model.record.InventoryRecord;

/**
* API of the Logic component
Expand All @@ -34,8 +33,6 @@ public interface Logic {
/** Returns an unmodifiable view of the filtered list of persons */
ObservableList<Person> getFilteredPersonList();

ObservableList<InventoryRecord> getFilteredInventory();

/**
* Returns the user prefs' address book file path.
*/
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/nustorage/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import nustorage.model.Model;
import nustorage.model.ReadOnlyAddressBook;
import nustorage.model.person.Person;
import nustorage.model.record.InventoryRecord;
import nustorage.storage.Storage;

/**
Expand Down Expand Up @@ -65,10 +64,6 @@ public ObservableList<Person> getFilteredPersonList() {
return model.getFilteredPersonList();
}

public ObservableList<InventoryRecord> getFilteredInventory() {
return model.getFilteredInventory();
}

@Override
public Path getAddressBookFilePath() {
return model.getAddressBookFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public AddInventoryCommand(InventoryRecord newInventoryRecord, FinanceRecord new
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

model.addInventoryRecord(newInventoryRecord);
model.addFinanceRecord(newFinanceRecord);
return new CommandResult(String.format(MESSAGE_SUCCESS, newInventoryRecord));
Expand Down
1 change: 0 additions & 1 deletion src/main/java/nustorage/logic/commands/CommandResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class CommandResult {
/** The application should exit. */
private final boolean exit;


/**
* Constructs a {@code CommandResult} with the specified fields.
*/
Expand Down
27 changes: 0 additions & 27 deletions src/main/java/nustorage/logic/commands/ListInventoryCommand.java

This file was deleted.

3 changes: 0 additions & 3 deletions src/main/java/nustorage/logic/parser/AddressBookParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import nustorage.logic.commands.FindCommand;
import nustorage.logic.commands.HelpCommand;
import nustorage.logic.commands.ListCommand;
import nustorage.logic.commands.ListInventoryCommand;
import nustorage.logic.commands.ListFinanceRecordsCommand;
import nustorage.logic.parser.exceptions.ParseException;

Expand Down Expand Up @@ -48,8 +47,6 @@ public Command parseCommand(String userInput) throws ParseException {
final String commandWord = matcher.group("commandWord");
final String arguments = matcher.group("arguments");
switch (commandWord) {
case ListInventoryCommand.COMMAND_WORD:
return new ListInventoryCommand();

case AddInventoryCommand.COMMAND_WORD:
return new AddInventoryCommandParser().parse(arguments);
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/nustorage/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
public interface Model {
/** {@code Predicate} that always evaluate to true */
Predicate<Person> PREDICATE_SHOW_ALL_PERSONS = unused -> true;
Predicate<InventoryRecord> PREDICATE_SHOW_ALL_INVENTORY = unused -> true;

/**
* Replaces user prefs data with the data in {@code userPrefs}.
Expand Down Expand Up @@ -93,13 +92,9 @@ public interface Model {
/** Returns an unmodifiable view of the filtered person list */
ObservableList<Person> getFilteredPersonList();

ObservableList<InventoryRecord> getFilteredInventory();

/**
* Updates the filter of the filtered person list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredPersonList(Predicate<Person> predicate);

void updateFilteredInventoryList(Predicate<InventoryRecord> predicate);
}
16 changes: 0 additions & 16 deletions src/main/java/nustorage/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class ModelManager implements Model {
private final AddressBook addressBook;
private final UserPrefs userPrefs;
private final FilteredList<Person> filteredPersons;
private final FilteredList<InventoryRecord> filteredInventory;

/**
* Initializes a ModelManager with the given addressBook and userPrefs.
Expand All @@ -43,7 +42,6 @@ public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs
logger.fine("Initializing with address book: " + addressBook + " and user prefs " + userPrefs);

this.inventory = new Inventory();
filteredInventory = new FilteredList<>(this.inventory.asUnmodifiableObservableList());
this.financeAccount = new FinanceAccount();
this.addressBook = new AddressBook(addressBook);
this.userPrefs = new UserPrefs(userPrefs);
Expand Down Expand Up @@ -95,19 +93,6 @@ public void addInventoryRecord(InventoryRecord newRecord) {
inventory.addInventoryRecord(newRecord);
}

public ObservableList<InventoryRecord> getFilteredInventory() {
return filteredInventory;
}

/**
* Applies a predicate to the Inventory and returns those that pass it.
* @param predicate the predicate used to filter Inventory
*/
public void updateFilteredInventoryList(Predicate<InventoryRecord> predicate) {
requireNonNull(predicate);
filteredInventory.setPredicate(predicate);
}

//=========== FinanceAccount ================================================================================

@Override
Expand Down Expand Up @@ -178,7 +163,6 @@ public void updateFilteredPersonList(Predicate<Person> predicate) {
filteredPersons.setPredicate(predicate);
}


@Override
public boolean equals(Object obj) {
// short circuit if same object
Expand Down
32 changes: 8 additions & 24 deletions src/main/java/nustorage/model/item/Inventory.java
Original file line number Diff line number Diff line change
@@ -1,60 +1,44 @@
package nustorage.model.item;

import java.util.Iterator;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import nustorage.model.record.InventoryRecord;

/**
* Class to store different InventoryRecords.
*/
public class Inventory implements Iterable<InventoryRecord>, ReadOnlyInventory {
public class Inventory {

private final ObservableList<InventoryRecord> internalList = FXCollections.observableArrayList();
private final ObservableList<InventoryRecord> internalUnmodifiableList =
FXCollections.unmodifiableObservableList(internalList);
private final List<InventoryRecord> inventory;

/**
* Constructs inventory object to hold InventoryRecords.
*/
public Inventory() {

this.inventory = new ArrayList<>();
}

/**
* Adds InventoryRecord into inventory.
* @param inventoryRecord to be added.
*/
public void addInventoryRecord(InventoryRecord inventoryRecord) {
internalList.add(inventoryRecord);
inventory.add(inventoryRecord);
}

/**
* Removes InventoryRecord from inventory.
* @param inventoryRecord to be removed.
*/
public void deleteInventoryRecord(InventoryRecord inventoryRecord) {
internalList.remove(inventoryRecord);
}

public ObservableList<InventoryRecord> getInventoryList() {
return internalList;
}

public ObservableList<InventoryRecord> asUnmodifiableObservableList() {
return internalUnmodifiableList;
}

@Override
public Iterator<InventoryRecord> iterator() {
return internalList.iterator();
inventory.remove(inventoryRecord);
}

@Override
public String toString() {
return internalList.stream()
return inventory.stream()
.map(InventoryRecord::toString)
.collect(Collectors.joining("\n"));
}
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/nustorage/model/item/ReadOnlyInventory.java

This file was deleted.

46 changes: 0 additions & 46 deletions src/main/java/nustorage/ui/InventoryPanel.java

This file was deleted.

Loading

0 comments on commit d770ca6

Please sign in to comment.