Package jmri
Class TransitSection
- java.lang.Object
-
- jmri.TransitSection
-
public class TransitSection extends java.lang.Object
This class holds information and options for a Section when assigned to a Transit. Corresponds to an allocatable "Section" of track assigned to a Transit.A TransitSection holds the following information: Section ID Section Direction Sequence number of Section within the Transit Special actions list for train in this Section, if requested (see TransitSectionAction.java) Whether this Section is a primary section or an alternate section
A TransitSection is referenced via a list in its parent Transit, and is stored on disk when its parent Transit is stored.
Provides for delayed initialization of Section when loading panel files, so that this is not dependent on order of items in the panel file.
-
-
Constructor Summary
Constructors Constructor Description TransitSection(java.lang.String secName, int seq, int direction, boolean alt)
Create an alternate or primary TransitSection with a delayed initialization.TransitSection(java.lang.String secName, int seq, int direction, boolean alt, boolean safe, java.lang.String stopAllocatingSensorName)
Create an alternate or primary TransitSection with a delayed initialization.TransitSection(Section s, int seq, int direction)
Create a TransitSection.TransitSection(Section s, int seq, int direction, boolean alt)
Create an alternate or primary TransitSection.TransitSection(Section s, int seq, int direction, boolean alt, boolean safe, java.lang.String stopAllocatingSensorName)
Create an alternate or primary TransitSection, and defined as safe or not
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAction(TransitSectionAction act)
int
getDirection()
Section
getSection()
Get the associated section.java.lang.String
getSectionName()
int
getSequenceNumber()
java.lang.String
getStopAllocatingSensor()
java.util.ArrayList<TransitSectionAction>
getTransitSectionActionList()
Get a list of the actions for this TransitSectionboolean
isAlternate()
boolean
isSafe()
boolean
isTemporary()
void
setAlternate(boolean alt)
void
setSafe(boolean safe)
void
setStopAllocatingSensor(java.lang.String stopAllocatingSensor)
void
setTemporary(boolean boo)
-
-
-
Constructor Detail
-
TransitSection
public TransitSection(Section s, int seq, int direction)
Create a TransitSection. This calls the alternate constructor with false for the alt value.- Parameters:
s
- the section to add to the transitseq
- the sequence number of the section in the transitdirection
- the direction of travel within the transit
-
TransitSection
public TransitSection(Section s, int seq, int direction, boolean alt)
Create an alternate or primary TransitSection.- Parameters:
s
- the section to add to the transitseq
- the sequence number of the section in the transitdirection
- the direction of travel within the transitalt
- true if the section is an alternate; false if section is primary or has no alternates
-
TransitSection
public TransitSection(Section s, int seq, int direction, boolean alt, boolean safe, java.lang.String stopAllocatingSensorName)
Create an alternate or primary TransitSection, and defined as safe or not- Parameters:
s
- the section to add to the transitseq
- the sequence number of the section in the transitdirection
- the direction of travel within the transitalt
- true if the section is an alternate; false if section is primary or has no alternatessafe
- true if this is a safe section. When dispatcher by safe sections a train is dispatched safe section to safe section with all intervening sections available.stopAllocatingSensorName
- If this sensor is present, valid, and Active allocation will stop until it is no longer Active.
-
TransitSection
public TransitSection(java.lang.String secName, int seq, int direction, boolean alt)
Create an alternate or primary TransitSection with a delayed initialization.- Parameters:
secName
- the name of the section to add to the transitseq
- the sequence number of the section in the transitdirection
- the direction of travel within the transitalt
- true if the section is an alternate; false if section is primary or has no alternates
-
TransitSection
public TransitSection(java.lang.String secName, int seq, int direction, boolean alt, boolean safe, java.lang.String stopAllocatingSensorName)
Create an alternate or primary TransitSection with a delayed initialization.- Parameters:
secName
- the name of the section to add to the transitseq
- the sequence number of the section in the transitdirection
- the direction of travel within the transitalt
- true if the section is an alternate; false if section is primary or has no alternatessafe
- true if this is a safe section. When dispatcher by safe sections a train is dispatched safe section to safe section with all intervening sections available.stopAllocatingSensorName
- If this sensor is present, valid, and Active allocation will stop until it is no longer Active.
-
-
Method Detail
-
setTemporary
public void setTemporary(boolean boo)
-
isTemporary
public boolean isTemporary()
-
getSection
public Section getSection()
Get the associated section.- Returns:
- the section or null if no section is associated with this TransitSection
-
getSectionName
public java.lang.String getSectionName()
-
getDirection
public int getDirection()
-
getSequenceNumber
public int getSequenceNumber()
-
addAction
public void addAction(TransitSectionAction act)
-
isAlternate
public boolean isAlternate()
-
setAlternate
public void setAlternate(boolean alt)
-
isSafe
public boolean isSafe()
-
setSafe
public void setSafe(boolean safe)
-
getStopAllocatingSensor
public java.lang.String getStopAllocatingSensor()
-
setStopAllocatingSensor
public void setStopAllocatingSensor(java.lang.String stopAllocatingSensor)
-
getTransitSectionActionList
public java.util.ArrayList<TransitSectionAction> getTransitSectionActionList()
Get a list of the actions for this TransitSection- Returns:
- a list of actions or an empty list if there are no actions
-
-