001/* This file was generated by SableCC (http://www.sablecc.org/). */
002
003package org.anarres.graphviz.parser.node;
004
005import org.anarres.graphviz.parser.analysis.*;
006
007@SuppressWarnings("nls")
008public final class Start extends Node
009{
010    private PGraph _pGraph_;
011    private EOF _eof_;
012
013    public Start()
014    {
015        // Empty body
016    }
017
018    public Start(
019        @SuppressWarnings("hiding") PGraph _pGraph_,
020        @SuppressWarnings("hiding") EOF _eof_)
021    {
022        setPGraph(_pGraph_);
023        setEOF(_eof_);
024    }
025
026    @Override
027    public Object clone()
028    {
029        return new Start(
030            cloneNode(this._pGraph_),
031            cloneNode(this._eof_));
032    }
033
034    public void apply(Switch sw)
035    {
036        ((Analysis) sw).caseStart(this);
037    }
038
039    public PGraph getPGraph()
040    {
041        return this._pGraph_;
042    }
043
044    public void setPGraph(PGraph node)
045    {
046        if(this._pGraph_ != null)
047        {
048            this._pGraph_.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._pGraph_ = 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._pGraph_ == child)
093        {
094            this._pGraph_ = 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._pGraph_ == oldChild)
111        {
112            setPGraph((PGraph) 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._pGraph_) +
130            toString(this._eof_);
131    }
132}