jmri.implementation
Class DefaultSignalAppearanceMap

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

public class DefaultSignalAppearanceMap
extends AbstractNamedBean
implements SignalAppearanceMap

Default implementation of a basic signal head table.

The default contents are taken from the NamedBeanBundle properties file. This makes creation a little more heavy-weight, but speeds operation.

Author:
Bob Jacobsen Copyright (C) 2009
See Also:
Serialized Form

Field Summary
protected  Hashtable<String,Hashtable<String,String>> aspectAttributeMap
           
protected  Hashtable<String,Hashtable<String,String>> aspectImageMap
           
protected  Hashtable<String,String[]> aspectRelationshipMap
           
static int NUMSPECIFIC
           
protected  Hashtable<Integer,String> specificMaps
           
protected  SignalSystem systemDefn
           
protected  Hashtable<String,int[]> table
           
 
Fields inherited from class jmri.implementation.AbstractNamedBean
mSystemName, mUserName
 
Fields inherited from interface jmri.SignalAppearanceMap
DANGER, DARK, HELD, PERMISSIVE
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
DefaultSignalAppearanceMap(String systemName)
           
DefaultSignalAppearanceMap(String systemName, String userName)
           
 
Method Summary
 void addAspect(String aspect, int[] appearances)
           
 boolean checkAspect(String aspect)
          Check if an aspect can be displayed by this particular Map
 Enumeration<String> getAspects()
          Get all available aspect names
 String getImageLink(String aspect, String type)
          Get an Image Link associated with a specific aspect and type
 Vector<String> getImageTypes(String aspect)
          Return a list of valid icon sets
static DefaultSignalAppearanceMap getMap(String signalSystemName, String aspectMapName)
           
 String getProperty(String aspect, String key)
          Get a property associated with a specific aspect
 SignalSystem getSignalSystem()
          Get the associated signal system and the common information it contains
 String getSpecificAppearance(int appearance)
          Return an aspect for a specific appearance
 int getState()
          Provide generic access to internal state.
 String[] getValidAspectsForAdvancedAspect(String advancedAspect)
          Returns a list of postential aspects that we could set the signalmast to given the state of the advanced signal mast.
 void loadDefaults()
           
 void setAppearances(String aspect, List<NamedBeanHandle<SignalHead>> heads)
          Set the associated SignalHeads to the appropriate appearance for a specified aspect.
 void setSignalSystem(SignalSystem t)
           
 void setState(int s)
          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
 

Field Detail

NUMSPECIFIC

public static final int NUMSPECIFIC
See Also:
Constant Field Values

aspectAttributeMap

protected Hashtable<String,Hashtable<String,String>> aspectAttributeMap

aspectImageMap

protected Hashtable<String,Hashtable<String,String>> aspectImageMap

specificMaps

protected Hashtable<Integer,String> specificMaps

aspectRelationshipMap

protected Hashtable<String,String[]> aspectRelationshipMap

systemDefn

protected SignalSystem systemDefn

table

protected Hashtable<String,int[]> table
Constructor Detail

DefaultSignalAppearanceMap

public DefaultSignalAppearanceMap(String systemName,
                                  String userName)

DefaultSignalAppearanceMap

public DefaultSignalAppearanceMap(String systemName)
Method Detail

getMap

public static DefaultSignalAppearanceMap getMap(String signalSystemName,
                                                String aspectMapName)

getProperty

public String getProperty(String aspect,
                          String key)
Get a property associated with a specific aspect

Specified by:
getProperty in interface SignalAppearanceMap

getImageLink

public String getImageLink(String aspect,
                           String type)
Description copied from interface: SignalAppearanceMap
Get an Image Link associated with a specific aspect and type

Specified by:
getImageLink in interface SignalAppearanceMap

getImageTypes

public Vector<String> getImageTypes(String aspect)
Description copied from interface: SignalAppearanceMap
Return a list of valid icon sets

Specified by:
getImageTypes in interface SignalAppearanceMap

loadDefaults

public void loadDefaults()

setAppearances

public void setAppearances(String aspect,
                           List<NamedBeanHandle<SignalHead>> heads)
Description copied from interface: SignalAppearanceMap
Set the associated SignalHeads to the appropriate appearance for a specified aspect.

Does not change state of map, just of the SignalHeads in the list.

Specified by:
setAppearances in interface SignalAppearanceMap

checkAspect

public boolean checkAspect(String aspect)
Description copied from interface: SignalAppearanceMap
Check if an aspect can be displayed by this particular Map

Specified by:
checkAspect in interface SignalAppearanceMap

addAspect

public void addAspect(String aspect,
                      int[] appearances)

getAspects

public Enumeration<String> getAspects()
Description copied from interface: SignalAppearanceMap
Get all available aspect names

Specified by:
getAspects in interface SignalAppearanceMap

getSpecificAppearance

public String getSpecificAppearance(int appearance)
Description copied from interface: SignalAppearanceMap
Return an aspect for a specific appearance

Specified by:
getSpecificAppearance in interface SignalAppearanceMap

getValidAspectsForAdvancedAspect

public String[] getValidAspectsForAdvancedAspect(String advancedAspect)
Returns a list of postential aspects that we could set the signalmast to given the state of the advanced signal mast.

Specified by:
getValidAspectsForAdvancedAspect in interface SignalAppearanceMap

getSignalSystem

public SignalSystem getSignalSystem()
Description copied from interface: SignalAppearanceMap
Get the associated signal system and the common information it contains

Specified by:
getSignalSystem in interface SignalAppearanceMap

setSignalSystem

public void setSignalSystem(SignalSystem t)

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

setState

public void setState(int s)
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


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