Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Commit

Permalink
Updates from upstream (#19)
Browse files Browse the repository at this point in the history
* Refactor TagList to UniqueTagList and TagBook to follow structure

Full changelist:
- Refactor TagList to UniqueTagList
- Add TagBook to implement ReadOnlyTagBook
- Change storage to use ReadOnlyTagBook instead of TagList
- Include new definition of equality for Tags (all fields equal except ID)
- Standardize UniqueXXXXList method naming convention

* Update architecture diagrams, UI structure, user stories, use cases and NFRs (AY1920S1-CS2103T-F12-3#108)
  • Loading branch information
shiweing committed Oct 23, 2019
1 parent 4fd3ea2 commit ed17406
Show file tree
Hide file tree
Showing 21 changed files with 352 additions and 206 deletions.
52 changes: 33 additions & 19 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The *_Architecture Diagram_* given above explains the high-level design of the A
The `.puml` files used to create diagrams in this document can be found in the link:{repoURL}/docs/diagrams/[diagrams] folder.
Refer to the <<UsingPlantUml#, Using PlantUML guide>> to learn how to create and edit diagrams.

`Main` has two classes called link:{repoURL}/src/main/java/seedu/address/Main.java[`Main`] and link:{repoURL}/src/main/java/seedu/address/MainApp.java[`MainApp`]. It is responsible for,
`Main` has two classes called link:{repoURL}/src/main/java/tagline/Main.java[`Main`] and link:{repoURL}/src/main/java/tagline/MainApp.java[`MainApp`]. It is responsible for,

* At app launch: Initializes the components in the correct sequence, and connects them up with each other.
* At shut down: Shuts down the components and invokes cleanup method where necessary.
Expand Down Expand Up @@ -66,7 +66,7 @@ image::LogicClassDiagram.png[]

The _Sequence Diagram_ below shows how the components interact with each other for the scenario where the user issues the command `delete 1`.

.Component interactions for `delete 1` command
.Component interactions for `contact delete 1` command
image::ArchitectureSequenceDiagram.png[]

The sections below give more details of each component.
Expand All @@ -77,15 +77,22 @@ The sections below give more details of each component.
.Structure of the UI Component
image::UiClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/ui/Ui.java[`Ui.java`]
*API* : link:{repoURL}/src/main/java/tagline/ui/Ui.java[`Ui.java`]

The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class.
The UI consists of a `MainWindow` which is made up of four parts, i.e. `StatusBarFooter`, `HelpWindow`, `ChatPane` and `ResultPane`. In particular,

The `UI` component uses JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the link:{repoURL}/src/main/java/seedu/address/ui/MainWindow.java[`MainWindow`] is specified in link:{repoURL}/src/main/resources/view/MainWindow.fxml[`MainWindow.fxml`]
* The `ChatPane` manages text interaction with the user. It uses `CommandBox` to read commands and `DialogBox` to display commands and feedback.

* The `ResultPane` displays a relevant `ResultView` based on the command entered.

All these classes, including the `MainWindow` itself, inherit from the abstract `UiPart` class.

The `UI` component uses JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the link:{repoURL}/src/main/java/tagline/ui/MainWindow.java[`MainWindow`] is specified in link:{repoURL}/src/main/resources/view/MainWindow.fxml[`MainWindow.fxml`]

The `UI` component,

* Executes user commands using the `Logic` component.
* Displays feedback and updates the `ResultPane` using `CommandResult` in the `Logic` component.
* Listens for changes to `Model` data so that the UI can be updated with the modified data.

[[Design-Logic]]
Expand All @@ -96,7 +103,7 @@ The `UI` component,
image::LogicClassDiagram.png[]

*API* :
link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`]
link:{repoURL}/src/main/java/tagline/logic/Logic.java[`Logic.java`]

. `Logic` uses the `AddressBookParser` class to parse the user command.
. This results in a `Command` object which is executed by the `LogicManager`.
Expand All @@ -117,7 +124,7 @@ NOTE: The lifeline for `DeleteCommandParser` should end at the destroy marker (X
.Structure of the Model Component
image::ModelClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/model/Model.java[`Model.java`]
*API* : link:{repoURL}/src/main/java/tagline/model/Model.java[`Model.java`]

The `Model`,

Expand All @@ -137,7 +144,7 @@ image:BetterModelClassDiagram.png[]
.Structure of the Storage Component
image::StorageClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/storage/Storage.java[`Storage.java`]
*API* : link:{repoURL}/src/main/java/tagline/storage/Storage.java[`Storage.java`]

The `Storage` component,

Expand All @@ -147,7 +154,7 @@ The `Storage` component,
[[Design-Commons]]
=== Common classes

Classes used by multiple components are in the `seedu.addressbook.commons` package.
Classes used by multiple components are in the `tagline.commons` package.

== Implementation

Expand Down Expand Up @@ -309,17 +316,17 @@ Priorities: High (must have) - `* * \*`, Medium (nice to have) - `* \*`, Low (un
|`* * *` |user |view all notes according to tags |view only notes related to an issue
|`* * *` |user |view all notes related to a contact |discuss these notes with them when I meet them
|`* * *` |user |view all notes related to a group |
|`* *` |user who works with the same person in multiple groups |view all notes related to these groups as well when querying for the person |
|`* *` |user |view all notes related to groups as well when querying for a person |view all information associated with that person at a glance
|`* *` |user with many friends with the same name |be able to differentiate them easily |locate a specific person
|`* *` |user |archive old notes |keep them while not cluttering my app page
|`* *` |clumsy user |export all my data and create a backup |keep my data somewhere safe
|`* *` |forgetful user |get suggestions when typing commands |do not need to memorize commands
|`* *` |user |export all my data and create a backup |keep my data somewhere safe
|`* *` |new user |get suggestions when typing commands |do not need to memorize commands
|`*` |user |embed links in my notes |directly access relevant webpages
|`*` |user |associate photos with notes |organize my photos better
|`*` |user |associate photos with notes |store and view related photos and notes together
|`*` |user |add text styles |personalize my entries
|`*` |user |colour entries with the same tag |organize my notes better
|`*` |clumsy user |prompted for correction when I make typos |fix my command without re-typing it entirely
|`*` |clumsy user |prompted for confirmation when I delete or edit notes or contacts |avoid making irreversible mistakes
|`*` |user |prompted for correction when I make typos |fix my command without re-typing it entirely
|`*` |user |prompted for confirmation when I delete or edit notes or contacts |avoid making irreversible mistakes
|`*` |user |lock notes with authentication |keep my notes secure
|=======================================================================

Expand All @@ -328,6 +335,12 @@ Priorities: High (must have) - `* * \*`, Medium (nice to have) - `* \*`, Low (un

(For each of the use cases below, the *System* is `TagLine` and the *Actor* is the `user`, unless specified otherwise)

The use cases are divided into categories using the following naming convention:

* *UCC* for contact-related use cases
* *UCN* for note-related use cases
* *UCE* for error handling use cases.

[discrete]
=== UCC01 Add person

Expand All @@ -347,7 +360,7 @@ Use case ends.
* 1b. [underline]#UCE02 Missing compulsory fields#

[discrete]
=== UCC02 Add person
=== UCC02 Add group

*MSS*

Expand All @@ -365,10 +378,10 @@ Use case ends.
* 1b. [underline]#UCE02 Command with missing compulsory fields#
+
[none]
* 1c. User inputs a group that already exists.
* 1c. User inputs a group with the same members as one that already exists.
+
[none]
** 1c1. TagLine adds the alternate name to the group.
** 1c1. TagLine adds the new group name as an alias to the currently existing group.
+
[none]
Use case ends.
Expand Down Expand Up @@ -495,8 +508,9 @@ Use case ends.

. Should work on any <<mainstream-os,mainstream OS>> as long as it has Java `11` or above installed.
. Should be able to hold up to 1000 contacts without a noticeable sluggishness in performance for typical usage.
. Should be able to display and navigate large text files without decrease in performance
. Should be able to display large amounts of text quickly, i.e. up to 10MB of text data within 2 seconds
. A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.
. Command syntax should not exceed 10 distinct terms, in order to avoid user confusion.

[appendix]
== Glossary
Expand Down
Binary file modified docs/images/ArchitectureDiagram.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/ArchitectureSequenceDiagram.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/UiClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions src/main/java/tagline/model/contact/AddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void resetData(ReadOnlyAddressBook newData) {
*/
public boolean hasContact(Contact contact) {
requireNonNull(contact);
return contacts.contains(contact);
return contacts.containsContact(contact);
}

/**
Expand All @@ -73,7 +73,7 @@ public boolean hasContact(Contact contact) {
public void addContact(Contact p) {
requireNonNull(p.getContactId());
assert (findContact(p.getContactId()).isEmpty()) : "Contact id is not unique";
contacts.add(p);
contacts.addContact(p);
}

/**
Expand All @@ -94,12 +94,16 @@ public void setContact(Contact target, Contact editedContact) {
* {@code key} must exist in the address book.
*/
public void removeContact(Contact key) {
contacts.remove(key);
contacts.removeContact(key);
}

/**
* Finds a contact with ID equal to {@code contactId}.
*/
public Optional<Contact> findContact(ContactId contactId) {
return contacts.findContact(contactId);
}

//// util methods

/**
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/tagline/model/contact/UniqueContactList.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class UniqueContactList implements Iterable<Contact> {
/**
* Returns true if the list contains an equivalent contact as the given argument.
*/
public boolean contains(Contact toCheck) {
public boolean containsContact(Contact toCheck) {
requireNonNull(toCheck);
return internalList.stream().anyMatch(toCheck::isSameContact);
}
Expand Down Expand Up @@ -64,9 +64,9 @@ public int size() {
* Adds a contact to the list.
* The contact must not already exist in the list.
*/
public void add(Contact toAdd) {
public void addContact(Contact toAdd) {
requireNonNull(toAdd);
if (contains(toAdd)) {
if (containsContact(toAdd)) {
throw new DuplicateContactException();
}
internalList.add(toAdd);
Expand All @@ -85,7 +85,7 @@ public void setContact(Contact target, Contact editedContact) {
throw new ContactNotFoundException();
}

if (!target.isSameContact(editedContact) && contains(editedContact)) {
if (!target.isSameContact(editedContact) && containsContact(editedContact)) {
throw new DuplicateContactException();
}

Expand All @@ -96,7 +96,7 @@ public void setContact(Contact target, Contact editedContact) {
* Removes the equivalent contact from the list.
* The contact must exist in the list.
*/
public void remove(Contact toRemove) {
public void removeContact(Contact toRemove) {
requireNonNull(toRemove);
if (!internalList.remove(toRemove)) {
throw new ContactNotFoundException();
Expand Down
16 changes: 12 additions & 4 deletions src/main/java/tagline/model/note/NoteBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import javafx.collections.ObservableList;

/**
* Wraps all data at the address-book level
* Wraps all data at the note book level
* Duplicates are not allowed (by .isSameNote comparison)
*/
public class NoteBook implements ReadOnlyNoteBook {
Expand Down Expand Up @@ -62,15 +62,23 @@ public void resetData(ReadOnlyNoteBook newData) {
*/
public boolean hasNote(Note note) {
requireNonNull(note);
return notes.contains(note);
return notes.containsNote(note);
}

/**
* Adds a note to the address book.
* The note must not already exist in the address book.
*/
public void addNote(Note p) {
notes.add(p);
notes.addNote(p);
}

/**
* Finds a {@code Note} based on the {@code noteId}.
* @return Optional object if corresponding note is found, empty otherwise
*/
public Optional<Note> findNote(NoteId noteId) {
return notes.findNote(noteId);
}

/**
Expand All @@ -97,7 +105,7 @@ public void setNote(Note target, Note editedNote) {
* {@code key} must exist in the address book.
*/
public void removeNote(Note key) {
notes.remove(key);
notes.removeNote(key);
}

//// util methods
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/tagline/model/note/UniqueNoteList.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class UniqueNoteList implements Iterable<Note> {
/**
* Returns true if the list contains an equivalent note as the given argument.
*/
public boolean contains(Note toCheck) {
public boolean containsNote(Note toCheck) {
requireNonNull(toCheck);
return internalList.stream().anyMatch(toCheck::isSameNote);
}
Expand All @@ -41,9 +41,9 @@ public boolean contains(Note toCheck) {
* Adds a note to the list.
* The note must not already exist in the list.
*/
public void add(Note toAdd) {
public void addNote(Note toAdd) {
requireNonNull(toAdd);
if (contains(toAdd)) {
if (containsNote(toAdd)) {
throw new DuplicateNoteException();
}
internalList.add(toAdd);
Expand Down Expand Up @@ -79,7 +79,7 @@ public void setNote(Note target, Note editedNote) {
throw new NoteNotFoundException();
}

if (!target.isSameNote(editedNote) && contains(editedNote)) {
if (!target.isSameNote(editedNote) && containsNote(editedNote)) {
throw new DuplicateNoteException();
}

Expand All @@ -90,7 +90,7 @@ public void setNote(Note target, Note editedNote) {
* Removes the equivalent note from the list.
* The note must exist in the list.
*/
public void remove(Note toRemove) {
public void removeNote(Note toRemove) {
requireNonNull(toRemove);
if (!internalList.remove(toRemove)) {
throw new NoteNotFoundException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Unmodifiable view of a tag list.
*/
public interface ReadOnlyTagList {
public interface ReadOnlyTagBook {

/**
* Returns an unmodifiable view of the tag list.
Expand Down
19 changes: 16 additions & 3 deletions src/main/java/tagline/model/tag/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public enum TagType {
GROUP_TAG,
}

private static int nextId = 1; //temporary implementation of an incrementing tag ID

public final TagId tagId;
public final TagType tagType;

Expand All @@ -42,11 +40,26 @@ public Tag(TagId tagId, TagType tagType) {
this.tagType = tagType;
}

/**
* Returns true if {@code other} has the same data and ID as this object.
* This defines a stronger notion of equality between two tags.
*/
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof Tag // instanceof handles nulls
&& tagType.equals(((Tag) other).tagType)); // state check
&& tagType.equals(((Tag) other).tagType) // state check
&& tagId.equals(((Tag) other).tagId));
}

/**
* Returns true if {@code other} has the same data as this object.
* This defines a weaker notion of equality between two tags.
*/
public boolean isSameContent(Object other) {
return other == this // short circuit if same object
|| (other instanceof Tag // instanceof handles nulls
&& tagType.equals(((Tag) other).tagType));
}

@Override
Expand Down
Loading

0 comments on commit ed17406

Please sign in to comment.