jmri.jmrit.operations.routes
Class Route

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

public class Route
extends java.lang.Object
implements java.beans.PropertyChangeListener

Represents a route on the layout


Field Summary
protected  java.lang.String _comment
           
protected  java.lang.String _id
           
protected  int _IdNumber
           
protected  java.lang.String _name
           
protected  java.util.Hashtable<java.lang.String,RouteLocation> _routeHashTable
           
protected  int _sequenceNum
           
static java.lang.String DISPOSE
           
static int EAST
           
static java.lang.String ERROR
           
static java.lang.String LISTCHANGE_CHANGED_PROPERTY
           
(package private) static org.slf4j.Logger log
           
static int NORTH
           
static java.lang.String OKAY
           
static java.lang.String ORPHAN
           
(package private)  java.beans.PropertyChangeSupport pcs
           
static int SOUTH
           
static int WEST
           
 
Constructor Summary
Route(org.jdom.Element e)
          Construct this Entry from XML.
Route(java.lang.String id, java.lang.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(java.beans.PropertyChangeListener l)
           
 void deleteLocation(RouteLocation rl)
          Delete a RouteLocation
 void dispose()
           
 javax.swing.JComboBox getComboBox()
           
 java.lang.String getComment()
           
 RouteLocation getDepartsRouteLocation()
          Get the first location in a route
 java.lang.String getId()
           
 RouteLocation getLastLocationByName(java.lang.String name)
          Get location by name (gets last route location with name)
 RouteLocation getLocationById(java.lang.String id)
          Get a RouteLocation by id
 java.util.List<RouteLocation> getLocationsBySequenceList()
          Get a list of RouteLocations sorted by route order
 java.lang.String getName()
           
 java.lang.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(java.beans.PropertyChangeEvent e)
           
 void register(RouteLocation rl)
          Remember a NamedBean Object created outside the manager.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void setComment(java.lang.String comment)
           
protected  void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
           
 void setName(java.lang.String name)
           
 int size()
           
 org.jdom.Element store()
          Create an XML element to represent this Entry.
 java.lang.String toString()
           
 void updateComboBox(javax.swing.JComboBox box)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_id

protected java.lang.String _id

_name

protected java.lang.String _name

_comment

protected java.lang.String _comment

_routeHashTable

protected java.util.Hashtable<java.lang.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 java.lang.String LISTCHANGE_CHANGED_PROPERTY
See Also:
Constant Field Values

DISPOSE

public static final java.lang.String DISPOSE
See Also:
Constant Field Values

OKAY

public static final java.lang.String OKAY

ORPHAN

public static final java.lang.String ORPHAN

ERROR

public static final java.lang.String ERROR

pcs

java.beans.PropertyChangeSupport pcs

log

static org.slf4j.Logger log
Constructor Detail

Route

public Route(java.lang.String id,
             java.lang.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 java.lang.String getId()

setName

public void setName(java.lang.String name)

toString

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

getName

public java.lang.String getName()

setComment

public void setComment(java.lang.String comment)

getComment

public java.lang.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(java.lang.String name)
Get location by name (gets last route location with name)

Parameters:
name -
Returns:
route location

getLocationById

public RouteLocation getLocationById(java.lang.String id)
Get a RouteLocation by id

Parameters:
id -
Returns:
route location

getLocationsBySequenceList

public java.util.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 java.lang.String getStatus()
Gets the status of the route: OKAY ORPHAN ERROR

Returns:
string with status of route.

getComboBox

public javax.swing.JComboBox getComboBox()

updateComboBox

public void updateComboBox(javax.swing.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(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)

setDirtyAndFirePropertyChange

protected void setDirtyAndFirePropertyChange(java.lang.String p,
                                             java.lang.Object old,
                                             java.lang.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