jmri
Interface Logix

All Superinterfaces:
NamedBean
All Known Implementing Classes:
DefaultLogix

public interface Logix
extends NamedBean

A Logix is a group of Conditionals that monitor one or more conditions (internal or on the layout). It services these Conditionals by installing and deinstalling the proper listeners for their variables.

A Logix can be enabled or not. It passes this attribute to its Conditionals. By default it is enabled. When not enabled, a Conditional will still respond to callbacks from its listeners and calculate its state, however it will not execute its actions. Enabled is a bound property of a Logix.

A Logix can be deactivated or not. When deactivated, the listeners of the Conditional variables are deinstalled.

A Logix does not have a "state", however, each of its Conditionals does.


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.

Author:
Dave Duchamp Copyright (C) 2007 Additional modifications Pete Cressman 2009

Field Summary
static int LISTENER_TYPE_CONDITIONAL
           
static int LISTENER_TYPE_FASTCLOCK
           
static int LISTENER_TYPE_LIGHT
           
static int LISTENER_TYPE_MEMORY
           
static int LISTENER_TYPE_SENSOR
           
static int LISTENER_TYPE_SIGNAL
           
static int LISTENER_TYPE_TURNOUT
           
static int LISTENER_TYPE_WARRANT
           
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
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 from this Logix Note: Since each Logix must have at least one Conditional, the last Conditional will not be 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
 void setEnabled(boolean state)
          Set enabled status.
 void swapConditional(int nextInOrder, int row)
          Move 'row' to 'nextInOrder' and shift all between 'nextInOrder' and 'row' up one position
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, dispose, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getState, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setState, setUserName
 

Field Detail

LISTENER_TYPE_SENSOR

static final int LISTENER_TYPE_SENSOR
See Also:
Constant Field Values

LISTENER_TYPE_TURNOUT

static final int LISTENER_TYPE_TURNOUT
See Also:
Constant Field Values

LISTENER_TYPE_LIGHT

static final int LISTENER_TYPE_LIGHT
See Also:
Constant Field Values

LISTENER_TYPE_CONDITIONAL

static final int LISTENER_TYPE_CONDITIONAL
See Also:
Constant Field Values

LISTENER_TYPE_SIGNAL

static final int LISTENER_TYPE_SIGNAL
See Also:
Constant Field Values

LISTENER_TYPE_MEMORY

static final int LISTENER_TYPE_MEMORY
See Also:
Constant Field Values

LISTENER_TYPE_FASTCLOCK

static final int LISTENER_TYPE_FASTCLOCK
See Also:
Constant Field Values

LISTENER_TYPE_WARRANT

static final int LISTENER_TYPE_WARRANT
See Also:
Constant Field Values
Method Detail

setEnabled

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.


getEnabled

boolean getEnabled()
Get enabled status


getNumConditionals

int getNumConditionals()
Get number of Conditionals for this Logix


swapConditional

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


getConditionalByNumberOrder

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.

Parameters:
order - - order in which the Conditional calculates.

addConditional

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.

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

deleteConditional

String[] deleteConditional(String systemName)
Delete a Conditional from this Logix

Note: Since each Logix must have at least one Conditional, the last Conditional will not be deleted.

Returns An array of names used in an error message explaining why Conditional should not be deleted.

Parameters:
systemName - The Conditional system name

calculateConditionals

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


activateLogix

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.


deActivateLogix

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.



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