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

package lombok.ast;

public class ConstructorInvocation 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 lombok.ast.AbstractNode qualifier = null;
	lombok.ast.ListAccessor<TypeReference, lombok.ast.ConstructorInvocation> constructorTypeArguments = ListAccessor.of(this, TypeReference.class, "ConstructorInvocation.constructorTypeArguments");
	private lombok.ast.AbstractNode typeReference = null;
	lombok.ast.ListAccessor<Expression, lombok.ast.ConstructorInvocation> arguments = ListAccessor.of(this, Expression.class, "ConstructorInvocation.arguments");
	private lombok.ast.AbstractNode anonymousClassBody = null;
	
	public java.util.List<lombok.ast.Position> astParensPositions() {
		return this.parensPositions;
	}
	
	public Expression astQualifier() {
		if (!(this.qualifier instanceof Expression)) return null;
		return (Expression) this.qualifier;
	}
	
	public lombok.ast.ConstructorInvocation astQualifier(Expression qualifier) {
		return this.rawQualifier(qualifier);
	}
	
	public lombok.ast.Node rawQualifier() {
		return this.qualifier;
	}
	
	public lombok.ast.ConstructorInvocation 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;
	}
	
	public lombok.ast.RawListAccessor<TypeReference, lombok.ast.ConstructorInvocation> rawConstructorTypeArguments() {
		return this.constructorTypeArguments.asRaw();
	}
	
	public lombok.ast.StrictListAccessor<TypeReference, lombok.ast.ConstructorInvocation> astConstructorTypeArguments() {
		return this.constructorTypeArguments.asStrict();
	}
	
	public TypeReference astTypeReference() {
		if (!(this.typeReference instanceof TypeReference)) return null;
		return (TypeReference) this.typeReference;
	}
	
	public lombok.ast.ConstructorInvocation astTypeReference(TypeReference typeReference) {
		if (typeReference == null) throw new java.lang.NullPointerException("typeReference is mandatory");
		return this.rawTypeReference(typeReference);
	}
	
	public lombok.ast.Node rawTypeReference() {
		return this.typeReference;
	}
	
	public lombok.ast.ConstructorInvocation rawTypeReference(lombok.ast.Node typeReference) {
		if (typeReference == this.typeReference) return this;
		if (typeReference != null) this.adopt((lombok.ast.AbstractNode)typeReference);
		if (this.typeReference != null) this.disown(this.typeReference);
		this.typeReference = (lombok.ast.AbstractNode)typeReference;
		return this;
	}
	
	public lombok.ast.RawListAccessor<Expression, lombok.ast.ConstructorInvocation> rawArguments() {
		return this.arguments.asRaw();
	}
	
	public lombok.ast.StrictListAccessor<Expression, lombok.ast.ConstructorInvocation> astArguments() {
		return this.arguments.asStrict();
	}
	
	public NormalTypeBody astAnonymousClassBody() {
		if (!(this.anonymousClassBody instanceof NormalTypeBody)) return null;
		return (NormalTypeBody) this.anonymousClassBody;
	}
	
	public lombok.ast.ConstructorInvocation astAnonymousClassBody(NormalTypeBody anonymousClassBody) {
		return this.rawAnonymousClassBody(anonymousClassBody);
	}
	
	public lombok.ast.Node rawAnonymousClassBody() {
		return this.anonymousClassBody;
	}
	
	public lombok.ast.ConstructorInvocation rawAnonymousClassBody(lombok.ast.Node anonymousClassBody) {
		if (anonymousClassBody == this.anonymousClassBody) return this;
		if (anonymousClassBody != null) this.adopt((lombok.ast.AbstractNode)anonymousClassBody);
		if (this.anonymousClassBody != null) this.disown(this.anonymousClassBody);
		this.anonymousClassBody = (lombok.ast.AbstractNode)anonymousClassBody;
		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);
		result.addAll(this.constructorTypeArguments.backingList());
		if (this.typeReference != null) result.add(this.typeReference);
		result.addAll(this.arguments.backingList());
		if (this.anonymousClassBody != null) result.add(this.anonymousClassBody);
		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;
		}
		if (this.rawConstructorTypeArguments().replace(original, replacement)) return true;
		if (this.typeReference == original) {
			this.rawTypeReference(replacement);
			return true;
		}
		if (this.rawArguments().replace(original, replacement)) return true;
		if (this.anonymousClassBody == original) {
			this.rawAnonymousClassBody(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;
		}
		if (this.rawConstructorTypeArguments().remove(child)) return true;
		if (this.typeReference == child) {
			this.disown((AbstractNode) child);
			this.typeReference = null;
			return true;
		}
		if (this.rawArguments().remove(child)) return true;
		if (this.anonymousClassBody == child) {
			this.disown((AbstractNode) child);
			this.anonymousClassBody = null;
			return true;
		}
		return false;
	}
	
	@java.lang.Override public void accept(lombok.ast.AstVisitor visitor) {
		if (visitor.visitConstructorInvocation(this)) return;
		if (this.qualifier != null) this.qualifier.accept(visitor);
		for (lombok.ast.Node child : this.constructorTypeArguments.asIterable()) {
			child.accept(visitor);
		}
		if (this.typeReference != null) this.typeReference.accept(visitor);
		for (lombok.ast.Node child : this.arguments.asIterable()) {
			child.accept(visitor);
		}
		if (this.anonymousClassBody != null) this.anonymousClassBody.accept(visitor);
		visitor.afterVisitConstructorInvocation(this);
		visitor.endVisit(this);
	}
	
	@java.lang.Override public ConstructorInvocation copy() {
		ConstructorInvocation result = new ConstructorInvocation();
		result.parensPositions = new java.util.ArrayList<lombok.ast.Position>(this.parensPositions);
		if (this.qualifier != null) result.rawQualifier(this.qualifier.copy());
		for (Node n : this.constructorTypeArguments.backingList()) {
			result.rawConstructorTypeArguments().addToEnd(n == null ? null : n.copy());
		}
		if (this.typeReference != null) result.rawTypeReference(this.typeReference.copy());
		for (Node n : this.arguments.backingList()) {
			result.rawArguments().addToEnd(n == null ? null : n.copy());
		}
		if (this.anonymousClassBody != null) result.rawAnonymousClassBody(this.anonymousClassBody.copy());
		return result;
	}
	
	public java.lang.String getDescription() {
		return lombok.ast.ConstructorInvocationTemplate.getDescription(this);
	}
	
	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);
	}
	
}
