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.DigitalActionManager;
012import jmri.jmrit.logixng.FemaleSocketListener;
013import jmri.jmrit.logixng.MaleSocket;
014import jmri.jmrit.logixng.FemaleDigitalActionSocket;
015import jmri.jmrit.logixng.MaleDigitalActionSocket;
016
017/**
018 * Default implementation of the Female Digital Action socket
019 */
020public class DefaultFemaleDigitalActionSocket
021        extends AbstractFemaleSocket
022        implements FemaleDigitalActionSocket {
023
024
025    public DefaultFemaleDigitalActionSocket(Base parent, FemaleSocketListener listener, String name) {
026        super(parent, listener, name);
027    }
028    
029    @Override
030    public boolean isCompatible(MaleSocket socket) {
031        return socket instanceof MaleDigitalActionSocket;
032    }
033    
034    @Override
035    public void execute() throws JmriException {
036        if (isConnected()) {
037            ((MaleDigitalActionSocket)getConnectedSocket()).execute();
038        }
039    }
040
041    @Override
042    public String getShortDescription(Locale locale) {
043        return Bundle.getMessage(locale, "DefaultFemaleDigitalActionSocket_Short");
044    }
045
046    @Override
047    public String getLongDescription(Locale locale) {
048        return Bundle.getMessage(locale, "DefaultFemaleDigitalActionSocket_Long", getName());
049    }
050
051    @Override
052    public Map<Category, List<Class<? extends Base>>> getConnectableClasses() {
053        return InstanceManager.getDefault(DigitalActionManager.class).getActionClasses();
054    }
055
056    /** {@inheritDoc} */
057    @Override
058    public void disposeMe() {
059        // Do nothing
060    }
061
062}