Class AllocatedSection
- java.lang.Object
-
- jmri.jmrit.dispatcher.AllocatedSection
-
public class AllocatedSection extends java.lang.Object
This class holds information and options for an AllocatedSection, a Section that is currently allocated to an ActiveTrain.AllocatedSections are referenced via a list in DispatcherFrame, which serves as a manager for AllocatedSection objects. Each ActiveTrain also maintains a list of AllocatedSections currently assigned to it.
AllocatedSections are transient, and are not saved to disk.
AllocatedSections keep track of whether they have been entered and exited.
If the Active Train this Section is assigned to is being run automatically, support is provided for monitoring Section changes and changes for Blocks within the Section.
This file is part of JMRI.JMRI is open source software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
AllocatedSection.RespondToBlockStateChange
-
Constructor Summary
Constructors Constructor Description AllocatedSection(Section s, ActiveTrain at, int seq, Section next, int nextSeqNo)
Create an AllocatedSection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
protected void
addToActiveBlockList(Block b)
void
dispose()
protected void
firePropertyChangeEvent(java.beans.PropertyChangeEvent evt)
protected void
firePropertyChangeEvent(java.lang.String name, java.lang.Object oldVal, java.lang.Object newVal)
ActiveTrain
getActiveTrain()
java.lang.String
getActiveTrainName()
int
getAllocationNumber()
java.util.List<LayoutTrackExpectedState<LayoutTurnout>>
getAutoTurnoutsResponse()
int
getDirection()
protected Block
getEnterBlock(AllocatedSection previousAllocatedSection)
boolean
getEntered()
protected Block
getExitBlock()
boolean
getExited()
java.beans.PropertyChangeListener
getExitSignalListener()
Sensor
getForwardStoppingSensor()
int
getIndex()
int
getLength()
float
getLengthRemaining(Block block)
Get the length of the section remaining including current blockSection
getNextSection()
int
getNextSectionSequence()
Sensor
getReverseStoppingSensor()
Section
getSection()
java.lang.String
getSectionName()
int
getSequence()
protected TransitSection
getTransitSection()
void
initializeMonitorBlockOccupancy()
protected boolean
isInActiveBlockList(Block b)
protected void
removeFromActiveBlockList(Block b)
void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
void
reset()
void
setAllocationNumber(int n)
void
setAutoTurnoutsResponse(java.util.List<LayoutTrackExpectedState<LayoutTurnout>> atr)
void
setExitSignalListener(java.beans.PropertyChangeListener xSigListener)
void
setIndex(int i)
protected boolean
setNextSection(Section sec, int i)
void
setNextSectionSequence(int i)
protected void
setStoppingSensors()
Methods
-
-
-
Constructor Detail
-
AllocatedSection
public AllocatedSection(@Nonnull Section s, ActiveTrain at, int seq, Section next, int nextSeqNo)
Create an AllocatedSection.- Parameters:
s
- the section to allocationat
- the train to allocate the section toseq
- the sequence location of the section in the routenext
- the following sectionnextSeqNo
- the sequence location of the following section
-
-
Method Detail
-
setAutoTurnoutsResponse
public void setAutoTurnoutsResponse(java.util.List<LayoutTrackExpectedState<LayoutTurnout>> atr)
-
getLengthRemaining
public float getLengthRemaining(Block block)
Get the length of the section remaining including current block- Parameters:
block
- block to start totaling block lengths- Returns:
- length in millimetres
-
getAutoTurnoutsResponse
public java.util.List<LayoutTrackExpectedState<LayoutTurnout>> getAutoTurnoutsResponse()
-
getSection
public Section getSection()
-
getSectionName
public java.lang.String getSectionName()
-
getActiveTrain
public ActiveTrain getActiveTrain()
-
getActiveTrainName
public java.lang.String getActiveTrainName()
-
getSequence
public int getSequence()
-
getNextSection
public Section getNextSection()
-
getNextSectionSequence
public int getNextSectionSequence()
-
setNextSection
protected boolean setNextSection(Section sec, int i)
-
setNextSectionSequence
public void setNextSectionSequence(int i)
-
getEntered
public boolean getEntered()
-
getExited
public boolean getExited()
-
getAllocationNumber
public int getAllocationNumber()
-
setAllocationNumber
public void setAllocationNumber(int n)
-
getForwardStoppingSensor
public Sensor getForwardStoppingSensor()
-
getReverseStoppingSensor
public Sensor getReverseStoppingSensor()
-
setIndex
public void setIndex(int i)
-
getIndex
public int getIndex()
-
setExitSignalListener
public void setExitSignalListener(java.beans.PropertyChangeListener xSigListener)
-
getExitSignalListener
public java.beans.PropertyChangeListener getExitSignalListener()
-
setStoppingSensors
protected final void setStoppingSensors()
Methods
-
getTransitSection
protected TransitSection getTransitSection()
-
getDirection
public int getDirection()
-
getLength
public int getLength()
-
reset
public void reset()
-
initializeMonitorBlockOccupancy
public final void initializeMonitorBlockOccupancy()
-
getExitBlock
protected Block getExitBlock()
-
getEnterBlock
protected Block getEnterBlock(AllocatedSection previousAllocatedSection)
-
addToActiveBlockList
protected void addToActiveBlockList(Block b)
-
removeFromActiveBlockList
protected void removeFromActiveBlockList(Block b)
-
isInActiveBlockList
protected boolean isInActiveBlockList(Block b)
-
dispose
public void dispose()
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
-
firePropertyChangeEvent
protected void firePropertyChangeEvent(java.beans.PropertyChangeEvent evt)
-
firePropertyChangeEvent
protected void firePropertyChangeEvent(java.lang.String name, java.lang.Object oldVal, java.lang.Object newVal)
-
-