jmri.implementation
Class DefaultSignalGroup

java.lang.Object
  extended by jmri.implementation.AbstractNamedBean
      extended by jmri.implementation.DefaultSignalGroup
All Implemented Interfaces:
Serializable, NamedBean, SignalGroup

public class DefaultSignalGroup
extends AbstractNamedBean
implements SignalGroup

Conditional.java A Conditional type to provide runtime support for Densor Groups.

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:
Pete Cressman Copyright (C) 2009
See Also:
Serialized Form

Field Summary
protected  PropertyChangeListener mSignalMastListener
           
 
Fields inherited from class jmri.implementation.AbstractNamedBean
mSystemName, mUserName
 
Fields inherited from interface jmri.SignalGroup
ONACTIVE, ONCLOSED, ONINACTIVE, ONTHROWN
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
DefaultSignalGroup(String systemName)
           
DefaultSignalGroup(String systemName, String userName)
           
 
Method Summary
 void addSignalHead(NamedBeanHandle<SignalHead> sh)
          Add a Signal Head to the Group
 void addSignalHead(String pName)
          Add a Signal Head to the Group
 void addSignalMastAppearance(String appearance)
          Add an appearance that can trigger the group activation
 void clearSignalMastAppearance()
          Clear the list of SignalMast Appearances that trigger the group
 void clearSignalSensor(String pSignal)
          Delete all Sensors for a given SignalHead in the group
 void clearSignalTurnout(String pSignal)
          Delete all Turnouts for a given SignalHead in the group
 void deleteSignalHead(NamedBeanHandle<SignalHead> sh)
          Delete Signal Head by NamedBean
 void deleteSignalHead(String pName)
          Delete Signal Head by Name
 void deleteSignalMastAppearance(String appearance)
          Remove a SignalMast Appearance from the set of triggers.
 boolean getEnabled()
          Get enabled status
 int getNumSignalHeadItems()
           
 int getNumSignalHeadSensorsByIndex(int x)
          Method to get the number of Sensors used to determine the On state for the signalhead at index x
 int getNumSignalHeadTurnoutsByIndex(int x)
          Method to get the number of turnouts used to determine the On state for the signalhead at index x
 int getNumSignalMastAppearances()
           
 String getSensorNameByIndex(int x, int pSensor)
          Gets the state of the Sensor at index x, for the given Signal Head at index x
 int getSensorState(String pSignal, String pSensor)
          Gets the state of the Sensor for the given Signal Head in the group
 int getSensorStateByIndex(int x, int pSensor)
          Gets the state of the Sensor for the given Signal Head at index x
 boolean getSensorTurnoutOper(String pSignal)
           
 boolean getSensorTurnoutOperByIndex(int x)
           
 String getSignalHeadItemNameByIndex(int n)
          Method to get a SignalHead by Index Returns null if there are no Signal Heads with that index
 int getSignalHeadOffState(String name)
          Method to get the Off State of Signal Head
 int getSignalHeadOffStateByIndex(int n)
          Method to get the Off State of a SignalState at Index n
 int getSignalHeadOnState(String name)
          Method to get the On State of Signal Head
 int getSignalHeadOnStateByIndex(int n)
          Method to get the On State of a SignalState at Index n
 SignalMast getSignalMast()
          Get the SignalMast
 String getSignalMastAppearanceByIndex(int x)
          Method to get a SignalMast Appearance by Index Returns null if there are no Appearances with that index
 String getSignalMastName()
          Get the name of the main Signal Mast
 int getState()
          Provide generic access to internal state.
 String getTurnoutNameByIndex(int x, int pTurnout)
          Gets the Name of the Turnout at index x, for the given Signal Head at index x
 int getTurnoutState(String pSignal, String pTurnout)
          Gets the state of the Turnout for the given Signal Head in the group
 int getTurnoutStateByIndex(int x, int pTurnout)
          Gets the state of the Turnout at index x, for the given Signal Head at index x
 int getTurnoutStateByIndex(int x, String pTurnout)
          Gets the state of the Turnout for the given Signal Head at index x
 boolean isSensorIncluded(String pSignal, String pSensor)
          Inquire if a Sensor is included in the Signal Head Calculation.
 boolean isSignalIncluded(String pName)
          Method to inquire if a Signal Head is included in this Group
 boolean isSignalMastAppearanceIncluded(String appearance)
          Inquire if a SignalMast Appearance is included.
 boolean isTurnoutIncluded(String pSignal, String pTurnout)
          Inquire if a Turnout is included in the Signal Head Calculation.
 void setEnabled(boolean boo)
          Set enabled status.
 void setSensorTurnoutOper(String pSignal, boolean boo)
          Sets whether the sensors and turnouts should be treated as seperate calculations or as one, when determining if the signal head should be on or off.
 void setSignalHeadAlignSensor(String mHead, String mSen, int state)
          Method to add a Sensor and its state to a signal head.
 void setSignalHeadAlignTurnout(String mHead, String mTurn, int state)
          Method to add a Turnout and its state to a signal head.
 void setSignalHeadOffState(String name, int state)
          Sets the Off State of the Signal in the Group
 void setSignalHeadOnState(String name, int state)
          Sets the On State of the Signal in the Group
 void setSignalMast(String pName)
          Sets the main Signal Mast to which the Group belongs
 void setState(int state)
          Provide generic access to internal state.
 
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef
 

Field Detail

mSignalMastListener

protected PropertyChangeListener mSignalMastListener
Constructor Detail

DefaultSignalGroup

public DefaultSignalGroup(String systemName,
                          String userName)

DefaultSignalGroup

public DefaultSignalGroup(String systemName)
Method Detail

setEnabled

public void setEnabled(boolean boo)
Description copied from interface: SignalGroup
Set enabled status.

Specified by:
setEnabled in interface SignalGroup

getEnabled

public boolean getEnabled()
Description copied from interface: SignalGroup
Get enabled status

Specified by:
getEnabled in interface SignalGroup

setSignalMast

public void setSignalMast(String pName)
Description copied from interface: SignalGroup
Sets the main Signal Mast to which the Group belongs

Specified by:
setSignalMast in interface SignalGroup

getSignalMast

public SignalMast getSignalMast()
Description copied from interface: SignalGroup
Get the SignalMast

Specified by:
getSignalMast in interface SignalGroup

getSignalMastName

public String getSignalMastName()
Description copied from interface: SignalGroup
Get the name of the main Signal Mast

Specified by:
getSignalMastName in interface SignalGroup

addSignalMastAppearance

public void addSignalMastAppearance(String appearance)
Description copied from interface: SignalGroup
Add an appearance that can trigger the group activation

Specified by:
addSignalMastAppearance in interface SignalGroup

isSignalMastAppearanceIncluded

public boolean isSignalMastAppearanceIncluded(String appearance)
Description copied from interface: SignalGroup
Inquire if a SignalMast Appearance is included.

Specified by:
isSignalMastAppearanceIncluded in interface SignalGroup

deleteSignalMastAppearance

public void deleteSignalMastAppearance(String appearance)
Description copied from interface: SignalGroup
Remove a SignalMast Appearance from the set of triggers.

Specified by:
deleteSignalMastAppearance in interface SignalGroup

getNumSignalMastAppearances

public int getNumSignalMastAppearances()
Specified by:
getNumSignalMastAppearances in interface SignalGroup

getSignalMastAppearanceByIndex

public String getSignalMastAppearanceByIndex(int x)
Description copied from interface: SignalGroup
Method to get a SignalMast Appearance by Index Returns null if there are no Appearances with that index

Specified by:
getSignalMastAppearanceByIndex in interface SignalGroup

clearSignalMastAppearance

public void clearSignalMastAppearance()
Description copied from interface: SignalGroup
Clear the list of SignalMast Appearances that trigger the group

Specified by:
clearSignalMastAppearance in interface SignalGroup

addSignalHead

public void addSignalHead(NamedBeanHandle<SignalHead> sh)
Description copied from interface: SignalGroup
Add a Signal Head to the Group

Specified by:
addSignalHead in interface SignalGroup
Parameters:
sh - The SignalHead as a Named Bean

addSignalHead

public void addSignalHead(String pName)
Description copied from interface: SignalGroup
Add a Signal Head to the Group

Specified by:
addSignalHead in interface SignalGroup
Parameters:
pName - The SignalHead as a Name

setSignalHeadAlignTurnout

public void setSignalHeadAlignTurnout(String mHead,
                                      String mTurn,
                                      int state)
Description copied from interface: SignalGroup
Method to add a Turnout and its state to a signal head.

Specified by:
setSignalHeadAlignTurnout in interface SignalGroup
Parameters:
mHead - SignalHead we are adding the turnout to
mTurn - Turnout as a String either User or System Name
state - The State that the turnout must be set to.

setSignalHeadAlignSensor

public void setSignalHeadAlignSensor(String mHead,
                                     String mSen,
                                     int state)
Description copied from interface: SignalGroup
Method to add a Sensor and its state to a signal head.

Specified by:
setSignalHeadAlignSensor in interface SignalGroup
Parameters:
mHead - SignalHead we are adding the sensor to
mSen - Sensor as a String either User or System Name
state - The State that the sensor must be set to.

getSignalHeadItemNameByIndex

public String getSignalHeadItemNameByIndex(int n)
Description copied from interface: SignalGroup
Method to get a SignalHead by Index Returns null if there are no Signal Heads with that index

Specified by:
getSignalHeadItemNameByIndex in interface SignalGroup

getNumSignalHeadItems

public int getNumSignalHeadItems()
Specified by:
getNumSignalHeadItems in interface SignalGroup

getSignalHeadOnState

public int getSignalHeadOnState(String name)
Description copied from interface: SignalGroup
Method to get the On State of Signal Head

Specified by:
getSignalHeadOnState in interface SignalGroup
Parameters:
name - The name of the SignalHead we are querying

getSignalHeadOffState

public int getSignalHeadOffState(String name)
Description copied from interface: SignalGroup
Method to get the Off State of Signal Head

Specified by:
getSignalHeadOffState in interface SignalGroup
Parameters:
name - The name of the SignalHead we are querying

getSignalHeadOnStateByIndex

public int getSignalHeadOnStateByIndex(int n)
Description copied from interface: SignalGroup
Method to get the On State of a SignalState at Index n

Specified by:
getSignalHeadOnStateByIndex in interface SignalGroup
Returns:
-1 if there are less than 'n' SignalHeads defined

getSignalHeadOffStateByIndex

public int getSignalHeadOffStateByIndex(int n)
Description copied from interface: SignalGroup
Method to get the Off State of a SignalState at Index n

Specified by:
getSignalHeadOffStateByIndex in interface SignalGroup
Returns:
-1 if there are less than 'n' SignalHeads defined

deleteSignalHead

public void deleteSignalHead(String pName)
Description copied from interface: SignalGroup
Delete Signal Head by Name

Specified by:
deleteSignalHead in interface SignalGroup

deleteSignalHead

public void deleteSignalHead(NamedBeanHandle<SignalHead> sh)
Description copied from interface: SignalGroup
Delete Signal Head by NamedBean

Specified by:
deleteSignalHead in interface SignalGroup

setSignalHeadOnState

public void setSignalHeadOnState(String name,
                                 int state)
Description copied from interface: SignalGroup
Sets the On State of the Signal in the Group

Specified by:
setSignalHeadOnState in interface SignalGroup
Parameters:
name - The SignalHead Name
state - The Apperance that the SignalHead will change to when the conditions are met.

setSignalHeadOffState

public void setSignalHeadOffState(String name,
                                  int state)
Description copied from interface: SignalGroup
Sets the Off State of the Signal in the Group

Specified by:
setSignalHeadOffState in interface SignalGroup
Parameters:
name - The SignalHead Name
state - The Apperance that the SignalHead will change to when the conditions are NOT met.

isSignalIncluded

public boolean isSignalIncluded(String pName)
Description copied from interface: SignalGroup
Method to inquire if a Signal Head is included in this Group

Specified by:
isSignalIncluded in interface SignalGroup

isTurnoutIncluded

public boolean isTurnoutIncluded(String pSignal,
                                 String pTurnout)
Description copied from interface: SignalGroup
Inquire if a Turnout is included in the Signal Head Calculation.

Specified by:
isTurnoutIncluded in interface SignalGroup
Parameters:
pSignal - Name of the Signal Head
pTurnout - Name of the Turnout

getTurnoutState

public int getTurnoutState(String pSignal,
                           String pTurnout)
Description copied from interface: SignalGroup
Gets the state of the Turnout for the given Signal Head in the group

Specified by:
getTurnoutState in interface SignalGroup
Parameters:
pSignal - Name of the Signal Head
pTurnout - Name of the Turnout within the Group
Returns:
-1 if the turnout or signal head is invalid

getTurnoutStateByIndex

public int getTurnoutStateByIndex(int x,
                                  String pTurnout)
Description copied from interface: SignalGroup
Gets the state of the Turnout for the given Signal Head at index x

Specified by:
getTurnoutStateByIndex in interface SignalGroup
Parameters:
x - Signal Head at index x
pTurnout - Name of the Turnout within the Group
Returns:
-1 if the turnout or signal head is invalid

getTurnoutStateByIndex

public int getTurnoutStateByIndex(int x,
                                  int pTurnout)
Description copied from interface: SignalGroup
Gets the state of the Turnout at index x, for the given Signal Head at index x

Specified by:
getTurnoutStateByIndex in interface SignalGroup
Parameters:
x - Signal Head at index x
pTurnout - Turnout at index pTurnout
Returns:
-1 if the turnout or signal head is invalid

getTurnoutNameByIndex

public String getTurnoutNameByIndex(int x,
                                    int pTurnout)
Description copied from interface: SignalGroup
Gets the Name of the Turnout at index x, for the given Signal Head at index x

Specified by:
getTurnoutNameByIndex in interface SignalGroup
Parameters:
x - Signal Head at index x
pTurnout - Turnout at index pTurnout
Returns:
null if the turnout or signal head is invalid

getSensorStateByIndex

public int getSensorStateByIndex(int x,
                                 int pSensor)
Description copied from interface: SignalGroup
Gets the state of the Sensor for the given Signal Head at index x

Specified by:
getSensorStateByIndex in interface SignalGroup
Parameters:
x - Signal Head at index x
pSensor - Name of the Sensor within the Group
Returns:
-1 if the sensor or signal head is invalid

getSensorNameByIndex

public String getSensorNameByIndex(int x,
                                   int pSensor)
Description copied from interface: SignalGroup
Gets the state of the Sensor at index x, for the given Signal Head at index x

Specified by:
getSensorNameByIndex in interface SignalGroup
Parameters:
x - Signal Head at index x
pSensor - Sensor at index pTurnout
Returns:
null if the sensor or signal head is invalid

isSensorIncluded

public boolean isSensorIncluded(String pSignal,
                                String pSensor)
Description copied from interface: SignalGroup
Inquire if a Sensor is included in the Signal Head Calculation.

Specified by:
isSensorIncluded in interface SignalGroup
Parameters:
pSignal - Name of the Signal Head
pSensor - Name of the Sensor

getSensorState

public int getSensorState(String pSignal,
                          String pSensor)
Description copied from interface: SignalGroup
Gets the state of the Sensor for the given Signal Head in the group

Specified by:
getSensorState in interface SignalGroup
Parameters:
pSignal - Name of the Signal Head
pSensor - Name of the Sensor within the Group
Returns:
-1 if the sensor or signal head is invalid

getSensorTurnoutOper

public boolean getSensorTurnoutOper(String pSignal)
Specified by:
getSensorTurnoutOper in interface SignalGroup

getSensorTurnoutOperByIndex

public boolean getSensorTurnoutOperByIndex(int x)
Specified by:
getSensorTurnoutOperByIndex in interface SignalGroup

setSensorTurnoutOper

public void setSensorTurnoutOper(String pSignal,
                                 boolean boo)
Description copied from interface: SignalGroup
Sets whether the sensors and turnouts should be treated as seperate calculations or as one, when determining if the signal head should be on or off.

Specified by:
setSensorTurnoutOper in interface SignalGroup

clearSignalTurnout

public void clearSignalTurnout(String pSignal)
Description copied from interface: SignalGroup
Delete all Turnouts for a given SignalHead in the group

Specified by:
clearSignalTurnout in interface SignalGroup
Parameters:
pSignal - SignalHead Name

clearSignalSensor

public void clearSignalSensor(String pSignal)
Description copied from interface: SignalGroup
Delete all Sensors for a given SignalHead in the group

Specified by:
clearSignalSensor in interface SignalGroup
Parameters:
pSignal - SignalHead Name

getNumSignalHeadSensorsByIndex

public int getNumSignalHeadSensorsByIndex(int x)
Description copied from interface: SignalGroup
Method to get the number of Sensors used to determine the On state for the signalhead at index x

Specified by:
getNumSignalHeadSensorsByIndex in interface SignalGroup
Returns:
-1 if there are less than 'n' SignalHeads defined

getNumSignalHeadTurnoutsByIndex

public int getNumSignalHeadTurnoutsByIndex(int x)
Description copied from interface: SignalGroup
Method to get the number of turnouts used to determine the On state for the signalhead at index x

Specified by:
getNumSignalHeadTurnoutsByIndex in interface SignalGroup
Returns:
-1 if there are less than 'n' SignalHeads defined

getState

public int getState()
Description copied from interface: NamedBean
Provide generic access to internal state.

This generally shouldn't be used by Java code; use the class-specific form instead. (E.g. getCommandedState in Turnout) This provided to make Jython script access easier to read.

Specified by:
getState in interface NamedBean
Specified by:
getState in interface SignalGroup

setState

public void setState(int state)
Description copied from interface: NamedBean
Provide generic access to internal state.

This generally shouldn't be used by Java code; use the class-specific form instead. (E.g. setCommandedState in Turnout) This provided to make Jython script access easier to read.

Specified by:
setState in interface NamedBean
Specified by:
setState in interface SignalGroup


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