]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/expression/node/APlusExpression.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.spreadsheet.common / src / org / simantics / spreadsheet / common / expression / node / APlusExpression.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 /* This file was generated by SableCC (http://www.sablecc.org/). */
13
14 package org.simantics.spreadsheet.common.expression.node;
15
16 import org.simantics.spreadsheet.common.expression.analysis.*;
17
18 @SuppressWarnings("nls")
19 public final class APlusExpression extends PExpression
20 {
21     private PExpression _left_;
22     private TPlus _plus_;
23     private PMultiplicative _right_;
24
25     public APlusExpression()
26     {
27         // Constructor
28     }
29
30     public APlusExpression(
31         @SuppressWarnings("hiding") PExpression _left_,
32         @SuppressWarnings("hiding") TPlus _plus_,
33         @SuppressWarnings("hiding") PMultiplicative _right_)
34     {
35         // Constructor
36         setLeft(_left_);
37
38         setPlus(_plus_);
39
40         setRight(_right_);
41
42     }
43
44     @Override
45     public Object clone()
46     {
47         return new APlusExpression(
48             cloneNode(this._left_),
49             cloneNode(this._plus_),
50             cloneNode(this._right_));
51     }
52
53     public void apply(Switch sw)
54     {
55         ((Analysis) sw).caseAPlusExpression(this);
56     }
57
58     public PExpression getLeft()
59     {
60         return this._left_;
61     }
62
63     public void setLeft(PExpression node)
64     {
65         if(this._left_ != null)
66         {
67             this._left_.parent(null);
68         }
69
70         if(node != null)
71         {
72             if(node.parent() != null)
73             {
74                 node.parent().removeChild(node);
75             }
76
77             node.parent(this);
78         }
79
80         this._left_ = node;
81     }
82
83     public TPlus getPlus()
84     {
85         return this._plus_;
86     }
87
88     public void setPlus(TPlus node)
89     {
90         if(this._plus_ != null)
91         {
92             this._plus_.parent(null);
93         }
94
95         if(node != null)
96         {
97             if(node.parent() != null)
98             {
99                 node.parent().removeChild(node);
100             }
101
102             node.parent(this);
103         }
104
105         this._plus_ = node;
106     }
107
108     public PMultiplicative getRight()
109     {
110         return this._right_;
111     }
112
113     public void setRight(PMultiplicative node)
114     {
115         if(this._right_ != null)
116         {
117             this._right_.parent(null);
118         }
119
120         if(node != null)
121         {
122             if(node.parent() != null)
123             {
124                 node.parent().removeChild(node);
125             }
126
127             node.parent(this);
128         }
129
130         this._right_ = node;
131     }
132
133     @Override
134     public String toString()
135     {
136         return ""
137             + toString(this._left_)
138             + toString(this._plus_)
139             + toString(this._right_);
140     }
141
142     @Override
143     void removeChild(@SuppressWarnings("unused") Node child)
144     {
145         // Remove child
146         if(this._left_ == child)
147         {
148             this._left_ = null;
149             return;
150         }
151
152         if(this._plus_ == child)
153         {
154             this._plus_ = null;
155             return;
156         }
157
158         if(this._right_ == child)
159         {
160             this._right_ = null;
161             return;
162         }
163
164         throw new RuntimeException("Not a child.");
165     }
166
167     @Override
168     void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
169     {
170         // Replace child
171         if(this._left_ == oldChild)
172         {
173             setLeft((PExpression) newChild);
174             return;
175         }
176
177         if(this._plus_ == oldChild)
178         {
179             setPlus((TPlus) newChild);
180             return;
181         }
182
183         if(this._right_ == oldChild)
184         {
185             setRight((PMultiplicative) newChild);
186             return;
187         }
188
189         throw new RuntimeException("Not a child.");
190     }
191 }