jmri.jmrit.operations.rollingstock.engines
Class Engine

java.lang.Object
  extended by jmri.jmrit.operations.rollingstock.RollingStock
      extended by jmri.jmrit.operations.rollingstock.engines.Engine
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class Engine
extends RollingStock

Represents an engine on the layout

Author:
Daniel Boudreau (C) Copyright 2008

Field Summary
 
Fields inherited from class jmri.jmrit.operations.rollingstock.RollingStock
_built, _color, _comment, _destination, _id, _length, _location, _locationUnknown, _moves, _number, _outOfService, _owner, _rfid, _road, _routeDestination, _routeId, _routeLocation, _trackDestination, _trackLocation, _train, _type, _value, _weight, _weightTons, COUPLER, DEFAULT_WEIGHT, DESTINATION_CHANGED_PROPERTY, DESTINATIONTRACK_CHANGED_PROPERTY, ERROR_TRACK, LENGTH_CHANGED_PROPERTY, LOCATION_CHANGED_PROPERTY, number, rb, TRACK_CHANGED_PROPERTY, TRAIN_CHANGED_PROPERTY, TYPE_CHANGED_PROPERTY
 
Constructor Summary
Engine(Element e)
          Construct this Entry from XML.
Engine(String road, String number)
           
 
Method Summary
 void dispose()
          Remove rolling stock.
 Consist getConsist()
          Get the consist for this engine
 String getConsistName()
           
 String getHp()
           
 String getLength()
           
 String getModel()
           
 String getType()
           
 String getWeightTons()
           
 void moveRollingStock(RouteLocation old, RouteLocation next)
           
 void propertyChange(PropertyChangeEvent e)
           
 void setConsist(Consist consist)
          Place engine in a consist
 void setHp(String hp)
          Set the engine horsepower rating for this engine's model
 void setLength(String length)
          Set the engine length for this engine's model
 void setModel(String model)
          Set the engine's model.
 void setType(String type)
          Set the engine type for this engine's model
 void setWeightTons(String weight)
          Set the engine weight for this engine's model
 Element store()
          Create an XML element to represent this Entry.
 String testDestination(Location destination, Track track)
          Used to check destination track to see if it will accept engine
 
Methods inherited from class jmri.jmrit.operations.rollingstock.RollingStock
addPropertyChangeListener, createId, firePropertyChange, getAdjustedWeightTons, getBuilt, getColor, getComment, getDestination, getDestinationId, getDestinationName, getDestinationTrack, getDestinationTrackId, getDestinationTrackName, getId, getLocation, getLocationId, getLocationName, getMoves, getNumber, getOwner, getPriority, getRfid, getRoad, getRouteDestination, getRouteDestinationId, getRouteLocation, getRouteLocationId, getSavedRouteId, getStatus, getTrack, getTrackId, getTrackName, getTrain, getTrainName, getValue, getWeight, isLocationUnknown, isOutOfService, removePropertyChangeListener, reset, rollingStock, setBuilt, setColor, setComment, setDestination, setDestination, setDestination, setDestinationTrack, setLocation, setLocation, setLocation, setLocationUnknown, setMoves, setNumber, setOutOfService, setOwner, setRfid, setRoad, setRouteDestination, setRouteLocation, setSavedRouteId, setTrack, setTrain, setValue, setWeight, store, testLocation, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Engine

public Engine(String road,
              String number)

Engine

public Engine(Element e)
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-engines.dtd

Parameters:
e - Engine XML element
Method Detail

setModel

public void setModel(String model)
Set the engine's model. Note a model has only one length, type, and horsepower rating.

Parameters:
model -

getModel

public String getModel()

setType

public void setType(String type)
Set the engine type for this engine's model

Overrides:
setType in class RollingStock
Parameters:
type - Engine type: Steam, Diesel, Gas Turbine, etc.

getType

public String getType()
Overrides:
getType in class RollingStock

setHp

public void setHp(String hp)
Set the engine horsepower rating for this engine's model

Parameters:
hp - engine horsepower

getHp

public String getHp()

setLength

public void setLength(String length)
Set the engine length for this engine's model

Overrides:
setLength in class RollingStock
Parameters:
length - engine length

getLength

public String getLength()
Overrides:
getLength in class RollingStock

setWeightTons

public void setWeightTons(String weight)
Set the engine weight for this engine's model

Overrides:
setWeightTons in class RollingStock
Parameters:
weight - engine weight

getWeightTons

public String getWeightTons()
Overrides:
getWeightTons in class RollingStock

setConsist

public void setConsist(Consist consist)
Place engine in a consist

Parameters:
consist -

getConsist

public Consist getConsist()
Get the consist for this engine

Returns:
null if engine isn't in a consist

getConsistName

public String getConsistName()

testDestination

public String testDestination(Location destination,
                              Track track)
Used to check destination track to see if it will accept engine

Overrides:
testDestination in class RollingStock
Returns:
status, see RollingStock.java

moveRollingStock

public void moveRollingStock(RouteLocation old,
                             RouteLocation next)
Overrides:
moveRollingStock in class RollingStock

dispose

public void dispose()
Description copied from class: RollingStock
Remove rolling stock. Releases all listeners.

Overrides:
dispose in class RollingStock

store

public Element store()
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-engines.dtd.

Returns:
Contents in a JDOM Element

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener
Overrides:
propertyChange in class RollingStock


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads