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 AIncludeCommand extends PCommand 9 { 10 private PPosition _position_; 11 private PExpression _expression_; 12 AIncludeCommand()13 public AIncludeCommand() 14 { 15 // Constructor 16 } 17 AIncludeCommand( @uppressWarnings"hiding") PPosition _position_, @SuppressWarnings("hiding") PExpression _expression_)18 public AIncludeCommand( 19 @SuppressWarnings("hiding") PPosition _position_, 20 @SuppressWarnings("hiding") PExpression _expression_) 21 { 22 // Constructor 23 setPosition(_position_); 24 25 setExpression(_expression_); 26 27 } 28 29 @Override clone()30 public Object clone() 31 { 32 return new AIncludeCommand( 33 cloneNode(this._position_), 34 cloneNode(this._expression_)); 35 } 36 apply(Switch sw)37 public void apply(Switch sw) 38 { 39 ((Analysis) sw).caseAIncludeCommand(this); 40 } 41 getPosition()42 public PPosition getPosition() 43 { 44 return this._position_; 45 } 46 setPosition(PPosition node)47 public void setPosition(PPosition node) 48 { 49 if(this._position_ != null) 50 { 51 this._position_.parent(null); 52 } 53 54 if(node != null) 55 { 56 if(node.parent() != null) 57 { 58 node.parent().removeChild(node); 59 } 60 61 node.parent(this); 62 } 63 64 this._position_ = node; 65 } 66 getExpression()67 public PExpression getExpression() 68 { 69 return this._expression_; 70 } 71 setExpression(PExpression node)72 public void setExpression(PExpression node) 73 { 74 if(this._expression_ != null) 75 { 76 this._expression_.parent(null); 77 } 78 79 if(node != null) 80 { 81 if(node.parent() != null) 82 { 83 node.parent().removeChild(node); 84 } 85 86 node.parent(this); 87 } 88 89 this._expression_ = node; 90 } 91 92 @Override toString()93 public String toString() 94 { 95 return "" 96 + toString(this._position_) 97 + toString(this._expression_); 98 } 99 100 @Override removeChild(@uppressWarnings"unused") Node child)101 void removeChild(@SuppressWarnings("unused") Node child) 102 { 103 // Remove child 104 if(this._position_ == child) 105 { 106 this._position_ = null; 107 return; 108 } 109 110 if(this._expression_ == child) 111 { 112 this._expression_ = null; 113 return; 114 } 115 116 throw new RuntimeException("Not a child."); 117 } 118 119 @Override replaceChild(@uppressWarnings"unused") Node oldChild, @SuppressWarnings("unused") Node newChild)120 void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) 121 { 122 // Replace child 123 if(this._position_ == oldChild) 124 { 125 setPosition((PPosition) newChild); 126 return; 127 } 128 129 if(this._expression_ == oldChild) 130 { 131 setExpression((PExpression) newChild); 132 return; 133 } 134 135 throw new RuntimeException("Not a child."); 136 } 137 } 138