jmri.jmrix.rps
Class Engine

java.lang.Object
  extended by jmri.jmrix.rps.Engine
All Implemented Interfaces:
ReadingListener

public class Engine
extends Object
implements ReadingListener

Engine does basic computations of RPS system.

Holds all the alignment info. Receivers are indexed by their RPS receiver number in all cases.

Gets a reading from the Distributor and passes back a Measurement

Bound properties:

This class maintains a collection of "Transmitter" objects representing the RPS-equipped rolling stock (usually engines) on the layout. This is an extension to the common Roster, and every entry in this class's collection must be present in the Roster.

Author:
Bob Jacobsen Copyright (C) 2006, 2008

Field Summary
protected static Engine _instance
           
 
Constructor Summary
Engine()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener p)
           
 void dispose()
           
 String getAlgorithm()
           
 boolean getBscPollMode()
           
 boolean getDirectPollMode()
           
 int getMaxReceiverNumber()
           
 int getNumTransmitters()
           
 int getOffset()
           
 int getPolledAddress()
           
 String getPolledID()
           
 boolean getPolling()
           
 int getPollingInterval()
           
 Receiver getReceiver(int i)
           
 Point3d getReceiverPosition(int i)
           
 boolean getThrottlePollMode()
           
 Transmitter getTransmitter(int i)
           
 Transmitter getTransmitterByAddress(int addr)
           
 double getVSound()
           
static Engine instance()
           
 void loadAlignment(File file)
           
 void loadPollConfig(File file)
           
 void notify(Reading r)
           
 void removePropertyChangeListener(PropertyChangeListener p)
           
 void setAlgorithm(String algorithm)
           
 void setBscPollMode()
           
protected  void setDefaultAlignment()
           
 void setDirectPollMode()
           
protected  void setInitialAlignment()
           
 void setMaxReceiverNumber(int n)
          Set the maximum receiver number expected.
 void setOffset(int offset)
           
 void setPolling(boolean polling)
           
 void setPollingInterval(int pollingInterval)
           
 void setReceiver(int address, Receiver receiver)
          Get a particular reciever by address (starting at 1)
 void setReceiverPosition(int i, Point3d p)
           
 void setThrottlePollMode()
           
 void setVSound(double v)
           
 void storeAlignment(File file)
           
 void storePollConfig(File file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_instance

protected static volatile Engine _instance
Constructor Detail

Engine

public Engine()
Method Detail

dispose

public void dispose()

setVSound

public void setVSound(double v)

getVSound

public double getVSound()

setOffset

public void setOffset(int offset)

getOffset

public int getOffset()

setMaxReceiverNumber

public void setMaxReceiverNumber(int n)
Set the maximum receiver number expected. If the highest value in the hardware is 5, that's what's needed here.


getMaxReceiverNumber

public int getMaxReceiverNumber()

setReceiver

public void setReceiver(int address,
                        Receiver receiver)
Get a particular reciever by address (starting at 1)


getReceiver

public Receiver getReceiver(int i)

setReceiverPosition

public void setReceiverPosition(int i,
                                Point3d p)

getReceiverPosition

public Point3d getReceiverPosition(int i)

setAlgorithm

public void setAlgorithm(String algorithm)

getAlgorithm

public String getAlgorithm()

notify

public void notify(Reading r)
Specified by:
notify in interface ReadingListener

storeAlignment

public void storeAlignment(File file)
                    throws IOException
Throws:
IOException

loadAlignment

public void loadAlignment(File file)
                   throws JDOMException,
                          IOException
Throws:
JDOMException
IOException

setInitialAlignment

protected void setInitialAlignment()

setDefaultAlignment

protected void setDefaultAlignment()

setPollingInterval

public void setPollingInterval(int pollingInterval)

getPollingInterval

public int getPollingInterval()

setPolling

public void setPolling(boolean polling)

getPolling

public boolean getPolling()

storePollConfig

public void storePollConfig(File file)
                     throws IOException
Throws:
IOException

loadPollConfig

public void loadPollConfig(File file)
                    throws JDOMException,
                           IOException
Throws:
JDOMException
IOException

getTransmitterByAddress

public Transmitter getTransmitterByAddress(int addr)

getTransmitter

public Transmitter getTransmitter(int i)

getNumTransmitters

public int getNumTransmitters()

getPolledID

public String getPolledID()

getPolledAddress

public int getPolledAddress()

setBscPollMode

public void setBscPollMode()

setDirectPollMode

public void setDirectPollMode()

setThrottlePollMode

public void setThrottlePollMode()

getBscPollMode

public boolean getBscPollMode()

getThrottlePollMode

public boolean getThrottlePollMode()

getDirectPollMode

public boolean getDirectPollMode()

instance

public static Engine instance()

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener p)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener p)


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