Class DefaultFemaleGenericExpressionSocket
- java.lang.Object
-
- jmri.jmrit.logixng.implementation.AbstractFemaleSocket
-
- jmri.jmrit.logixng.implementation.DefaultFemaleGenericExpressionSocket
-
- All Implemented Interfaces:
PropertyChangeProvider
,Base
,FemaleGenericExpressionSocket
,FemaleSocket
,FemaleSocketListener
public class DefaultFemaleGenericExpressionSocket extends AbstractFemaleSocket implements FemaleGenericExpressionSocket, FemaleSocketListener
Default implementation of the FemaleGenericExpressionSocket
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.jmrit.logixng.Base
Base.PrintTreeSettings, Base.RunnableWithBase, Base.RunnableWithBaseThrowException
-
Nested classes/interfaces inherited from interface jmri.jmrit.logixng.FemaleGenericExpressionSocket
FemaleGenericExpressionSocket.SocketType
-
-
Field Summary
-
Fields inherited from class jmri.jmrit.logixng.implementation.AbstractFemaleSocket
_enableListeners, _listener
-
Fields inherited from interface jmri.jmrit.logixng.Base
PRINT_LINE_NUMBERS_FORMAT, PROPERTY_CHILD_COUNT, PROPERTY_CHILD_REORDER, PROPERTY_LAST_RESULT_CHANGED, PROPERTY_SOCKET_CONNECTED, PROPERTY_SOCKET_DISCONNECTED, SEPARATOR, SOCKET_CONNECTED, SOCKET_DISCONNECTED
-
-
Constructor Summary
Constructors Constructor Description DefaultFemaleGenericExpressionSocket(FemaleGenericExpressionSocket.SocketType socketType, Base parent, FemaleSocketListener listener, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect(MaleSocket socket)
Connect the male socket to this female socket.void
connected(FemaleSocket socket)
The socket is connected.void
disconnect()
Disconnect the current connected male socket from this female socket.void
disconnected(FemaleSocket socket)
The socket is disconnected.void
disposeMe()
java.lang.Object
evaluateGeneric()
Evaluate this expression.java.util.Map<Category,java.util.List<java.lang.Class<? extends Base>>>
getConnectableClasses()
Get a set of classes that are compatible with this female socket.MaleSocket
getConnectedSocket()
Get the connected socket.FemaleSocket
getCurrentActiveSocket()
Get the current active socket.boolean
getDoI18N()
java.lang.String
getLongDescription(java.util.Locale locale)
Get a long description of this item.java.lang.String
getShortDescription(java.util.Locale locale)
Get a short description of this item.FemaleGenericExpressionSocket.SocketType
getSocketType()
Get the type of the socket.boolean
isCompatible(MaleSocket socket)
Is a particular male socket compatible with this female socket?boolean
isConnected()
Is a male socket connected to this female socket?void
setDoI18N(boolean do_i18n)
void
setSocketType(FemaleGenericExpressionSocket.SocketType socketType)
Set the type of the socket.-
Methods inherited from class jmri.jmrit.logixng.implementation.AbstractFemaleSocket
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, deepCopyChildren, dispose, forEntireTree, forEntireTreeWithException, getCategory, getChild, getChildCount, getComment, getConditionalNG, getDeepCopy, getEnableListeners, getListenerRef, getListenerRefs, getListenerRefsIncludingChildren, getLogixNG, getName, getNumPropertyChangeListeners, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getRoot, getSystemName, getUsageDetail, getUsageTree, getUserName, hasChild, isActive, printTree, printTree, printTree, printTreeRow, registerListeners, registerListenersForThisClass, removePropertyChangeListener, removePropertyChangeListener, setComment, setEnableListeners, setName, setParent, setParentForAllChildren, setUserName, unregisterListeners, unregisterListenersForThisClass, updateListenerRef, validateName, vetoableChange
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.jmrit.logixng.Base
addPropertyChangeListener, addPropertyChangeListener, deepCopyChildren, dispose, doSocketOperation, existsInTree, forEntireTree, forEntireTreeWithException, getCategory, getChild, getChildCount, getComment, getConditionalNG, getDeepCopy, getListenerRef, getListenerRefs, getListenerRefsIncludingChildren, getLogixNG, getLongDescription, getModule, getNumPropertyChangeListeners, getParent, getPropertyChangeListenersByReference, getRoot, getShortDescription, getSystemName, getUsageDetail, getUsageTree, getUserName, hasChild, isActive, isEnabled, isSocketOperationAllowed, printTree, printTree, printTree, printTree, printTree, registerListeners, setComment, setParent, setParentForAllChildren, setUserName, unregisterListeners, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.jmrit.logixng.FemaleSocket
canDisconnect, doSocketOperation, getEnableListeners, getName, isAncestor, isSocketOperationAllowed, setEnableListeners, setName, setName, setup, validateName, validateName
-
Methods inherited from interface jmri.jmrit.logixng.FemaleSocketListener
socketNameChanged
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
DefaultFemaleGenericExpressionSocket
public DefaultFemaleGenericExpressionSocket(FemaleGenericExpressionSocket.SocketType socketType, Base parent, FemaleSocketListener listener, java.lang.String name)
-
-
Method Detail
-
getCurrentActiveSocket
public FemaleSocket getCurrentActiveSocket()
Get the current active socket.- Specified by:
getCurrentActiveSocket
in interfaceFemaleGenericExpressionSocket
- Returns:
- the currently active socket or null if no socket is active
-
isCompatible
public boolean isCompatible(MaleSocket socket)
Is a particular male socket compatible with this female socket?- Specified by:
isCompatible
in interfaceFemaleSocket
- Parameters:
socket
- the male socket- Returns:
- true if the male socket can be connected to this female socket
-
setSocketType
public void setSocketType(FemaleGenericExpressionSocket.SocketType socketType) throws SocketAlreadyConnectedException
Set the type of the socket.- Specified by:
setSocketType
in interfaceFemaleGenericExpressionSocket
- Parameters:
socketType
- the type of socket.- Throws:
SocketAlreadyConnectedException
- if the socket is already connected and if the new type doesn't match the currently connected socket.
-
getSocketType
public FemaleGenericExpressionSocket.SocketType getSocketType()
Get the type of the socket.- Specified by:
getSocketType
in interfaceFemaleGenericExpressionSocket
- Returns:
- the type of socket
-
setDoI18N
public void setDoI18N(boolean do_i18n)
-
getDoI18N
public boolean getDoI18N()
-
evaluateGeneric
@CheckForNull public java.lang.Object evaluateGeneric() throws JmriException
Description copied from interface:FemaleGenericExpressionSocket
Evaluate this expression.This method validates the expression without doing any convertation of the return value.
The parameter isCompleted is used if the expression should be evaluated more than once. For example, the Count expression is not completed until its child expression has been true and false a number of times.
- Specified by:
evaluateGeneric
in interfaceFemaleGenericExpressionSocket
- Returns:
- the result of the evaluation. This is of the same class as parentValue.
- Throws:
JmriException
- when an exception occurs
-
getShortDescription
public java.lang.String getShortDescription(java.util.Locale locale)
Get a short description of this item.- Specified by:
getShortDescription
in interfaceBase
- Parameters:
locale
- The locale to be used- Returns:
- a short description
-
getLongDescription
public java.lang.String getLongDescription(java.util.Locale locale)
Get a long description of this item.- Specified by:
getLongDescription
in interfaceBase
- Parameters:
locale
- The locale to be used- Returns:
- a long description
-
getConnectableClasses
public java.util.Map<Category,java.util.List<java.lang.Class<? extends Base>>> getConnectableClasses()
Description copied from interface:FemaleSocket
Get a set of classes that are compatible with this female socket.- Specified by:
getConnectableClasses
in interfaceFemaleSocket
- Returns:
- a set of entries with category and class
-
connect
public void connect(MaleSocket socket) throws SocketAlreadyConnectedException
Connect the male socket to this female socket.- Specified by:
connect
in interfaceFemaleSocket
- Overrides:
connect
in classAbstractFemaleSocket
- Parameters:
socket
- the socket to connect- Throws:
SocketAlreadyConnectedException
- if the socket is already connected
-
disconnect
public void disconnect()
Disconnect the current connected male socket from this female socket.- Specified by:
disconnect
in interfaceFemaleSocket
- Overrides:
disconnect
in classAbstractFemaleSocket
-
getConnectedSocket
public MaleSocket getConnectedSocket()
Get the connected socket.- Specified by:
getConnectedSocket
in interfaceFemaleSocket
- Overrides:
getConnectedSocket
in classAbstractFemaleSocket
- Returns:
- the male socket or null if not connected
-
isConnected
public boolean isConnected()
Is a male socket connected to this female socket?- Specified by:
isConnected
in interfaceFemaleSocket
- Overrides:
isConnected
in classAbstractFemaleSocket
- Returns:
- true if connected
-
connected
public void connected(FemaleSocket socket)
Description copied from interface:FemaleSocketListener
The socket is connected.- Specified by:
connected
in interfaceFemaleSocketListener
- Parameters:
socket
- the socket
-
disconnected
public void disconnected(FemaleSocket socket)
Description copied from interface:FemaleSocketListener
The socket is disconnected.- Specified by:
disconnected
in interfaceFemaleSocketListener
- Parameters:
socket
- the socket
-
disposeMe
public void disposeMe()
- Specified by:
disposeMe
in classAbstractFemaleSocket
-
-