1 2 3 package org.sablecc.sablecc.syntax3.node; 4 5 import org.sablecc.sablecc.syntax3.analysis.*; 6 7 @SuppressWarnings ("nls") 8 public final class ANormalTransition extends PTransition 9 { 10 private TIdentifier _source_; 11 private PTokenCollection _tokenCollection_; 12 private TIdentifier _destination_; 13 14 public ANormalTransition() 15 { 16 } 18 19 public ANormalTransition( 20 @SuppressWarnings ("hiding") TIdentifier _source_, 21 @SuppressWarnings ("hiding") PTokenCollection _tokenCollection_, 22 @SuppressWarnings ("hiding") TIdentifier _destination_) 23 { 24 setSource(_source_); 26 27 setTokenCollection(_tokenCollection_); 28 29 setDestination(_destination_); 30 31 } 32 33 @Override 34 public Object clone() 35 { 36 return new ANormalTransition( 37 cloneNode(this._source_), 38 cloneNode(this._tokenCollection_), 39 cloneNode(this._destination_)); 40 } 41 42 public void apply(Switch sw) 43 { 44 ((Analysis) sw).caseANormalTransition(this); 45 } 46 47 public TIdentifier getSource() 48 { 49 return this._source_; 50 } 51 52 public void setSource(TIdentifier node) 53 { 54 if(this._source_ != null) 55 { 56 this._source_.parent(null); 57 } 58 59 if(node != null) 60 { 61 if(node.parent() != null) 62 { 63 node.parent().removeChild(node); 64 } 65 66 node.parent(this); 67 } 68 69 this._source_ = node; 70 } 71 72 public PTokenCollection getTokenCollection() 73 { 74 return this._tokenCollection_; 75 } 76 77 public void setTokenCollection(PTokenCollection node) 78 { 79 if(this._tokenCollection_ != null) 80 { 81 this._tokenCollection_.parent(null); 82 } 83 84 if(node != null) 85 { 86 if(node.parent() != null) 87 { 88 node.parent().removeChild(node); 89 } 90 91 node.parent(this); 92 } 93 94 this._tokenCollection_ = node; 95 } 96 97 public TIdentifier getDestination() 98 { 99 return this._destination_; 100 } 101 102 public void setDestination(TIdentifier node) 103 { 104 if(this._destination_ != null) 105 { 106 this._destination_.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._destination_ = node; 120 } 121 122 @Override 123 public String toString() 124 { 125 return "" 126 + toString(this._source_) 127 + toString(this._tokenCollection_) 128 + toString(this._destination_); 129 } 130 131 @Override 132 void removeChild(@SuppressWarnings ("unused") Node child) 133 { 134 if(this._source_ == child) 136 { 137 this._source_ = null; 138 return; 139 } 140 141 if(this._tokenCollection_ == child) 142 { 143 this._tokenCollection_ = null; 144 return; 145 } 146 147 if(this._destination_ == child) 148 { 149 this._destination_ = 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 if(this._source_ == oldChild) 161 { 162 setSource((TIdentifier) newChild); 163 return; 164 } 165 166 if(this._tokenCollection_ == oldChild) 167 { 168 setTokenCollection((PTokenCollection) newChild); 169 return; 170 } 171 172 if(this._destination_ == oldChild) 173 { 174 setDestination((TIdentifier) newChild); 175 return; 176 } 177 178 throw new RuntimeException ("Not a child."); 179 } 180 } 181 | Popular Tags |