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 ABitComplementLevel2 extends PLevel2
009    {
010        private TBitComplement _bitComplement_;
011        private PLevel1 _level1_;
012    
013        public ABitComplementLevel2()
014        {
015            // Constructor
016        }
017    
018        public ABitComplementLevel2(
019            @SuppressWarnings("hiding") TBitComplement _bitComplement_,
020            @SuppressWarnings("hiding") PLevel1 _level1_)
021        {
022            // Constructor
023            setBitComplement(_bitComplement_);
024    
025            setLevel1(_level1_);
026    
027        }
028    
029        @Override
030        public Object clone()
031        {
032            return new ABitComplementLevel2(
033                cloneNode(this._bitComplement_),
034                cloneNode(this._level1_));
035        }
036    
037        public void apply(Switch sw)
038        {
039            ((Analysis) sw).caseABitComplementLevel2(this);
040        }
041    
042        public TBitComplement getBitComplement()
043        {
044            return this._bitComplement_;
045        }
046    
047        public void setBitComplement(TBitComplement node)
048        {
049            if(this._bitComplement_ != null)
050            {
051                this._bitComplement_.parent(null);
052            }
053    
054            if(node != null)
055            {
056                if(node.parent() != null)
057                {
058                    node.parent().removeChild(node);
059                }
060    
061                node.parent(this);
062            }
063    
064            this._bitComplement_ = node;
065        }
066    
067        public PLevel1 getLevel1()
068        {
069            return this._level1_;
070        }
071    
072        public void setLevel1(PLevel1 node)
073        {
074            if(this._level1_ != null)
075            {
076                this._level1_.parent(null);
077            }
078    
079            if(node != null)
080            {
081                if(node.parent() != null)
082                {
083                    node.parent().removeChild(node);
084                }
085    
086                node.parent(this);
087            }
088    
089            this._level1_ = node;
090        }
091    
092        @Override
093        public String toString()
094        {
095            return ""
096                + toString(this._bitComplement_)
097                + toString(this._level1_);
098        }
099    
100        @Override
101        void removeChild(@SuppressWarnings("unused") Node child)
102        {
103            // Remove child
104            if(this._bitComplement_ == child)
105            {
106                this._bitComplement_ = null;
107                return;
108            }
109    
110            if(this._level1_ == child)
111            {
112                this._level1_ = null;
113                return;
114            }
115    
116            throw new RuntimeException("Not a child.");
117        }
118    
119        @Override
120        void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
121        {
122            // Replace child
123            if(this._bitComplement_ == oldChild)
124            {
125                setBitComplement((TBitComplement) newChild);
126                return;
127            }
128    
129            if(this._level1_ == oldChild)
130            {
131                setLevel1((PLevel1) newChild);
132                return;
133            }
134    
135            throw new RuntimeException("Not a child.");
136        }
137    }