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) and take action when these conditionals change in a user specified way.

A Logix can be enabled or not. By default it is enabled and will act when one or more of its Conditionals changes in a user specified way. When not enabled, the Logix will not trigger actions when its Conditionals change. Enabled is a bound property of a Logix.

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

Field Summary
static int LISTENER_TYPE_CONDITIONAL
           
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 MAX_CONDITIONALS
           
static int MAX_LISTENERS
           
 
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.
 boolean checkLoopCondition()
          Assembles a list of state variables that both trigger the Logix, and are changed by it.
 void deActivateLogix()
          Deactivate the Logix.
 boolean 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
 String getLoopGremlins()
          Assembles a string listing state variables that might result in a loop.
 int getNextConditionalNumber()
          Get never used number for next Conditional system name
 int getNumConditionals()
          Get number of Conditionals for this Logix
 int getStateVariableList(String[] varName, int[] varListenerType, String[] varListenerProperty, int[] varAppearance, int[] numTriggersCalc, int[] numTriggerSuppressed, int arrayMax)
          Assembles and returns a list of state variables that are used by conditionals of this Logix including the number of occurances of each variable that trigger a calculation, and the number of occurances where the triggering has been suppressed.
 void initializeReorder()
          Initialize for reordering Conditionals
 boolean nextConditionalInOrder(int oldOrder)
          Make the Conditional with given current order, the next in order Returns 'true' if reordering is done, returns 'false' if continue
 void setEnabled(boolean state)
          Set enabled status.
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, dispose, getComment, getNumPropertyChangeListeners, getState, getSystemName, getUserName, removePropertyChangeListener, setComment, setState, setUserName
 

Field Detail

MAX_CONDITIONALS

static final int MAX_CONDITIONALS
See Also:
Constant Field Values

MAX_LISTENERS

static final int MAX_LISTENERS
See Also:
Constant Field Values

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
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


initializeReorder

void initializeReorder()
Initialize for reordering Conditionals


nextConditionalInOrder

boolean nextConditionalInOrder(int oldOrder)
Make the Conditional with given current order, the next in order Returns 'true' if reordering is done, returns 'false' if continue


getNextConditionalNumber

int getNextConditionalNumber()
Get never used number for next Conditional system name


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

boolean 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 true if Conditional was successfully deleted, otherwise returns false.

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.


checkLoopCondition

boolean checkLoopCondition()
Assembles a list of state variables that both trigger the Logix, and are changed by it. Returns true if any such variables were found. Returns false otherwise.


getLoopGremlins

String getLoopGremlins()
Assembles a string listing state variables that might result in a loop. Returns an empty string if there are none, probably because "checkLoopCondition" was not invoked before the call, or returned false.


getStateVariableList

int getStateVariableList(String[] varName,
                         int[] varListenerType,
                         String[] varListenerProperty,
                         int[] varAppearance,
                         int[] numTriggersCalc,
                         int[] numTriggerSuppressed,
                         int arrayMax)
Assembles and returns a list of state variables that are used by conditionals of this Logix including the number of occurances of each variable that trigger a calculation, and the number of occurances where the triggering has been suppressed. The main use of this method is to return information that can be used to test for inconsistency in suppressing triggering of a calculation among multiple occurances of the same state variable. Note that FastClockRange state varible type is not returned, since each occurance is considered a unique state variable - there is no duplication possible. Returns the number of state variables returned. Note that 'arrayMax' is the dimension of the arrays passed in the call. If more state variables are found than 'arrayMax', the overflow is skipped.



Copyright © 1997 - 2008 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: SourceForge_Logo