reservation.system
Class Flight

java.lang.Object
  extended byreservation.system.Flight
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Flight
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class hold fligth structure. This object could be asserted in the FlightList.

Author:
Texier Mathieu and Frederic Bidon
See Also:
Serialized Form

Field Summary
static int ROW_LENGTH_MAX
          The maximum number of length of each row in a flight
static int ROWS_MAX
          The maximum number of rows in a flight
 
Constructor Summary
Flight(java.lang.String flightName, Pos dimension)
          Construct a Flight named flightName with the size dimension
 
Method Summary
 void _check()
          Verify invariants : - regex [[A-Z]*[a-z]*[0-9]*]+
- dimension < (ROWS_MAX,ROWS_LENGHT_MAX) and > 0
protected  java.lang.Object clone()
          Creates and returns a copy of this object.
 boolean equals(java.lang.Object anObject)
          Overide equals
 Pos getDimension()
          Return the dimension (Rows and row length) of the flight
 java.lang.String getFlightName()
          Return the name of the fligth
 java.lang.String toString()
          Returns a string representation of this Flight object.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ROWS_MAX

public static final int ROWS_MAX
The maximum number of rows in a flight

See Also:
Constant Field Values

ROW_LENGTH_MAX

public static final int ROW_LENGTH_MAX
The maximum number of length of each row in a flight

See Also:
Constant Field Values
Constructor Detail

Flight

public Flight(java.lang.String flightName,
              Pos dimension)
       throws java.lang.Exception
Construct a Flight named flightName with the size dimension

Parameters:
flightName - Name of the flight. This name is used to Lists the flight
dimension - The size of the flight : number of rows and row length
Throws:
java.lang.Exception - When value dosn't make sense, this exception is thrown
Method Detail

getFlightName

public java.lang.String getFlightName()
Return the name of the fligth

Returns:
the name of the flight

getDimension

public Pos getDimension()
Return the dimension (Rows and row length) of the flight

Returns:
the dimension of the flight

toString

public java.lang.String toString()
Returns a string representation of this Flight object. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null

Returns:
a string representation of this Flight object.

equals

public boolean equals(java.lang.Object anObject)
Overide equals

Parameters:
anObject - anObject - the reference object with which to compare
Returns:
true if this object is the same as the obj argument; false otherwise

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Returns:
a copy of this Flight object
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface.

_check

public void _check()
            throws java.lang.Exception,
                   java.lang.NullPointerException
Verify invariants :
 - regex [[A-Z]*[a-z]*[0-9]*]+
- dimension < (ROWS_MAX,ROWS_LENGHT_MAX) and > 0

Throws:
java.lang.NullPointerException - if pos or name is null
java.lang.Exception - if the invariant is violated