jmri
Class ConditionalVariable

java.lang.Object
  extended by jmri.ConditionalVariable

public class ConditionalVariable
extends Object

ConditionalVariable.java The variable used in the antecedent (the 'if' part) of the Conditional. proposition. The states of ConditionalVariables and logic expression of the antecedent determine the state of the Conditional.

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:
Pete Cressman Copyright (C) 2009

Field Summary
static int EQUAL
           
static int GREATER_THAN
           
static int GREATER_THAN_OR_EQUAL
           
static int LESS_THAN
           
static int LESS_THAN_OR_EQUAL
           
static int NUM_COMPARE_OPERATIONS
           
 
Constructor Summary
ConditionalVariable()
           
ConditionalVariable(boolean not, int opern, int type, String name, boolean trigger)
           
 
Method Summary
 boolean doTriggerActions()
          If change of state of this object causes a change of state of the Conditional, should any actions be executed.
 boolean evaluate()
          Evaluates this State Variable Returns true if variable evaluates true, otherwise false.
static String getCompareOperationString(int index)
           
static String getCompareSymbols(int index)
           
 String getDataString()
           
static String getItemTypeString(int t)
          Convert Variable Type to Text String
 String getName()
           
 int getNum1()
           
 int getNum2()
           
 int getOpern()
           
 String getOpernString()
           
 int getState()
           
static String getStateString(int t)
          get state name from Variable Test Type
 String getTestTypeString()
           
static String getTestTypeString(int t)
          Convert Variable Test Type to Text String
 int getType()
           
 boolean isNegated()
           
 void setDataString(String data)
           
 void setName(String name)
           
 void setNegation(boolean not)
           
 void setNum1(int num)
           
 void setNum2(int num)
           
 void setOpern(int opern)
           
 void setState(boolean state)
           
 void setState(int state)
           
 void setTriggerActions(boolean trigger)
           
 void setType(int type)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NUM_COMPARE_OPERATIONS

public static final int NUM_COMPARE_OPERATIONS
See Also:
Constant Field Values

LESS_THAN

public static final int LESS_THAN
See Also:
Constant Field Values

LESS_THAN_OR_EQUAL

public static final int LESS_THAN_OR_EQUAL
See Also:
Constant Field Values

EQUAL

public static final int EQUAL
See Also:
Constant Field Values

GREATER_THAN_OR_EQUAL

public static final int GREATER_THAN_OR_EQUAL
See Also:
Constant Field Values

GREATER_THAN

public static final int GREATER_THAN
See Also:
Constant Field Values
Constructor Detail

ConditionalVariable

public ConditionalVariable()

ConditionalVariable

public ConditionalVariable(boolean not,
                           int opern,
                           int type,
                           String name,
                           boolean trigger)
Method Detail

isNegated

public boolean isNegated()

setNegation

public void setNegation(boolean not)

getOpern

public int getOpern()

setOpern

public void setOpern(int opern)

getType

public int getType()

setType

public void setType(int type)

getName

public String getName()

setName

public void setName(String name)

getDataString

public String getDataString()

setDataString

public void setDataString(String data)

getNum1

public int getNum1()

setNum1

public void setNum1(int num)

getNum2

public int getNum2()

setNum2

public void setNum2(int num)

doTriggerActions

public boolean doTriggerActions()
If change of state of this object causes a change of state of the Conditional, should any actions be executed.


setTriggerActions

public void setTriggerActions(boolean trigger)

getState

public int getState()

setState

public void setState(int state)

setState

public void setState(boolean state)

getTestTypeString

public String getTestTypeString()

getOpernString

public String getOpernString()

evaluate

public boolean evaluate()
Evaluates this State Variable

Returns true if variable evaluates true, otherwise false.


getItemTypeString

public static String getItemTypeString(int t)
Convert Variable Type to Text String


getStateString

public static String getStateString(int t)
get state name from Variable Test Type


getTestTypeString

public static String getTestTypeString(int t)
Convert Variable Test Type to Text String


getCompareOperationString

public static String getCompareOperationString(int index)

getCompareSymbols

public static String getCompareSymbols(int index)

toString

public String toString()
Overrides:
toString in class Object


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