001    /* This file was generated by SableCC (http://www.sablecc.org/). */
002    
003    package org.jdmp.core.script.jdmp.node;
004    
005    import org.jdmp.core.script.jdmp.analysis.*;
006    
007    @SuppressWarnings("nls")
008    public final class Start extends Node
009    {
010        private PScript _pScript_;
011        private EOF _eof_;
012    
013        public Start()
014        {
015            // Empty body
016        }
017    
018        public Start(
019            @SuppressWarnings("hiding") PScript _pScript_,
020            @SuppressWarnings("hiding") EOF _eof_)
021        {
022            setPScript(_pScript_);
023            setEOF(_eof_);
024        }
025    
026        @Override
027        public Object clone()
028        {
029            return new Start(
030                cloneNode(this._pScript_),
031                cloneNode(this._eof_));
032        }
033    
034        public void apply(Switch sw)
035        {
036            ((Analysis) sw).caseStart(this);
037        }
038    
039        public PScript getPScript()
040        {
041            return this._pScript_;
042        }
043    
044        public void setPScript(PScript node)
045        {
046            if(this._pScript_ != null)
047            {
048                this._pScript_.parent(null);
049            }
050    
051            if(node != null)
052            {
053                if(node.parent() != null)
054                {
055                    node.parent().removeChild(node);
056                }
057    
058                node.parent(this);
059            }
060    
061            this._pScript_ = node;
062        }
063    
064        public EOF getEOF()
065        {
066            return this._eof_;
067        }
068    
069        public void setEOF(EOF node)
070        {
071            if(this._eof_ != null)
072            {
073                this._eof_.parent(null);
074            }
075    
076            if(node != null)
077            {
078                if(node.parent() != null)
079                {
080                    node.parent().removeChild(node);
081                }
082    
083                node.parent(this);
084            }
085    
086            this._eof_ = node;
087        }
088    
089        @Override
090        void removeChild(Node child)
091        {
092            if(this._pScript_ == child)
093            {
094                this._pScript_ = null;
095                return;
096            }
097    
098            if(this._eof_ == child)
099            {
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._pScript_ == oldChild)
111            {
112                setPScript((PScript) 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._pScript_) +
130                toString(this._eof_);
131        }
132    }