Interface SignalHead
- All Superinterfaces:
Comparable<NamedBean>
,NamedBean
,PropertyChangeProvider
,Signal
- All Known Implementing Classes:
AbstractSignalHead
,AcelaSignalHead
,DccSignalHead
,DefaultSignalHead
,DoubleTurnoutSignalHead
,LsDecSignalHead
,MergSD2SignalHead
,QuadOutputSignalHead
,SE8cSignalHead
,SE8cSignalHead
,SerialSignalHead
,SingleTurnoutSignalHead
,TripleOutputSignalHead
,TripleTurnoutSignalHead
,VirtualSignalHead
public interface SignalHead extends Signal
This allows access to explicit appearance information. We don't call this an Aspect, as that's a composite of the appearance of several heads.
This class has three bound parameters:
- Appearance
- The specific color being shown. Values are the various
color constants defined in the class.
The appearance constants form a bit mask, so they can be used with hardware that can display e.g. more than one lit color at a time. Individual implementations may not be able to handle that, however; most of the early ones probably won't. If a particular implementation can't display a commanded color, it doesn't try to replace it, but rather just leaves that color off the resulting display.
- Lit
- Whether the head's lamps are lit or left dark.
This differs from the DARK color defined for the appearance parameter, in that it's independent of that. Lit is intended to allow you to extinguish a signal head for approach lighting, while still allowing it's color to be set to a definite value for e.g. display on a panel or evaluation in higher level logic.
- Held
- Whether the head's lamps should be forced to a specific
appearance, e.g. RED in higher-level logic.
For use in signaling systems, this is a convenient way of storing whether a higher-level of control (e.g. non-vital system or dispatcher) has "held" the signal at stop. It does not effect how this signal head actually works; any appearance can be set and will be displayed even when "held" is set.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
Field Summary
Fields Modifier and Type Field Description static int
DARK
static int
FLASHGREEN
static int
FLASHLUNAR
static int
FLASHRED
static int
FLASHYELLOW
static int
GREEN
static int
HELD
static int
LUNAR
static int
RED
static int
YELLOW
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
Method Summary
Modifier and Type Method Description int
getAppearance()
Get the Signal Head Appearance.String
getAppearanceKey()
String
getAppearanceKey(int appearance)
String
getAppearanceName()
String
getAppearanceName(int appearance)
boolean
getHeld()
Get whether the signal head is held.boolean
getLit()
Get whether the signal head is lit or dark.String[]
getValidStateKeys()
Get an array of non-localized appearance keys valid for the mast type.String[]
getValidStateNames()
Get an array of localized appearance descriptions valid for the mast type.int[]
getValidStates()
Get an array of appearance indexes valid for the mast type.void
setAppearance(int newAppearance)
Set the Signal Head Appearance.void
setHeld(boolean newHeld)
void
setLit(boolean newLit)
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getFullyFormattedDisplayName, getFullyFormattedDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getState, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChange
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
DARK
- See Also:
- Constant Field Values
-
RED
- See Also:
- Constant Field Values
-
FLASHRED
- See Also:
- Constant Field Values
-
YELLOW
- See Also:
- Constant Field Values
-
FLASHYELLOW
- See Also:
- Constant Field Values
-
GREEN
- See Also:
- Constant Field Values
-
FLASHGREEN
- See Also:
- Constant Field Values
-
LUNAR
- See Also:
- Constant Field Values
-
FLASHLUNAR
- See Also:
- Constant Field Values
-
HELD
- See Also:
- Constant Field Values
-
-
Method Details
-
getAppearance
int getAppearance()Get the Signal Head Appearance. Changes in this value can be listened to using the Appearance property.- Returns:
- the appearance
-
setAppearance
Set the Signal Head Appearance.- Parameters:
newAppearance
- integer representing a valid Appearance for this head
-
getAppearanceKey
-
getAppearanceKey
-
getAppearanceName
-
getAppearanceName
-
getLit
boolean getLit()Get whether the signal head is lit or dark. Changes to this value can be listened to using the Lit property. -
setLit
-
getHeld
boolean getHeld()Get whether the signal head is held. Changes to this value can be listened to using the Held property. It controls what mechanisms can control the head's appearance. The actual semantics are defined by those external mechanisms. -
setHeld
-
getValidStates
int[] getValidStates()Get an array of appearance indexes valid for the mast type.- Returns:
- array of appearance state values available on this mast type
-
getValidStateKeys
Get an array of non-localized appearance keys valid for the mast type. For GUI application consider using (capitalized)getValidStateNames()
- Returns:
- array of translated appearance names available on this mast type
-
getValidStateNames
Get an array of localized appearance descriptions valid for the mast type. For persistance and comparison consider usinggetValidStateKeys()
- Returns:
- array of translated appearance names
-