001package jmri.jmrit.logixng.tools.debugger;
002
003import java.util.Set;
004
005import jmri.JmriException;
006import jmri.NamedBean;
007import jmri.jmrit.logixng.BaseManager;
008import jmri.jmrit.logixng.MaleDigitalExpressionSocket;
009
010/**
011 *
012 * @author daniel
013 */
014public class DebuggerMaleDigitalExpressionSocket extends AbstractDebuggerMaleSocket implements MaleDigitalExpressionSocket {
015    
016    private boolean _lastResult;
017    
018    public DebuggerMaleDigitalExpressionSocket(BaseManager<MaleDigitalExpressionSocket> manager, MaleDigitalExpressionSocket maleSocket) {
019        super(manager, maleSocket);
020    }
021
022    /** {@inheritDoc} */
023    @Override
024    public void notifyChangedResult(boolean oldResult, boolean newResult) {
025        ((MaleDigitalExpressionSocket)getObject()).notifyChangedResult(oldResult, newResult);
026    }
027
028    /** {@inheritDoc} */
029    @Override
030    public String getBeforeInfo() {
031        return Bundle.getMessage("AnalogExpression_InfoBefore");
032    }
033    
034    /** {@inheritDoc} */
035    @Override
036    public String getAfterInfo() {
037        return Bundle.getMessage("AnalogExpression_InfoAfter", _lastResult ? Bundle.getMessage("True") : Bundle.getMessage("False"));
038    }
039    
040    @Override
041    public boolean evaluate() throws JmriException {
042        before();
043        _lastResult = ((MaleDigitalExpressionSocket)getObject()).evaluate();
044        after();
045        return _lastResult;
046    }
047
048    @Override
049    public boolean getLastResult() {
050        return ((MaleDigitalExpressionSocket)getObject()).getLastResult();
051    }
052
053    @Override
054    public void setState(int s) throws JmriException {
055        ((MaleDigitalExpressionSocket)getObject()).setState(s);
056    }
057
058    @Override
059    public int getState() {
060        return ((MaleDigitalExpressionSocket)getObject()).getState();
061    }
062
063    @Override
064    public String describeState(int state) {
065        return ((MaleDigitalExpressionSocket)getObject()).describeState(state);
066    }
067
068    @Override
069    public void setProperty(String key, Object value) {
070        ((MaleDigitalExpressionSocket)getObject()).setProperty(key, value);
071    }
072
073    @Override
074    public Object getProperty(String key) {
075        return ((MaleDigitalExpressionSocket)getObject()).getProperty(key);
076    }
077
078    @Override
079    public void removeProperty(String key) {
080        ((MaleDigitalExpressionSocket)getObject()).removeProperty(key);
081    }
082
083    @Override
084    public Set<String> getPropertyKeys() {
085        return ((MaleDigitalExpressionSocket)getObject()).getPropertyKeys();
086    }
087
088    @Override
089    public String getBeanType() {
090        return ((MaleDigitalExpressionSocket)getObject()).getBeanType();
091    }
092
093    @Override
094    public int compareSystemNameSuffix(String suffix1, String suffix2, NamedBean n2) {
095        return ((MaleDigitalExpressionSocket)getObject()).compareSystemNameSuffix(suffix1, suffix2, n2);
096    }
097
098}