Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefferson111 committed Nov 10, 2019
2 parents 839df32 + 8092cc3 commit fa9ee42
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,78 @@ e.g. `routeGenerate amk hub to nus by bus`
.Activity diagram for the execute() method in RouteGenerateCommand
image::SGTravel_routeGenerate_diagram.png[height="1150" width="1030"]

=== Itinerary Feature

==== Implementation

SGTravel facilitates the user to create itineraries for their Singapore trip either on their own liking or based on recommendations given. The user can then store these itineraries and access them at any time leading to effective trip planning and scheduling. The itinerary feature is facilitated by the Itinerary class. This section will document the implementation of the Itinerary feature and its various components. Included below is the class diagram for Itinerary:

.The class diagram for Itinerary and associated classes
image::SGTravel_Itinerary_class_diagram.png[height="400" width="700"]

As can be seen from the diagram above. The main itinerary class has different fields such as the start and end dates (to calculate the number of days) and a list of Agendas. Here the agenda class models the activities and locations to be seen in one day. Hence, it contains a list of Venues and Todos.

Given below is an example usage scenario and how the newItinerary mechanism behaves at each step:

. The user calls the `NewItineraryCommand` with its relevant parameters. +
e.g. `newItinerary 23/04/20 24/04/20 NewItinerary 1 /venue MBS /do sightseeing /and eating.`
. The `LogicManager` parses the user input using the `Parser`.
. The Parser calls `CreateNewItineraryParser` and returns an NewItineraryCommand Object and passes the created itinerary in the constructor.
. The `LogicManager` will call `execute()` on the `NewItineraryCommand` object which interacts with and stores the new itinerary in the Model component.
. A new `Route` is created with the relevant parameters and is added to the `RouteList` via the `add()` method in the `RouteList`.
. The method `save()` is invoked in the `Model`, and a `CommandResultText` object is created with an appropriate message to show that the command has been executed properly
. If no Itinerary is created, it would return a string of message MESSAGE_IRINERARY_FAIL_CREATION.

The activity diagram given above shows how the NewItineraryCommand interacts with the model interface to save the new Itinerary.

.Activity diagram for the execute() method in newItineraryCommand
image::SGTravel_newItinerary_Command_diagram.png[height="640" width="1400"]

Alternatively, the creation of itineraries can be facilitated by the Recommendations and AddListCommands in the Logic Component.

Given below is an example usage scenario and how the recommendation mechanism behaves and interacts in the Model :

. The user calls the `RecommendationsCommand` with its relevant parameters. +
e.g. `recommend itinerary between 23/04/20 and 24/04/20`
. The `LogicManager` parses the user input using the `RecommendationsCommandParser`.
. The RecommendationParser returns a RecommendationsCommand object and passes the relevant String Array of date details.
. The `LogicManager` will call `execute()` on the `RecommendationsCommand` object which return a `CommandResultText` Object containing a message.
. During the `execute()` method a recommendation Object containing all of SGTravels possible locations is created.
. The recommendation object then calls on the makeItinerary function. This then returns an itinerary objects containing only the specified amount worth of days. If more than 9 days are entered a RecommendationsFailException is passed.
. This returned itinerary is then stored into the Model component via the setRecentItinerary method. This makes the recommendation easily accessible to the addThisList command.
. A `CommandResultText` object is created with an appropriate message to show that the command has been executed properly.

Given below is the sequence diagram of how the various components work in the `execute()` method of the `RecommendationsCommand` command:

.Sequence diagram for the execute() method in RecommendationsCommand
image::SGTravel_recommend_command_diagram.png[height="950" width="1380"]

Other helper commands such as list,show and doneItineraries have not been shown but are an important interface to the user.

==== Design Considerations

===== **Aspect: How a new Itinerary is entered**

* **Alternative 1:** Through a conversation
** Pros: Easier for the users to understand and learn
** Cons: Harder to implement
* **Alternative 2:** Through an interactable UI Component
** Pros: Much easier for the user to use
** Cons: Not command line based

==== [Proposed] Itinerary Builder Command

The completed itinerary feature would allow the user to create an itinerary like a conversation. This process would also allow the user to edit the itinerary before confirming and storing it. The app would use an algorithm to find the nearest attractions to the user's hotel stay (currently not implemented). It also recommend the most popular attractions based on the user's length of stay. The activity diagram for this feature is given below:

.Activity diagram for the Itinerary Builder command
image::SGTravel_v.20_newItinerary_builder_diagram.png[height="950" width="1380"]

There are two main additions coming in v2.0 which are :

. A logic algorithm, would find the best places to visit based on a users hotel of choice
. Once an itinerary has been entered, SGTravel gives the user a chance to edit any day’s agenda they wish to. The user could then edit and confirm once they were satisfied. Given below is the workflow diagram, for the edit/update command.


=== [Proposed] Data Encryption

_{Explain here how the data encryption feature will be implemented}_
Expand Down
Binary file modified docs/images/SGTravel_recommend_command_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fa9ee42

Please sign in to comment.