|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.kolls.railworld.car.AbstractCar
public abstract class AbstractCar
AbstractCar contains some reasonable defaults to avoid repetition in creating standard cargo car types.
| Field Summary | |
|---|---|
protected boolean |
isLoaded
Indicates if the Car is currently loaded (with cargo) or not. |
| Fields inherited from interface net.kolls.railworld.Car |
|---|
CAR_WIDTH, DIST_BETWEEN_CARS |
| Constructor Summary | |
|---|---|
AbstractCar()
Constructs a new Car. |
|
| Method Summary | |
|---|---|
boolean |
canUserCreate()
Indicates if this car should appear in any user creation selection window. |
boolean |
equals(java.lang.Object o)
|
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. |
void |
load()
Loads the current Car. |
void |
load(java.util.Map<java.lang.String,java.lang.String> m)
Default implementation only loads whether or not the car is loaded. |
boolean |
loaded()
Indicates if the Car is currently loaded. |
java.awt.Color |
midColor()
By default, if the car is not loaded, or not loadable, show a solid car. |
java.lang.Object |
newInstance()
like getClass().newInstance(). |
java.util.Map<java.lang.String,java.lang.String> |
save()
Default implementation saves only whether or not the car is loaded. |
java.util.Set<RailSegment> |
segs()
For the current Car, returns the segments that the Car occupies, if any. |
java.lang.String |
toString()
|
void |
unload()
Unloads the current Car. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.kolls.railworld.Car |
|---|
color, length, show, weight |
| Field Detail |
|---|
protected boolean isLoaded
| Constructor Detail |
|---|
public AbstractCar()
| Method Detail |
|---|
public boolean loaded()
Car
loaded in interface Cartrue if the car is loadable and is currently loaded.public void load()
Car
load in interface Carpublic void unload()
Car
unload in interface Carpublic boolean isLoadable()
Car
isLoadable in interface Cartrue if the Car may be loaded and unloaded. Defaults to true.public final java.util.Set<RailSegment> segs()
Car
segs in interface CarSet of RailSegments.public final boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.awt.Color midColor()
midColor in interface CarColor of the middle line in the carpublic java.lang.String toString()
toString in interface SaveLoadtoString in class java.lang.Objectpublic java.util.Map<java.lang.String,java.lang.String> save()
save in interface SaveLoadpublic void load(java.util.Map<java.lang.String,java.lang.String> m)
load in interface SaveLoadm - Key value pairs saved by an instance of this classpublic boolean canUserCreate()
Car
canUserCreate in interface Carpublic java.lang.Object newInstance()
SaveLoad
newInstance in interface SaveLoadpublic boolean isEngine()
Car
isEngine in interface Car
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||