Class AbstractBase
- All Implemented Interfaces:
Comparable<NamedBean>,PropertyChangeProvider,Base,NamedBean
- Direct Known Subclasses:
AbstractAnalogAction,AbstractAnalogExpression,AbstractDigitalAction,AbstractDigitalBooleanAction,AbstractDigitalExpression,AbstractStringAction,AbstractStringExpression,ClipboardMany,DefaultClipboard,DefaultConditionalNG,DefaultModule,NullBase
-
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.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
FieldsFields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields 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_DISCONNECTEDFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN -
Constructor Summary
ConstructorsConstructorDescriptionAbstractBase(String sys) AbstractBase(String sys, String user) AbstractBase(String sys, String user, Category category) AbstractBase(String sys, Category category) -
Method Summary
Modifier and TypeMethodDescriptionvoidassertListenersAreNotRegistered(org.slf4j.Logger log, String method) intcompareSystemNameSuffix(String suffix1, String suffix2, NamedBean n) Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for theNamedBean.compareTo(jmri.NamedBean)operation.Do 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 voidDispose this class.Get the category.getChild(int index) Get a child of this itemintGet the number of children.Get the ConditionalNG of this item.voidReturns a list of all the listeners references for this object and all its children.final LogixNGGet the LogixNG of this item.final BasegetRoot()Get the root of the tree that this item belongs to.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 booleanisActive()Is this item active?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) final voidRegister listeners if this object needs that.protected voidRegister listeners if this object needs that.final booleansetParentForAllChildren(List<String> errors) Set the parent for all the children.final voidUnregister listeners if this object needs that.protected voidUnregister listeners if this object needs that.Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, describeState, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChangeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.jmrit.logixng.Base
addPropertyChangeListener, addPropertyChangeListener, doSocketOperation, existsInTree, forEntireTree, forEntireTreeWithException, getComment, getDeepCopy, getListenerRef, getListenerRefs, getLongDescription, getLongDescription, getModule, getNumPropertyChangeListeners, getParent, getPropertyChangeListenersByReference, getShortDescription, getShortDescription, getSystemName, getUserName, hasChild, isEnabled, isSocketOperationAllowed, printTree, printTree, setComment, setParent, setup, setUserName, updateListenerRef, vetoableChangeMethods inherited from interface jmri.NamedBean
compareTo, getBeanType, getRecommendedToolTip, getState, getUsageReport, setStateMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
_listenersAreRegistered
-
-
Constructor Details
-
AbstractBase
- Throws:
NamedBean.BadSystemNameException
-
AbstractBase
public AbstractBase(String sys, String user) throws NamedBean.BadUserNameException, NamedBean.BadSystemNameException -
AbstractBase
- Throws:
NamedBean.BadSystemNameException
-
AbstractBase
public AbstractBase(String sys, String user, Category category) throws NamedBean.BadUserNameException, NamedBean.BadSystemNameException
-
-
Method Details
-
getCategory
Get the category.- Specified by:
getCategoryin interfaceBase- Returns:
- the category
-
getChild
public FemaleSocket getChild(int index) throws IllegalArgumentException, UnsupportedOperationException Get 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
Get the number of children.- Specified by:
getChildCountin interfaceBase- Returns:
- the number of children
-
deepCopyChildren
public Base deepCopyChildren(Base original, Map<String, String> systemNames, Map<String, throws JmriExceptionString> userNames) Do 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
-
getConditionalNG
Get the ConditionalNG of this item.- Specified by:
getConditionalNGin interfaceBase- Returns:
- the ConditionalNG that owns this item
-
getLogixNG
Get the LogixNG of this item.- Specified by:
getLogixNGin interfaceBase- Returns:
- the LogixNG that owns this item
-
getRoot
Get the root of the tree that this item belongs to. -
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) -
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
-
compareSystemNameSuffix
@CheckReturnValue public int compareSystemNameSuffix(@Nonnull String suffix1, @Nonnull String suffix2, @Nonnull NamedBean n) Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for theNamedBean.compareTo(jmri.NamedBean)operation. This is intended to be a system-specific comparison that understands the various formats, etc. By default, does an alphanumeric-by-chunks comparison. Do a string comparison.- Specified by:
compareSystemNameSuffixin interfaceNamedBean- Overrides:
compareSystemNameSuffixin classAbstractNamedBean- Parameters:
suffix1- The suffix for the 1st bean in the comparisonsuffix2- The suffix for the 2nd bean in the comparisonn- The other (second) NamedBean in the comparison- Returns:
- -1,0,+1 for ordering if the names are well-formed; may not provide proper ordering if the names are not well-formed.
-
disposeMe
Dispose this class. Listeners do not need to be unregistered by this method since they are unregistered by dispose(). -
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 NamedBean contained.
-
assertListenersAreNotRegistered
-
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
-