001package jmri.jmrit.logixng.implementation;
002
003import java.util.List;
004import java.util.Locale;
005import java.util.Map;
006
007import jmri.InstanceManager;
008import jmri.JmriException;
009import jmri.jmrit.logixng.Base;
010import jmri.jmrit.logixng.Category;
011import jmri.jmrit.logixng.AnalogActionManager;
012import jmri.jmrit.logixng.FemaleAnalogActionSocket;
013import jmri.jmrit.logixng.FemaleSocketListener;
014import jmri.jmrit.logixng.MaleAnalogActionSocket;
015import jmri.jmrit.logixng.MaleSocket;
016
017/**
018 * Default implementation of the Female Analog Action socket
019 */
020public final class DefaultFemaleAnalogActionSocket
021        extends AbstractFemaleSocket
022        implements FemaleAnalogActionSocket {
023
024    public DefaultFemaleAnalogActionSocket(Base parent, FemaleSocketListener listener, String name) {
025        super(parent, listener, name);
026    }
027    
028    /** {@inheritDoc} */
029    @Override
030    public boolean isCompatible(MaleSocket socket) {
031        return socket instanceof MaleAnalogActionSocket;
032    }
033    
034    /** {@inheritDoc} */
035    @Override
036    public Map<Category, List<Class<? extends Base>>> getConnectableClasses() {
037        return InstanceManager.getDefault(AnalogActionManager.class).getActionClasses();
038    }
039
040    /** {@inheritDoc} */
041    @Override
042    public void setValue(double value) throws JmriException {
043        if (isConnected()) {
044            ((MaleAnalogActionSocket)getConnectedSocket()).setValue(value);
045        }
046    }
047
048    /** {@inheritDoc} */
049    @Override
050    public String getShortDescription(Locale locale) {
051        return Bundle.getMessage(locale, "DefaultFemaleAnalogActionSocket_Short");
052    }
053
054    /** {@inheritDoc} */
055    @Override
056    public String getLongDescription(Locale locale) {
057        return Bundle.getMessage(locale, "DefaultFemaleAnalogActionSocket_Long", getName());
058    }
059
060    /** {@inheritDoc} */
061    @Override
062    public void disposeMe() {
063        // Do nothing
064    }
065    
066}