|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.dispatcher.ActiveTrain
public class ActiveTrain
This class holds information and options for an ActiveTrain, that is a train that has been linked to a Transit and activated for transit around the layout.
An ActiveTrain may be assigned one of the following modes, which specify how the active train will be run through its transit: AUTOMATIC - indicates the ActiveTrain will be run under automatic control of the computer. (Automatic Running) MANUAL - indicates an ActiveTrain running in AUTOMATIC mode has reached a Special Action in its Transit that requires MANUAL operation. When this happens, the status changes to WORKING, and the mode changes to MANUAL. The ActiveTrain will be run by an operator using a throttle. AUTOMATIC running is resumed when the work has been completed. DISPATCHED - indicates the ActiveTrain will be run by an operator using a throttle. A dispatcher will allocate Sections to the ActiveTrain as needed, control optional signals using a CTC panel or computer logic, and arbitrate any conflicts between ActiveTrains. (Human Dispatcher).
An ActiveTrain will have one of the following statuses: RUNNING - Actively running on the layout, according to its mode of operation. PAUSED - Paused waiting for a user-specified number of fast clock minutes. The Active Train is expected to move to either RUNNING or WAITING once the specified number of minutes has elapsed. This is intended for automatic station stops. (automatic trains only) WAITING - Stopped waiting for a Section allocation. This is the state the Active Train is in when it is created in Dispatcher. WORKING - Peforming work under control of a human engineer. This is the state an Active Train assumes when an engineer is picking up or setting out cars at industries. (automatic trains only) READY - Train has completed WORKING, and is awaiting a restart - dispatcher clearance to resume running. (automatic trains only) STOPPED - Train was stopped by the dispatcher. Dispatcher must resume. (automatic trains only) DONE - Train has completed its transit of the layout and is ready to be terminated by the dispatcher. Status is a bound property.
The ActiveTrain status should maintained (setStatus) by the running class, or if running in DISPATCHED mode, by Dispatcher. When an ActiveTrain is WAITING, and the dispatcher allocates a section to it, the status of the ActiveTrain is automatically set to RUNNING. So an autoRun class can listen to the status of the ActiveTrain to trigger start up if the train has been waiting for the dispatcher. Npte: There is still more to be programmed here.
Train information supplied when the ActiveTrain is created can come from any of the following: ROSTER - The train was selected from the JMRI roster menu OPERATIONS - The train was selected from trains available from JMRI operations USER - Neither menu was used--the user entered a name and DCC address. Train source information is recorded when an ActiveTrain is created, and may be referenced by getTrainSource if it is needed by other objects. The train source should be specified in the Dispatcher Options window prior to creating an ActiveTrain.
ActiveTrains are referenced via a list in DispatcherFrame, which serves as a manager for ActiveTrain objects.
ActiveTrains are transient, and are not saved to disk. Active Train information can be saved to disk, making set up with the same options, etc very easy.
An ActiveTrain runs through its Transit in the FORWARD direction, until a Transit Action reverses the direction of travel in the Transit. When running with its Transit reversed, the Active Train returns to its starting Section. Upon reaching and stopping in its starting Section, the Transit is automatically set back to the forward direction. If AutoRestart is set, the run is repeated. The direction of travel in the Transit is maintained here.
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 |
AUTOMATIC
Constants representing the mode of running of the Active Train The mode is set when the Active Train is created. |
static int |
DISPATCHED
|
static int |
DONE
|
static int |
EXPRESS_FREIGHT
|
static int |
EXPRESS_PASSENGER
|
static int |
LOCAL_FREIGHT
|
static int |
LOCAL_PASSENGER
|
static int |
MANUAL
|
static int |
MOW
|
static int |
NONE
Constants representing Type of ActiveTrains. |
static int |
OPERATIONS
|
static int |
PAUSED
|
static int |
READY
|
static int |
ROSTER
Constants representing the source of the train information |
static int |
RUNNING
Constants representing the Status of this ActiveTrain When created, the Status of an Active Train is always WAITING, |
static int |
STOPPED
|
static int |
THROUGH_FREIGHT
|
static int |
THROUGH_PASSENGER
|
static int |
USER
|
static int |
WAITING
|
static int |
WORKING
|
| Constructor Summary | |
|---|---|
ActiveTrain(Transit t,
String name,
int trainSource)
Main constructor method |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int RUNNING
public static final int PAUSED
public static final int WAITING
public static final int WORKING
public static final int READY
public static final int STOPPED
public static final int DONE
public static final int NONE
public static final int LOCAL_PASSENGER
public static final int LOCAL_FREIGHT
public static final int THROUGH_PASSENGER
public static final int THROUGH_FREIGHT
public static final int EXPRESS_PASSENGER
public static final int EXPRESS_FREIGHT
public static final int MOW
public static final int AUTOMATIC
public static final int MANUAL
public static final int DISPATCHED
public static final int ROSTER
public static final int OPERATIONS
public static final int USER
| Constructor Detail |
|---|
public ActiveTrain(Transit t,
String name,
int trainSource)
| Method Detail |
|---|
public boolean getStarted()
public void setStarted()
public Transit getTransit()
public String getTransitName()
public String getActiveTrainName()
public String getTrainName()
public int getTrainSource()
public int getStatus()
public void setStatus(int status)
public String getStatusText()
public boolean isTransitReversed()
public void setTransitReversed(boolean set)
public boolean isAllocationReversed()
public void setAllocationReversed(boolean set)
public boolean getDelayedStart()
public void setDelayedStart(boolean set)
public int getDepartureTimeHr()
public void setDepartureTimeHr(int hr)
public int getDepartureTimeMin()
public void setDepartureTimeMin(int min)
public void setTrainType(int type)
public int getTrainType()
public String getTrainTypeText()
public int getMode()
public void setMode(int mode)
public String getModeText()
public void setAutoActiveTrain(AutoActiveTrain aat)
public AutoActiveTrain getAutoActiveTrain()
public int getRunningDirectionFromSectionAndSeq(Section s,
int seqNo)
public int getAllocationDirectionFromSectionAndSeq(Section s,
int seqNo)
public void addAllocatedSection(AllocatedSection as)
public void removeAllocatedSection(AllocatedSection as)
public ArrayList<AllocatedSection> getAllocatedSectionList()
public Section getLastAllocatedSection()
public String getLastAllocatedSectionName()
public Section getNextSectionToAllocate()
public int getNextSectionSeqNumber()
public String getNextSectionToAllocateName()
public Block getStartBlock()
public void setStartBlock(Block sBlock)
public int getStartBlockSectionSequenceNumber()
public void setStartBlockSectionSequenceNumber(int sBlockSeqNum)
public Block getEndBlock()
public void setEndBlock(Block eBlock)
public Section getEndBlockSection()
public void setEndBlockSection(Section eSection)
public int getEndBlockSectionSequenceNumber()
public void setEndBlockSectionSequenceNumber(int eBlockSeqNum)
public int getPriority()
public void setPriority(int priority)
public boolean getAutoRun()
public void setAutoRun(boolean autoRun)
public String getDccAddress()
public void setDccAddress(String dccAddress)
public boolean getResetWhenDone()
public void setResetWhenDone(boolean s)
public boolean getReverseAtEnd()
public void setReverseAtEnd(boolean s)
protected Section getSecondAllocatedSection()
public AllocationRequest initializeFirstAllocation()
protected void reverseAllAllocatedSections()
protected void resetAllAllocatedSections()
public void terminate()
public void dispose()
public void addPropertyChangeListener(PropertyChangeListener l)
protected void firePropertyChange(String p,
Object old,
Object n)
public void removePropertyChangeListener(PropertyChangeListener l)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||