org.deltava.beans.event
Class Route

java.lang.Object
  extended by org.deltava.beans.DatabaseBean
      extended by org.deltava.beans.event.Route
All Implemented Interfaces:
Serializable, Comparable<Object>, ComboAlias, ViewEntry, Cacheable

public class Route
extends DatabaseBean
implements ComboAlias, ViewEntry

A class to store information about a Flight Route for an Online Event.

Since:
1.0
Version:
3.1
Author:
Luke
See Also:
Serialized Form

Constructor Summary
Route(int eventID, String route)
          Creates a new Event Route.
 
Method Summary
 int compareTo(Object o)
          Compare two routes by comparing the event and route IDs.
 boolean equals(Object o)
          Compares a route by comparing the departure and arrival airports.
 boolean getActive()
          Returns whether the Route is active.
 Airport getAirportA()
          Returns the arrival Airport for this Flight Route.
 Airport getAirportD()
          Returns the departure Airport for this Flight Route.
 String getComboAlias()
          Returns the alias to use in the HTML <OPTION> element.
 String getComboName()
          Returns the visible name to use in the HTML <OPTION> element.
 int getDistance()
          Returns the distance between the Airports.
 boolean getIsRNAV()
          Returns whether this is an RNAV routing.
 int getMaxSignups()
          Returns the maximum number of signups for this Route.
 String getName()
          Returns the Route name.
 String getRoute()
          Returns the flight plan for this route.
 int getRouteID()
          Returns the identifier for this Route.
 String getRowClassName()
          Returns the CSS class for this object if rendered in a view table.
 int getSignups()
          Returns the number of Pilots signed up for this Route.
 boolean isAvailable()
          Returns if there are still signup slots available for this route.
 void setActive(boolean isActive)
          Updates whether the Route is Active.
 void setAirportA(Airport a)
          Updates the Arrival airport.
 void setAirportD(Airport a)
          Updates the Departure airport.
 void setIsRNAV(boolean isRNAV)
          Updates whether this is an RNAV route.
 void setMaxSignups(int maxSignups)
          Updates the maximum number of Pilots who can be signed up for this Route.
 void setName(String name)
          Updates the route name.
 void setRoute(String route)
          Updates the flight route for this Route.
 void setRouteID(int id)
          Updates the Route identifier.
 void setSignups(int count)
          Updates the number of Pilots signed up for this Route.
 String toString()
          Renders this object to a String by appending the airports and codes.
 
Methods inherited from class org.deltava.beans.DatabaseBean
cacheKey, getHexID, getID, hashCode, setID, validateID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Route

public Route(int eventID,
             String route)
Creates a new Event Route.

Parameters:
eventID - the Event database ID
route - the flight route
Method Detail

getAirportA

public Airport getAirportA()
Returns the arrival Airport for this Flight Route.

Returns:
the Arrival airport object
See Also:
setAirportA(Airport), getAirportD()

getAirportD

public Airport getAirportD()
Returns the departure Airport for this Flight Route.

Returns:
the Departure airport object
See Also:
setAirportD(Airport), getAirportA()

getDistance

public int getDistance()
Returns the distance between the Airports.

Returns:
the distance in miles

getName

public String getName()
Returns the Route name.

Returns:
the name, or the airports if null
See Also:
setName(String)

getRoute

public String getRoute()
Returns the flight plan for this route.

Returns:
the flight plan
See Also:
setRoute(String)

getActive

public boolean getActive()
Returns whether the Route is active.

Returns:
TRUE if the Route is available for signup, otherwise FALSE

getIsRNAV

public boolean getIsRNAV()
Returns whether this is an RNAV routing.

Returns:
TRUE if RNAV, otherwise FALSE

isAvailable

public boolean isAvailable()
Returns if there are still signup slots available for this route.

Returns:
TRUE if signups are less than maximum signups, otherwise FALSE

getSignups

public int getSignups()
Returns the number of Pilots signed up for this Route.

Returns:
the number of Pilots signed up
See Also:
getSignups()

getMaxSignups

public int getMaxSignups()
Returns the maximum number of signups for this Route.

Returns:
the maximum number of Pilots signed up
See Also:
setMaxSignups(int)

getRouteID

public int getRouteID()
Returns the identifier for this Route.

Returns:
the Route identifier
See Also:
setRouteID(int)

setAirportA

public void setAirportA(Airport a)
Updates the Arrival airport.

Parameters:
a - the new arrival Airport object
See Also:
getAirportA(), setAirportD(Airport)

setAirportD

public void setAirportD(Airport a)
Updates the Departure airport.

Parameters:
a - the new departure Airport object
See Also:
getAirportD(), setAirportA(Airport)

setActive

public void setActive(boolean isActive)
Updates whether the Route is Active.

Parameters:
isActive - TRUE if the Route is active, otherwise FALSE

setIsRNAV

public void setIsRNAV(boolean isRNAV)
Updates whether this is an RNAV route.

Parameters:
isRNAV - TRUE if RNAV, otherwise FALSE

setRoute

public void setRoute(String route)
Updates the flight route for this Route.

Parameters:
route - the waypoints
See Also:
getRoute()

setName

public void setName(String name)
Updates the route name.

Parameters:
name - the name
See Also:
getName()

setSignups

public void setSignups(int count)
Updates the number of Pilots signed up for this Route.

Parameters:
count - the number of signups
See Also:
getSignups()

setMaxSignups

public void setMaxSignups(int maxSignups)
Updates the maximum number of Pilots who can be signed up for this Route.

Parameters:
maxSignups - the maximum number of signups
See Also:
getMaxSignups()

setRouteID

public void setRouteID(int id)
Updates the Route identifier.

Parameters:
id - the identifier
Throws:
IllegalArgumentException - if id is zero or negative

getComboName

public String getComboName()
Description copied from interface: ComboAlias
Returns the visible name to use in the HTML <OPTION> element.

Specified by:
getComboName in interface ComboAlias
Returns:
The visible name for this entry

getComboAlias

public String getComboAlias()
Description copied from interface: ComboAlias
Returns the alias to use in the HTML <OPTION> element.

Specified by:
getComboAlias in interface ComboAlias
Returns:
The alias for this entry

compareTo

public int compareTo(Object o)
Compare two routes by comparing the event and route IDs.

Specified by:
compareTo in interface Comparable<Object>
Overrides:
compareTo in class DatabaseBean
See Also:
Comparable.compareTo(Object)

equals

public boolean equals(Object o)
Compares a route by comparing the departure and arrival airports.

Overrides:
equals in class DatabaseBean
Parameters:
o - the object to compare with
Returns:
TRUE if the objects have the same class and database ID

toString

public String toString()
Renders this object to a String by appending the airports and codes.

Overrides:
toString in class Object

getRowClassName

public String getRowClassName()
Description copied from interface: ViewEntry
Returns the CSS class for this object if rendered in a view table.

Specified by:
getRowClassName in interface ViewEntry
Returns:
the CSS class name, or NULL if none


Copyright © 2004-2009 Global Virtual Airlines Group. All Rights Reserved.