Skip to content

Commit d770ca6

Browse files
authored
Revert "List Inventory"
1 parent cb63615 commit d770ca6

20 files changed

+23
-302
lines changed

docs/AboutUs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: page
33
title: About Us
44
---
55

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

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

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

67-
[[github](https://github.com/howtoosee)]
67+
[[github](https://github.com/howtoosee)]
6868
[[portfolio](team/xihao.md)]
6969

7070
* Role: Developer

docs/DeveloperGuide.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
264264
### Use cases
265265
For all use cases (unless specified otherwise):
266266
- The **System** is `NUStorage`
267-
- The **Actor** is `User`
267+
- The **Actor** is `User`
268268

269269

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

279279
Use case ends.
280-
280+
281281
**Use case: Remove an inventory item**
282282

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

332332
Use case resumes at step 2.
333-
333+
334334
**Use case: List finance/inventory records**
335335

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

343343
Use case ends.
344-
344+
345345
**Use case: Save finance / inventory records**
346346

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

361361

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

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

376376
--------------------------------------------------------------------------------------------------------------------
377377

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

405405
1. If you would like to save your records prior to shutting down, remember to enter the `save` command
406-
406+
407407
1. Close the app by simply clicking on the close button or enter the `exit` command.
408408

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

428428
1. Prerequisites: None
429-
429+
430430
1. Test case: `add_inventory i/MacBook n/10`<br>
431431
Expected: An inventory item 'MacBook' is added with the quantity of 10. Details of the added record shown in the status message.
432-
432+
433433
1. Test case: `add_finance op/in amt/1000`
434434
Expected: A finance record of an increase by $1000.00 is added. Details of the added record shown in status message.
435-
435+
436436
1. Other incorrect add commands to try: `add`, `add_record`, `add_inventory i/MacBook` <br>
437437
Expected: No record is added. Error details shown in the status message.
438438

src/main/java/nustorage/logic/Logic.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import nustorage.logic.parser.exceptions.ParseException;
1010
import nustorage.model.ReadOnlyAddressBook;
1111
import nustorage.model.person.Person;
12-
import nustorage.model.record.InventoryRecord;
1312

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

37-
ObservableList<InventoryRecord> getFilteredInventory();
38-
3936
/**
4037
* Returns the user prefs' address book file path.
4138
*/

src/main/java/nustorage/logic/LogicManager.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import nustorage.model.Model;
1616
import nustorage.model.ReadOnlyAddressBook;
1717
import nustorage.model.person.Person;
18-
import nustorage.model.record.InventoryRecord;
1918
import nustorage.storage.Storage;
2019

2120
/**
@@ -65,10 +64,6 @@ public ObservableList<Person> getFilteredPersonList() {
6564
return model.getFilteredPersonList();
6665
}
6766

68-
public ObservableList<InventoryRecord> getFilteredInventory() {
69-
return model.getFilteredInventory();
70-
}
71-
7267
@Override
7368
public Path getAddressBookFilePath() {
7469
return model.getAddressBookFilePath();

src/main/java/nustorage/logic/commands/AddInventoryCommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public AddInventoryCommand(InventoryRecord newInventoryRecord, FinanceRecord new
3333
@Override
3434
public CommandResult execute(Model model) throws CommandException {
3535
requireNonNull(model);
36+
3637
model.addInventoryRecord(newInventoryRecord);
3738
model.addFinanceRecord(newFinanceRecord);
3839
return new CommandResult(String.format(MESSAGE_SUCCESS, newInventoryRecord));

src/main/java/nustorage/logic/commands/CommandResult.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public class CommandResult {
1717
/** The application should exit. */
1818
private final boolean exit;
1919

20-
2120
/**
2221
* Constructs a {@code CommandResult} with the specified fields.
2322
*/

src/main/java/nustorage/logic/commands/ListInventoryCommand.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/main/java/nustorage/logic/parser/AddressBookParser.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import nustorage.logic.commands.FindCommand;
1919
import nustorage.logic.commands.HelpCommand;
2020
import nustorage.logic.commands.ListCommand;
21-
import nustorage.logic.commands.ListInventoryCommand;
2221
import nustorage.logic.commands.ListFinanceRecordsCommand;
2322
import nustorage.logic.parser.exceptions.ParseException;
2423

@@ -48,8 +47,6 @@ public Command parseCommand(String userInput) throws ParseException {
4847
final String commandWord = matcher.group("commandWord");
4948
final String arguments = matcher.group("arguments");
5049
switch (commandWord) {
51-
case ListInventoryCommand.COMMAND_WORD:
52-
return new ListInventoryCommand();
5350

5451
case AddInventoryCommand.COMMAND_WORD:
5552
return new AddInventoryCommandParser().parse(arguments);

src/main/java/nustorage/model/Model.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
public interface Model {
1919
/** {@code Predicate} that always evaluate to true */
2020
Predicate<Person> PREDICATE_SHOW_ALL_PERSONS = unused -> true;
21-
Predicate<InventoryRecord> PREDICATE_SHOW_ALL_INVENTORY = unused -> true;
2221

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

96-
ObservableList<InventoryRecord> getFilteredInventory();
97-
9895
/**
9996
* Updates the filter of the filtered person list to filter by the given {@code predicate}.
10097
* @throws NullPointerException if {@code predicate} is null.
10198
*/
10299
void updateFilteredPersonList(Predicate<Person> predicate);
103-
104-
void updateFilteredInventoryList(Predicate<InventoryRecord> predicate);
105100
}

src/main/java/nustorage/model/ModelManager.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public class ModelManager implements Model {
3131
private final AddressBook addressBook;
3232
private final UserPrefs userPrefs;
3333
private final FilteredList<Person> filteredPersons;
34-
private final FilteredList<InventoryRecord> filteredInventory;
3534

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

4544
this.inventory = new Inventory();
46-
filteredInventory = new FilteredList<>(this.inventory.asUnmodifiableObservableList());
4745
this.financeAccount = new FinanceAccount();
4846
this.addressBook = new AddressBook(addressBook);
4947
this.userPrefs = new UserPrefs(userPrefs);
@@ -95,19 +93,6 @@ public void addInventoryRecord(InventoryRecord newRecord) {
9593
inventory.addInventoryRecord(newRecord);
9694
}
9795

98-
public ObservableList<InventoryRecord> getFilteredInventory() {
99-
return filteredInventory;
100-
}
101-
102-
/**
103-
* Applies a predicate to the Inventory and returns those that pass it.
104-
* @param predicate the predicate used to filter Inventory
105-
*/
106-
public void updateFilteredInventoryList(Predicate<InventoryRecord> predicate) {
107-
requireNonNull(predicate);
108-
filteredInventory.setPredicate(predicate);
109-
}
110-
11196
//=========== FinanceAccount ================================================================================
11297

11398
@Override
@@ -178,7 +163,6 @@ public void updateFilteredPersonList(Predicate<Person> predicate) {
178163
filteredPersons.setPredicate(predicate);
179164
}
180165

181-
182166
@Override
183167
public boolean equals(Object obj) {
184168
// short circuit if same object

src/main/java/nustorage/model/item/Inventory.java

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,44 @@
11
package nustorage.model.item;
22

3-
import java.util.Iterator;
3+
import java.util.ArrayList;
4+
import java.util.List;
45
import java.util.stream.Collectors;
56

6-
import javafx.collections.FXCollections;
7-
import javafx.collections.ObservableList;
87
import nustorage.model.record.InventoryRecord;
98

109
/**
1110
* Class to store different InventoryRecords.
1211
*/
13-
public class Inventory implements Iterable<InventoryRecord>, ReadOnlyInventory {
12+
public class Inventory {
1413

15-
private final ObservableList<InventoryRecord> internalList = FXCollections.observableArrayList();
16-
private final ObservableList<InventoryRecord> internalUnmodifiableList =
17-
FXCollections.unmodifiableObservableList(internalList);
14+
private final List<InventoryRecord> inventory;
1815

1916
/**
2017
* Constructs inventory object to hold InventoryRecords.
2118
*/
2219
public Inventory() {
23-
20+
this.inventory = new ArrayList<>();
2421
}
2522

2623
/**
2724
* Adds InventoryRecord into inventory.
2825
* @param inventoryRecord to be added.
2926
*/
3027
public void addInventoryRecord(InventoryRecord inventoryRecord) {
31-
internalList.add(inventoryRecord);
28+
inventory.add(inventoryRecord);
3229
}
3330

3431
/**
3532
* Removes InventoryRecord from inventory.
3633
* @param inventoryRecord to be removed.
3734
*/
3835
public void deleteInventoryRecord(InventoryRecord inventoryRecord) {
39-
internalList.remove(inventoryRecord);
40-
}
41-
42-
public ObservableList<InventoryRecord> getInventoryList() {
43-
return internalList;
44-
}
45-
46-
public ObservableList<InventoryRecord> asUnmodifiableObservableList() {
47-
return internalUnmodifiableList;
48-
}
49-
50-
@Override
51-
public Iterator<InventoryRecord> iterator() {
52-
return internalList.iterator();
36+
inventory.remove(inventoryRecord);
5337
}
5438

5539
@Override
5640
public String toString() {
57-
return internalList.stream()
41+
return inventory.stream()
5842
.map(InventoryRecord::toString)
5943
.collect(Collectors.joining("\n"));
6044
}

src/main/java/nustorage/model/item/ReadOnlyInventory.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/main/java/nustorage/ui/InventoryPanel.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)