]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.basicexpression/src/org/simantics/basicexpression/node/AValuePrimary.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.basicexpression / src / org / simantics / basicexpression / node / AValuePrimary.java
1 /* This file was generated by SableCC (http://www.sablecc.org/). */\r
2 \r
3 package org.simantics.basicexpression.node;\r
4 \r
5 import org.simantics.basicexpression.analysis.*;\r
6 \r
7 @SuppressWarnings("nls")\r
8 public final class AValuePrimary extends PPrimary\r
9 {\r
10     private PValue _value_;\r
11 \r
12     public AValuePrimary()\r
13     {\r
14         // Constructor\r
15     }\r
16 \r
17     public AValuePrimary(\r
18         @SuppressWarnings("hiding") PValue _value_)\r
19     {\r
20         // Constructor\r
21         setValue(_value_);\r
22 \r
23     }\r
24 \r
25     @Override\r
26     public Object clone()\r
27     {\r
28         return new AValuePrimary(\r
29             cloneNode(this._value_));\r
30     }\r
31 \r
32     public void apply(Switch sw)\r
33     {\r
34         ((Analysis) sw).caseAValuePrimary(this);\r
35     }\r
36 \r
37     public PValue getValue()\r
38     {\r
39         return this._value_;\r
40     }\r
41 \r
42     public void setValue(PValue node)\r
43     {\r
44         if(this._value_ != null)\r
45         {\r
46             this._value_.parent(null);\r
47         }\r
48 \r
49         if(node != null)\r
50         {\r
51             if(node.parent() != null)\r
52             {\r
53                 node.parent().removeChild(node);\r
54             }\r
55 \r
56             node.parent(this);\r
57         }\r
58 \r
59         this._value_ = node;\r
60     }\r
61 \r
62     @Override\r
63     public String toString()\r
64     {\r
65         return ""\r
66             + toString(this._value_);\r
67     }\r
68 \r
69     @Override\r
70     void removeChild(@SuppressWarnings("unused") Node child)\r
71     {\r
72         // Remove child\r
73         if(this._value_ == child)\r
74         {\r
75             this._value_ = null;\r
76             return;\r
77         }\r
78 \r
79         throw new RuntimeException("Not a child.");\r
80     }\r
81 \r
82     @Override\r
83     void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)\r
84     {\r
85         // Replace child\r
86         if(this._value_ == oldChild)\r
87         {\r
88             setValue((PValue) newChild);\r
89             return;\r
90         }\r
91 \r
92         throw new RuntimeException("Not a child.");\r
93     }\r
94 }\r