Start.java revision 56ed4167b942ec265f9cee70ac4d71d10b3835ce
15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/* This file was generated by SableCC (http://www.sablecc.org/). */
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)package com.google.clearsilver.jsilver.syntax.node;
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)import com.google.clearsilver.jsilver.syntax.analysis.*;
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)@SuppressWarnings("nls")
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)public final class Start extends Node
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles){
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    private PCommand _pCommand_;
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    private EOF _eof_;
125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    public Start()
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    {
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        // Empty body
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    }
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    public Start(
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        @SuppressWarnings("hiding") PCommand _pCommand_,
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        @SuppressWarnings("hiding") EOF _eof_)
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    {
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        setPCommand(_pCommand_);
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        setEOF(_eof_);
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    }
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    @Override
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    public Object clone()
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    {
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        return new Start(
30            cloneNode(this._pCommand_),
31            cloneNode(this._eof_));
32    }
33
34    public void apply(Switch sw)
35    {
36        ((Analysis) sw).caseStart(this);
37    }
38
39    public PCommand getPCommand()
40    {
41        return this._pCommand_;
42    }
43
44    public void setPCommand(PCommand node)
45    {
46        if(this._pCommand_ != null)
47        {
48            this._pCommand_.parent(null);
49        }
50
51        if(node != null)
52        {
53            if(node.parent() != null)
54            {
55                node.parent().removeChild(node);
56            }
57
58            node.parent(this);
59        }
60
61        this._pCommand_ = node;
62    }
63
64    public EOF getEOF()
65    {
66        return this._eof_;
67    }
68
69    public void setEOF(EOF node)
70    {
71        if(this._eof_ != null)
72        {
73            this._eof_.parent(null);
74        }
75
76        if(node != null)
77        {
78            if(node.parent() != null)
79            {
80                node.parent().removeChild(node);
81            }
82
83            node.parent(this);
84        }
85
86        this._eof_ = node;
87    }
88
89    @Override
90    void removeChild(Node child)
91    {
92        if(this._pCommand_ == child)
93        {
94            this._pCommand_ = null;
95            return;
96        }
97
98        if(this._eof_ == child)
99        {
100            this._eof_ = null;
101            return;
102        }
103
104        throw new RuntimeException("Not a child.");
105    }
106
107    @Override
108    void replaceChild(Node oldChild, Node newChild)
109    {
110        if(this._pCommand_ == oldChild)
111        {
112            setPCommand((PCommand) newChild);
113            return;
114        }
115
116        if(this._eof_ == oldChild)
117        {
118            setEOF((EOF) newChild);
119            return;
120        }
121
122        throw new RuntimeException("Not a child.");
123    }
124
125    @Override
126    public String toString()
127    {
128        return "" +
129            toString(this._pCommand_) +
130            toString(this._eof_);
131    }
132}
133