001package jmri;
002
003import java.awt.event.ActionListener;
004import javax.swing.Timer;
005import jmri.jmrit.Sound;
006
007/**
008 * The consequent of the antecedent of the conditional proposition. The data for
009 * the action to be taken when a Conditional calculates to True.
010 *
011 * @author Pete Cressman Copyright (C) 2009
012 */
013public interface ConditionalAction {
014
015    /**
016     * Integer data for action.
017     *
018     * @return the data
019     */
020    int getActionData();
021
022    String getActionDataString();
023
024    /**
025     * String data for action.
026     *
027     * @return the action String
028     */
029    String getActionString();
030
031    /**
032     * Name of the device or element that is effected.
033     *
034     * @return the name
035     */
036    String getDeviceName();
037
038    /**
039     * Options on when action is taken.
040     *
041     * @return the option
042     */
043    int getOption();
044
045    /**
046     * @param type the type
047     * @return String name of the option for this consequent type
048     */
049    String getOptionString(boolean type);
050
051    /**
052     * The consequent device or element type.
053     *
054     * @return the type
055     */
056    Conditional.Action getType();
057
058    /**
059     * @return String name of this consequent type
060     */
061    String getTypeString();
062
063    /**
064     * Sets action data from user's name for it
065     *
066     * @param actionData user name
067     */
068    void setActionData(String actionData);
069
070    void setActionData(int actionData);
071
072    void setActionString(String actionString);
073
074    void setDeviceName(String deviceName);
075
076    void setOption(int option);
077
078    /**
079     * Sets type from user's name for it.
080     *
081     * @param type name of the type
082     */
083    void setType(String type);
084
085    void setType(Conditional.Action type);
086
087    public String description(boolean triggerType);
088
089    /*
090     * get timer for delays and other timed events
091     */
092    Timer getTimer();
093
094    /*
095     * set timer for delays and other timed events
096     */
097    void setTimer(Timer timer);
098
099    boolean isTimerActive();
100
101    void startTimer();
102
103    void stopTimer();
104
105    /*
106     * set listener for delays and other timed events
107     */
108    ActionListener getListener();
109
110    /*
111     * set listener for delays and other timed events
112     */
113    void setListener(ActionListener listener);
114
115    /**
116     * Get the Sound.
117     *
118     * @return the sound
119     */
120    public Sound getSound();
121
122    public NamedBeanHandle<?> getNamedBean();
123
124    public NamedBean getBean();
125
126    /**
127     * Dispose this ConditionalAction.
128     */
129    public void dispose();
130
131}