Class AbstractMaleSocket
- All Implemented Interfaces:
PropertyChangeProvider,Base,Debugable,MaleSocket
- Direct Known Subclasses:
AbstractDebuggerMaleSocket,DefaultMaleAnalogActionSocket,DefaultMaleAnalogExpressionSocket,DefaultMaleDigitalActionSocket,DefaultMaleDigitalBooleanActionSocket,DefaultMaleDigitalExpressionSocket,DefaultMaleStringActionSocket,DefaultMaleStringExpressionSocket,ModuleEditorMaleSocket
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.jmrit.logixng.Base
Base.PrintTreeSettings, Base.RunnableWithBase, Base.RunnableWithBaseThrowExceptionNested classes/interfaces inherited from interface jmri.jmrit.logixng.Debugable
Debugable.DebugConfigNested classes/interfaces inherited from interface jmri.jmrit.logixng.MaleSocket
MaleSocket.ErrorHandlingType -
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocalVariable(String name, SymbolTable.InitialValueType initialValueType, String initialValueData) voidaddLocalVariable(SymbolTable.VariableData variableData) final voidAdd aPropertyChangeListenerto the listener list.final voidaddPropertyChangeListener(PropertyChangeListener l, String name, String listenerRef) Request a call-back when a bound property changes.final voidaddPropertyChangeListener(String propertyName, PropertyChangeListener l) Add aPropertyChangeListenerfor a specific property.final voidaddPropertyChangeListener(String propertyName, PropertyChangeListener l, String name, String listenerRef) Request a call-back when a bound property changes.voidfinal BaseDo a deep copy of children from the original to me.final voiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.protected abstract voidDisposes this object.voidExecutes the error handling module.booleanIs the node catching AbortExecution or not?final CategoryGet the category.final FemaleSocketgetChild(int index) Get a child of this itemfinal intGet the number of children.Get associated comment text.final ConditionalNGGet the ConditionalNG of this item.final BaseCreate a deep copy of myself and my children The item needs to try to lookup itself in both systemNames and userNames to see if the user has given a new system name and/or a new user name.If no new system name is given, an auto system name is used.static FemaleSocketGet the error handling type for this socket.booleanGet whenether the node should listen to changes or not.final StringGet the textual reference for the specific listenerReturns a list of all the listeners referencesvoidReturns a list of all the listeners references for this object and all its children.final LogixNGGet the LogixNG of this item.final StringgetLongDescription(Locale locale) Get a long description of this item.BaseManager<? extends NamedBean>Get the manager that stores this socket.final intNumber of current listeners.final BaseGet the object that this male socket holds.Get the parent.final PropertyChangeListener[]Get allPropertyChangeListeners currently attached to this object.final PropertyChangeListener[]getPropertyChangeListeners(String propertyName) Get allPropertyChangeListeners currently listening to changes to the specified property.final PropertyChangeListener[]Get a list of all the property change listeners that are registered using a specific namefinal BasegetRoot()Get the root of the tree that this item belongs to.final StringgetShortDescription(Locale locale) Get a short description of this item.final StringGet the system name.voidgetUsageDetail(int level, NamedBean bean, List<NamedBeanUsageReport> report, NamedBean cdl) Add a new NamedBeanUsageReport to the report list if there are any matches in this action or expresssion.voidgetUsageTree(int level, NamedBean bean, List<NamedBeanUsageReport> report, NamedBean cdl) Navigate the LogixNG tree.final StringGet the user name.voidhandleError(Base item, String message, RuntimeException e, org.slf4j.Logger log) Handle an error that has happened during execution or evaluation of this item.voidhandleError(Base item, String message, List<String> messageList, JmriException e, org.slf4j.Logger log) Handle an error that has happened during execution or evaluation of this item.voidhandleError(Base item, String message, JmriException e, org.slf4j.Logger log) Handle an error that has happened during execution or evaluation of this item.booleanDoes this item has the child b?final booleanisActive()Is this item active?static booleanbooleanisLocked()Is the node locked?booleanisSystem()Is the node a system node?protected voidprintLocalVariable(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String currentIndent, MutableInt lineNumber, SymbolTable.VariableData localVariable) voidprintTree(Base.PrintTreeSettings settings, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream.voidprintTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, String currentIndent, MutableInt lineNumber) Print the tree to a stream.voidprintTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream.protected voidprintTreeRow(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String currentIndent, MutableInt lineNumber) Print this row.final voidRegister listeners if this object needs that.protected abstract voidRegister listeners if this object needs that.final voidRemove the specified listener from this object.final voidremovePropertyChangeListener(String propertyName, PropertyChangeListener l) Remove the specified listener of the specified property from this object.voidsetCatchAbortExecution(boolean catchAbortExecution) Set if the node should catch AbortExecution or not.voidsetComment(String comment) Set associated comment text.voidsetErrorHandlingType(MaleSocket.ErrorHandlingType errorHandlingType) Set the error handling type for this socket.voidsetListen(boolean listen) Set whenether the node should listen to changes or not.voidsetLocked(boolean locked) Set if the node is locked or not.voidSet the parent.final booleansetParentForAllChildren(List<String> errors) Set the parent for all the children.voidsetSystem(boolean system) Set if the node is system or not.final voidGet the user name.toString()final voidUnregister listeners if this object needs that.protected abstract voidUnregister listeners if this object needs that.final voidupdateListenerRef(PropertyChangeListener l, String newName) final voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.jmrit.logixng.Base
doSocketOperation, existsInTree, forEntireTree, forEntireTreeWithException, getLongDescription, getModule, getShortDescription, isSocketOperationAllowed, printTree, printTreeMethods inherited from interface jmri.jmrit.logixng.Debugable
createDebugConfig, getDebugConfig, setDebugConfigMethods inherited from interface jmri.jmrit.logixng.MaleSocket
find, isEnabled, isSupportingLocalVariables, setEnabled, setEnabledFlag, setup
-
Field Details
-
_localVariables
-
-
Constructor Details
-
AbstractMaleSocket
-
-
Method Details
-
getErrorHandlingModuleSocket
-
isErrorHandlingModuleEnabled
-
getObject
Get the object that this male socket holds. This method is used when the object is going to be configured.- Specified by:
getObjectin interfaceMaleSocket- Returns:
- the object this male socket holds
-
getRoot
Get the root of the tree that this item belongs to. -
isLocked
Is the node locked?- Specified by:
isLockedin interfaceMaleSocket- Returns:
- true if locked, false otherwise
-
setLocked
Set if the node is locked or not.- Specified by:
setLockedin interfaceMaleSocket- Parameters:
locked- true if locked, false otherwise
-
isSystem
Is the node a system node?- Specified by:
isSystemin interfaceMaleSocket- Returns:
- true if system, false otherwise
-
setSystem
Set if the node is system or not.- Specified by:
setSystemin interfaceMaleSocket- Parameters:
system- true if system, false otherwise
-
getCategory
Get the category.- Specified by:
getCategoryin interfaceBase- Returns:
- the category
-
getChild
public final FemaleSocket getChild(int index) throws IllegalArgumentException, UnsupportedOperationException Description copied from interface:BaseGet a child of this item- Specified by:
getChildin interfaceBase- Parameters:
index- the index of the child to get- Returns:
- the child
- Throws:
IllegalArgumentException- if the index is less than 0 or greater or equal with the value returned by getChildCount()UnsupportedOperationException- when needed
-
getChildCount
Description copied from interface:BaseGet the number of children.- Specified by:
getChildCountin interfaceBase- Returns:
- the number of children
-
getShortDescription
Description copied from interface:BaseGet a short description of this item.- Specified by:
getShortDescriptionin interfaceBase- Parameters:
locale- The locale to be used- Returns:
- a short description
-
getLongDescription
Description copied from interface:BaseGet a long description of this item.- Specified by:
getLongDescriptionin interfaceBase- Parameters:
locale- The locale to be used- Returns:
- a long description
-
getUserName
Description copied from interface:BaseGet the user name.- Specified by:
getUserNamein interfaceBase- Returns:
- the user name
-
setUserName
Description copied from interface:BaseGet the user name.- Specified by:
setUserNamein interfaceBase- Parameters:
s- the new user name- Throws:
NamedBean.BadUserNameException- when needed
-
getSystemName
Description copied from interface:BaseGet the system name.- Specified by:
getSystemNamein interfaceBase- Returns:
- the system name
-
addPropertyChangeListener
public final void addPropertyChangeListener(PropertyChangeListener l, String name, String listenerRef) Description copied from interface:BaseRequest a call-back when a bound property changes. Bound properties are the known state, commanded state, user and system names.- Specified by:
addPropertyChangeListenerin interfaceBase- Parameters:
l- The listener. This may change in the future to be a subclass of NamedProprtyChangeListener that carries the name and listenerRef values internallyname- The name (either system or user) that the listener uses for this namedBean, this parameter is used to help determine when which listeners should be moved when the username is moved from one bean to anotherlistenerRef- A textual reference for the listener, that can be presented to the user when a delete is called
-
addPropertyChangeListener
public final void addPropertyChangeListener(String propertyName, PropertyChangeListener l, String name, String listenerRef) Description copied from interface:BaseRequest a call-back when a bound property changes. Bound properties are the known state, commanded state, user and system names.- Specified by:
addPropertyChangeListenerin interfaceBase- Parameters:
propertyName- The name of the property to listen tol- The listener. This may change in the future to be a subclass of NamedProprtyChangeListener that carries the name and listenerRef values internallyname- The name (either system or user) that the listener uses for this namedBean, this parameter is used to help determine when which listeners should be moved when the username is moved from one bean to anotherlistenerRef- A textual reference for the listener, that can be presented to the user when a delete is called
-
addPropertyChangeListener
Description copied from interface:PropertyChangeProviderAdd aPropertyChangeListenerto the listener list.- Specified by:
addPropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
l- The PropertyChangeListener to be added
-
addPropertyChangeListener
Description copied from interface:PropertyChangeProviderAdd aPropertyChangeListenerfor a specific property.- Specified by:
addPropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
propertyName- The name of the property to listen on.l- The PropertyChangeListener to be added
-
removePropertyChangeListener
Description copied from interface:PropertyChangeProviderRemove the specified listener from this object.- Specified by:
removePropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
l- ThePropertyChangeListenerto remove.
-
removePropertyChangeListener
Description copied from interface:PropertyChangeProviderRemove the specified listener of the specified property from this object.- Specified by:
removePropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
propertyName- The name of the property to stop listening to.l- ThePropertyChangeListenerto remove.
-
updateListenerRef
- Specified by:
updateListenerRefin interfaceBase
-
vetoableChange
- Specified by:
vetoableChangein interfaceBase- Throws:
PropertyVetoException
-
getListenerRef
Description copied from interface:BaseGet the textual reference for the specific listener- Specified by:
getListenerRefin interfaceBase- Parameters:
l- the listener of interest- Returns:
- the textual reference
-
getListenerRefs
Description copied from interface:BaseReturns a list of all the listeners references- Specified by:
getListenerRefsin interfaceBase- Returns:
- a list of textual references
-
getNumPropertyChangeListeners
Description copied from interface:BaseNumber of current listeners. May return -1 if the information is not available for some reason.- Specified by:
getNumPropertyChangeListenersin interfaceBase- Returns:
- the number of listeners.
-
getPropertyChangeListeners
Description copied from interface:PropertyChangeProviderGet allPropertyChangeListeners currently attached to this object.- Specified by:
getPropertyChangeListenersin interfacePropertyChangeProvider- Returns:
- An array of PropertyChangeListeners.
-
getPropertyChangeListeners
Description copied from interface:PropertyChangeProviderGet allPropertyChangeListeners currently listening to changes to the specified property.- Specified by:
getPropertyChangeListenersin interfacePropertyChangeProvider- Parameters:
propertyName- the name of the property of interest- Returns:
- an array of PropertyChangeListeners
-
getPropertyChangeListenersByReference
Description copied from interface:BaseGet a list of all the property change listeners that are registered using a specific name- Specified by:
getPropertyChangeListenersByReferencein interfaceBase- Parameters:
name- The name (either system or user) that the listener has registered as referencing this namedBean- Returns:
- empty list if none
-
getComment
Description copied from interface:BaseGet associated comment text. A LogixNG comment can have multiple lines, separated with \n.- Specified by:
getCommentin interfaceBase- Returns:
- the comment or null
-
setComment
Description copied from interface:BaseSet associated comment text.Comments can be any valid text.
- Specified by:
setCommentin interfaceBase- Parameters:
comment- the comment or null to remove an existing comment
-
getListen
Description copied from interface:MaleSocketGet whenether the node should listen to changes or not.- Specified by:
getListenin interfaceMaleSocket- Returns:
- true if listen, false if not listen
-
setListen
Description copied from interface:MaleSocketSet whenether the node should listen to changes or not.- Specified by:
setListenin interfaceMaleSocket- Parameters:
listen- true if listen, false if not listen
-
getCatchAbortExecution
Description copied from interface:MaleSocketIs the node catching AbortExecution or not?- Specified by:
getCatchAbortExecutionin interfaceMaleSocket- Returns:
- true if catching, false otherwise
-
setCatchAbortExecution
Description copied from interface:MaleSocketSet if the node should catch AbortExecution or not.- Specified by:
setCatchAbortExecutionin interfaceMaleSocket- Parameters:
catchAbortExecution- true if catch, false otherwise
-
addLocalVariable
public void addLocalVariable(String name, SymbolTable.InitialValueType initialValueType, String initialValueData) - Specified by:
addLocalVariablein interfaceMaleSocket
-
addLocalVariable
- Specified by:
addLocalVariablein interfaceMaleSocket
-
clearLocalVariables
- Specified by:
clearLocalVariablesin interfaceMaleSocket
-
getLocalVariables
- Specified by:
getLocalVariablesin interfaceMaleSocket
-
getParent
Description copied from interface:BaseGet the parent.The following rules apply
- LogixNGs has no parent. The method throws an UnsupportedOperationException if called.
- Expressions and actions has the male socket that they are connected to as their parent.
- Male sockets has the female socket that they are connected to as their parent.
- The parent of a female sockets is the LogixNG, expression or action that has this female socket.
- The parent of a male sockets is the same parent as the expression or action that it contains.
-
setParent
Description copied from interface:BaseSet the parent.The following rules apply
- ExecutionGroups has no parent. The method throws an UnsupportedOperationException if called.
- LogixNGs has the execution group as its parent.
- Expressions and actions has the male socket that they are connected to as their parent.
- Male sockets has the female socket that they are connected to as their parent.
- The parent of a female sockets is the LogixNG, expression or action that has this female socket.
- The parent of a male sockets is the same parent as the expression or action that it contains.
-
getConditionalNG
Description copied from interface:BaseGet the ConditionalNG of this item.- Specified by:
getConditionalNGin interfaceBase- Returns:
- the ConditionalNG that owns this item
-
getLogixNG
Description copied from interface:BaseGet the LogixNG of this item.- Specified by:
getLogixNGin interfaceBase- Returns:
- the LogixNG that owns this item
-
setParentForAllChildren
Set the parent for all the children.- Specified by:
setParentForAllChildrenin interfaceBase- Parameters:
errors- a list of potential errors- Returns:
- true if success, false otherwise
-
registerListenersForThisClass
Register listeners if this object needs that.Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not registered more than once.
-
unregisterListenersForThisClass
Unregister listeners if this object needs that.Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not unregistered more than once.
-
registerListeners
Register listeners if this object needs that.Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not registered more than once.
- Specified by:
registerListenersin interfaceBase
-
unregisterListeners
Unregister listeners if this object needs that.Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not unregistered more than once.
- Specified by:
unregisterListenersin interfaceBase
-
isActive
Is this item active? If this item is enabled and all the parents are enabled, this item is active. -
printTreeRow
protected void printTreeRow(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String currentIndent, MutableInt lineNumber) Print this row. If getObject() doesn't return an AbstractMaleSocket, print this row.If a male socket that extends AbstractMaleSocket wants to print something here, it needs to override this method.
The reason this method doesn't print if getObject() returns an AbstractMaleSocket is to protect so it doesn't print itself twice if it's embedding an other AbstractMaleSocket. An example of this is the AbstractDebuggerMaleSocket which embeds other male sockets.
- Parameters:
settings- settings for what to printlocale- The locale to be usedwriter- the stream to print the tree tocurrentIndent- the current indentationlineNumber- the line number
-
printLocalVariable
protected void printLocalVariable(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String currentIndent, MutableInt lineNumber, SymbolTable.VariableData localVariable) -
printTree
public void printTree(Base.PrintTreeSettings settings, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream. -
printTree
public void printTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, MutableInt lineNumber) Print the tree to a stream. -
printTree
public void printTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, String currentIndent, MutableInt lineNumber) Print the tree to a stream. -
getUsageTree
public void getUsageTree(int level, NamedBean bean, List<NamedBeanUsageReport> report, NamedBean cdl) Navigate the LogixNG tree.- Specified by:
getUsageTreein interfaceBase- Parameters:
level- The current recursion level for debugging.bean- The named bean that is the object of the search.report- A list of NamedBeanUsageReport usage reports.cdl- The current ConditionalNG bean. Null for Module searches since there is no conditional
-
getUsageDetail
public void getUsageDetail(int level, NamedBean bean, List<NamedBeanUsageReport> report, NamedBean cdl) Add a new NamedBeanUsageReport to the report list if there are any matches in this action or expresssion.NamedBeanUsageReport Usage keys:
- LogixNGAction
- LogixNGExpression
- Specified by:
getUsageDetailin interfaceBase- Parameters:
level- The current recursion level for debugging.bean- The named bean that is the object of the search.report- A list of NamedBeanUsageReport usage reports.cdl- The current ConditionalNG bean. Null for Module searches since there is no conditional
-
getManager
Description copied from interface:MaleSocketGet the manager that stores this socket. This method is used when the object is going to be configured.- Specified by:
getManagerin interfaceMaleSocket- Returns:
- the manager
-
getDeepCopy
public final Base getDeepCopy(Map<String, String> systemNames, Map<String, throws JmriExceptionString> userNames) Description copied from interface:BaseCreate a deep copy of myself and my children The item needs to try to lookup itself in both systemNames and userNames to see if the user has given a new system name and/or a new user name.If no new system name is given, an auto system name is used. If no user name is given, a null user name is used.- Specified by:
getDeepCopyin interfaceBase- Parameters:
systemNames- a map of old and new system nameuserNames- a map of old system name and new user name- Returns:
- a deep copy
- Throws:
JmriException- in case of an error
-
deepCopyChildren
public final Base deepCopyChildren(Base original, Map<String, String> systemNames, Map<String, throws JmriExceptionString> userNames) Description copied from interface:BaseDo a deep copy of children from the original to me.- Specified by:
deepCopyChildrenin interfaceBase- Parameters:
original- the item to copy fromsystemNames- a map of old and new system nameuserNames- a map of old system name and new user name- Returns:
- myself
- Throws:
JmriException- in case of an error
-
disposeMe
Disposes this object. This must remove _all_ connections! -
dispose
Deactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this object contained.
-
getErrorHandlingType
Description copied from interface:MaleSocketGet the error handling type for this socket.- Specified by:
getErrorHandlingTypein interfaceMaleSocket- Returns:
- the error handling type
-
setErrorHandlingType
Description copied from interface:MaleSocketSet the error handling type for this socket.- Specified by:
setErrorHandlingTypein interfaceMaleSocket- Parameters:
errorHandlingType- the error handling type
-
executeErrorHandlingModule
public void executeErrorHandlingModule(Base item, String message, List<String> messageList, Exception e) Executes the error handling module.- Parameters:
item- the item that had the errormessage- the error messagemessageList- a list of error messagese- the exception that has happened
-
handleError
public void handleError(Base item, String message, JmriException e, org.slf4j.Logger log) throws JmriException Description copied from interface:MaleSocketHandle an error that has happened during execution or evaluation of this item.- Specified by:
handleErrorin interfaceMaleSocket- Parameters:
item- the item that had the errormessage- the error messagee- the exception that has happenedlog- the logger- Throws:
JmriException- if the male socket is configured to throw an exception
-
handleError
public void handleError(Base item, String message, List<String> messageList, JmriException e, org.slf4j.Logger log) throws JmriException Description copied from interface:MaleSocketHandle an error that has happened during execution or evaluation of this item.- Specified by:
handleErrorin interfaceMaleSocket- Parameters:
item- the item that had the errormessage- the error messagemessageList- a list of error messagese- the exception that has happenedlog- the logger- Throws:
JmriException- if the male socket is configured to throw an exception
-
handleError
public void handleError(Base item, String message, RuntimeException e, org.slf4j.Logger log) throws JmriException Description copied from interface:MaleSocketHandle an error that has happened during execution or evaluation of this item.- Specified by:
handleErrorin interfaceMaleSocket- Parameters:
item- the item that had the errormessage- the error messagee- the exception that has happenedlog- the logger- Throws:
JmriException- if the male socket is configured to throw an exception
-
getListenerRefsIncludingChildren
Returns a list of all the listeners references for this object and all its children.- Specified by:
getListenerRefsIncludingChildrenin interfaceBase- Parameters:
list- a list of textual references
-
hasChild
Description copied from interface:BaseDoes this item has the child b? -
toString
-