jmri.jmrix.loconet
Class AspectGenerator

java.lang.Object
  extended by jmri.jmrix.loconet.AspectGenerator
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class AspectGenerator
extends Object
implements PropertyChangeListener

Test implementation of AspectGenerator, ala 1/8 of an SE8.

An AspectGenerator drives specific Aspects to SignalHead objects. The SignalHead objects represent individual signals either on a screen or physical items on the layout.

Note that this class is tightly bound to both the SecurityElement class and a specific SecurityElement object. More thought needs to be given to whether this is the same object, a related one (e.g. common config), or completely separate. This matter for both state and configuration!

At runtime, we reference everything through a SecurityElement referece, at least for now. Eventually, we can listen to messages to decouple this.

Head 0 guards entering the A leg, head 1 guards the B legt, head 2 guards the C leg, head 3 is the 2nd head on the A leg

Simple hard-coded aspect chart: Green is 55MPH and up Flashing yellow is 35 and up Yellow is 15 and up Red is less than 15

The SignalHead are created here if they don't already exist, because instantiating the AspectGenerator is actually creating the connection to the device on the layout. We assume the SE8cSignalHead implementation.

The algorithms in this class are a collaborative effort of Digitrax, Inc and Bob Jacobsen. Some of the message formats are copyright Digitrax, Inc.

Author:
Bob Jacobsen Copyright (C) 2002

Constructor Summary
  AspectGenerator(int se)
           
protected AspectGenerator(SecurityElement pElement)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
protected  void firePropertyChange(String p, Object old, Object n)
           
 int getHeadState(int num)
          Access the state of a specific head
 int getNumHeads()
           
 String getSEName()
           
 void propertyChange(PropertyChangeEvent e)
          The associated SecurityElement has changed state, so update our signal heads
 void removePropertyChangeListener(PropertyChangeListener l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectGenerator

protected AspectGenerator(SecurityElement pElement)

AspectGenerator

public AspectGenerator(int se)
Method Detail

getHeadState

public int getHeadState(int num)
Access the state of a specific head

Parameters:
num - Head number 0 -> getNumHeads()-1
Returns:
A SignalHead-defined constant

getSEName

public String getSEName()

getNumHeads

public int getNumHeads()

propertyChange

public void propertyChange(PropertyChangeEvent e)
The associated SecurityElement has changed state, so update our signal heads

Specified by:
propertyChange in interface PropertyChangeListener

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

firePropertyChange

protected void firePropertyChange(String p,
                                  Object old,
                                  Object n)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)


Copyright © 1997 - 2009 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