jmri.jmrit.operations.routes
Class Route

java.lang.Object
  extended by jmri.jmrit.operations.routes.Route
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class Route
extends Object
implements PropertyChangeListener

Represents a route on the layout


Field Summary
protected  String _comment
           
protected  String _id
           
protected  int _IdNumber
           
protected  String _name
           
protected  Hashtable<String,RouteLocation> _routeHashTable
           
protected  int _sequenceNum
           
static String DISPOSE
           
static int EAST
           
static String ERROR
           
static String LISTCHANGE_CHANGED_PROPERTY
           
(package private) static org.slf4j.Logger log
           
static int NORTH
           
static String OKAY
           
static String ORPHAN
           
(package private)  PropertyChangeSupport pcs
           
static int SOUTH
           
static int WEST
           
 
Constructor Summary
Route(org.jdom.Element e)
          Construct this Entry from XML.
Route(String id, String name)
           
 
Method Summary
 RouteLocation addLocation(Location location)
          Adds a location to the end of this route
 RouteLocation addLocation(Location location, int sequence)
          Add a route location at a specific place (sequence) in the route Allowable sequence numbers are 0 to max size of route;
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void deleteLocation(RouteLocation rl)
          Delete a RouteLocation
 void dispose()
           
 JComboBox getComboBox()
           
 String getComment()
           
 RouteLocation getDepartsRouteLocation()
          Get the first location in a route
 String getId()
           
 RouteLocation getLastLocationByName(String name)
          Get location by name (gets last route location with name)
 RouteLocation getLocationById(String id)
          Get a RouteLocation by id
 List<RouteLocation> getLocationsBySequenceList()
          Get a list of RouteLocations sorted by route order
 String getName()
           
 String getStatus()
          Gets the status of the route: OKAY ORPHAN ERROR
 void moveLocationDown(RouteLocation rl)
          Moves a RouteLocation later in the route by incrementing the sequenceId for the RouteLocation
 void moveLocationUp(RouteLocation rl)
          Moves a RouteLocation earlier in the route by decrementing the sequenceId for the RouteLocation
 void propertyChange(PropertyChangeEvent e)
           
 void register(RouteLocation rl)
          Remember a NamedBean Object created outside the manager.
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void setComment(String comment)
           
protected  void setDirtyAndFirePropertyChange(String p, Object old, Object n)
           
 void setName(String name)
           
 int size()
           
 org.jdom.Element store()
          Create an XML element to represent this Entry.
 String toString()
           
 void updateComboBox(JComboBox box)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_id

protected String _id

_name

protected String _name

_comment

protected String _comment

_routeHashTable

protected Hashtable<String,RouteLocation> _routeHashTable

_IdNumber

protected int _IdNumber

_sequenceNum

protected int _sequenceNum

EAST

public static final int EAST
See Also:
Constant Field Values

WEST

public static final int WEST
See Also:
Constant Field Values

NORTH

public static final int NORTH
See Also:
Constant Field Values

SOUTH

public static final int SOUTH
See Also:
Constant Field Values

LISTCHANGE_CHANGED_PROPERTY

public static final String LISTCHANGE_CHANGED_PROPERTY
See Also:
Constant Field Values

DISPOSE

public static final String DISPOSE
See Also:
Constant Field Values

OKAY

public static final String OKAY

ORPHAN

public static final String ORPHAN

ERROR

public static final String ERROR

pcs

PropertyChangeSupport pcs

log

static org.slf4j.Logger log
Constructor Detail

Route

public Route(String id,
             String name)

Route

public Route(org.jdom.Element e)
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-config.xml

Parameters:
e - Consist XML element
Method Detail

getId

public String getId()

setName

public void setName(String name)

toString

public String toString()
Overrides:
toString in class Object

getName

public String getName()

setComment

public void setComment(String comment)

getComment

public String getComment()

dispose

public void dispose()

addLocation

public RouteLocation addLocation(Location location)
Adds a location to the end of this route

Parameters:
location -
Returns:
RouteLocation created for the location added

addLocation

public RouteLocation addLocation(Location location,
                                 int sequence)
Add a route location at a specific place (sequence) in the route Allowable sequence numbers are 0 to max size of route;

Parameters:
location -
sequence -
Returns:
route location

register

public void register(RouteLocation rl)
Remember a NamedBean Object created outside the manager.


deleteLocation

public void deleteLocation(RouteLocation rl)
Delete a RouteLocation

Parameters:
rl -

size

public int size()

getDepartsRouteLocation

public RouteLocation getDepartsRouteLocation()
Get the first location in a route

Returns:
the first route location

getLastLocationByName

public RouteLocation getLastLocationByName(String name)
Get location by name (gets last route location with name)

Parameters:
name -
Returns:
route location

getLocationById

public RouteLocation getLocationById(String id)
Get a RouteLocation by id

Parameters:
id -
Returns:
route location

getLocationsBySequenceList

public List<RouteLocation> getLocationsBySequenceList()
Get a list of RouteLocations sorted by route order

Returns:
list of RouteLocations ordered by sequence

moveLocationUp

public void moveLocationUp(RouteLocation rl)
Moves a RouteLocation earlier in the route by decrementing the sequenceId for the RouteLocation

Parameters:
rl -

moveLocationDown

public void moveLocationDown(RouteLocation rl)
Moves a RouteLocation later in the route by incrementing the sequenceId for the RouteLocation

Parameters:
rl -

getStatus

public String getStatus()
Gets the status of the route: OKAY ORPHAN ERROR

Returns:
string with status of route.

getComboBox

public JComboBox getComboBox()

updateComboBox

public void updateComboBox(JComboBox box)

store

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

Returns:
Contents in a JDOM Element

propertyChange

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

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)

setDirtyAndFirePropertyChange

protected void setDirtyAndFirePropertyChange(String p,
                                             Object old,
                                             Object n)


Copyright © 1997-2014 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