jmri.implementation
Class DefaultLogix

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

public class DefaultLogix
extends AbstractNamedBean
implements Logix, Serializable

Class providing the basic logic of the Logix interface.

Author:
Dave Duchamp Copyright (C) 2007, Pete Cressman Copyright (C) 2009
See Also:
Serialized Form

Field Summary
 
Fields inherited from class jmri.implementation.AbstractNamedBean
mSystemName, mUserName
 
Fields inherited from interface jmri.Logix
LISTENER_TYPE_CONDITIONAL, LISTENER_TYPE_FASTCLOCK, LISTENER_TYPE_LIGHT, LISTENER_TYPE_MEMORY, LISTENER_TYPE_OBLOCK, LISTENER_TYPE_SENSOR, LISTENER_TYPE_SIGNALHEAD, LISTENER_TYPE_SIGNALMAST, LISTENER_TYPE_TURNOUT, LISTENER_TYPE_WARRANT
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
DefaultLogix(String systemName)
           
DefaultLogix(String systemName, String userName)
           
 
Method Summary
 void activateLogix()
          Activate the Logix, starts Logix processing by connecting all inputs that are included the Conditionals in this Logix.
 boolean addConditional(String systemName, int order)
          Add a Conditional to this Logix Returns true if Conditional was successfully added, returns false if the maximum number of conditionals has been exceeded.
 void calculateConditionals()
          Calculate all Conditionals, triggering action if the user specified conditions are met, and the Logix is enabled.
 void deActivateLogix()
          Deactivate the Logix.
 String[] deleteConditional(String systemName)
          Delete a Conditional and remove it from this Logix Note: Since each Logix must have at least one Conditional to do anything, the user is warned in Logix Table Action when the last Conditional is deleted.
 String getConditionalByNumberOrder(int order)
          Returns the system name of the conditional that will calculate in the specified order.
 boolean getEnabled()
          Get enabled status
 int getNumConditionals()
          Get number of Conditionals for this Logix
 int getState()
          Not needed for Logixs - included to complete implementation of the NamedBean interface.
 void setEnabled(boolean state)
          Set enabled status.
 void setState(int state)
          Not needed for Logixs - included to complete implementation of the NamedBean interface.
 void swapConditional(int nextInOrder, int row)
          Move 'row' to 'nextInOrder' and shift all between 'row' and 'nextInOrder' up one position ( row > nextInOrder )
 
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
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef
 

Constructor Detail

DefaultLogix

public DefaultLogix(String systemName,
                    String userName)

DefaultLogix

public DefaultLogix(String systemName)
Method Detail

getNumConditionals

public int getNumConditionals()
Get number of Conditionals for this Logix

Specified by:
getNumConditionals in interface Logix

swapConditional

public void swapConditional(int nextInOrder,
                            int row)
Move 'row' to 'nextInOrder' and shift all between 'row' and 'nextInOrder' up one position ( row > nextInOrder )

Specified by:
swapConditional in interface Logix

getConditionalByNumberOrder

public String getConditionalByNumberOrder(int order)
Returns the system name of the conditional that will calculate in the specified order. This is also the order the Conditional is listed in the Add/Edit Logix dialog. If 'order' is greater than the number of Conditionals for this Logix, and empty String is returned.

Specified by:
getConditionalByNumberOrder in interface Logix
Parameters:
order - - order in which the Conditional calculates.

addConditional

public boolean addConditional(String systemName,
                              int order)
Add a Conditional to this Logix Returns true if Conditional was successfully added, returns false if the maximum number of conditionals has been exceeded.

Specified by:
addConditional in interface Logix
Parameters:
systemName - The Conditional system name
order - - the order this conditional should calculate in if order is negative, the conditional is added at the end of current group of conditionals

setEnabled

public void setEnabled(boolean state)
Set enabled status. Enabled is a bound property All conditionals are set to UNKNOWN state and recalculated when the Logix is enabled, provided the Logix has been previously activated.

Specified by:
setEnabled in interface Logix

getEnabled

public boolean getEnabled()
Get enabled status

Specified by:
getEnabled in interface Logix

deleteConditional

public String[] deleteConditional(String systemName)
Delete a Conditional and remove it from this Logix

Note: Since each Logix must have at least one Conditional to do anything, the user is warned in Logix Table Action when the last Conditional is deleted.

Returns true if Conditional was successfully deleted, otherwise returns false.

Specified by:
deleteConditional in interface Logix
Parameters:
systemName - The Conditional system name

calculateConditionals

public void calculateConditionals()
Calculate all Conditionals, triggering action if the user specified conditions are met, and the Logix is enabled.

Specified by:
calculateConditionals in interface Logix

activateLogix

public void activateLogix()
Activate the Logix, starts Logix processing by connecting all inputs that are included the Conditionals in this Logix.

A Logix must be activated before it will calculate any of its Conditionals.

Specified by:
activateLogix in interface Logix

deActivateLogix

public void deActivateLogix()
Deactivate the Logix. This method disconnects the Logix from all input objects and stops it from being triggered to calculate.

A Logix must be deactivated before it's Conditionals are changed.

Specified by:
deActivateLogix in interface Logix

getState

public int getState()
Not needed for Logixs - included to complete implementation of the NamedBean interface.

Specified by:
getState in interface NamedBean

setState

public void setState(int state)
Not needed for Logixs - included to complete implementation of the NamedBean interface.

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