//Generated by lombok.ast.template.TemplateProcessor. DO NOT EDIT, DO NOT CHECK IN!

package lombok.ast;

public class InlineIfExpression extends lombok.ast.AbstractNode implements lombok.ast.Expression {
	private java.util.List<lombok.ast.Position> parensPositions = new java.util.ArrayList<lombok.ast.Position>();
	private lombok.ast.AbstractNode condition = null;
	private lombok.ast.AbstractNode ifTrue = null;
	private lombok.ast.AbstractNode ifFalse = null;
	
	public java.util.List<lombok.ast.Position> astParensPositions() {
		return this.parensPositions;
	}
	
	public Expression astCondition() {
		if (!(this.condition instanceof Expression)) return null;
		return (Expression) this.condition;
	}
	
	public lombok.ast.InlineIfExpression astCondition(Expression condition) {
		if (condition == null) throw new java.lang.NullPointerException("condition is mandatory");
		return this.rawCondition(condition);
	}
	
	public lombok.ast.Node rawCondition() {
		return this.condition;
	}
	
	public lombok.ast.InlineIfExpression rawCondition(lombok.ast.Node condition) {
		if (condition == this.condition) return this;
		if (condition != null) this.adopt((lombok.ast.AbstractNode)condition);
		if (this.condition != null) this.disown(this.condition);
		this.condition = (lombok.ast.AbstractNode)condition;
		return this;
	}
	
	public Expression astIfTrue() {
		if (!(this.ifTrue instanceof Expression)) return null;
		return (Expression) this.ifTrue;
	}
	
	public lombok.ast.InlineIfExpression astIfTrue(Expression ifTrue) {
		if (ifTrue == null) throw new java.lang.NullPointerException("ifTrue is mandatory");
		return this.rawIfTrue(ifTrue);
	}
	
	public lombok.ast.Node rawIfTrue() {
		return this.ifTrue;
	}
	
	public lombok.ast.InlineIfExpression rawIfTrue(lombok.ast.Node ifTrue) {
		if (ifTrue == this.ifTrue) return this;
		if (ifTrue != null) this.adopt((lombok.ast.AbstractNode)ifTrue);
		if (this.ifTrue != null) this.disown(this.ifTrue);
		this.ifTrue = (lombok.ast.AbstractNode)ifTrue;
		return this;
	}
	
	public Expression astIfFalse() {
		if (!(this.ifFalse instanceof Expression)) return null;
		return (Expression) this.ifFalse;
	}
	
	public lombok.ast.InlineIfExpression astIfFalse(Expression ifFalse) {
		if (ifFalse == null) throw new java.lang.NullPointerException("ifFalse is mandatory");
		return this.rawIfFalse(ifFalse);
	}
	
	public lombok.ast.Node rawIfFalse() {
		return this.ifFalse;
	}
	
	public lombok.ast.InlineIfExpression rawIfFalse(lombok.ast.Node ifFalse) {
		if (ifFalse == this.ifFalse) return this;
		if (ifFalse != null) this.adopt((lombok.ast.AbstractNode)ifFalse);
		if (this.ifFalse != null) this.disown(this.ifFalse);
		this.ifFalse = (lombok.ast.AbstractNode)ifFalse;
		return this;
	}
	
	@java.lang.Override public java.util.List<Node> getChildren() {
		java.util.List<Node> result = new java.util.ArrayList<Node>();
		if (this.condition != null) result.add(this.condition);
		if (this.ifTrue != null) result.add(this.ifTrue);
		if (this.ifFalse != null) result.add(this.ifFalse);
		return result;
	}
	
	@java.lang.Override public boolean replaceChild(Node original, Node replacement) throws lombok.ast.AstException {
		if (this.condition == original) {
			this.rawCondition(replacement);
			return true;
		}
		if (this.ifTrue == original) {
			this.rawIfTrue(replacement);
			return true;
		}
		if (this.ifFalse == original) {
			this.rawIfFalse(replacement);
			return true;
		}
		return false;
	}
	
	@java.lang.Override public boolean detach(Node child) {
		if (this.condition == child) {
			this.disown((AbstractNode) child);
			this.condition = null;
			return true;
		}
		if (this.ifTrue == child) {
			this.disown((AbstractNode) child);
			this.ifTrue = null;
			return true;
		}
		if (this.ifFalse == child) {
			this.disown((AbstractNode) child);
			this.ifFalse = null;
			return true;
		}
		return false;
	}
	
	@java.lang.Override public void accept(lombok.ast.AstVisitor visitor) {
		if (visitor.visitInlineIfExpression(this)) return;
		if (this.condition != null) this.condition.accept(visitor);
		if (this.ifTrue != null) this.ifTrue.accept(visitor);
		if (this.ifFalse != null) this.ifFalse.accept(visitor);
		visitor.afterVisitInlineIfExpression(this);
		visitor.endVisit(this);
	}
	
	@java.lang.Override public InlineIfExpression copy() {
		InlineIfExpression result = new InlineIfExpression();
		result.parensPositions = new java.util.ArrayList<lombok.ast.Position>(this.parensPositions);
		if (this.condition != null) result.rawCondition(this.condition.copy());
		if (this.ifTrue != null) result.rawIfTrue(this.ifTrue.copy());
		if (this.ifFalse != null) result.rawIfFalse(this.ifFalse.copy());
		return result;
	}
	
	public boolean needsParentheses() {
		return lombok.ast.InlineIfExpressionTemplate.needsParentheses(this);
	}
	
	public int getParens() {
		return lombok.ast.ExpressionMixin.getParens(this);
	}
	
	public int getIntendedParens() {
		return lombok.ast.ExpressionMixin.getIntendedParens(this);
	}
	
	public boolean isStatementExpression() {
		return lombok.ast.ExpressionMixin.isStatementExpression(this);
	}
	
}
