001package jmri.jmrit.logixng; 002 003import javax.annotation.CheckForNull; 004 005import jmri.JmriException; 006 007/** 008 * A generic female socket 009 */ 010public interface FemaleGenericExpressionSocket 011 extends FemaleSocket { 012 013 enum SocketType { 014 DIGITAL("SocketTypeDigital"), 015 ANALOG("SocketTypeAnalog"), 016 STRING("SocketTypeString"), 017 GENERIC("SocketTypeGeneric"); 018 019 private final String _bundleName; 020 021 private SocketType(String bundleName) { 022 _bundleName = bundleName; 023 } 024 025 @Override 026 public String toString() { 027 return Bundle.getMessage(_bundleName); 028 } 029 030 } 031 032 /** 033 * Get the current active socket. 034 * @return the currently active socket or null if no socket is active 035 */ 036 FemaleSocket getCurrentActiveSocket(); 037 038 /** 039 * Set the type of the socket. 040 * 041 * @param socketType the type of socket. 042 * @throws SocketAlreadyConnectedException if the socket is already 043 * connected and if the new type doesn't match the currently connected 044 * socket. 045 */ 046 void setSocketType(SocketType socketType) 047 throws SocketAlreadyConnectedException; 048 049 /** 050 * Get the type of the socket. 051 * 052 * @return the type of socket 053 */ 054 SocketType getSocketType(); 055 056 /** 057 * Evaluate this expression. 058 * <P> 059 * This method validates the expression without doing any convertation of 060 * the return value. 061 * <P> 062 * The parameter isCompleted is used if the expression should be evaluated 063 * more than once. For example, the Count expression is not completed until 064 * its child expression has been true and false a number of times. 065 * 066 * @return the result of the evaluation. This is of the same class as 067 * parentValue. 068 * @throws JmriException when an exception occurs 069 */ 070 @CheckForNull 071 Object evaluateGeneric() throws JmriException; 072 073}