Skip to content

Commit 91f6f50

Browse files
authored
Merge pull request #206 from AY2021S1-CS2103T-T12-1/branch-docs-saad
Bug fixes and update usage pictures for edit-i
2 parents debaabd + a1db7fd commit 91f6f50

File tree

6 files changed

+4
-54
lines changed

6 files changed

+4
-54
lines changed
2.66 KB
Loading
-17.4 KB
Loading

src/main/java/seedu/address/model/delivery/UniqueDeliveryList.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import javafx.collections.FXCollections;
1010
import javafx.collections.ObservableList;
1111
import seedu.address.model.delivery.exception.DeliveryNotFoundException;
12-
import seedu.address.model.delivery.exception.DuplicateDeliveryException;
1312

1413
/**
1514
* A list of deliveries that enforces uniqueness between its elements and does not allow nulls.
@@ -42,9 +41,6 @@ public boolean contains(Delivery toCheck) {
4241
*/
4342
public void add(Delivery toAdd) {
4443
requireNonNull(toAdd);
45-
if (contains(toAdd)) {
46-
throw new DuplicateDeliveryException();
47-
}
4844
internalList.add(toAdd);
4945
}
5046

@@ -61,10 +57,6 @@ public void setDelivery(Delivery target, Delivery editedDelivery) {
6157
throw new DeliveryNotFoundException();
6258
}
6359

64-
if (!target.equals(editedDelivery) && contains(editedDelivery)) {
65-
throw new DuplicateDeliveryException();
66-
}
67-
6860
internalList.set(index, editedDelivery);
6961
}
7062

@@ -90,10 +82,6 @@ public void setDeliveries(UniqueDeliveryList replacement) {
9082
*/
9183
public void setDeliveries(List<Delivery> deliveries) {
9284
requireAllNonNull(deliveries);
93-
if (!deliveriesAreUnique(deliveries)) {
94-
throw new DuplicateDeliveryException();
95-
}
96-
9785
internalList.setAll(deliveries);
9886
}
9987

@@ -121,17 +109,4 @@ public int hashCode() {
121109
return internalList.hashCode();
122110
}
123111

124-
/**
125-
* Returns true if {@code deliveries} contains only unique deliveries.
126-
*/
127-
private boolean deliveriesAreUnique(List<Delivery> items) {
128-
for (int i = 0; i < items.size() - 1; i++) {
129-
for (int j = i + 1; j < items.size(); j++) {
130-
if (items.get(i).equals(items.get(j))) {
131-
return false;
132-
}
133-
}
134-
}
135-
return true;
136-
}
137112
}

src/main/java/seedu/address/model/delivery/exception/DuplicateDeliveryException.java

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

src/main/resources/view/CommandBox.fxml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55

66
<?import javafx.scene.control.Button?>
77

8-
<StackPane styleClass="stack-pane" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
9-
<TextField fx:id="commandTextField" onAction="#handleCommandEntered" promptText="Enter command here..."/>
8+
<?import javafx.scene.layout.HBox?>
9+
<HBox styleClass="stack-pane" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
10+
<TextField fx:id="commandTextField" onAction="#handleCommandEntered" promptText="Enter command here..." HBox.hgrow="ALWAYS"/>
1011
<Button fx:id="submitCommand" onAction="#handleCommandEntered"
1112
prefHeight="40" minHeight="40" layoutX="500" StackPane.alignment="CENTER_RIGHT">
1213
Send</Button>
13-
</StackPane>
14+
</HBox>
1415

src/test/java/seedu/address/model/delivery/UniqueDeliveryListTest.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
import static seedu.address.testutil.TypicalDeliveries.KELVIN;
99
import static seedu.address.testutil.TypicalDeliveries.MARCUS;
1010

11-
import java.util.Arrays;
1211
import java.util.Collections;
1312
import java.util.List;
1413

1514
import org.junit.jupiter.api.Test;
1615

1716
import seedu.address.model.delivery.exception.DeliveryNotFoundException;
18-
import seedu.address.model.delivery.exception.DuplicateDeliveryException;
1917
import seedu.address.testutil.DeliveryBuilder;
2018

2119
public class UniqueDeliveryListTest {
@@ -52,12 +50,6 @@ public void add_nullDelivery_throwsNullPointerException() {
5250
assertThrows(NullPointerException.class, () -> uniqueDeliveryList.add(null));
5351
}
5452

55-
@Test
56-
public void add_duplicateDelivery_throwsDuplicateDeliveryException() {
57-
uniqueDeliveryList.add(KELVIN);
58-
assertThrows(DuplicateDeliveryException.class, () -> uniqueDeliveryList.add(KELVIN));
59-
}
60-
6153
@Test
6254
public void setDelivery_nullTargetDelivery_throwsNullPointerException() {
6355
assertThrows(NullPointerException.class, () -> uniqueDeliveryList.setDelivery(null, KELVIN));
@@ -131,13 +123,6 @@ public void setDeliveries_list_replacesOwnListWithProvidedList() {
131123
assertEquals(expectedUniqueDeliveryList, uniqueDeliveryList);
132124
}
133125

134-
@Test
135-
public void setDeliveries_listWithDuplicateDeliverys_throwsDuplicateDeliveryException() {
136-
List<Delivery> listWithDuplicateDeliverys = Arrays.asList(KELVIN, KELVIN);
137-
assertThrows(DuplicateDeliveryException.class, () -> uniqueDeliveryList
138-
.setDeliveries(listWithDuplicateDeliverys));
139-
}
140-
141126
@Test
142127
public void asUnmodifiableObservableList_modifyList_throwsUnsupportedOperationException() {
143128
assertThrows(UnsupportedOperationException.class, ()

0 commit comments

Comments
 (0)