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