mil.af.afit.router
Class Vehicle

java.lang.Object
  |
  +--java.util.Observable
        |
        +--mil.af.afit.router.Vehicle
All Implemented Interfaces:
java.io.Serializable

public class Vehicle
extends java.util.Observable
implements java.io.Serializable

A vehicle travels to the sites that it can service based on the vehicle's capabilities and the sites' requirements. By default a vehicle leaves from and returns to its home base, but it can also leave from an "alternate location" in which case it will start there and return to its home base.

Since:
1.0
See Also:
Site, Base, Serialized Form

Constructor Summary
Vehicle()
          Constructs a vehicle with default values.
Vehicle(java.lang.String name)
          Constructs a vehicle with the specified name
Vehicle(java.lang.String name, int speed)
          Constructs a vehicle with the specified name and speed
Vehicle(Vehicle copyThis)
          Constructs a vehicle copied from the specified vehicle
 
Method Summary
 void addSupportedRequirementType(java.lang.String reqType)
          Adds a requirement type to the list of vehicle capabilities.
 void determineHomeBaseFromList(BaseList list)
          Determines a base object from the home base named stored during serialization.
 double getAlternateLatitude()
          Returns the vehicle's alternate starting latitude.
 double getAlternateLongitude()
          Returns the vehicle's alternate starting longitude.
 int getAltitude()
          Returns the vehicle's altitude (in feet).
 int getEarliestStartTime()
          Returns the earliest time when the vehicle is available for takeoff.
 double getEndingLatitude()
          Returns the vehicle's ending latitude.
 double getEndingLongitude()
          Returns the vehicle's ending longitude.
 Base getHomeBase()
          Returns the vehicle's home base.
 java.lang.String getName()
          Returns the vehicle's name.
 int getPriority()
          Returns the vehicle's priority.
 int getRange()
          Returns the vehicle's range (in minutes).
 int getSpeed()
          Returns the vehicle's speed (in knots).
 double getStartingLatitude()
          Returns the vehicle's starting latitude.
 double getStartingLongitude()
          Returns the vehicle's starting longitude.
 java.lang.String[] getSupportedRequirementTypes()
          Returns the vehicle's supported requirement types.
 boolean isAtHome()
          Returns whether or not the vehicle is currently at its home base.
 boolean isEnabled()
          Returns whether or not the vehicl is enabled.
 void removeSupportedRequirementType(java.lang.String reqType)
          Removes a requirement type from the list of vehicle capabilities.
 void setAlternateLatitude(double altLat)
          Sets the vehicle's alternate latitude.
 void setAlternateLongitude(double altLong)
          Sets the vehicle's alternate longitude.
 void setAltitude(int altitude)
          Sets the vehicle's altitude (in feet).
 void setAtHome(boolean state)
          Sets whether or not the vehicle is at its home base.
 void setEarliestStartTime(int time)
          Sets the earliest time that the vehicle can take off.
 void setEnabled(boolean state)
          Sets whether or not the vehicle is enabled.
 void setHomeBase(Base home)
          Sets the vehicle's home base.
 void setHomeBaseName(java.lang.String name)
          Sets the vehicle's home base name.
 void setHomeBaseName(java.lang.String name, BaseList baseList)
          Sets the vehicle's home base name.
 void setName(java.lang.String name)
          Sets the vehicle's name.
 void setRange(int range)
          Sets the vehicle's range (in minutes).
 void setSpeed(int speed)
          Sets the vehicle's speed (in knots).
 void setSupportedRequirementTypes(java.lang.String[] reqTypes)
          Adds the requirement types to the list of vehicle capabilities.
 boolean supportsRequirementType(java.lang.String reqType)
          Returns whether or not the vehicle supports the requirement type.
 java.lang.String toString()
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vehicle

public Vehicle()
Constructs a vehicle with default values.
Since:
1.0

Vehicle

public Vehicle(java.lang.String name)
Constructs a vehicle with the specified name
Parameters:
name - vehicle name
Since:
1.0

Vehicle

public Vehicle(java.lang.String name,
               int speed)
Constructs a vehicle with the specified name and speed
Parameters:
name - vehicle name
speed - vehicle speed (in knots)
Since:
1.0

Vehicle

public Vehicle(Vehicle copyThis)
Constructs a vehicle copied from the specified vehicle
Parameters:
copyThis - vehicle to copy
Since:
1.0
Method Detail

isEnabled

public boolean isEnabled()
Returns whether or not the vehicl is enabled.
Returns:
whether or not the vehicl is enabled
Since:
1.0

getPriority

public final int getPriority()
Returns the vehicle's priority.
Returns:
vehicle's priority
Since:
1.0

getName

public final java.lang.String getName()
Returns the vehicle's name.
Returns:
vehicle's name
Since:
1.0

getHomeBase

public final Base getHomeBase()
Returns the vehicle's home base.
Returns:
vehicle's home base
Since:
1.0

getAlternateLatitude

public final double getAlternateLatitude()
Returns the vehicle's alternate starting latitude.
Returns:
vehicle's alternate starting latitude
Since:
1.0

getAlternateLongitude

public final double getAlternateLongitude()
Returns the vehicle's alternate starting longitude.
Returns:
vehicle's alternate starting longitude
Since:
1.0

getStartingLatitude

public final double getStartingLatitude()
Returns the vehicle's starting latitude. This is a little inefficient at the moment and could use some cleaning up.
Returns:
vehicle's starting latitude
Since:
1.0

getStartingLongitude

public final double getStartingLongitude()
Returns the vehicle's starting longitude. This is a little inefficient at the moment and could use some cleaning up.
Returns:
vehicle's starting longitude
Since:
1.0

getEndingLatitude

public final double getEndingLatitude()
Returns the vehicle's ending latitude. This is a little inefficient at the moment and could use some cleaning up.
Returns:
vehicle's ending latitude
Since:
1.0

getEndingLongitude

public final double getEndingLongitude()
Returns the vehicle's ending longitude. This is a little inefficient at the moment and could use some cleaning up.
Returns:
vehicle's ending longitude
Since:
1.0

isAtHome

public final boolean isAtHome()
Returns whether or not the vehicle is currently at its home base.
Returns:
whether or not the vehicle is at its home base
Since:
1.0

getEarliestStartTime

public final int getEarliestStartTime()
Returns the earliest time when the vehicle is available for takeoff.
Returns:
the earliest time when the vehicle is available for takeoff
Since:
1.0

getSpeed

public final int getSpeed()
Returns the vehicle's speed (in knots).
Returns:
the vehicle's speed (in knots)
Since:
1.0

getRange

public final int getRange()
Returns the vehicle's range (in minutes).
Returns:
the vehicle's range (in minutes)
Since:
1.0

getSupportedRequirementTypes

public final java.lang.String[] getSupportedRequirementTypes()
Returns the vehicle's supported requirement types.
Returns:
the vehicle's supported requirement types
Since:
1.0

getAltitude

public final int getAltitude()
Returns the vehicle's altitude (in feet).
Returns:
the vehicle's altitude (in feet)
Since:
1.0

setEnabled

public void setEnabled(boolean state)
Sets whether or not the vehicle is enabled.
Parameters:
state - whether or not the vehicle is enabled
Since:
1.0

setName

public final void setName(java.lang.String name)
Sets the vehicle's name.
Parameters:
name - the vehicle's name
Since:
1.0

setHomeBase

public final void setHomeBase(Base home)
Sets the vehicle's home base.
Parameters:
name - the vehicle's home base
Since:
1.0

setHomeBaseName

public final void setHomeBaseName(java.lang.String name)
Sets the vehicle's home base name. This value is saved when a vehicle is serializd.
Parameters:
name - the vehicle's home base name
Since:
1.0

setHomeBaseName

public final void setHomeBaseName(java.lang.String name,
                                  BaseList baseList)
Sets the vehicle's home base name. This value is saved when a vehicle is serializd. Try to match up the base name to an actual base object in baseList.
Parameters:
name - the vehicle's home base name
baseList - the base list to use for finding bases
Since:
1.0

setAlternateLatitude

public final void setAlternateLatitude(double altLat)
Sets the vehicle's alternate latitude.
Parameters:
altLat - the vehicle's alternate latitude
Since:
1.0

setAlternateLongitude

public final void setAlternateLongitude(double altLong)
Sets the vehicle's alternate longitude.
Parameters:
altLong - the vehicle's alternate latitude
Since:
1.0

setAtHome

public final void setAtHome(boolean state)
Sets whether or not the vehicle is at its home base. If false, the vehicle must be at its alternate latitude and longitude.
Parameters:
state - whether or not the vehicle is at its home base
Since:
1.0

setEarliestStartTime

public final void setEarliestStartTime(int time)
Sets the earliest time that the vehicle can take off.
Parameters:
time - the earliest time that the vehicle can take off
Since:
1.0

setRange

public final void setRange(int range)
Sets the vehicle's range (in minutes).
Parameters:
range - the vehicle's range (in minutes).
Since:
1.0

setSpeed

public final void setSpeed(int speed)
Sets the vehicle's speed (in knots).
Parameters:
range - the vehicle's speed (in knots).
Since:
1.0

setAltitude

public final void setAltitude(int altitude)
Sets the vehicle's altitude (in feet). Used in wind calculations.
Parameters:
range - the vehicle's altitude (in feet).
Since:
1.0

addSupportedRequirementType

public final void addSupportedRequirementType(java.lang.String reqType)
Adds a requirement type to the list of vehicle capabilities.
Parameters:
reqType - requirement type to add to capabilities list
Since:
1.0

setSupportedRequirementTypes

public final void setSupportedRequirementTypes(java.lang.String[] reqTypes)
Adds the requirement types to the list of vehicle capabilities.
Parameters:
reqTypes - requirement types to add to capabilities list
Since:
1.0

removeSupportedRequirementType

public final void removeSupportedRequirementType(java.lang.String reqType)
Removes a requirement type from the list of vehicle capabilities.
Parameters:
reqType - requirement type to remove from capabilities list
Since:
1.0

supportsRequirementType

public final boolean supportsRequirementType(java.lang.String reqType)
Returns whether or not the vehicle supports the requirement type.
Parameters:
reqType - requirement type to check
Since:
1.0

determineHomeBaseFromList

public final void determineHomeBaseFromList(BaseList list)
Determines a base object from the home base named stored during serialization.
Parameters:
list - base list to search through
Since:
1.0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object