jmri.implementation
Class DefaultConditionalAction

java.lang.Object
  extended by jmri.implementation.DefaultConditionalAction
All Implemented Interfaces:
ConditionalAction

public class DefaultConditionalAction
extends Object
implements ConditionalAction

ConditionalAction.java The consequent of the antecedent of the conditional proposition. The data for the action to be taken when a Conditional calculates to True

This is in the implementations package because of a Swing dependence via the times. Java 1.5 or Java 1.6 might make it possible to break that, which will simplify things.

Author:
Pete Cressman Copyright (C) 2009, 2010, 2011, Matthew Harris copyright (c) 2009

Field Summary
protected  NamedBeanHandleManager nbhm
           
 
Constructor Summary
DefaultConditionalAction()
           
DefaultConditionalAction(int option, int type, String name, int actionData, String actionStr)
           
 
Method Summary
 String description(boolean triggerType)
           
 int getActionData()
          Integer data for action
 String getActionDataString()
           
static String getActionDataString(int t, int data)
           
 String getActionString()
          String data for action
static String getActionTypeString(int t)
          Convert Consequent Type to Text String
 NamedBean getBean()
           
 String getDeviceName()
          Name of the device or element that is effected
static String getItemTypeString(int t)
          Convert Variable Type to Text String
 ActionListener getListener()
           
 NamedBeanHandle<?> getNamedBean()
           
 int getOption()
          Options on when action is taken
 String getOptionString(boolean type)
          return String name of the option for this consequent type
static String getOptionString(int opt, boolean type)
          Convert consequent option to String
 Sound getSound()
          get Sound file
 Timer getTimer()
           
 int getType()
          The consequent device or element type
 String getTypeString()
          return String name of this consequent type
 boolean isTimerActive()
           
 void setActionData(int actionData)
           
 void setActionData(String actionData)
          Sets action data from user's name for it
 void setActionString(String actionString)
           
 void setDeviceName(String deviceName)
           
 void setListener(ActionListener listener)
           
 void setOption(int option)
           
protected  void setSound(Sound sound)
          set Sound file
 void setTimer(Timer timer)
           
 void setType(int type)
           
 void setType(String type)
          Sets type from user's name for it
 void startTimer()
           
 void stopTimer()
           
static int stringToActionData(String str)
          Identifies action Data from Text String Note: if string does not correspond to an action Data as defined in ConditionalAction, returns -1.
static int stringToActionType(String str)
          Identifies action Type from Text String Note: if string does not correspond to an action type as defined in ConditionalAction, returns 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nbhm

protected NamedBeanHandleManager nbhm
Constructor Detail

DefaultConditionalAction

public DefaultConditionalAction()

DefaultConditionalAction

public DefaultConditionalAction(int option,
                                int type,
                                String name,
                                int actionData,
                                String actionStr)
Method Detail

getType

public int getType()
The consequent device or element type

Specified by:
getType in interface ConditionalAction

setType

public void setType(int type)
Specified by:
setType in interface ConditionalAction

setType

public void setType(String type)
Sets type from user's name for it

Specified by:
setType in interface ConditionalAction

getDeviceName

public String getDeviceName()
Name of the device or element that is effected

Specified by:
getDeviceName in interface ConditionalAction

setDeviceName

public void setDeviceName(String deviceName)
Specified by:
setDeviceName in interface ConditionalAction

getNamedBean

public NamedBeanHandle<?> getNamedBean()
Specified by:
getNamedBean in interface ConditionalAction

getBean

public NamedBean getBean()

getOption

public int getOption()
Options on when action is taken

Specified by:
getOption in interface ConditionalAction

setOption

public void setOption(int option)
Specified by:
setOption in interface ConditionalAction

getActionData

public int getActionData()
Integer data for action

Specified by:
getActionData in interface ConditionalAction

setActionData

public void setActionData(int actionData)
Specified by:
setActionData in interface ConditionalAction

setActionData

public void setActionData(String actionData)
Sets action data from user's name for it

Specified by:
setActionData in interface ConditionalAction

getActionString

public String getActionString()
String data for action

Specified by:
getActionString in interface ConditionalAction

setActionString

public void setActionString(String actionString)
Specified by:
setActionString in interface ConditionalAction

getTimer

public Timer getTimer()
Specified by:
getTimer in interface ConditionalAction

setTimer

public void setTimer(Timer timer)
Specified by:
setTimer in interface ConditionalAction

isTimerActive

public boolean isTimerActive()
Specified by:
isTimerActive in interface ConditionalAction

startTimer

public void startTimer()
Specified by:
startTimer in interface ConditionalAction

stopTimer

public void stopTimer()
Specified by:
stopTimer in interface ConditionalAction

getListener

public ActionListener getListener()
Specified by:
getListener in interface ConditionalAction

setListener

public void setListener(ActionListener listener)
Specified by:
setListener in interface ConditionalAction

getSound

public Sound getSound()
get Sound file

Specified by:
getSound in interface ConditionalAction

setSound

protected void setSound(Sound sound)
set Sound file


getTypeString

public String getTypeString()
return String name of this consequent type

Specified by:
getTypeString in interface ConditionalAction

getOptionString

public String getOptionString(boolean type)
return String name of the option for this consequent type

Specified by:
getOptionString in interface ConditionalAction

getActionDataString

public String getActionDataString()
Specified by:
getActionDataString in interface ConditionalAction

getItemTypeString

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


getActionTypeString

public static String getActionTypeString(int t)
Convert Consequent Type to Text String


getOptionString

public static String getOptionString(int opt,
                                     boolean type)
Convert consequent option to String


stringToActionType

public static int stringToActionType(String str)
Identifies action Type from Text String Note: if string does not correspond to an action type as defined in ConditionalAction, returns 0.


stringToActionData

public static int stringToActionData(String str)
Identifies action Data from Text String Note: if string does not correspond to an action Data as defined in ConditionalAction, returns -1.


getActionDataString

public static String getActionDataString(int t,
                                         int data)

description

public String description(boolean triggerType)
Specified by:
description in interface ConditionalAction


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