]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/expression/node/AUnaryminusUnary.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.spreadsheet.common / src / org / simantics / spreadsheet / common / expression / node / AUnaryminusUnary.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 /* This file was generated by SableCC (http://www.sablecc.org/). */\r
13 \r
14 package org.simantics.spreadsheet.common.expression.node;\r
15 \r
16 import org.simantics.spreadsheet.common.expression.analysis.*;\r
17 \r
18 @SuppressWarnings("nls")\r
19 public final class AUnaryminusUnary extends PUnary\r
20 {\r
21     private TMinus _minus_;\r
22     private PUnary _unary_;\r
23 \r
24     public AUnaryminusUnary()\r
25     {\r
26         // Constructor\r
27     }\r
28 \r
29     public AUnaryminusUnary(\r
30         @SuppressWarnings("hiding") TMinus _minus_,\r
31         @SuppressWarnings("hiding") PUnary _unary_)\r
32     {\r
33         // Constructor\r
34         setMinus(_minus_);\r
35 \r
36         setUnary(_unary_);\r
37 \r
38     }\r
39 \r
40     @Override\r
41     public Object clone()\r
42     {\r
43         return new AUnaryminusUnary(\r
44             cloneNode(this._minus_),\r
45             cloneNode(this._unary_));\r
46     }\r
47 \r
48     public void apply(Switch sw)\r
49     {\r
50         ((Analysis) sw).caseAUnaryminusUnary(this);\r
51     }\r
52 \r
53     public TMinus getMinus()\r
54     {\r
55         return this._minus_;\r
56     }\r
57 \r
58     public void setMinus(TMinus node)\r
59     {\r
60         if(this._minus_ != null)\r
61         {\r
62             this._minus_.parent(null);\r
63         }\r
64 \r
65         if(node != null)\r
66         {\r
67             if(node.parent() != null)\r
68             {\r
69                 node.parent().removeChild(node);\r
70             }\r
71 \r
72             node.parent(this);\r
73         }\r
74 \r
75         this._minus_ = node;\r
76     }\r
77 \r
78     public PUnary getUnary()\r
79     {\r
80         return this._unary_;\r
81     }\r
82 \r
83     public void setUnary(PUnary node)\r
84     {\r
85         if(this._unary_ != null)\r
86         {\r
87             this._unary_.parent(null);\r
88         }\r
89 \r
90         if(node != null)\r
91         {\r
92             if(node.parent() != null)\r
93             {\r
94                 node.parent().removeChild(node);\r
95             }\r
96 \r
97             node.parent(this);\r
98         }\r
99 \r
100         this._unary_ = node;\r
101     }\r
102 \r
103     @Override\r
104     public String toString()\r
105     {\r
106         return ""\r
107             + toString(this._minus_)\r
108             + toString(this._unary_);\r
109     }\r
110 \r
111     @Override\r
112     void removeChild(@SuppressWarnings("unused") Node child)\r
113     {\r
114         // Remove child\r
115         if(this._minus_ == child)\r
116         {\r
117             this._minus_ = null;\r
118             return;\r
119         }\r
120 \r
121         if(this._unary_ == child)\r
122         {\r
123             this._unary_ = null;\r
124             return;\r
125         }\r
126 \r
127         throw new RuntimeException("Not a child.");\r
128     }\r
129 \r
130     @Override\r
131     void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)\r
132     {\r
133         // Replace child\r
134         if(this._minus_ == oldChild)\r
135         {\r
136             setMinus((TMinus) newChild);\r
137             return;\r
138         }\r
139 \r
140         if(this._unary_ == oldChild)\r
141         {\r
142             setUnary((PUnary) newChild);\r
143             return;\r
144         }\r
145 \r
146         throw new RuntimeException("Not a child.");\r
147     }\r
148 }\r