Class EvalWrapper

All Implemented Interfaces:
Serializable, Remote, EventListener, org.djutils.event.EventListener

public class EvalWrapper extends AbstractNodeDecoratorRemove
Wraps an evaluator for the editor. Any editor component that has content that depends on evaluation, may listen to this object via the editor and be notified of any change. In particular, changes involve changes in the input parameters. This wrapper makes sure that it returns an evaluator based on the current input parameters and selected scenario in the editor.

Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
See Also:
  • Constructor Details

    • EvalWrapper

      public EvalWrapper(OtsEditor editor)
      Constructor.
      Parameters:
      editor - OtsEditor; editor.
  • Method Details

    • getEval

      public org.djutils.eval.Eval getEval(ScenarioWrapper scenario)
      Returns expression evaluator.
      Parameters:
      scenario - ScenarioWrapper; selected scenario (of type as listed in dropdown menu).
      Returns:
      Eval; expression evaluator.
    • getLastValidEval

      public org.djutils.eval.Eval getLastValidEval()
      Returns the last evaluator that was valid, i.e. did not have a circular dependency between input parameters.
      Returns:
      Eval; last valid evaluator.
    • notifyCreated

      public void notifyCreated(XsdTreeNode node)
      Notified when a node has been created.
      Specified by:
      notifyCreated in class AbstractNodeDecorator
      Parameters:
      node - XsdTreeNode; created node.
    • notifyRemoved

      public void notifyRemoved(XsdTreeNode node)
      Notified when a node has been removed.
      Specified by:
      notifyRemoved in class AbstractNodeDecoratorRemove
      Parameters:
      node - XsdTreeNode; removed node.
    • notify

      public void notify(org.djutils.event.Event event) throws RemoteException
      Specified by:
      notify in interface org.djutils.event.EventListener
      Overrides:
      notify in class AbstractNodeDecoratorRemove
      Throws:
      RemoteException
    • setDirty

      public void setDirty()
      Sets the evaluator as being dirty, i.e. some input parameter was added, removed or changed. All listeners are notified.
    • addListener

      public void addListener(EvalWrapper.EvalListener listener)
      Adds listener to changes in the evaluator, i.e. added, removed or changed input parameters.
      Parameters:
      listener - EvalListener; listener.
    • removeListener

      public void removeListener(EvalWrapper.EvalListener listener)
      Removes listener to changes in the evaluator, i.e. added, removed or changed input parameters.
      Parameters:
      listener - EvalListener; listener.