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