Interface SignalHead
-
- All Superinterfaces:
java.lang.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
Represent a single signal head. (Try saying that ten times fast!) A signal may have more than one of these (e.g. a signal mast consisting of several heads) when needed to represent more complex aspects, e.g. Diverging Approach etc.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getAppearance()
Get the Signal Head Appearance.java.lang.String
getAppearanceKey()
Get the current Signal Head Appearance Key.java.lang.String
getAppearanceKey(int appearance)
Get the Appearance Key for a particular Appearance.java.lang.String
getAppearanceName()
Get the current appearance name.java.lang.String
getAppearanceName(int appearance)
Get the Appearance Name for a particular Appearance.boolean
getHeld()
Get whether the signal is held.boolean
getLit()
Get whether the signal is lit or dark.java.lang.String[]
getValidStateKeys()
Get an array of non-localized appearance keys valid for the mast type.java.lang.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, 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
-
Methods inherited from interface jmri.Signal
isAtStop, isCleared, isShowingRestricting
-
-
-
-
Field Detail
-
DARK
static final int DARK
- See Also:
- Constant Field Values
-
RED
static final int RED
- See Also:
- Constant Field Values
-
FLASHRED
static final int FLASHRED
- See Also:
- Constant Field Values
-
YELLOW
static final int YELLOW
- See Also:
- Constant Field Values
-
FLASHYELLOW
static final int FLASHYELLOW
- See Also:
- Constant Field Values
-
GREEN
static final int GREEN
- See Also:
- Constant Field Values
-
FLASHGREEN
static final int FLASHGREEN
- See Also:
- Constant Field Values
-
LUNAR
static final int LUNAR
- See Also:
- Constant Field Values
-
FLASHLUNAR
static final int FLASHLUNAR
- See Also:
- Constant Field Values
-
HELD
static final int HELD
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
void setAppearance(int newAppearance)
Set the Signal Head Appearance.- Parameters:
newAppearance
- integer representing a valid Appearance for this head
-
getAppearanceKey
@Nonnull java.lang.String getAppearanceKey()
Get the current Signal Head Appearance Key.- Returns:
- Key, or empty String if no valid appearance set.
-
getAppearanceKey
@Nonnull java.lang.String getAppearanceKey(int appearance)
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
@Nonnull java.lang.String getAppearanceName()
Get the current appearance name.- Returns:
- Name of the Appearance, e.g. "Dark" or "Flashing Red"
-
getAppearanceName
@Nonnull java.lang.String getAppearanceName(int appearance)
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.
-
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.
-
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
java.lang.String[] 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
java.lang.String[] 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
-
-