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 AEmptyFunction extends PFunction
009    {
010        private PName _name_;
011        private TLParenthese _lParenthese_;
012        private TRParenthese _rParenthese_;
013    
014        public AEmptyFunction()
015        {
016            // Constructor
017        }
018    
019        public AEmptyFunction(
020            @SuppressWarnings("hiding") PName _name_,
021            @SuppressWarnings("hiding") TLParenthese _lParenthese_,
022            @SuppressWarnings("hiding") TRParenthese _rParenthese_)
023        {
024            // Constructor
025            setName(_name_);
026    
027            setLParenthese(_lParenthese_);
028    
029            setRParenthese(_rParenthese_);
030    
031        }
032    
033        @Override
034        public Object clone()
035        {
036            return new AEmptyFunction(
037                cloneNode(this._name_),
038                cloneNode(this._lParenthese_),
039                cloneNode(this._rParenthese_));
040        }
041    
042        public void apply(Switch sw)
043        {
044            ((Analysis) sw).caseAEmptyFunction(this);
045        }
046    
047        public PName getName()
048        {
049            return this._name_;
050        }
051    
052        public void setName(PName node)
053        {
054            if(this._name_ != null)
055            {
056                this._name_.parent(null);
057            }
058    
059            if(node != null)
060            {
061                if(node.parent() != null)
062                {
063                    node.parent().removeChild(node);
064                }
065    
066                node.parent(this);
067            }
068    
069            this._name_ = node;
070        }
071    
072        public TLParenthese getLParenthese()
073        {
074            return this._lParenthese_;
075        }
076    
077        public void setLParenthese(TLParenthese node)
078        {
079            if(this._lParenthese_ != null)
080            {
081                this._lParenthese_.parent(null);
082            }
083    
084            if(node != null)
085            {
086                if(node.parent() != null)
087                {
088                    node.parent().removeChild(node);
089                }
090    
091                node.parent(this);
092            }
093    
094            this._lParenthese_ = node;
095        }
096    
097        public TRParenthese getRParenthese()
098        {
099            return this._rParenthese_;
100        }
101    
102        public void setRParenthese(TRParenthese node)
103        {
104            if(this._rParenthese_ != null)
105            {
106                this._rParenthese_.parent(null);
107            }
108    
109            if(node != null)
110            {
111                if(node.parent() != null)
112                {
113                    node.parent().removeChild(node);
114                }
115    
116                node.parent(this);
117            }
118    
119            this._rParenthese_ = node;
120        }
121    
122        @Override
123        public String toString()
124        {
125            return ""
126                + toString(this._name_)
127                + toString(this._lParenthese_)
128                + toString(this._rParenthese_);
129        }
130    
131        @Override
132        void removeChild(@SuppressWarnings("unused") Node child)
133        {
134            // Remove child
135            if(this._name_ == child)
136            {
137                this._name_ = null;
138                return;
139            }
140    
141            if(this._lParenthese_ == child)
142            {
143                this._lParenthese_ = null;
144                return;
145            }
146    
147            if(this._rParenthese_ == child)
148            {
149                this._rParenthese_ = null;
150                return;
151            }
152    
153            throw new RuntimeException("Not a child.");
154        }
155    
156        @Override
157        void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
158        {
159            // Replace child
160            if(this._name_ == oldChild)
161            {
162                setName((PName) newChild);
163                return;
164            }
165    
166            if(this._lParenthese_ == oldChild)
167            {
168                setLParenthese((TLParenthese) newChild);
169                return;
170            }
171    
172            if(this._rParenthese_ == oldChild)
173            {
174                setRParenthese((TRParenthese) newChild);
175                return;
176            }
177    
178            throw new RuntimeException("Not a child.");
179        }
180    }