|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.display.layoutEditor.LayoutBlockConnectivityTools
public class LayoutBlockConnectivityTools
These are a series of layout block connectivity tools that can be used when the advanced layout block routing has been enabled. These tools can determine if a path from a source to destination bean is valid. If a route between two layout blocks is usable and free.
| Nested Class Summary | |
|---|---|
(package private) static class |
LayoutBlockConnectivityTools.BlocksTested
|
(package private) static class |
LayoutBlockConnectivityTools.FacingProtecting
|
| Field Summary | |
|---|---|
static int |
ANY
Constant used in the getLayoutBlocks to represent a path from either a Signal Mast or Head to another Signal Mast or Head and that no mast of head should be in the path. |
static int |
DISTANCE
|
static int |
HEADTOHEAD
Constant used in the getLayoutBlocks to represent a path from one Signal Head to another and that no head should be in the path. |
static int |
HOPCOUNT
|
(package private) String |
lastErrorMessage
|
(package private) static org.slf4j.Logger |
log
|
static int |
MASTTOMAST
Constant used in the getLayoutBlocks to represent a path from one Signal Mast to another and that no mast should be in the path. |
static int |
METRIC
|
static int |
NONE
Constant used in the getLayoutBlocks to indicate that the the system should not check for signal masts or heads on the path. |
static int |
SENSORTOSENSOR
Constant used in the getLayoutBlocks to represent a path from one Sensor to another and that no sensor should be in the path. |
| Constructor Summary | |
|---|---|
LayoutBlockConnectivityTools()
|
|
| Method Summary | |
|---|---|
boolean |
checkValidDest(LayoutBlock facing,
LayoutBlock protecting,
LayoutBlockConnectivityTools.FacingProtecting dest,
int pathMethod)
This uses the layout editor to check if the destination location is reachable from the source location |
boolean |
checkValidDest(LayoutBlock currentBlock,
LayoutBlock nextBlock,
LayoutBlock destBlock,
LayoutBlock destBlockn1,
int pathMethod)
Determines if one set of blocks is reachable from another set of blocks based upon the directions of the set of blocks. |
boolean |
checkValidDest(LayoutBlock currentBlock,
LayoutBlock nextBlock,
LayoutBlock destBlock,
List<LayoutBlock> destBlockn1,
int pathMethod)
|
boolean |
checkValidDest(NamedBean sourceBean,
NamedBean destBean,
int pathMethod)
Determines if a pair of NamedBeans (Signalhead, Signalmast or Sensor) assigned to a block boundary are reachable. |
(package private) ArrayList<NamedBean> |
discoverPairDest(NamedBean source,
LayoutBlock lProtecting,
LayoutBlock lFacing,
ArrayList<LayoutBlockConnectivityTools.FacingProtecting> blockList,
int pathMethod)
|
List<NamedBean> |
discoverPairDest(NamedBean source,
LayoutEditor editor,
Class<?> T,
int pathMethod)
Returns a list of valid destination beans reachable from a given source bean. |
Hashtable<NamedBean,ArrayList<NamedBean>> |
discoverValidBeanPairs(LayoutEditor editor,
Class<?> T,
int pathMethod)
Discovers valid pairs of beans type T assigned to a layout editor. |
(package private) int |
findBestHop(Block preBlock,
Block currentBlock,
Block destBlock,
int direction,
List<Integer> offSet,
boolean validateOnly,
int pathMethod)
|
(package private) ArrayList<LayoutBlockConnectivityTools.FacingProtecting> |
generateBlocksWithBeans(LayoutEditor editor,
Class<?> T)
|
List<NamedBean> |
getBeansInPath(List<LayoutBlock> blocklist,
LayoutEditor panel,
Class<?> T)
Returns a list of NamedBeans (Signalhead, Signalmast or Sensor) that are assinged to block boundaries in a given list |
ArrayList<LayoutBlock> |
getLayoutBlocks(LayoutBlock sourceLayoutBlock,
LayoutBlock destinationLayoutBlock,
LayoutBlock protectingLayoutBlock,
boolean validateOnly,
int pathMethod)
The is used in conjunction with the layout block routing protocol, to discover a clear path from a source layout block through to a destination layout block. |
ArrayList<LayoutBlock> |
getLayoutBlocks(NamedBean sourceBean,
NamedBean destBean,
boolean validateOnly,
int pathMethod)
The is used in conjunction with the layout block routing protocol, to discover a clear path from a source layout block through to a destination layout block. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MASTTOMAST
public static final int HEADTOHEAD
public static final int SENSORTOSENSOR
public static final int ANY
public static final int NONE
public static final int HOPCOUNT
public static final int METRIC
public static final int DISTANCE
String lastErrorMessage
static org.slf4j.Logger log
| Constructor Detail |
|---|
public LayoutBlockConnectivityTools()
| Method Detail |
|---|
public boolean checkValidDest(NamedBean sourceBean,
NamedBean destBean,
int pathMethod)
throws JmriException
Jmri.Exception - if no blocks can be found that related to the named beans.
JmriException
public ArrayList<LayoutBlock> getLayoutBlocks(NamedBean sourceBean,
NamedBean destBean,
boolean validateOnly,
int pathMethod)
throws JmriException
sourceBean - - The source bean (SignalHead, SignalMast or Sensor) assigned to a
block boundary that we are starting from.destBean - - The destination bean.validateOnly - - When set false, the system will not use layout blocks
that are set as either reserved(useExtraColor set) or occupied, if it
finds any then it will try to find an alternative path
When set false, no block state checking is performed.pathMethod - - Performs a check to see if any signal heads/masts are
in the path, if there are then the system will try to find
an alternative path. If set to NONE, then no checking is performed.
JmriException - if it can not find a valid path or the routing
has not been enabled.
public List<NamedBean> getBeansInPath(List<LayoutBlock> blocklist,
LayoutEditor panel,
Class<?> T)
blocklist - The list of block in order that need to be checked.panel - (Optional) panel that the blocks need to be checked againstT - (Optional) the class that we want to check against, either Sensor, SignalMast or SignalHead, set null will return any.
public boolean checkValidDest(LayoutBlock currentBlock,
LayoutBlock nextBlock,
LayoutBlock destBlock,
LayoutBlock destBlockn1,
int pathMethod)
throws JmriException
This is used to help with identifying items such as signalmasts located at positionable points or turnouts are facing in the same direction as other given signalmasts.
Given the current block and the next block we can work out the direction of travel. Given the destBlock and the next block on, we can determine the whether the destBlock comes before the destBlock+1.
Jmri.Exception - if any Block is null;
JmriException
public boolean checkValidDest(LayoutBlock currentBlock,
LayoutBlock nextBlock,
LayoutBlock destBlock,
List<LayoutBlock> destBlockn1,
int pathMethod)
throws JmriException
JmriException
public boolean checkValidDest(LayoutBlock facing,
LayoutBlock protecting,
LayoutBlockConnectivityTools.FacingProtecting dest,
int pathMethod)
throws JmriException
facing - Layout Block that is considered our first blockprotecting - Layout Block that is considered first block +1dest - Layout Block that we want to get to
JmriException
public ArrayList<LayoutBlock> getLayoutBlocks(LayoutBlock sourceLayoutBlock,
LayoutBlock destinationLayoutBlock,
LayoutBlock protectingLayoutBlock,
boolean validateOnly,
int pathMethod)
throws JmriException
sourceLayoutBlock - - The layout block that we are starting from,
can also be considered as the block facing a signal.destinationLayoutBlock - - The layout block that we want to get toprotectingLayoutBlock - - The next layout block connected to the source
block, this can also be considered as the block being protected by a signalvalidateOnly - - When set false, the system will not use layout blocks
that are set as either reserved(useExtraColor set) or occupied, if it
finds any then it will try to find an alternative path
When set false, no block state checking is performed.pathMethod - - Performs a check to see if any signal heads/masts are
in the path, if there are then the system will try to find
an alternative path. If set to NONE, then no checking is performed.
JmriException - if it can not find a valid path or the routing
has not been enabled.
int findBestHop(Block preBlock,
Block currentBlock,
Block destBlock,
int direction,
List<Integer> offSet,
boolean validateOnly,
int pathMethod)
public Hashtable<NamedBean,ArrayList<NamedBean>> discoverValidBeanPairs(LayoutEditor editor,
Class<?> T,
int pathMethod)
pathMethod - Determine whether or not we should reject pairs if there are other beans in the way.
Constant values of NONE, ANY, MASTTOMAST, HEADTOHEAD
public List<NamedBean> discoverPairDest(NamedBean source,
LayoutEditor editor,
Class<?> T,
int pathMethod)
throws JmriException
source - Either a SignalMast or Sensoreditor - The layout editor that the source is located on, if null, then all editors are consideredT - The class of the remote destination, if null, then both SignalMasts and Sensors are consideredpathMethod - Determine whether or not we should reject pairs if there are other beans in the way.
Constant values of NONE, ANY, MASTTOMAST, HEADTOHEAD
JmriException
ArrayList<NamedBean> discoverPairDest(NamedBean source,
LayoutBlock lProtecting,
LayoutBlock lFacing,
ArrayList<LayoutBlockConnectivityTools.FacingProtecting> blockList,
int pathMethod)
throws JmriException
JmriException
ArrayList<LayoutBlockConnectivityTools.FacingProtecting> generateBlocksWithBeans(LayoutEditor editor,
Class<?> T)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||