|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.implementation.AbstractNamedBean
jmri.Transit
public class Transit
Class providing the basic implementation of a Transit.
Transits represent a group of Sections representing a specified path through a layout.
A Transit may have the following states. IDLE - indicating that it is available for "assignment" ASSIGNED - linked to a train to form an ActiveTrain
When assigned to a Transit, options may be set for the assigned Section. The Section and its options are kept in a TransitSection object.
To accomodate passing sidings and other track features, there may be alternate Sections connecting two Sections in a Transit. If so, one Section is assigned as primary, and other Sections are assigned as alternates.
A Section may be in a Transit more than once, for example if a train is to make two or more loops around before going elsewhere.
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.
| Field Summary | |
|---|---|
static int |
ASSIGNED
|
static int |
IDLE
Constants representing the state of the Transit. |
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Constructor Summary | |
|---|---|
Transit(String systemName)
|
|
Transit(String systemName,
String userName)
|
|
| Method Summary | |
|---|---|
void |
addTransitSection(TransitSection s)
Add a TransitSection to the Transit Section sequence numnbers are set automatically as Sections are added. |
boolean |
canBeResetWhenDone()
Determines whether this Transit is capable of continuous running. |
boolean |
checkSignals(JmriJFrame frame,
LayoutEditor panel)
Checks that exit Signal Heads are in place for all Sections in this Transit and for block boundaries at turnouts or level crossings within Sections of the Transit for the direction defined in this Transit. |
boolean |
containsBlock(Block b)
Test if a Block is in the Transit |
boolean |
containsSection(Section s)
Test if a Section is in the Transit |
int |
getBlockCount(Block b)
Count the number of times a Block is in this Transit |
ArrayList<Integer> |
getBlockSeqList()
|
ArrayList<Integer> |
getDestBlocksSeqList()
|
ArrayList<Block> |
getDestinationBlocksList(Block startBlock,
boolean startInTransit)
Get a list of all destination blocks that can be reached from a specified starting block, "startBlock". |
int |
getDirectionFromSectionAndSeq(Section s,
int seq)
Gets the direction of a Section in the transit from its sequence number Returns 0 if direction was not found. |
ArrayList<Block> |
getEntryBlocksList()
Get a list of all entry blocks to this Transit. |
ArrayList<Block> |
getInternalBlocksList()
Get a list of all blocks internal to this Transit Since Sections may be present more than once, blocks may be listed more than once. |
int |
getMaxSequence()
Get the maximum sequence number used in this Transit |
Section |
getSectionFromBlockAndSeq(Block b,
int seq)
Returns a Section from one of its Blocks and its sequence number |
Section |
getSectionFromConnectedBlockAndSeq(Block b,
int seq)
Returns a Section from one of its EntryPoint Blocks and its sequence number |
ArrayList<Section> |
getSectionListBySeq(int seq)
Get a List of Sections with a given sequence number |
ArrayList<Integer> |
getSeqListBySection(Section s)
Get a List of sequence numbers for a given Section |
int |
getState()
Query the state of the Transit |
ArrayList<TransitSection> |
getTransitSectionList()
Get a copy of this Transit's TransitSection list |
void |
removeAllSections()
Remove all TransitSections |
void |
setState(int state)
Set the state of the Transit |
boolean |
validateConnectivity(JmriJFrame frame,
LayoutEditor panel)
Validates connectivity through the Transit. |
| Methods inherited from class jmri.implementation.AbstractNamedBean |
|---|
addPropertyChangeListener, dispose, firePropertyChange, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int IDLE
public static final int ASSIGNED
| Constructor Detail |
|---|
public Transit(String systemName,
String userName)
public Transit(String systemName)
| Method Detail |
|---|
public int getState()
getState in interface NamedBeanpublic void setState(int state)
setState in interface NamedBeanpublic void addTransitSection(TransitSection s)
public ArrayList<TransitSection> getTransitSectionList()
public int getMaxSequence()
public void removeAllSections()
public boolean containsSection(Section s)
public ArrayList<Section> getSectionListBySeq(int seq)
public ArrayList<Integer> getSeqListBySection(Section s)
public boolean containsBlock(Block b)
public int getBlockCount(Block b)
public Section getSectionFromBlockAndSeq(Block b,
int seq)
public Section getSectionFromConnectedBlockAndSeq(Block b,
int seq)
public int getDirectionFromSectionAndSeq(Section s,
int seq)
public ArrayList<Block> getInternalBlocksList()
public ArrayList<Integer> getBlockSeqList()
public ArrayList<Block> getEntryBlocksList()
public ArrayList<Block> getDestinationBlocksList(Block startBlock,
boolean startInTransit)
public ArrayList<Integer> getDestBlocksSeqList()
public boolean canBeResetWhenDone()
public boolean checkSignals(JmriJFrame frame,
LayoutEditor panel)
public boolean validateConnectivity(JmriJFrame frame,
LayoutEditor panel)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||