Package org.opentrafficsim.editor
Class EvalWrapper
java.lang.Object
org.opentrafficsim.editor.decoration.AbstractNodeDecorator
org.opentrafficsim.editor.decoration.AbstractNodeDecoratorRemove
org.opentrafficsim.editor.EvalWrapper
- All Implemented Interfaces:
Serializable
,Remote
,EventListener
,org.djutils.event.EventListener
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface for listeners that need to know when evaluation results may have changed. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(EvalWrapper.EvalListener listener) Adds listener to changes in the evaluator, i.e. added, removed or changed input parameters.org.djutils.eval.Eval
getEval
(ScenarioWrapper scenario) Returns expression evaluator.org.djutils.eval.Eval
Returns the last evaluator that was valid, i.e. did not have a circular dependency between input parameters.void
notify
(org.djutils.event.Event event) void
notifyCreated
(XsdTreeNode node) Notified when a node has been created.void
notifyRemoved
(XsdTreeNode node) Notified when a node has been removed.void
removeListener
(EvalWrapper.EvalListener listener) Removes listener to changes in the evaluator, i.e. added, removed or changed input parameters.void
setDirty()
Sets the evaluator as being dirty, i.e. some input parameter was added, removed or changed.
-
Constructor Details
-
EvalWrapper
Constructor.- Parameters:
editor
- OtsEditor; editor.
-
-
Method Details
-
getEval
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
Notified when a node has been created.- Specified by:
notifyCreated
in classAbstractNodeDecorator
- Parameters:
node
- XsdTreeNode; created node.
-
notifyRemoved
Notified when a node has been removed.- Specified by:
notifyRemoved
in classAbstractNodeDecoratorRemove
- Parameters:
node
- XsdTreeNode; removed node.
-
notify
- Specified by:
notify
in interfaceorg.djutils.event.EventListener
- Overrides:
notify
in classAbstractNodeDecoratorRemove
- 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
Adds listener to changes in the evaluator, i.e. added, removed or changed input parameters.- Parameters:
listener
- EvalListener; listener.
-
removeListener
Removes listener to changes in the evaluator, i.e. added, removed or changed input parameters.- Parameters:
listener
- EvalListener; listener.
-