PROJECT: Car Park Finder
My name is Tang Yurou, a Year 2 Computer Science student at NUS School of Computing. This is the portfolio of the project my team and I worked on for CS2103T Software Engineering module. Other than implementing various enhancement features, my main responsibilities include ensuring proper documentation and ensuring proper integration of command features implemented by different teammates. My teammates include Keith Fong, Yeo Zhuan Yu and Xiao Delong.
Overview
The project that my team and I worked on is a Car Park Finder that helps users find a suitable car park easily. Car Park Finder is a desktop application customised for users who are more comfortable with typing. The application uses the Command Line Interface for all commands, i.e. all functions of the application can be used by simply typing!
More About Our Application
The Find
command helps you find a list of car parks within a specific
location. After which, you can use the Filter
command
to narrow down the list of car parks to just those that fit your needs,
e.g. you can use the Filter
command to find a car park that
has both night parking and short-term parking. With our Query
and Notify
feature, you can always received the most updated car park information!
Moreover, to decide on which car park to choose or whether to even drive,
you can use the Calculate
command to calculate the cost of
parking at a particular car park during
a specified period of time.
The Autocomplete
and Abbreviation
features makes it even easier for
you to find a car park of your choice by making typing easier.
Summary of contributions
Given below is a summary of my contributions to the project. My main contributions
include implementing the |
-
Major enhancement: added the Filter command
-
What it does: allow users to filter car parks listed by
Find
command based on six criteria:-
Car park has available parking slots
-
Car park has short-term parking
-
Type of car park
-
Car park has free parking between a specified time period
-
Car park has night parking
-
Type of parking system that the car park uses
-
-
Justification: The feature helps to narrow down a long list of car parks in the location to just those that meets the criteria of the user. Helps user to decide on which car park to go to.
-
Highlights:
-
Filter
command integrates withFind
command to accomplish location-based filtering. -
Moreover, the command can work with varying number of flags, i.e. users can choose how many criteria they would like to filter by, and input them in any order. Each criteria may have different input parameters.
-
If users were to forget what flags are available for use and which parameters are required for each flag, error messages would guide them to execute the commands correctly.
-
-
-
Minor enhancement: added the Calculate command
-
What it does: Allow users to calculate the cost of parking at a car park when they specify the day and time they are parking.
-
Justification: Users might want to know how much it cost to park their car, or choose between driving and other transport options e.g. taking public transport.
-
-
Code contributed:
-
Other contributions:
Contributions to the User Guide
My main contributions to the User Guide are in the sections documenting the |
Filtering car parks : filter
Filters the list of car parks returned by FindCommand
by the following flags:
-
Car park has available parking slots
a/
-
Car park has short-term parking
s/
-
Type of car park
ct/
-
Car park has free parking between a specified time period
f/
-
Car park has night parking
n/
-
Type of parking system that the car park uses
ps/
FilterCommand
can take in any number of flags, in any order.
Format | Abbreviation | Example(s) |
---|---|---|
filter FLAG&PARAMETER(S) [FLAG&PARAMETER(S)] … |
fil, filt, filte |
filter f/ sun 7.30am 5.30pm ct/ surface |
List of valid flags:
Criteria | Flag | Parameter Structure | Valid Parameters | Example(s) |
---|---|---|---|---|
Car park has free parking |
f/ |
DAY START_TIME END_TIME |
DAY: e.g. sun |
filter f/ sun 9.00am 5.30pm |
Car park has night parking |
n/ |
- |
- |
filter n/ |
Type of car park |
ct/ |
CAR_PARK_TYPE |
surface, multistorey, basement, mechanised, covered |
filter ct/ covered |
Car park has available parking slot |
a/ |
- |
- |
filter a/ |
Car park has short-term parking |
s/ |
- |
- |
filter s/ |
Type of parking system |
ps/ |
PARKING_SYSTEM_TYPE |
coupon, electronic |
filter ps/ coupon |
Take note that FindCommand
must be used to find a list of carparks within the location first.
Upper or lower case characters do not matter.
Calculating the cost of parking : calculate
Calculates the cost of parking at a selected car park between a specified time period.
Format | Abbreviation | Example(s) |
---|---|---|
calculate CARPARK_NAME DAY START_TIME END_TIME |
ca, cal, calc, calcu |
calculate TJ39 sun 3.30am 6.30pm |
CalculateCommand
takes into account the free parking times of car parks.
It returns an error message if the car park has no short-term parking.
Contributions to the Developer Guide
The following are my contributions to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project. |
Filter feature
The filter feature allow users to find a suitable car park based on criteria that users input, within a certain area.
Overview
The filter mechanism is facilitated by FilterCommand
and FilterCommandParser
.
The filter mechanism can filter car parks by the following criteria. The corresponding flag of each criterion is also
indicated below.
-
Car park has available parking slots
a/
-
Car park has short-term parking
s/
-
Type of car park
ct/
-
Car park has free parking between a specified time period
f/
-
Car park has night parking
n/
-
Type of parking system that the car park uses
ps/
The FilterCommandParser
extends Parser
and implements the following operation:
-
FilterCommandParser#parse()
— Splits the arguments by white spaces and store them into an array list. Parser then checks the validity of the arguments input by user, and throws aParseException
when arguments are deemed invalid in various ways.
The FilterCommand
extends Command
and implements the following operation:
-
FilterCommand#execute()
— Executes the command by filtering the car park list withCarparkFilteringPredicate
.
The FilterCommand
is able to filter car parks by multiple criteria at a time.
Current Implementation
Given below is an example usage scenario of how the filter mechanism behaves at each step when filtering with the following criteria:
-
car park is covered
-
car park has free parking between Sunday 11.30am and 3.30pm
-
car park currently has available parking slot
Step 1. The user launches the application.
Step 2. The user executes filter ct/ COVERED f/ SUN 11.30AM 3.30PM a/
.
Input parameters can also be in lower case as FilterCommandParser will convert input parameters to upper case
if they are not.
|
Step 3. After CarparkFinderParser
detects filter
as the command word, a
FilterCommandParser
is created to parse the arguments supplied to the command.
Step 4. The FilterCommandParser
splits the arguments by white spaces and store them into List<String> argumentsList
.
Step 5. Then, it identifies the flags present in List<String> argumentsList
and store them in List<String> flagList
.
If List<String> flagList is empty, FilterCommandParser throws a ParseException to indicatte that the command has invalid parameters.
|
Step 6. FilterCommandParser
also parses the parameter(s) of each flag, and throws ParseException
when necessary.
-
ct/
:FilterCommandParser
ensures thatCOVERED
is a valid car park type. -
f/
:FilterCommandParser
ensures thatSUN
is a valid day and11.30AM
and3.30PM
are valid times. Moreover,FilterCommandParser
ensures that all three parameters are present.
Step 7. Parameters of ct/
and f/
are packaged into CarparkTypeParameter carparkTypeParameter
and
FreeParkingParameter freeParkingParameter
respectively. They are then passed to a newly created FilterCommand
together with List<String> flagList
.
Step 8. The FilterCommand
object obtains the last predicate used by FindCommand
from model
and creates the CarparkFilteringPredicate
.
The ModelManager stores the last predicate used by FindCommand . The predicate is updated every time FindCommand is executed.
|
Step 9. Besides filtering by the last predicate used by FindCommand
(location), CarparkFilteringPredicate
has a
series of if
statements that checks which flags are present in List<String> flagList
, before looking into
the parameters of the flags.
-
For
a/
:CarparkFilteringPredicate
checks that the car park has available parking slots. -
For
ct/
:CarparkFilteringPredicate
checks that the car park type of the car park isCOVERED
. -
For
f/
:CarparkFilteringPredicate
checks that the car park has free parking on Sunday, and the start and end time input by the user falls between the free parking time period of the car park.
Step 10. To combine the filtering criteria, a boolean variable, collective
, is used. The following snippet of code shows more clearly how it is used.
Step 11. The list of car parks is filtered against the predicate and returned to the GUI.
Please refer to the Sequence Diagram below for the filter operation.
Design Considerations
Aspect: How location based filtering is done
-
Alternative 1 (Current choice): Combining the location predicate from the previous
FindCommand
to form the predicate for the currentFilterCommand
Pros
Able to accomplish location-based filtering with less modification to existing code structure.
Cons
Less efficient as the list of car park needs to be filtered by an additional parameter.
-
Alternative 2: Store the filtered list of car parks from
FindCommand
, then filter from there.Pros
Improved efficiency as a shorter list of car park needs to be filtered by
FilterCommand
.Cons
Additional memory required to store the list of car park generated by
FindCommand
. A whole new set of classes and methods needs to be written to store the filtered list, might over-complicate code.
Calculate feature
The calculate feature helps users calculate the cost of parking at a specific car park for a specified time period.
Overview
The calculate mechanism is facilitated by CalculateCommand
and CalculateCommandParser
.
Current Implementation
Given below is an example usage scenario of how the calculate mechanism behaves at each step when the user wants to know the cost of parking at car park W49, on a Monday, from 9.00am to 5.30pm.
Step 1. The user launches the application.
Step 2. The user executes calculate W49 SUN 9.00AM 5.30PM
.
Step 3. After CarparkFinderParser
detects calculate
as the command word, a CalculateCommandParser
is created to
parse the arguments supplied to the command.
Step 4. The CarparkFinderParser
splits the arguments by white spaces, then creates a CalculateCommand
object.
Step 5. CalculateCommand
creates a CarparkIsOfNumberPredicate
to find the specified car park, car park W49, from
the list of car parks.
Step 6. CalculateCommand
checks if the car park W49 has short-term parking.
Step 7. As some car parks only has short-term parking between certain timings, CalculateCommand
checks if the parking time input by the user is valid.
Step 8. After which CalculateCommand
checks of there is free parking on Monday between the specified time. Since there
is no free parking during that time period, it will calculate the cost of parking by the standard rate of $0.60 per half an hour.
Step 9. The calculated cost is then returned to the GUI as a command result.
The following Activity Diagram summarizes the implementation of the calculate command.
Design Considerations
Aspect: How specified car park is identified and obtained from car park list
-
Alternative 1 (Current choice): Identify car park by car park number. Filter list of car parks by the car park number. Then obtain the car park from filtered list.
Pros
Command can be executed independently, as long as user knows the car park number of car park. Make use of existing filtering methods to obtain car park. Since car park number is unique to each car park, there would only be one car park left in filtered list if car park number is valid.
Cons
Less efficient as command needs to find the specific car park from all the car parks.
-
Alternative 2: Identify the car park by index from last filtered list.
Pros
Simple to implement, can directly obtain car park by obtaining the last filtered list from
modal
and then using theget
method on the list.Cons
Command can only work after
FindCommand
orFilterCommand
is executed.