/* This file was generated by SableCC (http://www.sablecc.org/). */
package org.openflexo.antar.expr.parser.node;
import org.openflexo.antar.expr.parser.analysis.Analysis;
@SuppressWarnings("nls")
public final class ACondExprExpr extends PExpr {
private PExpr _condition_;
private TIfToken _ifToken_;
private PExpr2 _then_;
private TElseToken _elseToken_;
private PExpr2 _else_;
public ACondExprExpr() {
// Constructor
}
public ACondExprExpr(@SuppressWarnings("hiding") PExpr _condition_, @SuppressWarnings("hiding") TIfToken _ifToken_,
@SuppressWarnings("hiding") PExpr2 _then_, @SuppressWarnings("hiding") TElseToken _elseToken_,
@SuppressWarnings("hiding") PExpr2 _else_) {
// Constructor
setCondition(_condition_);
setIfToken(_ifToken_);
setThen(_then_);
setElseToken(_elseToken_);
setElse(_else_);
}
@Override
public Object clone() {
return new ACondExprExpr(cloneNode(this._condition_), cloneNode(this._ifToken_), cloneNode(this._then_),
cloneNode(this._elseToken_), cloneNode(this._else_));
}
@Override
public void apply(Switch sw) {
((Analysis) sw).caseACondExprExpr(this);
}
public PExpr getCondition() {
return this._condition_;
}
public void setCondition(PExpr node) {
if (this._condition_ != null) {
this._condition_.parent(null);
}
if (node != null) {
if (node.parent() != null) {
node.parent().removeChild(node);
}
node.parent(this);
}
this._condition_ = node;
}
public TIfToken getIfToken() {
return this._ifToken_;
}
public void setIfToken(TIfToken node) {
if (this._ifToken_ != null) {
this._ifToken_.parent(null);
}
if (node != null) {
if (node.parent() != null) {
node.parent().removeChild(node);
}
node.parent(this);
}
this._ifToken_ = node;
}
public PExpr2 getThen() {
return this._then_;
}
public void setThen(PExpr2 node) {
if (this._then_ != null) {
this._then_.parent(null);
}
if (node != null) {
if (node.parent() != null) {
node.parent().removeChild(node);
}
node.parent(this);
}
this._then_ = node;
}
public TElseToken getElseToken() {
return this._elseToken_;
}
public void setElseToken(TElseToken node) {
if (this._elseToken_ != null) {
this._elseToken_.parent(null);
}
if (node != null) {
if (node.parent() != null) {
node.parent().removeChild(node);
}
node.parent(this);
}
this._elseToken_ = node;
}
public PExpr2 getElse() {
return this._else_;
}
public void setElse(PExpr2 node) {
if (this._else_ != null) {
this._else_.parent(null);
}
if (node != null) {
if (node.parent() != null) {
node.parent().removeChild(node);
}
node.parent(this);
}
this._else_ = node;
}
@Override
public String toString() {
return "" + toString(this._condition_) + toString(this._ifToken_) + toString(this._then_) + toString(this._elseToken_)
+ toString(this._else_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child) {
// Remove child
if (this._condition_ == child) {
this._condition_ = null;
return;
}
if (this._ifToken_ == child) {
this._ifToken_ = null;
return;
}
if (this._then_ == child) {
this._then_ = null;
return;
}
if (this._elseToken_ == child) {
this._elseToken_ = null;
return;
}
if (this._else_ == child) {
this._else_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) {
// Replace child
if (this._condition_ == oldChild) {
setCondition((PExpr) newChild);
return;
}
if (this._ifToken_ == oldChild) {
setIfToken((TIfToken) newChild);
return;
}
if (this._then_ == oldChild) {
setThen((PExpr2) newChild);
return;
}
if (this._elseToken_ == oldChild) {
setElseToken((TElseToken) newChild);
return;
}
if (this._else_ == oldChild) {
setElse((PExpr2) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}