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

package lombok.ast;

public class UnaryExpression extends lombok.ast.AbstractNode implements lombok.ast.Expression, lombok.ast.DescribedNode {
	private java.util.List<lombok.ast.Position> parensPositions = new java.util.ArrayList<lombok.ast.Position>();
	private UnaryOperator operator = null;
	private lombok.ast.AbstractNode operand = null;
	
	public java.util.List<lombok.ast.Position> astParensPositions() {
		return this.parensPositions;
	}
	
	public UnaryOperator astOperator() {
		return this.operator;
	}
	
	public lombok.ast.UnaryExpression astOperator(UnaryOperator operator) {
		if (operator == null) throw new java.lang.NullPointerException("operator is mandatory");
		this.operator = operator;
		return this;
	}
	
	public Expression astOperand() {
		if (!(this.operand instanceof Expression)) return null;
		return (Expression) this.operand;
	}
	
	public lombok.ast.UnaryExpression astOperand(Expression operand) {
		if (operand == null) throw new java.lang.NullPointerException("operand is mandatory");
		return this.rawOperand(operand);
	}
	
	public lombok.ast.Node rawOperand() {
		return this.operand;
	}
	
	public lombok.ast.UnaryExpression rawOperand(lombok.ast.Node operand) {
		if (operand == this.operand) return this;
		if (operand != null) this.adopt((lombok.ast.AbstractNode)operand);
		if (this.operand != null) this.disown(this.operand);
		this.operand = (lombok.ast.AbstractNode)operand;
		return this;
	}
	
	@java.lang.Override public java.util.List<Node> getChildren() {
		java.util.List<Node> result = new java.util.ArrayList<Node>();
		if (this.operand != null) result.add(this.operand);
		return result;
	}
	
	@java.lang.Override public boolean replaceChild(Node original, Node replacement) throws lombok.ast.AstException {
		if (this.operand == original) {
			this.rawOperand(replacement);
			return true;
		}
		return false;
	}
	
	@java.lang.Override public boolean detach(Node child) {
		if (this.operand == child) {
			this.disown((AbstractNode) child);
			this.operand = null;
			return true;
		}
		return false;
	}
	
	@java.lang.Override public void accept(lombok.ast.AstVisitor visitor) {
		if (visitor.visitUnaryExpression(this)) return;
		if (this.operand != null) this.operand.accept(visitor);
		visitor.afterVisitUnaryExpression(this);
		visitor.endVisit(this);
	}
	
	@java.lang.Override public UnaryExpression copy() {
		UnaryExpression result = new UnaryExpression();
		result.parensPositions = new java.util.ArrayList<lombok.ast.Position>(this.parensPositions);
		result.operator = this.operator;
		if (this.operand != null) result.rawOperand(this.operand.copy());
		return result;
	}
	
	public java.lang.String getDescription() {
		return lombok.ast.UnaryExpressionTemplate.getDescription(this);
	}
	
	public boolean needsParentheses() {
		return lombok.ast.UnaryExpressionTemplate.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);
	}
	
}
