Interface Base

All Superinterfaces:
PropertyChangeProvider
All Known Subinterfaces:
AnalogAction, AnalogActionBean, AnalogExpression, AnalogExpressionBean, ConditionalNG, Debugable, DigitalAction, DigitalActionBean, DigitalBooleanAction, DigitalBooleanActionBean, DigitalExpression, DigitalExpressionBean, FemaleAnalogActionSocket, FemaleAnalogExpressionSocket, FemaleAnySocket, FemaleDigitalActionSocket, FemaleDigitalBooleanActionSocket, FemaleDigitalExpressionSocket, FemaleGenericExpressionSocket, FemaleSocket, FemaleStringActionSocket, FemaleStringExpressionSocket, GlobalVariable, LogixNG, MaleAnalogActionSocket, MaleAnalogExpressionSocket, MaleDigitalActionSocket, MaleDigitalBooleanActionSocket, MaleDigitalExpressionSocket, MaleSocket, MaleStringActionSocket, MaleStringExpressionSocket, Module, StringAction, StringActionBean, StringExpression, StringExpressionBean
All Known Implementing Classes:
AbstractAnalogAction, AbstractAnalogExpression, AbstractBase, AbstractDebuggerMaleSocket, AbstractDigitalAction, AbstractDigitalBooleanAction, AbstractDigitalExpression, AbstractFemaleSocket, AbstractMaleSocket, AbstractStringAction, AbstractStringExpression, ActionAtomicBoolean, ActionAudio, ActionAudioIcon, ActionBlock, ActionClearSlots, ActionClock, ActionClockRate, ActionCreateBeansFromTable, ActionDispatcher, ActionEntryExit, ActionFindTableRowOrColumn, ActionLayoutTurnout, ActionLight, ActionLightIntensity, ActionListenOnBeans, ActionListenOnBeansLocalVariable, ActionListenOnBeansTable, ActionLocalVariable, ActionMemory, ActionOBlock, ActionPositionable, ActionPositionableByClass, ActionPower, ActionReporter, ActionRequestUpdateAllSensors, ActionRequestUpdateOfSensor, ActionRequestUpdateOfTurnout, ActionScript, ActionSensor, ActionSetReporter, ActionShutDownTask, ActionSignalHead, ActionSignalMast, ActionSound, ActionTable, ActionThrottle, ActionThrottleFunction, ActionTimer, ActionTurnout, ActionTurnoutLock, ActionUpdateSlots, ActionWarrant, AnalogActionLightIntensity, AnalogActionMemory, AnalogExpressionAnalogIO, AnalogExpressionConstant, AnalogExpressionLocalVariable, AnalogExpressionMemory, AnalogFormula, AnalogMany, And, Antecedent, Break, ClipboardMany, ConnectionName, Continue, DebuggerMaleAnalogActionSocket, DebuggerMaleAnalogExpressionSocket, DebuggerMaleDigitalActionSocket, DebuggerMaleDigitalBooleanActionSocket, DebuggerMaleDigitalExpressionSocket, DebuggerMaleStringActionSocket, DebuggerMaleStringExpressionSocket, DefaultClipboard, DefaultConditionalNG, DefaultFemaleAnalogActionSocket, DefaultFemaleAnalogExpressionSocket, DefaultFemaleAnySocket, DefaultFemaleDigitalActionSocket, DefaultFemaleDigitalBooleanActionSocket, DefaultFemaleDigitalExpressionSocket, DefaultFemaleGenericExpressionSocket, DefaultFemaleStringActionSocket, DefaultFemaleStringExpressionSocket, DefaultGlobalVariable, DefaultLogixNG, DefaultMaleAnalogActionSocket, DefaultMaleAnalogExpressionSocket, DefaultMaleDigitalActionSocket, DefaultMaleDigitalBooleanActionSocket, DefaultMaleDigitalExpressionSocket, DefaultMaleStringActionSocket, DefaultMaleStringExpressionSocket, DefaultModule, DigitalBooleanLogixAction, DigitalBooleanMany, DigitalCallModule, DigitalCallModule, DigitalFormula, DigitalFormula, DigitalMany, DoAnalogAction, DoStringAction, EnableLogix, EnableLogixNG, Error, ExecuteAction, ExecuteDelayed, ExecuteProgram, Exit, ExpressionAudio, ExpressionBlock, ExpressionClock, ExpressionConditional, ExpressionDispatcher, ExpressionEntryExit, ExpressionLight, ExpressionLinuxLinePower, ExpressionLocalVariable, ExpressionMemory, ExpressionOBlock, ExpressionPower, ExpressionReference, ExpressionReporter, ExpressionScript, ExpressionSection, ExpressionSensor, ExpressionSensorEdge, ExpressionSignalHead, ExpressionSignalMast, ExpressionSlotUsage, ExpressionTransit, ExpressionTurnout, ExpressionWarrant, False, FileAsFlag, For, ForEach, ForEachWithDelay, Hold, IfThenElse, JsonDecode, LastResultOfDigitalExpression, LogData, LogData, Logix, LogLocalVariables, ModuleEditorMaleSocket, Not, NullBase, OperationsProStartAutomation, Or, ProgramOnMain, Publish, Return, RunOnce, SendMergCbusEvent, Sequence, SetLocalVariables, SetSpeedZero, ShowDialog, ShutdownComputer, SimulateTurnoutFeedback, StringActionMemory, StringActionStringIO, StringExpressionConstant, StringExpressionMemory, StringExpressionStringIO, StringFormula, StringMany, Subscribe, TableForEach, Timeout, Timer, TimeSinceMidnight, TriggerOnce, TriggerRoute, True, WebBrowser, WebRequest, WindowManagement

public interface Base extends PropertyChangeProvider
The base interface for LogixNG expressions and actions. Used to simplify the user interface.
  • Field Details

    • SEPARATOR

      static final String SEPARATOR
      Separator returned by enums toString() methods to get a separator in JComboBoxes. See ExpressionEntryExit.EntryExitState for an example.
      See Also:
    • PROPERTY_CHILD_COUNT

      The name of the property child count. To get the number of children, use the method getChildCount(). This constant is used in calls to firePropertyChange(). The class fires a property change then a child is added or removed.

      If children are removed, the field oldValue of the PropertyChange event must be a List<FemaleSocket> with the FemaleSockets that are removed from the list so that the listener can unregister itself as a listener of this female socket.

      If children are added, the field newValue of the PropertyChange event must be a List<FemaleSocket> with the FemaleSockets that are added to the list so that the listener can register itself as a listener of this female socket.

      See Also:
    • PROPERTY_CHILD_REORDER

      The name of the property child reorder. The number of children has remained the same, but the order of children has changed.

      The field newValue of the PropertyChange event must be a List<FemaleSocket> with the FemaleSockets that are reordered so that the listener can update the tree.

      See Also:
    • PROPERTY_SOCKET_CONNECTED

      The socket has been connected. This constant is used in calls to firePropertyChange(). The socket fires a property change when it is connected or disconnected.
      See Also:
    • PROPERTY_SOCKET_DISCONNECTED

      The socket has been disconnected. This constant is used in calls to firePropertyChange(). The socket fires a property change when it is connected or disconnected.
      See Also:
    • PROPERTY_LAST_RESULT_CHANGED

      The last result of the expression has changed. This constant is used in calls to firePropertyChange().
      See Also:
    • SOCKET_CONNECTED

      static final int SOCKET_CONNECTED
      Constant representing an "connected" state of the socket
      See Also:
    • SOCKET_DISCONNECTED

      static final int SOCKET_DISCONNECTED
      Constant representing an "disconnected" state of the socket
      See Also:
  • Method Details

    • getSystemName

      Get the system name.
      Returns:
      the system name
    • getUserName

      Get the user name.
      Returns:
      the user name
    • getComment

      Get associated comment text. A LogixNG comment can have multiple lines, separated with \n.
      Returns:
      the comment or null
    • setUserName

      Get the user name.
      Parameters:
      s - the new user name
      Throws:
      NamedBean.BadUserNameException - when needed
    • getDeepCopy

      Base getDeepCopy(Map<String,String> systemNames, Map<String,String> userNames) throws JmriException
      Create 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.
      Parameters:
      systemNames - a map of old and new system name
      userNames - a map of old system name and new user name
      Returns:
      a deep copy
      Throws:
      JmriException - in case of an error
    • deepCopyChildren

      Base deepCopyChildren(Base original, Map<String,String> systemNames, Map<String,String> userNames) throws JmriException
      Do a deep copy of children from the original to me.
      Parameters:
      original - the item to copy from
      systemNames - a map of old and new system name
      userNames - a map of old system name and new user name
      Returns:
      myself
      Throws:
      JmriException - in case of an error
    • setComment

      Set associated comment text.

      Comments can be any valid text.

      Parameters:
      comment - the comment or null to remove an existing comment
    • getShortDescription

      Get a short description of this item.
      Returns:
      a short description
    • getLongDescription

      Get a long description of this item.
      Returns:
      a long description
    • getShortDescription

      Get a short description of this item.
      Parameters:
      locale - The locale to be used
      Returns:
      a short description
    • getLongDescription

      Get a long description of this item.
      Parameters:
      locale - The locale to be used
      Returns:
      a long description
    • getModule

      default Module getModule()
      Get the Module of this item, if it's part of a module.
      Returns:
      the Module that owns this item or null if it's owned by a ConditonalNG.
    • getConditionalNG

      Get the ConditionalNG of this item.
      Returns:
      the ConditionalNG that owns this item
    • getLogixNG

      Get the LogixNG of this item.
      Returns:
      the LogixNG that owns this item
    • getRoot

      Get the root of the tree that this item belongs to.
      Returns:
      the top most item in the tree
    • getParent

      Get 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.
      Returns:
      the parent of this object
    • setParent

      void setParent(Base parent)
      Set 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.
      Parameters:
      parent - the new parent of this object
    • setParentForAllChildren

      Set the parent for all the children.
      Parameters:
      errors - a list of potential errors
      Returns:
      true if success, false otherwise
    • getChild

      Get a child of this item
      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.
      Returns:
      the number of children
    • isSocketOperationAllowed

      default boolean isSocketOperationAllowed(int index, FemaleSocketOperation oper)
      Is the operation allowed on this child?
      Parameters:
      index - the index of the child to do the operation on
      oper - the operation to do
      Returns:
      true if operation is allowed, false otherwise
    • doSocketOperation

      default void doSocketOperation(int index, FemaleSocketOperation oper)
      Do an operation on a child
      Parameters:
      index - the index of the child to do the operation on
      oper - the operation to do
    • getCategory

      Get the category.
      Returns:
      the category
    • isActive

      boolean isActive()
      Is this item active? If this item is enabled and all the parents are enabled, this item is active.
      Returns:
      true if active, false otherwise.
    • setup

      void setup()
      Setup this object and its children. This method is used to lookup system names for child sockets, turnouts, sensors, and so on.
    • dispose

      void 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.

    • isEnabled

      default boolean isEnabled()
      Determines whether this object is enabled.
      Returns:
      true if the object is enabled, false otherwise
    • 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.

    • 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.

    • printTree

      default void printTree(PrintWriter writer, String indent, MutableInt lineNumber)
      Print the tree to a stream.
      Parameters:
      writer - the stream to print the tree to
      indent - the indentation of each level
      lineNumber - the line number
    • printTree

      void printTree(Base.PrintTreeSettings settings, PrintWriter writer, String indent, MutableInt lineNumber)
      Print the tree to a stream.
      Parameters:
      settings - settings for what to print
      writer - the stream to print the tree to
      indent - the indentation of each level
      lineNumber - the line number
    • printTree

      default void printTree(Locale locale, PrintWriter writer, String indent, MutableInt lineNumber)
      Print the tree to a stream.
      Parameters:
      locale - The locale to be used
      writer - the stream to print the tree to
      indent - the indentation of each level
      lineNumber - the line number
    • printTree

      void printTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, MutableInt lineNumber)
      Print the tree to a stream.
      Parameters:
      settings - settings for what to print
      locale - The locale to be used
      writer - the stream to print the tree to
      indent - the indentation of each level
      lineNumber - the line number
    • printTree

      void printTree(Base.PrintTreeSettings settings, Locale locale, PrintWriter writer, String indent, String currentIndent, MutableInt lineNumber)
      Print the tree to a stream.
      Parameters:
      settings - settings for what to print
      locale - The locale to be used
      writer - the stream to print the tree to
      indent - the indentation of each level
      currentIndent - the current indentation
      lineNumber - the line number
    • getListenString

      static String getListenString(boolean listen)
    • getNoListenString

    • getUsageTree

      void getUsageTree(int level, NamedBean bean, List<NamedBeanUsageReport> report, NamedBean cdl)
      Navigate the LogixNG tree.
      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

      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
      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
    • addPropertyChangeListener

      Request a call-back when a bound property changes. Bound properties are the known state, commanded state, user and system names.
      Parameters:
      listener - The listener. This may change in the future to be a subclass of NamedProprtyChangeListener that carries the name and listenerRef values internally
      name - 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 another
      listenerRef - A textual reference for the listener, that can be presented to the user when a delete is called
    • addPropertyChangeListener

      void addPropertyChangeListener(@Nonnull String propertyName, @Nonnull PropertyChangeListener listener, String name, String listenerRef)
      Request a call-back when a bound property changes. Bound properties are the known state, commanded state, user and system names.
      Parameters:
      propertyName - The name of the property to listen to
      listener - The listener. This may change in the future to be a subclass of NamedProprtyChangeListener that carries the name and listenerRef values internally
      name - 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 another
      listenerRef - A textual reference for the listener, that can be presented to the user when a delete is called
    • updateListenerRef

    • vetoableChange

      Throws:
      PropertyVetoException
    • getListenerRef

      Get the textual reference for the specific listener
      Parameters:
      l - the listener of interest
      Returns:
      the textual reference
    • getListenerRefs

      Returns a list of all the listeners references
      Returns:
      a list of textual references
    • getListenerRefsIncludingChildren

      Returns a list of all the listeners references for this object and all its children.
      Parameters:
      list - a list of textual references
    • getNumPropertyChangeListeners

      Number of current listeners. May return -1 if the information is not available for some reason.
      Returns:
      the number of listeners.
    • getPropertyChangeListenersByReference

      Get a list of all the property change listeners that are registered using a specific name
      Parameters:
      name - The name (either system or user) that the listener has registered as referencing this namedBean
      Returns:
      empty list if none
    • forEntireTree

      Do something on every item in the sub tree of this item.
      Parameters:
      r - the action to do on all items.
    • forEntireTreeWithException

      Do something on every item in the sub tree of this item.
      Parameters:
      r - the action to do on all items.
      Throws:
      Exception - if an exception occurs
    • hasChild

      default boolean hasChild(@Nonnull Base b)
      Does this item has the child b?
      Parameters:
      b - the child
      Returns:
      true if this item has the child b, false otherwise
    • existsInTree

      default boolean existsInTree()
      Does this item exists in the tree?
      Returns:
      true if the item exists in the tree, false otherwise