001package jmri.jmrit.logixng;
002
003import jmri.JmriException;
004
005/**
006 * Analog expression is used in LogixNG to answer a question that can give
007 * an analog value as result.
008 * 
009 * @author Daniel Bergqvist Copyright 2018
010 */
011public interface AnalogExpression extends Base {
012    
013    /**
014     * Evaluate this expression.
015     * 
016     * @return the result of the evaluation. The male socket that holds this
017     * expression throws an exception if this value is a Double.NaN or an
018     * infinite number.
019     * 
020     * @throws jmri.JmriException when an exception occurs
021     */
022    double evaluate() throws JmriException;
023    
024    /**
025     * Set whenether this expression should trigger the ConditionalNG if the
026     * named beans it listens to changes state.
027     * @param triggerOnChange true if trigger on change, false otherwise
028     */
029    void setTriggerOnChange(boolean triggerOnChange);
030    
031    /**
032     * Get whenether this expression should trigger the ConditionalNG if the
033     * named beans it listens to changes state.
034     * @return true if trigger on change, false otherwise
035     */
036    boolean getTriggerOnChange();
037    
038}