net.kolls.railworld.car
Class Engine

java.lang.Object
  extended by net.kolls.railworld.car.AbstractCar
      extended by net.kolls.railworld.car.Engine
All Implemented Interfaces:
Car, SaveLoad

public class Engine
extends AbstractCar

Locomotive based on GE Dash 7

Author:
Steve Kollmansberger

Field Summary
 
Fields inherited from class net.kolls.railworld.car.AbstractCar
isLoaded
 
Fields inherited from interface net.kolls.railworld.Car
CAR_WIDTH, DIST_BETWEEN_CARS
 
Constructor Summary
Engine()
           
 
Method Summary
 java.awt.Color color()
          Return the Car's color.
 boolean isEngine()
          Indicates if this car provides power.
 boolean isLoadable()
          Determine if the current Car can be loaded and unloaded; that is, does it carry cargo.
 Distance length()
          Returns the length of this Car.
 void load()
          Loads the current Car.
 boolean loaded()
          Indicates if the Car is currently loaded.
 java.lang.String show()
          Gives a human-readable word for the Car.
 void unload()
          Unloads the current Car.
 int weight()
          Returns the weight of this Car (taking load/unload into account, if necessary) in US Tons.
 
Methods inherited from class net.kolls.railworld.car.AbstractCar
canUserCreate, equals, load, midColor, newInstance, save, segs, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Engine

public Engine()
Method Detail

length

public Distance length()
Description copied from interface: Car
Returns the length of this Car.

Returns:
Distance indicating the length of the Car.

loaded

public boolean loaded()
Description copied from interface: Car
Indicates if the Car is currently loaded.

Specified by:
loaded in interface Car
Overrides:
loaded in class AbstractCar
Returns:
true if the car is loadable and is currently loaded.

weight

public int weight()
Description copied from interface: Car
Returns the weight of this Car (taking load/unload into account, if necessary) in US Tons. 1 US Ton = 2000 US Pounds

Returns:
int representing weight in tons.

color

public java.awt.Color color()
Description copied from interface: Car
Return the Car's color. The following color assignments exist: black: open hopper car blue: tank car cyan: intermodal dark gray: engine gray: green: covered hopper light gray: passenger magenta: auto rack orange: centerbeam flat car pink: boxcar red: caboose white: yellow: stock car

Returns:
The Color of the current Car.

show

public java.lang.String show()
Description copied from interface: Car
Gives a human-readable word for the Car. Should indicate only the type of the Car, not whether it is loaded or unloaded.

Returns:
String indicating type of Car.

load

public void load()
Description copied from interface: Car
Loads the current Car. Do not call on a Car you have specified as not loadable.

Specified by:
load in interface Car
Overrides:
load in class AbstractCar

unload

public void unload()
Description copied from interface: Car
Unloads the current Car. Do not call on a Car you have specified as not loadable.

Specified by:
unload in interface Car
Overrides:
unload in class AbstractCar

isLoadable

public boolean isLoadable()
Description copied from interface: Car
Determine if the current Car can be loaded and unloaded; that is, does it carry cargo.

Specified by:
isLoadable in interface Car
Overrides:
isLoadable in class AbstractCar
Returns:
true if the Car may be loaded and unloaded. Defaults to true.

isEngine

public boolean isEngine()
Description copied from interface: Car
Indicates if this car provides power.

Specified by:
isEngine in interface Car
Overrides:
isEngine in class AbstractCar
Returns:
true if the car provides power (is a working engine)