]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/expression/node/ASingleArgList.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.spreadsheet.common / src / org / simantics / spreadsheet / common / expression / node / ASingleArgList.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 ASingleArgList extends PArgList\r
20 {\r
21     private PExpression _expression_;\r
22 \r
23     public ASingleArgList()\r
24     {\r
25         // Constructor\r
26     }\r
27 \r
28     public ASingleArgList(\r
29         @SuppressWarnings("hiding") PExpression _expression_)\r
30     {\r
31         // Constructor\r
32         setExpression(_expression_);\r
33 \r
34     }\r
35 \r
36     @Override\r
37     public Object clone()\r
38     {\r
39         return new ASingleArgList(\r
40             cloneNode(this._expression_));\r
41     }\r
42 \r
43     public void apply(Switch sw)\r
44     {\r
45         ((Analysis) sw).caseASingleArgList(this);\r
46     }\r
47 \r
48     public PExpression getExpression()\r
49     {\r
50         return this._expression_;\r
51     }\r
52 \r
53     public void setExpression(PExpression node)\r
54     {\r
55         if(this._expression_ != null)\r
56         {\r
57             this._expression_.parent(null);\r
58         }\r
59 \r
60         if(node != null)\r
61         {\r
62             if(node.parent() != null)\r
63             {\r
64                 node.parent().removeChild(node);\r
65             }\r
66 \r
67             node.parent(this);\r
68         }\r
69 \r
70         this._expression_ = node;\r
71     }\r
72 \r
73     @Override\r
74     public String toString()\r
75     {\r
76         return ""\r
77             + toString(this._expression_);\r
78     }\r
79 \r
80     @Override\r
81     void removeChild(@SuppressWarnings("unused") Node child)\r
82     {\r
83         // Remove child\r
84         if(this._expression_ == child)\r
85         {\r
86             this._expression_ = null;\r
87             return;\r
88         }\r
89 \r
90         throw new RuntimeException("Not a child.");\r
91     }\r
92 \r
93     @Override\r
94     void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)\r
95     {\r
96         // Replace child\r
97         if(this._expression_ == oldChild)\r
98         {\r
99             setExpression((PExpression) newChild);\r
100             return;\r
101         }\r
102 \r
103         throw new RuntimeException("Not a child.");\r
104     }\r
105 }\r