reservation.system.functions
Class Cancel

java.lang.Object
  extended byreservation.system.functions.Functions
      extended byreservation.system.functions.Cancel
All Implemented Interfaces:
Action

public class Cancel
extends Functions

This class hold Cancel structure. This object allows to cancel a reservation for different person or for a whole of person by calling the methods cancel in FlightSystem.

Author:
Texier Mathieu and Frederic Bidon

Field Summary
 
Fields inherited from class reservation.system.functions.Functions
arg
 
Fields inherited from interface reservation.Action
fs, NUMBER_ARGUMENT_MAX
 
Constructor Summary
Cancel()
           
 
Method Summary
(package private)  void _check(java.lang.String[] arg)
          Verify that at least one flight is created and also one reservation has been made.
 java.lang.String execute()
          Cancel several person or a whole of person if the command cancel and their arguments are correct.
static java.lang.String usage()
          Display the usage for the command cancel.
 
Methods inherited from class reservation.system.functions.Functions
ArgumentIsValid, CheckBookingListNotEmpty, CheckFlightListNotEmpty, checkInteger, execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cancel

public Cancel()
Method Detail

execute

public java.lang.String execute()
                         throws java.lang.Exception
Cancel several person or a whole of person if the command cancel and their arguments are correct.

Specified by:
execute in class Functions
Returns:
a confimation's message if the person(s) or the bookingNumber are canceled.
Throws:
java.lang.Exception - if a person name is duplicated or if the person are not canceled.

_check

void _check(java.lang.String[] arg)
      throws java.lang.Exception
Verify that at least one flight is created and also one reservation has been made. Verify invariants :
 - Arguments not null
 - bookingNumber belongs to [1 fs.getBookingNumberMax]
 

Specified by:
_check in class Functions
Throws:
java.lang.Exception - if the invariants is violated

usage

public static java.lang.String usage()
Display the usage for the command cancel.

Returns:
the usage.