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

package lombok.ast;

public class InstanceInitializer extends lombok.ast.AbstractNode implements lombok.ast.TypeMember {
	private lombok.ast.AbstractNode body = null;
	
	public TypeBody upToTypeBody() {
		if (!(this.getParent() instanceof TypeBody)) return null;
		TypeBody out = (TypeBody)this.getParent();
		if (!out.rawMembers().contains(this)) return null;
		return out;
	}
	
	
	public Block astBody() {
		if (!(this.body instanceof Block)) return null;
		return (Block) this.body;
	}
	
	public lombok.ast.InstanceInitializer astBody(Block body) {
		if (body == null) throw new java.lang.NullPointerException("body is mandatory");
		return this.rawBody(body);
	}
	
	public lombok.ast.Node rawBody() {
		return this.body;
	}
	
	public lombok.ast.InstanceInitializer rawBody(lombok.ast.Node body) {
		if (body == this.body) return this;
		if (body != null) this.adopt((lombok.ast.AbstractNode)body);
		if (this.body != null) this.disown(this.body);
		this.body = (lombok.ast.AbstractNode)body;
		return this;
	}
	
	@java.lang.Override public java.util.List<Node> getChildren() {
		java.util.List<Node> result = new java.util.ArrayList<Node>();
		if (this.body != null) result.add(this.body);
		return result;
	}
	
	@java.lang.Override public boolean replaceChild(Node original, Node replacement) throws lombok.ast.AstException {
		if (this.body == original) {
			this.rawBody(replacement);
			return true;
		}
		return false;
	}
	
	@java.lang.Override public boolean detach(Node child) {
		if (this.body == child) {
			this.disown((AbstractNode) child);
			this.body = null;
			return true;
		}
		return false;
	}
	
	@java.lang.Override public void accept(lombok.ast.AstVisitor visitor) {
		if (visitor.visitInstanceInitializer(this)) return;
		if (this.body != null) this.body.accept(visitor);
		visitor.afterVisitInstanceInitializer(this);
		visitor.endVisit(this);
	}
	
	@java.lang.Override public InstanceInitializer copy() {
		InstanceInitializer result = new InstanceInitializer();
		if (this.body != null) result.rawBody(this.body.copy());
		return result;
	}
	
	public lombok.ast.TypeDeclaration upUpToTypeDeclaration() {
		return lombok.ast.TypeMemberMixin.upUpToTypeDeclaration(this);
	}
	
}
