]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/expression/node/Start.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.spreadsheet.common / src / org / simantics / spreadsheet / common / expression / node / Start.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 Start extends Node\r
20 {\r
21     private PExpression _pExpression_;\r
22     private EOF _eof_;\r
23 \r
24     public Start()\r
25     {\r
26         // Empty body\r
27     }\r
28 \r
29     public Start(\r
30         @SuppressWarnings("hiding") PExpression _pExpression_,\r
31         @SuppressWarnings("hiding") EOF _eof_)\r
32     {\r
33         setPExpression(_pExpression_);\r
34         setEOF(_eof_);\r
35     }\r
36 \r
37     @Override\r
38     public Object clone()\r
39     {\r
40         return new Start(\r
41             cloneNode(this._pExpression_),\r
42             cloneNode(this._eof_));\r
43     }\r
44 \r
45     public void apply(Switch sw)\r
46     {\r
47         ((Analysis) sw).caseStart(this);\r
48     }\r
49 \r
50     public PExpression getPExpression()\r
51     {\r
52         return this._pExpression_;\r
53     }\r
54 \r
55     public void setPExpression(PExpression node)\r
56     {\r
57         if(this._pExpression_ != null)\r
58         {\r
59             this._pExpression_.parent(null);\r
60         }\r
61 \r
62         if(node != null)\r
63         {\r
64             if(node.parent() != null)\r
65             {\r
66                 node.parent().removeChild(node);\r
67             }\r
68 \r
69             node.parent(this);\r
70         }\r
71 \r
72         this._pExpression_ = node;\r
73     }\r
74 \r
75     public EOF getEOF()\r
76     {\r
77         return this._eof_;\r
78     }\r
79 \r
80     public void setEOF(EOF node)\r
81     {\r
82         if(this._eof_ != null)\r
83         {\r
84             this._eof_.parent(null);\r
85         }\r
86 \r
87         if(node != null)\r
88         {\r
89             if(node.parent() != null)\r
90             {\r
91                 node.parent().removeChild(node);\r
92             }\r
93 \r
94             node.parent(this);\r
95         }\r
96 \r
97         this._eof_ = node;\r
98     }\r
99 \r
100     @Override\r
101     void removeChild(Node child)\r
102     {\r
103         if(this._pExpression_ == child)\r
104         {\r
105             this._pExpression_ = null;\r
106             return;\r
107         }\r
108 \r
109         if(this._eof_ == child)\r
110         {\r
111             this._eof_ = null;\r
112             return;\r
113         }\r
114 \r
115         throw new RuntimeException("Not a child.");\r
116     }\r
117 \r
118     @Override\r
119     void replaceChild(Node oldChild, Node newChild)\r
120     {\r
121         if(this._pExpression_ == oldChild)\r
122         {\r
123             setPExpression((PExpression) newChild);\r
124             return;\r
125         }\r
126 \r
127         if(this._eof_ == oldChild)\r
128         {\r
129             setEOF((EOF) newChild);\r
130             return;\r
131         }\r
132 \r
133         throw new RuntimeException("Not a child.");\r
134     }\r
135 \r
136     @Override\r
137     public String toString()\r
138     {\r
139         return "" +\r
140             toString(this._pExpression_) +\r
141             toString(this._eof_);\r
142     }\r
143 }\r