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