Skip to content

Commit

Permalink
Merge pull request #206 from AY2021S1-CS2103T-T12-1/branch-docs-saad
Browse files Browse the repository at this point in the history
Bug fixes and update usage pictures for edit-i
  • Loading branch information
Wincenttjoi authored Oct 28, 2020
2 parents debaabd + a1db7fd commit 91f6f50
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 54 deletions.
Binary file modified docs/images/edit-i_example_one_step_three.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/edit-i_example_two_step_three.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 0 additions & 25 deletions src/main/java/seedu/address/model/delivery/UniqueDeliveryList.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.address.model.delivery.exception.DeliveryNotFoundException;
import seedu.address.model.delivery.exception.DuplicateDeliveryException;

/**
* A list of deliveries that enforces uniqueness between its elements and does not allow nulls.
Expand Down Expand Up @@ -42,9 +41,6 @@ public boolean contains(Delivery toCheck) {
*/
public void add(Delivery toAdd) {
requireNonNull(toAdd);
if (contains(toAdd)) {
throw new DuplicateDeliveryException();
}
internalList.add(toAdd);
}

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

if (!target.equals(editedDelivery) && contains(editedDelivery)) {
throw new DuplicateDeliveryException();
}

internalList.set(index, editedDelivery);
}

Expand All @@ -90,10 +82,6 @@ public void setDeliveries(UniqueDeliveryList replacement) {
*/
public void setDeliveries(List<Delivery> deliveries) {
requireAllNonNull(deliveries);
if (!deliveriesAreUnique(deliveries)) {
throw new DuplicateDeliveryException();
}

internalList.setAll(deliveries);
}

Expand Down Expand Up @@ -121,17 +109,4 @@ public int hashCode() {
return internalList.hashCode();
}

/**
* Returns true if {@code deliveries} contains only unique deliveries.
*/
private boolean deliveriesAreUnique(List<Delivery> items) {
for (int i = 0; i < items.size() - 1; i++) {
for (int j = i + 1; j < items.size(); j++) {
if (items.get(i).equals(items.get(j))) {
return false;
}
}
}
return true;
}
}

This file was deleted.

7 changes: 4 additions & 3 deletions src/main/resources/view/CommandBox.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import static seedu.address.testutil.TypicalDeliveries.KELVIN;
import static seedu.address.testutil.TypicalDeliveries.MARCUS;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.junit.jupiter.api.Test;

import seedu.address.model.delivery.exception.DeliveryNotFoundException;
import seedu.address.model.delivery.exception.DuplicateDeliveryException;
import seedu.address.testutil.DeliveryBuilder;

public class UniqueDeliveryListTest {
Expand Down Expand Up @@ -52,12 +50,6 @@ public void add_nullDelivery_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> uniqueDeliveryList.add(null));
}

@Test
public void add_duplicateDelivery_throwsDuplicateDeliveryException() {
uniqueDeliveryList.add(KELVIN);
assertThrows(DuplicateDeliveryException.class, () -> uniqueDeliveryList.add(KELVIN));
}

@Test
public void setDelivery_nullTargetDelivery_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> uniqueDeliveryList.setDelivery(null, KELVIN));
Expand Down Expand Up @@ -131,13 +123,6 @@ public void setDeliveries_list_replacesOwnListWithProvidedList() {
assertEquals(expectedUniqueDeliveryList, uniqueDeliveryList);
}

@Test
public void setDeliveries_listWithDuplicateDeliverys_throwsDuplicateDeliveryException() {
List<Delivery> listWithDuplicateDeliverys = Arrays.asList(KELVIN, KELVIN);
assertThrows(DuplicateDeliveryException.class, () -> uniqueDeliveryList
.setDeliveries(listWithDuplicateDeliverys));
}

@Test
public void asUnmodifiableObservableList_modifyList_throwsUnsupportedOperationException() {
assertThrows(UnsupportedOperationException.class, ()
Expand Down

0 comments on commit 91f6f50

Please sign in to comment.