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.*; 010 011/** 012 * Default implementation of the Female Analog Expression socket 013 */ 014public class DefaultFemaleAnalogExpressionSocket extends AbstractFemaleSocket 015 implements FemaleAnalogExpressionSocket { 016 017 018 public DefaultFemaleAnalogExpressionSocket(Base parent, FemaleSocketListener listener, String name) { 019 super(parent, listener, name); 020 } 021 022 /** {@inheritDoc} */ 023 @Override 024 public boolean isCompatible(MaleSocket socket) { 025 return socket instanceof MaleAnalogExpressionSocket; 026 } 027 028 /** {@inheritDoc} */ 029 @Override 030 public double evaluate() throws JmriException { 031 if (isConnected()) { 032 return ((MaleAnalogExpressionSocket)getConnectedSocket()).evaluate(); 033 } else { 034 return 0.0; 035 } 036 } 037 038 /** {@inheritDoc} */ 039 @Override 040 public boolean getTriggerOnChange() { 041 throw new UnsupportedOperationException("Not supported"); 042 } 043 044 /** {@inheritDoc} */ 045 @Override 046 public void setTriggerOnChange(boolean triggerOnChange) { 047 throw new UnsupportedOperationException("Not supported"); 048 } 049 050 /** {@inheritDoc} */ 051 @Override 052 public String getShortDescription(Locale locale) { 053 return Bundle.getMessage(locale, "DefaultFemaleAnalogExpressionSocket_Short"); 054 } 055 056 /** {@inheritDoc} */ 057 @Override 058 public String getLongDescription(Locale locale) { 059 return Bundle.getMessage(locale, "DefaultFemaleAnalogExpressionSocket_Long", getName()); 060 } 061 062 /** {@inheritDoc} */ 063 @Override 064 public Map<Category, List<Class<? extends Base>>> getConnectableClasses() { 065 return InstanceManager.getDefault(AnalogExpressionManager.class).getExpressionClasses(); 066 } 067 068 /** {@inheritDoc} */ 069 @Override 070 public void disposeMe() { 071 // Do nothing 072 } 073 074}