1 package org.opentrafficsim.editor;
2
3 /**
4 * Wraps a scenario node as an item in the dropdown menu.
5 * <p>
6 * Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
7 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
8 * </p>
9 * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
10 * @param scenarioNode node of the scenario
11 */
12 public record ScenarioWrapper(XsdTreeNode scenarioNode)
13 {
14
15 /**
16 * Returns whether this wraps the given node.
17 * @param node node.
18 * @return whether this wraps the given node.
19 */
20 public boolean isScenario(final XsdTreeNode node)
21 {
22 return node.equals(this.scenarioNode);
23 }
24
25 /**
26 * Returns the scenario node.
27 * @return scenario node.
28 */
29 public XsdTreeNode scenarioNode()
30 {
31 return this.scenarioNode;
32 }
33
34 @Override
35 public String toString()
36 {
37 if (this.scenarioNode == null)
38 {
39 return "(Default)";
40 }
41 String id = this.scenarioNode.getId();
42 return id == null ? "(no id)" : id;
43 }
44
45 }