|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectreservation.system.functions.Functions
This class uniform the way to call each sub-class (Create, Reserve, Cancel, Lists, Identify) that processes the commands. It delegates to the sub-class the implementation of the function execute () and check (). Also it masks the machinery and helps the developer who want to reuse the program.
Field Summary | |
protected java.lang.String[] |
arg
The list of argnument receive from the command |
Fields inherited from interface reservation.Action |
fs, NUMBER_ARGUMENT_MAX |
Constructor Summary | |
Functions()
|
Method Summary | |
(package private) abstract void |
_check(java.lang.String[] arg)
Check if the arguments are correct and can be executed |
static void |
ArgumentIsValid(java.lang.String[] arg,
int min,
int max)
Verify the number of arguments of the command Verify invariants : - regex ^[A-Z][a-z]*
- seat < dimension of the flight and > 0
|
(package private) static void |
CheckBookingListNotEmpty()
Verify that one reservation has been made. |
(package private) static void |
CheckFlightListNotEmpty()
Verify that at least one flight is created. |
static boolean |
checkInteger(java.lang.String arg,
int min,
int max)
Verify invariants : - regex ^0*[1-9]+0*
* - arg belongs to [min max]
|
abstract java.lang.String |
execute()
Proceed the execution of the request |
java.lang.String |
execute(java.lang.String[] arg)
Process the array of argument |
static java.lang.String |
usage()
Display the usage for the command (details the different arguments, his type...). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String[] arg
Constructor Detail |
public Functions()
Method Detail |
public abstract java.lang.String execute() throws java.lang.Exception
java.lang.Exception
- if the excution is not completepublic static java.lang.String usage()
public java.lang.String execute(java.lang.String[] arg) throws java.lang.Exception
execute
in interface Action
arg
- the list of command to be proceed
java.lang.Exception
- If the command is not executedpublic static boolean checkInteger(java.lang.String arg, int min, int max)
-regex
^0*[1-9]+0* * -arg
belongs to [min max]
min
- the minimun number allowed in arg
max
- the maximum number allowed in arg
arg
- the input String that will be checked
public static void ArgumentIsValid(java.lang.String[] arg, int min, int max) throws java.lang.Exception
- regex
^[A-Z][a-z]*
- seat < dimension of the flight and > 0
arg
- the input array that will be checkedmin
- the minimum argument allowed in arg
max
- the maximum argument allowed in arg
java.lang.Exception
- if the invariants is violatedstatic void CheckFlightListNotEmpty() throws java.lang.Exception
java.lang.Exception
- if the FlightList contains no flight.static void CheckBookingListNotEmpty() throws java.lang.Exception
java.lang.Exception
- if the BookingList contains no BookingNumber.abstract void _check(java.lang.String[] arg) throws java.lang.Exception
java.lang.Exception
- if the argument is violated
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |