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
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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final StringString constant for the appearance property.static final intstatic final intFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWNFields inherited from interface jmri.Signal
PROPERTY_HELD, PROPERTY_LIT -
Method Summary
Modifier and TypeMethodDescriptionintGet the Signal Head Appearance.Get the current Signal Head Appearance Key.getAppearanceKey(int appearance) Get the Appearance Key for a particular Appearance.Get the current appearance name.getAppearanceName(int appearance) Get the Appearance Name for a particular Appearance.booleangetHeld()Get whether the signal is held.booleangetLit()Get whether the signal is lit or dark.String[]Get an array of non-localized appearance keys valid for the mast type.String[]Get an array of localized appearance descriptions valid for the mast type.int[]Get an array of appearance indexes valid for the mast type.voidsetAppearance(int newAppearance) Set the Signal Head Appearance.voidsetHeld(boolean newHeld) voidsetLit(boolean newLit) Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getState, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.Signal
isAtStop, isCleared, isShowingRestricting
-
Field Details
-
DARK
- See Also:
-
RED
- See Also:
-
FLASHRED
- See Also:
-
YELLOW
- See Also:
-
FLASHYELLOW
- See Also:
-
GREEN
- See Also:
-
FLASHGREEN
- See Also:
-
LUNAR
- See Also:
-
FLASHLUNAR
- See Also:
-
HELD
- See Also:
-
PROPERTY_APPEARANCE
String constant for the appearance property.- See Also:
-
-
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, e.g. SignalHead.YELLOW
-
setAppearance
Set the Signal Head Appearance.- Parameters:
newAppearance- integer representing a valid Appearance for this head
-
getAppearanceKey
Get the current Signal Head Appearance Key.- Returns:
- Key, or empty String if no valid appearance set.
-
getAppearanceKey
Get the Appearance Key for a particular Appearance.- Parameters:
appearance- id for the key, e.g. SignalHead.GREEN- Returns:
- the Appearance Key, e.g. "Green" or empty String if unknown. The key can be used as a Bundle String, e.g. Bundle.getMessage(getAppearanceKey(SignalHead.RED))
-
getAppearanceName
Get the current appearance name.- Returns:
- Name of the Appearance, e.g. "Dark" or "Flashing Red"
-
getAppearanceName
Get the Appearance Name for a particular Appearance.- Parameters:
appearance- id for the Name.- Returns:
- the Appearance Name, or empty String if unknown.
-
getLit
boolean getLit()Get whether the signal is lit or dark. Changes to this value can be listened to using the Lit property. -
setLit
-
getHeld
boolean getHeld()Get whether the signal is held. Changes to this value can be listened to using the Held property. It controls what mechanisms can control the signal'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
-