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

package lombok.ast;

public class This 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 qualifier = null;
	
	public java.util.List<lombok.ast.Position> astParensPositions() {
		return this.parensPositions;
	}
	
	public TypeReference astQualifier() {
		if (!(this.qualifier instanceof TypeReference)) return null;
		return (TypeReference) this.qualifier;
	}
	
	public lombok.ast.This astQualifier(TypeReference qualifier) {
		return this.rawQualifier(qualifier);
	}
	
	public lombok.ast.Node rawQualifier() {
		return this.qualifier;
	}
	
	public lombok.ast.This rawQualifier(lombok.ast.Node qualifier) {
		if (qualifier == this.qualifier) return this;
		if (qualifier != null) this.adopt((lombok.ast.AbstractNode)qualifier);
		if (this.qualifier != null) this.disown(this.qualifier);
		this.qualifier = (lombok.ast.AbstractNode)qualifier;
		return this;
	}
	
	@java.lang.Override public java.util.List<Node> getChildren() {
		java.util.List<Node> result = new java.util.ArrayList<Node>();
		if (this.qualifier != null) result.add(this.qualifier);
		return result;
	}
	
	@java.lang.Override public boolean replaceChild(Node original, Node replacement) throws lombok.ast.AstException {
		if (this.qualifier == original) {
			this.rawQualifier(replacement);
			return true;
		}
		return false;
	}
	
	@java.lang.Override public boolean detach(Node child) {
		if (this.qualifier == child) {
			this.disown((AbstractNode) child);
			this.qualifier = null;
			return true;
		}
		return false;
	}
	
	@java.lang.Override public void accept(lombok.ast.AstVisitor visitor) {
		if (visitor.visitThis(this)) return;
		if (this.qualifier != null) this.qualifier.accept(visitor);
		visitor.afterVisitThis(this);
		visitor.endVisit(this);
	}
	
	@java.lang.Override public This copy() {
		This result = new This();
		result.parensPositions = new java.util.ArrayList<lombok.ast.Position>(this.parensPositions);
		if (this.qualifier != null) result.rawQualifier(this.qualifier.copy());
		return result;
	}
	
	public int getParens() {
		return lombok.ast.ExpressionMixin.getParens(this);
	}
	
	public int getIntendedParens() {
		return lombok.ast.ExpressionMixin.getIntendedParens(this);
	}
	
	public boolean needsParentheses() {
		return lombok.ast.ExpressionMixin.needsParentheses(this);
	}
	
	public boolean isStatementExpression() {
		return lombok.ast.ExpressionMixin.isStatementExpression(this);
	}
	
}
