Home | History | Annotate | Download | only in node
      1 /* This file was generated by SableCC (http://www.sablecc.org/). */
      2 
      3 package com.google.clearsilver.jsilver.syntax.node;
      4 
      5 import com.google.clearsilver.jsilver.syntax.analysis.*;
      6 
      7 @SuppressWarnings("nls")
      8 public final class Start extends Node
      9 {
     10     private PCommand _pCommand_;
     11     private EOF _eof_;
     12 
     13     public Start()
     14     {
     15         // Empty body
     16     }
     17 
     18     public Start(
     19         @SuppressWarnings("hiding") PCommand _pCommand_,
     20         @SuppressWarnings("hiding") EOF _eof_)
     21     {
     22         setPCommand(_pCommand_);
     23         setEOF(_eof_);
     24     }
     25 
     26     @Override
     27     public Object clone()
     28     {
     29         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