|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.managers.AbstractManager
jmri.jmrit.display.layoutEditor.LayoutBlockManager
public class LayoutBlockManager
Implementation of a Manager to handle LayoutBlocks Note: that the same LayoutBlocks may appear in multiple LayoutEditor panels.
This manager does not enforce any particular system naming convention.
LayoutBlocks are usually addressed by userName. The systemName is hidden from the user for the most part.
| Field Summary | |
|---|---|
(package private) static LayoutBlockManager |
_instance
|
(package private) boolean |
checking
|
protected boolean |
enableAdvancedRouting
|
(package private) LayoutBlockConnectivityTools |
lbct
|
(package private) static org.slf4j.Logger |
log
|
(package private) static ResourceBundle |
rb
|
(package private) boolean |
stabilised
|
(package private) Thread |
thr
|
| Fields inherited from class jmri.managers.AbstractManager |
|---|
_tsys, _tuser |
| Fields inherited from interface jmri.Manager |
|---|
AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXS, MEMORIES, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS |
| Constructor Summary | |
|---|---|
LayoutBlockManager()
|
|
| Method Summary | |
|---|---|
void |
addBadBeanError()
|
LayoutBlock |
createNewLayoutBlock()
|
LayoutBlock |
createNewLayoutBlock(String systemName,
String userName)
Method to create a new LayoutBlock if the LayoutBlock does not exist Returns null if a LayoutBlock with the same systemName or userName already exists, or if there is trouble creating a new LayoutBlock. |
void |
deleteLayoutBlock(LayoutBlock block)
Remove an existing LayoutBlock. |
void |
enableAdvancedRouting(boolean boo)
Enables the advanced layout block routing protocol The block routing protocol enables each layout block to build up a list of all reachable blocks, along with how far away they are, which direction they are in and which of the connected blocks they are reachable from. |
LayoutBlock |
getBlockWithMemoryAssigned(Memory m)
Method to find a LayoutBlock with a specified Memory assigned as its value display. |
LayoutBlock |
getBlockWithSensorAssigned(Sensor s)
Method to find a LayoutBlock with a specified Sensor assigned as its occupancy sensor. |
LayoutBlock |
getBySystemName(String name)
|
LayoutBlock |
getByUserName(String key)
|
NamedBean |
getFacingBean(Block facingBlock,
Block protectedBlock,
LayoutEditor panel,
Class<?> T)
Method to return a facing bean into a specified Block from a specified protected Block. |
LayoutBlock |
getFacingBlock(SignalHead signalHead,
LayoutEditor panel)
|
LayoutBlock |
getFacingBlock(String signalName,
LayoutEditor panel)
Method to return the LayoutBlock that a given signal is facing. |
LayoutBlock |
getFacingBlockByMast(SignalMast signalMast,
LayoutEditor panel)
Method to return the LayoutBlock that a given signal is facing. |
LayoutBlock |
getFacingBlockByNamedBean(NamedBean nb,
LayoutEditor panel)
Method to return the block facing a given bean object (Sensor, SignalMast or SignalHead). |
LayoutBlock |
getFacingBlockBySensor(Sensor sensor,
LayoutEditor panel)
Method to return the LayoutBlock that a given sensor is facing. |
LayoutBlock |
getFacingBlockBySensor(String sensorName,
LayoutEditor panel)
Method to return the LayoutBlock that a given sensor is facing. |
NamedBean |
getFacingNamedBean(Block facingBlock,
Block protectedBlock,
LayoutEditor panel)
Method to return the named bean of either a Sensor or signalmast facing into a specified Block from a specified protected Block. |
Sensor |
getFacingSensor(Block facingBlock,
Block protectedBlock,
LayoutEditor panel)
Method to return the Sensor facing into a specified Block from a specified protected Block. |
SignalHead |
getFacingSignalHead(Block facingBlock,
Block protectedBlock)
Method to return the Signal Head facing into a specified Block from a specified protected Block. |
SignalMast |
getFacingSignalMast(Block facingBlock,
Block protectedBlock)
|
SignalMast |
getFacingSignalMast(Block facingBlock,
Block protectedBlock,
LayoutEditor panel)
Method to return the Signal Mast facing into a specified Block from a specified protected Block. |
Object |
getFacingSignalObject(Block facingBlock,
Block protectedBlock)
Returns in the first instance a Signal Mast or if none exists a Signal Head for a given facing block and protected block combination. |
long |
getLastRoutingChange()
returns the time when the last routing change was made, recorded as System.nanoTime() |
LayoutBlock |
getLayoutBlock(Block block)
|
LayoutBlock |
getLayoutBlock(String name)
Method to get an existing LayoutBlock. |
LayoutBlockConnectivityTools |
getLayoutBlockConnectivityTools()
|
NamedBean |
getNamedBeanAtEndBumper(Block facingBlock,
LayoutEditor panel)
Method to return the named bean of either a Sensor or signalmast facing into a specified Block from a specified protected Block. |
NamedBeanHandle<Sensor> |
getNamedStabilisedSensor()
Get the sensor used for the stability indication |
LayoutBlock |
getProtectedBlock(SignalHead signalHead,
LayoutEditor panel)
|
LayoutBlock |
getProtectedBlock(String signalName,
LayoutEditor panel)
Method to return the LayoutBlock that a given signal is protecting. |
LayoutBlock |
getProtectedBlockByMast(SignalMast signalMast,
LayoutEditor panel)
|
LayoutBlock |
getProtectedBlockByNamedBean(NamedBean nb,
LayoutEditor panel)
Method to return the block that a given bean object (Sensor, SignalMast or SignalHead) is protecting |
LayoutBlock |
getProtectedBlockBySensor(Sensor sensor,
LayoutEditor panel)
Method to return the LayoutBlock that a given sensor is protecting. |
LayoutBlock |
getProtectedBlockBySensor(String sensorName,
LayoutEditor panel)
Method to return the LayoutBlock that a given sensor is protecting. |
List<LayoutBlock> |
getProtectingBlocksByNamedBean(NamedBean nb,
LayoutEditor panel)
|
List<LayoutBlock> |
getProtectingBlocksBySensor(Sensor sensor,
LayoutEditor panel)
|
List<LayoutBlock> |
getProtectingBlocksBySensorOld(Sensor sensor,
LayoutEditor panel)
|
Sensor |
getSensorAtEndBumper(Block facingBlock,
LayoutEditor panel)
Method to return a Sensor facing into a specific Block. |
SignalMast |
getSignalMastAtEndBumper(Block facingBlock,
LayoutEditor panel)
Method to return a Signal Mast that is assigned to a block which has an end bumper at one end. |
Sensor |
getStabilisedSensor()
Return the sensor used to indicate if the routing protocol has stabilised or not |
String |
getSystemPrefix()
Provides access to the system prefix string. |
int |
getXMLOrder()
|
void |
initializeLayoutBlockPaths()
Initializes/checks the Paths of all Blocks associated with LayoutBlocks. |
static LayoutBlockManager |
instance()
|
boolean |
isAdvancedRoutingEnabled()
returns true if advanced layout block routing has been enabled. |
boolean |
routingStablised()
Returns true if the layout block routing protocol has stabilised |
(package private) void |
setLastRoutingChange()
|
void |
setStabilisedSensor(String pName)
Assign a sensor to the routing protocol, that changes state dependant upon if the routing protocol has stabilised or is under going a change. |
void |
turnOffWarning()
|
char |
typeLetter()
|
boolean |
warn()
Controls switching off incompatible block connectivity messages Warnings are always on when program starts up. |
| Methods inherited from class jmri.managers.AbstractManager |
|---|
addPropertyChangeListener, deregister, dispose, firePropertyChange, getBeanBySystemName, getBeanByUserName, getInstanceBySystemName, getInstanceByUserName, getNamedBean, getNamedBeanList, getSystemNameArray, getSystemNameList, makeSystemName, propertyChange, register, registerSelf, removePropertyChangeListener, systemLetter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final ResourceBundle rb
static LayoutBlockManager _instance
protected boolean enableAdvancedRouting
LayoutBlockConnectivityTools lbct
boolean checking
boolean stabilised
Thread thr
static org.slf4j.Logger log
| Constructor Detail |
|---|
public LayoutBlockManager()
| Method Detail |
|---|
public int getXMLOrder()
getXMLOrder in interface ManagergetXMLOrder in class AbstractManagerpublic String getSystemPrefix()
Manager
getSystemPrefix in interface Managerpublic char typeLetter()
typeLetter in interface Manager
public LayoutBlock createNewLayoutBlock(String systemName,
String userName)
public LayoutBlock createNewLayoutBlock()
public void deleteLayoutBlock(LayoutBlock block)
public LayoutBlock getLayoutBlock(String name)
public LayoutBlock getLayoutBlock(Block block)
public LayoutBlock getBySystemName(String name)
public LayoutBlock getByUserName(String key)
public static LayoutBlockManager instance()
public LayoutBlock getBlockWithSensorAssigned(Sensor s)
public LayoutBlock getBlockWithMemoryAssigned(Memory m)
public void initializeLayoutBlockPaths()
This routine should be called when loading panels, after all Layout Editor panels have been loaded.
public void addBadBeanError()
public SignalHead getFacingSignalHead(Block facingBlock,
Block protectedBlock)
This method is primarily designed for use with scripts to get information initially residing in a Layout Editor panel. If either of the input Blocks is null, or if the two blocks do not join at a block boundary, or if either of the input Blocks are not Layout Editor panel blocks, an error message is logged, and "null" is returned. If the signal at the block boundary has two heads--is located at the facing point of a turnout-- the Signal Head that applies for the current setting of turnout (THROWN or CLOSED) is returned. If the turnout state is UNKNOWN or INCONSISTENT, an error message is logged, and "null" is returned. If the signal at the block boundary has three heads--the facing point of a 3-way turnout--the Signal Head that applies for the current settings of the two turnouts of the 3-way turnout is returned. If the turnout state of either turnout is UNKNOWN or INCONSISTENT, an error is logged and "null" is returned. "null" is returned if the block boundary is between the two turnouts of a THROAT_TO_THROAT turnout or a 3-way turnout. "null" is returned for block boundaries exiting a THROAT_TO_THROAT turnout block, since there are no signals that apply there.
public NamedBean getNamedBeanAtEndBumper(Block facingBlock,
LayoutEditor panel)
facingBlock - panel -
public SignalMast getSignalMastAtEndBumper(Block facingBlock,
LayoutEditor panel)
public Sensor getSensorAtEndBumper(Block facingBlock,
LayoutEditor panel)
public NamedBean getFacingNamedBean(Block facingBlock,
Block protectedBlock,
LayoutEditor panel)
facingBlock - protectedBlock -
public SignalMast getFacingSignalMast(Block facingBlock,
Block protectedBlock)
public SignalMast getFacingSignalMast(Block facingBlock,
Block protectedBlock,
LayoutEditor panel)
facingBlock - protectedBlock -
public Sensor getFacingSensor(Block facingBlock,
Block protectedBlock,
LayoutEditor panel)
facingBlock - protectedBlock -
public NamedBean getFacingBean(Block facingBlock,
Block protectedBlock,
LayoutEditor panel,
Class<?> T)
facingBlock - protectedBlock - panel - the layout editor panel the block is assigned, if null then the maximum connected panel of the facing block is usedT - The class of the item that we are looking for, either SignalMast or Sensor
public Object getFacingSignalObject(Block facingBlock,
Block protectedBlock)
facingBlock - protectedBlock -
public LayoutBlock getProtectedBlockByNamedBean(NamedBean nb,
LayoutEditor panel)
nb - NamedBeanpanel - - panel that this bean is on
public List<LayoutBlock> getProtectingBlocksByNamedBean(NamedBean nb,
LayoutEditor panel)
public LayoutBlock getProtectedBlockByMast(SignalMast signalMast,
LayoutEditor panel)
public LayoutBlock getProtectedBlockBySensor(String sensorName,
LayoutEditor panel)
public List<LayoutBlock> getProtectingBlocksBySensor(Sensor sensor,
LayoutEditor panel)
public List<LayoutBlock> getProtectingBlocksBySensorOld(Sensor sensor,
LayoutEditor panel)
public LayoutBlock getProtectedBlockBySensor(Sensor sensor,
LayoutEditor panel)
public LayoutBlock getFacingBlockByNamedBean(NamedBean nb,
LayoutEditor panel)
nb - NamedBeanpanel - - panel that this bean is on
public LayoutBlock getFacingBlockBySensor(String sensorName,
LayoutEditor panel)
public LayoutBlock getFacingBlockByMast(SignalMast signalMast,
LayoutEditor panel)
public LayoutBlock getFacingBlockBySensor(Sensor sensor,
LayoutEditor panel)
public LayoutBlock getProtectedBlock(SignalHead signalHead,
LayoutEditor panel)
public LayoutBlock getProtectedBlock(String signalName,
LayoutEditor panel)
public LayoutBlock getFacingBlock(SignalHead signalHead,
LayoutEditor panel)
public LayoutBlock getFacingBlock(String signalName,
LayoutEditor panel)
public boolean warn()
Warnings are always on when program starts up. Once stopped by the user, these messages may not be switched on again until program restarts.
public void turnOffWarning()
public boolean isAdvancedRoutingEnabled()
public void enableAdvancedRouting(boolean boo)
The block routing protocol enables each layout block to build up a list of all reachable blocks, along with how far away they are, which direction they are in and which of the connected blocks they are reachable from.
public LayoutBlockConnectivityTools getLayoutBlockConnectivityTools()
void setLastRoutingChange()
public void setStabilisedSensor(String pName)
throws JmriException
JmriExceptionpublic Sensor getStabilisedSensor()
public NamedBeanHandle<Sensor> getNamedStabilisedSensor()
public boolean routingStablised()
public long getLastRoutingChange()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||