jmri.implementation
Class DefaultSignalMastLogic

java.lang.Object
  extended by jmri.implementation.DefaultSignalMastLogic
All Implemented Interfaces:
SignalMastLogic

public class DefaultSignalMastLogic
extends Object
implements SignalMastLogic


This file is part of JMRI.

JMRI is free 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.

Author:
Kevin Dickerson Copyright (C) 2011

Field Summary
protected  PropertyChangeListener propertyDestinationMastListener
           
protected  PropertyChangeListener propertySourceMastListener
           
 
Fields inherited from interface jmri.SignalMastLogic
STOREALL, STOREMASTSONLY, STORENONE
 
Constructor Summary
DefaultSignalMastLogic(SignalMast source)
          Initialise the signal mast logic
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void allowAutoMaticSignalMastGeneration(boolean allow, SignalMast destination)
          Sets whether we should allow the system to automatically generate a list of signal masts that could cause a conflicting route.
 boolean allowAutoMaticSignalMastGeneration(SignalMast destination)
          Query if we are allowing the system to automatically generated a list of conflicting SignalMast that have a direct effect on our logic.
 void allowTurnoutLock(boolean lock, SignalMast destination)
          Sets whether we should lock all turnouts between the source and destination signal masts when the logic goes active, to prevent them from being changed.
 boolean areBlocksIncluded(ArrayList<Block> blks)
          Returns true if any of the blocks in the supplied list are included in any of the logics that set this signal.
 void dispose()
           
protected  void firePropertyChange(String p, Object old, Object n)
           
 ArrayList<Block> getAutoBlocks(SignalMast destination)
           
 int getAutoBlockState(Block block, SignalMast destination)
           
 ArrayList<SignalMast> getAutoMasts(SignalMast destination)
           
 String getAutoSignalMastState(SignalMast mast, SignalMast destination)
           
 ArrayList<Turnout> getAutoTurnouts(SignalMast destination)
           
 int getAutoTurnoutState(Turnout turnout, SignalMast destination)
           
 ArrayList<Block> getBlocks(SignalMast destination)
           
 int getBlockState(Block block, SignalMast destination)
           
 String getComment(SignalMast dest)
           
 ArrayList<SignalMast> getDestinationList()
           
 float getMaximumSpeed(SignalMast destination)
           
 ArrayList<NamedBeanHandle<Sensor>> getNamedSensors(SignalMast destination)
           
 ArrayList<NamedBeanHandle<Turnout>> getNamedTurnouts(SignalMast destination)
           
 int getNumPropertyChangeListeners()
           
 ArrayList<Sensor> getSensors(SignalMast destination)
           
 int getSensorState(Sensor sensor, SignalMast destination)
           
 ArrayList<SignalMast> getSignalMasts(SignalMast destination)
           
 String getSignalMastState(SignalMast mast, SignalMast destination)
           
 SignalMast getSourceMast()
           
 int getStoreState(SignalMast destination)
          returns where the signalmast logic should be stored, if so how much.
 ArrayList<Turnout> getTurnouts(SignalMast destination)
           
 int getTurnoutState(Turnout turnout, SignalMast destination)
           
 void initialise()
           
 void initialise(SignalMast destination)
          Initialise the signalmast after all the parameters have been set.
 boolean isActive(SignalMast dest)
          Query if the signalmast logic to the destination signal mast is active.
 boolean isBlockIncluded(Block block, SignalMast destination)
           
 boolean isDestinationValid(SignalMast dest)
           
 boolean isEnabled(SignalMast dest)
          Query if the signalmast logic to the destination signal mast is enabled or disabled.
 boolean isSensorIncluded(Sensor sensor, SignalMast destination)
           
 boolean isSignalMastIncluded(SignalMast signal, SignalMast destination)
           
 boolean isTurnoutIncluded(Turnout turnout, SignalMast destination)
           
 boolean isTurnoutLockAllowed(SignalMast destination)
          Query if we are allowing the system to lock turnouts when the logic goes active.
 void removeConflictingLogic(SignalMast sm, LevelXing lx)
           
 boolean removeDestination(SignalMast dest)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void setAutoBlocks(Hashtable<Block,Integer> blocks, SignalMast destination)
          Sets which blocks must be inactive for the signal not to be set at a stop aspect These blocks are not stored in the panel file.
 void setAutoMasts(Hashtable<SignalMast,String> masts, SignalMast destination)
          Sets which masts must be in a given state before our mast can be set.
 void setAutoTurnouts(Hashtable<Turnout,Integer> turnouts, SignalMast destination)
          Sets which blocks must be inactive for the signal not to be set at a stop aspect These Turnouts are not stored in the panel file.
 void setBlocks(Hashtable<Block,Integer> blocks, SignalMast destination)
          Sets which blocks must be inactive for the signal not to be set at a stop aspect
 void setComment(String comment, SignalMast dest)
           
 void setConflictingLogic(SignalMast sm, LevelXing lx)
           
 void setDestinationMast(SignalMast dest)
           
 void setDisabled(SignalMast dest)
          Sets the logic to the destination signal mast to be disabled.
 void setEnabled(SignalMast dest)
          Sets the logic to the destination signal mast to be enabled.
 void setFacingBlock(LayoutBlock facing)
           
 void setMasts(Hashtable<SignalMast,String> masts, SignalMast destination)
          Sets which masts must be in a given state before our mast can be set.
 void setProtectingBlock(LayoutBlock protecting)
           
 void setSensors(Hashtable<NamedBeanHandle<Sensor>,Integer> sensors, SignalMast destination)
          Sets which sensors must be in a given state before our mast can be set.
 void setStore(int store, SignalMast destination)
          Use this to determine if the signalmast logic is stored in the panel file and if all the information is stored.
 void setTurnouts(Hashtable<NamedBeanHandle<Turnout>,Integer> turnouts, SignalMast destination)
          Sets the states that each turnout must be in for signal not to be set at a stop aspect
 void setupLayoutEditorDetails()
           
 void useLayoutEditor(boolean boo, SignalMast destination)
          Sets whether this logic should use the details stored in the layout editor to determine the which blocks, turnouts will make up the logic between the source and destination signal mast.
 boolean useLayoutEditor(SignalMast destination)
          Query if we are using the layout editor panels to build the signal mast logic, blocks, turnouts .
 boolean useLayoutEditorBlocks(SignalMast destination)
          Query if we are using the layout editor block information in the signal mast logic.
 void useLayoutEditorDetails(boolean turnouts, boolean blocks, SignalMast destination)
          Sets whether we should use the information from the layout editor for either blocks or turnouts.
 boolean useLayoutEditorTurnouts(SignalMast destination)
          Query if we are using the layout editor turnout information in the signal mast logic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyDestinationMastListener

protected PropertyChangeListener propertyDestinationMastListener

propertySourceMastListener

protected PropertyChangeListener propertySourceMastListener
Constructor Detail

DefaultSignalMastLogic

public DefaultSignalMastLogic(SignalMast source)
Initialise the signal mast logic

Parameters:
source - - The signalmast we are configuring
Method Detail

setFacingBlock

public void setFacingBlock(LayoutBlock facing)
Specified by:
setFacingBlock in interface SignalMastLogic

setProtectingBlock

public void setProtectingBlock(LayoutBlock protecting)
Specified by:
setProtectingBlock in interface SignalMastLogic

getSourceMast

public SignalMast getSourceMast()
Specified by:
getSourceMast in interface SignalMastLogic

setDestinationMast

public void setDestinationMast(SignalMast dest)
Specified by:
setDestinationMast in interface SignalMastLogic

isDestinationValid

public boolean isDestinationValid(SignalMast dest)
Specified by:
isDestinationValid in interface SignalMastLogic

getDestinationList

public ArrayList<SignalMast> getDestinationList()
Specified by:
getDestinationList in interface SignalMastLogic

getComment

public String getComment(SignalMast dest)
Specified by:
getComment in interface SignalMastLogic

setComment

public void setComment(String comment,
                       SignalMast dest)
Specified by:
setComment in interface SignalMastLogic

setStore

public void setStore(int store,
                     SignalMast destination)
Use this to determine if the signalmast logic is stored in the panel file and if all the information is stored.

Specified by:
setStore in interface SignalMastLogic
Parameters:
store -

getStoreState

public int getStoreState(SignalMast destination)
returns where the signalmast logic should be stored, if so how much.

Specified by:
getStoreState in interface SignalMastLogic

setEnabled

public void setEnabled(SignalMast dest)
Sets the logic to the destination signal mast to be enabled.

Specified by:
setEnabled in interface SignalMastLogic

setDisabled

public void setDisabled(SignalMast dest)
Sets the logic to the destination signal mast to be disabled.

Specified by:
setDisabled in interface SignalMastLogic

isEnabled

public boolean isEnabled(SignalMast dest)
Query if the signalmast logic to the destination signal mast is enabled or disabled.

Specified by:
isEnabled in interface SignalMastLogic

isActive

public boolean isActive(SignalMast dest)
Query if the signalmast logic to the destination signal mast is active.

Specified by:
isActive in interface SignalMastLogic

removeDestination

public boolean removeDestination(SignalMast dest)
Specified by:
removeDestination in interface SignalMastLogic
Parameters:
dest - Destination SignalMast.
Returns:
true if there are no more destination signal masts

useLayoutEditor

public void useLayoutEditor(boolean boo,
                            SignalMast destination)
                     throws JmriException
Sets whether this logic should use the details stored in the layout editor to determine the which blocks, turnouts will make up the logic between the source and destination signal mast.

Specified by:
useLayoutEditor in interface SignalMastLogic
Parameters:
boo - Use the layout editor details to determine logic details.
destination - Destination SignalMast.
Throws:
JmriException

useLayoutEditor

public boolean useLayoutEditor(SignalMast destination)
Query if we are using the layout editor panels to build the signal mast logic, blocks, turnouts .

Specified by:
useLayoutEditor in interface SignalMastLogic
Parameters:
destination - Destination SignalMast.
Returns:
true if we are using the layout editor to build the signal mast logic.

useLayoutEditorDetails

public void useLayoutEditorDetails(boolean turnouts,
                                   boolean blocks,
                                   SignalMast destination)
                            throws JmriException
Sets whether we should use the information from the layout editor for either blocks or turnouts.

Specified by:
useLayoutEditorDetails in interface SignalMastLogic
Parameters:
destination - Destination SignalMast.
blocks - set false if not to use the block information gathered from the layouteditor
turnouts - set false if not to use the turnout information gathered from the layouteditor
Throws:
JmriException

useLayoutEditorTurnouts

public boolean useLayoutEditorTurnouts(SignalMast destination)
Query if we are using the layout editor turnout information in the signal mast logic.

Specified by:
useLayoutEditorTurnouts in interface SignalMastLogic
Parameters:
destination - Destination SignalMast.
Returns:
true if we are using the turnout information from the layout editor.

useLayoutEditorBlocks

public boolean useLayoutEditorBlocks(SignalMast destination)
Query if we are using the layout editor block information in the signal mast logic.

Specified by:
useLayoutEditorBlocks in interface SignalMastLogic
Parameters:
destination - Destination SignalMast.
Returns:
true if we are using the block information from the layout editor.

allowAutoMaticSignalMastGeneration

public boolean allowAutoMaticSignalMastGeneration(SignalMast destination)
Query if we are allowing the system to automatically generated a list of conflicting SignalMast that have a direct effect on our logic.

Specified by:
allowAutoMaticSignalMastGeneration in interface SignalMastLogic
Parameters:
destination - Destination SignalMast.
Returns:
true if this is allowed.

allowAutoMaticSignalMastGeneration

public void allowAutoMaticSignalMastGeneration(boolean allow,
                                               SignalMast destination)
Sets whether we should allow the system to automatically generate a list of signal masts that could cause a conflicting route.

Specified by:
allowAutoMaticSignalMastGeneration in interface SignalMastLogic
Parameters:
destination - Destination SignalMast.
allow - set true if we are to allow automatic generation.

allowTurnoutLock

public void allowTurnoutLock(boolean lock,
                             SignalMast destination)
Sets whether we should lock all turnouts between the source and destination signal masts when the logic goes active, to prevent them from being changed. This is dependant upon the hardware allowing for this.

Specified by:
allowTurnoutLock in interface SignalMastLogic
Parameters:
destination - Destination SignalMast.
lock - set true if the system should lock the turnout.

isTurnoutLockAllowed

public boolean isTurnoutLockAllowed(SignalMast destination)
Query if we are allowing the system to lock turnouts when the logic goes active.

Specified by:
isTurnoutLockAllowed in interface SignalMastLogic
Parameters:
destination - Destination SignalMast.
Returns:
true if locking is allowed.

setTurnouts

public void setTurnouts(Hashtable<NamedBeanHandle<Turnout>,Integer> turnouts,
                        SignalMast destination)
Sets the states that each turnout must be in for signal not to be set at a stop aspect

Specified by:
setTurnouts in interface SignalMastLogic
Parameters:
turnouts -

setAutoTurnouts

public void setAutoTurnouts(Hashtable<Turnout,Integer> turnouts,
                            SignalMast destination)
Sets which blocks must be inactive for the signal not to be set at a stop aspect These Turnouts are not stored in the panel file.

Specified by:
setAutoTurnouts in interface SignalMastLogic

setBlocks

public void setBlocks(Hashtable<Block,Integer> blocks,
                      SignalMast destination)
Sets which blocks must be inactive for the signal not to be set at a stop aspect

Specified by:
setBlocks in interface SignalMastLogic
Parameters:
blocks -

setAutoBlocks

public void setAutoBlocks(Hashtable<Block,Integer> blocks,
                          SignalMast destination)
Sets which blocks must be inactive for the signal not to be set at a stop aspect These blocks are not stored in the panel file.

Specified by:
setAutoBlocks in interface SignalMastLogic
Parameters:
blocks -

setMasts

public void setMasts(Hashtable<SignalMast,String> masts,
                     SignalMast destination)
Sets which masts must be in a given state before our mast can be set.

Specified by:
setMasts in interface SignalMastLogic
Parameters:
masts -

setAutoMasts

public void setAutoMasts(Hashtable<SignalMast,String> masts,
                         SignalMast destination)
Sets which masts must be in a given state before our mast can be set. These masts are not stored in the panel file.

Specified by:
setAutoMasts in interface SignalMastLogic
Parameters:
masts -

setSensors

public void setSensors(Hashtable<NamedBeanHandle<Sensor>,Integer> sensors,
                       SignalMast destination)
Sets which sensors must be in a given state before our mast can be set.

Specified by:
setSensors in interface SignalMastLogic
Parameters:
sensors -

getBlocks

public ArrayList<Block> getBlocks(SignalMast destination)
Specified by:
getBlocks in interface SignalMastLogic

getAutoBlocks

public ArrayList<Block> getAutoBlocks(SignalMast destination)
Specified by:
getAutoBlocks in interface SignalMastLogic

getTurnouts

public ArrayList<Turnout> getTurnouts(SignalMast destination)
Specified by:
getTurnouts in interface SignalMastLogic

getNamedTurnouts

public ArrayList<NamedBeanHandle<Turnout>> getNamedTurnouts(SignalMast destination)
Specified by:
getNamedTurnouts in interface SignalMastLogic

getAutoTurnouts

public ArrayList<Turnout> getAutoTurnouts(SignalMast destination)
Specified by:
getAutoTurnouts in interface SignalMastLogic

getSensors

public ArrayList<Sensor> getSensors(SignalMast destination)
Specified by:
getSensors in interface SignalMastLogic

getNamedSensors

public ArrayList<NamedBeanHandle<Sensor>> getNamedSensors(SignalMast destination)
Specified by:
getNamedSensors in interface SignalMastLogic

getSignalMasts

public ArrayList<SignalMast> getSignalMasts(SignalMast destination)
Specified by:
getSignalMasts in interface SignalMastLogic

getAutoMasts

public ArrayList<SignalMast> getAutoMasts(SignalMast destination)
Specified by:
getAutoMasts in interface SignalMastLogic

initialise

public void initialise()
Specified by:
initialise in interface SignalMastLogic

initialise

public void initialise(SignalMast destination)
Initialise the signalmast after all the parameters have been set.

Specified by:
initialise in interface SignalMastLogic

setupLayoutEditorDetails

public void setupLayoutEditorDetails()
Specified by:
setupLayoutEditorDetails in interface SignalMastLogic

areBlocksIncluded

public boolean areBlocksIncluded(ArrayList<Block> blks)
Returns true if any of the blocks in the supplied list are included in any of the logics that set this signal.

Specified by:
areBlocksIncluded in interface SignalMastLogic

getBlockState

public int getBlockState(Block block,
                         SignalMast destination)
Specified by:
getBlockState in interface SignalMastLogic

isBlockIncluded

public boolean isBlockIncluded(Block block,
                               SignalMast destination)
Specified by:
isBlockIncluded in interface SignalMastLogic

isTurnoutIncluded

public boolean isTurnoutIncluded(Turnout turnout,
                                 SignalMast destination)
Specified by:
isTurnoutIncluded in interface SignalMastLogic

isSensorIncluded

public boolean isSensorIncluded(Sensor sensor,
                                SignalMast destination)
Specified by:
isSensorIncluded in interface SignalMastLogic

isSignalMastIncluded

public boolean isSignalMastIncluded(SignalMast signal,
                                    SignalMast destination)
Specified by:
isSignalMastIncluded in interface SignalMastLogic

getAutoBlockState

public int getAutoBlockState(Block block,
                             SignalMast destination)
Specified by:
getAutoBlockState in interface SignalMastLogic

getSensorState

public int getSensorState(Sensor sensor,
                          SignalMast destination)
Specified by:
getSensorState in interface SignalMastLogic

getTurnoutState

public int getTurnoutState(Turnout turnout,
                           SignalMast destination)
Specified by:
getTurnoutState in interface SignalMastLogic

getAutoTurnoutState

public int getAutoTurnoutState(Turnout turnout,
                               SignalMast destination)
Specified by:
getAutoTurnoutState in interface SignalMastLogic

getSignalMastState

public String getSignalMastState(SignalMast mast,
                                 SignalMast destination)
Specified by:
getSignalMastState in interface SignalMastLogic

getAutoSignalMastState

public String getAutoSignalMastState(SignalMast mast,
                                     SignalMast destination)
Specified by:
getAutoSignalMastState in interface SignalMastLogic

getMaximumSpeed

public float getMaximumSpeed(SignalMast destination)
Specified by:
getMaximumSpeed in interface SignalMastLogic

setConflictingLogic

public void setConflictingLogic(SignalMast sm,
                                LevelXing lx)
Specified by:
setConflictingLogic in interface SignalMastLogic

removeConflictingLogic

public void removeConflictingLogic(SignalMast sm,
                                   LevelXing lx)
Specified by:
removeConflictingLogic in interface SignalMastLogic

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface SignalMastLogic

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface SignalMastLogic

getNumPropertyChangeListeners

public int getNumPropertyChangeListeners()
Specified by:
getNumPropertyChangeListeners in interface SignalMastLogic

firePropertyChange

protected void firePropertyChange(String p,
                                  Object old,
                                  Object n)

dispose

public void dispose()
Specified by:
dispose in interface SignalMastLogic


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads