PROJECT: Car Park Finder


yuroutang

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 Filter command and Calculate command.

  • 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 with Find 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:

    • Documentation:

      • Ensure consistency in format and clear language use in Developer Guide and User Guide: #68 #90

      • Updated contents of the User Guide and Developer Guide with new features: #9 #11 #38

    • Community:

      • Ensure that the various commands of the project are able to integrate properly.

Contributions to the User Guide

My main contributions to the User Guide are in the sections documenting the Filter and Calculate commands. They showcase my ability to write clear and concise documentation targeting end-users.

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
fil a/ ps/ coupon

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
START_TIME: e.g. 7.30AM
END_TIME: e.g. 9.30PM

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.

filter screenshot
Figure 1. Filtering surface car parks that have available parking lots and night parking.

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
calcul, calcula, calculat

calculate TJ39 sun 3.30am 6.30pm
ca 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.

calculate screenshot
Figure 2. Calculating the cost of parking at car park Y14 on Monday from 9.00am to 5.30pm

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 a ParseException 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 with CarparkFilteringPredicate.

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 that COVERED is a valid car park type.

  • f/: FilterCommandParser ensures that SUN is a valid day and 11.30AM and 3.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 is COVERED.

  • 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.

CarparkFilteringPredicate code snippet

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.

SequenceDiagram filter
Figure 3. How the filter operation works

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 current FilterCommand

    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.

ActivityDiag calculate
Figure 4. How the calculate operation works

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 the get method on the list.

    Cons

    Command can only work after FindCommand or FilterCommand is executed.