Package jmri

Class 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, float fwdStopPerCent, float revStopPerCent)
      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, float fwdStopPerCent, float revStopPerCent)
      Create an alternate or primary TransitSection, and defined as safe or not
    • 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 transit
        seq - the sequence number of the section in the transit
        direction - 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 transit
        seq - the sequence number of the section in the transit
        direction - the direction of travel within the transit
        alt - 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,
                              float fwdStopPerCent,
                              float revStopPerCent)
        Create an alternate or primary TransitSection, and defined as safe or not
        Parameters:
        s - the section to add to the transit
        seq - the sequence number of the section in the transit
        direction - the direction of travel within the transit
        alt - true if the section is an alternate; false if section is primary or has no alternates
        safe - 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.
        fwdStopPerCent - The distance into the section when traveling fwd thru the transit.
        revStopPerCent - The distance into the section when traveling rev thru the transit.
      • 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 transit
        seq - the sequence number of the section in the transit
        direction - the direction of travel within the transit
        alt - 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,
                              float fwdStopPerCent,
                              float revStopPerCent)
        Create an alternate or primary TransitSection with a delayed initialization.
        Parameters:
        secName - the name of the section to add to the transit
        seq - the sequence number of the section in the transit
        direction - the direction of travel within the transit
        alt - true if the section is an alternate; false if section is primary or has no alternates
        safe - 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.
        fwdStopPerCent - The distance into the section when traveling fwd thru the transit.
        revStopPerCent - The distance into the section when traveling rev thru the transit.
    • Method Detail

      • getSection

        public Section getSection()
        Get the associated section.
        Returns:
        the section or null if no section is associated with this TransitSection
      • isSafe

        public boolean isSafe()
      • setSafe

        public void setSafe​(boolean safe)
      • setFwdStopPerCent

        public void setFwdStopPerCent​(float val)
        Sets the stopping distance percentage of section when transit allocated fwd.
        Parameters:
        val - length as a percentage of section;
      • getFwdStopPerCent

        public float getFwdStopPerCent()
        Returns the stopping distance percentage of section when transit allocated fwd.
      • setRevStopPerCent

        public void setRevStopPerCent​(float val)
        Sets actual distance percentage of section when transit allocated fwd.
        Parameters:
        val - length as a percentage of section;
      • getRevStopPerCent

        public float getRevStopPerCent()
        Returns the stopping distance percentage of section when transit allocated rev.