1 /* This file was generated by SableCC (http://www.sablecc.org/). */
3 package org.simantics.basicexpression.node;
5 import org.simantics.basicexpression.analysis.*;
7 @SuppressWarnings("nls")
8 public final class APlusExpression extends PExpression
10 private PExpression _left_;
12 private PMultiplicative _right_;
14 public APlusExpression()
19 public APlusExpression(
20 @SuppressWarnings("hiding") PExpression _left_,
21 @SuppressWarnings("hiding") TPlus _plus_,
22 @SuppressWarnings("hiding") PMultiplicative _right_)
36 return new APlusExpression(
37 cloneNode(this._left_),
38 cloneNode(this._plus_),
39 cloneNode(this._right_));
42 public void apply(Switch sw)
44 ((Analysis) sw).caseAPlusExpression(this);
47 public PExpression getLeft()
52 public void setLeft(PExpression node)
54 if(this._left_ != null)
56 this._left_.parent(null);
61 if(node.parent() != null)
63 node.parent().removeChild(node);
72 public TPlus getPlus()
77 public void setPlus(TPlus node)
79 if(this._plus_ != null)
81 this._plus_.parent(null);
86 if(node.parent() != null)
88 node.parent().removeChild(node);
97 public PMultiplicative getRight()
102 public void setRight(PMultiplicative node)
104 if(this._right_ != null)
106 this._right_.parent(null);
111 if(node.parent() != null)
113 node.parent().removeChild(node);
123 public String toString()
126 + toString(this._left_)
127 + toString(this._plus_)
128 + toString(this._right_);
132 void removeChild(@SuppressWarnings("unused") Node child)
135 if(this._left_ == child)
141 if(this._plus_ == child)
147 if(this._right_ == child)
153 throw new RuntimeException("Not a child.");
157 void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
160 if(this._left_ == oldChild)
162 setLeft((PExpression) newChild);
166 if(this._plus_ == oldChild)
168 setPlus((TPlus) newChild);
172 if(this._right_ == oldChild)
174 setRight((PMultiplicative) newChild);
178 throw new RuntimeException("Not a child.");