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

package lombok.ast;

public class EnumTypeBody extends lombok.ast.AbstractNode implements lombok.ast.TypeBody {
	lombok.ast.ListAccessor<EnumConstant, lombok.ast.EnumTypeBody> constants = ListAccessor.of(this, EnumConstant.class, "EnumTypeBody.constants");
	lombok.ast.ListAccessor<TypeMember, lombok.ast.EnumTypeBody> members = ListAccessor.of(this, TypeMember.class, "EnumTypeBody.members");
	
	public EnumDeclaration upToEnumDeclaration() {
		if (!(this.getParent() instanceof EnumDeclaration)) return null;
		EnumDeclaration out = (EnumDeclaration)this.getParent();
		if (out.rawBody() != this) return null;
		return out;
	}
	
	public TypeDeclaration upToTypeDeclaration() {
		if (!(this.getParent() instanceof TypeDeclaration)) return null;
		TypeDeclaration out = (TypeDeclaration)this.getParent();
		if (out.rawBody() != this) return null;
		return out;
	}
	
	
	public lombok.ast.RawListAccessor<EnumConstant, lombok.ast.EnumTypeBody> rawConstants() {
		return this.constants.asRaw();
	}
	
	public lombok.ast.StrictListAccessor<EnumConstant, lombok.ast.EnumTypeBody> astConstants() {
		return this.constants.asStrict();
	}
	
	public lombok.ast.RawListAccessor<TypeMember, lombok.ast.EnumTypeBody> rawMembers() {
		return this.members.asRaw();
	}
	
	public lombok.ast.StrictListAccessor<TypeMember, lombok.ast.EnumTypeBody> astMembers() {
		return this.members.asStrict();
	}
	
	@java.lang.Override public java.util.List<Node> getChildren() {
		java.util.List<Node> result = new java.util.ArrayList<Node>();
		result.addAll(this.constants.backingList());
		result.addAll(this.members.backingList());
		return result;
	}
	
	@java.lang.Override public boolean replaceChild(Node original, Node replacement) throws lombok.ast.AstException {
		if (this.rawConstants().replace(original, replacement)) return true;
		if (this.rawMembers().replace(original, replacement)) return true;
		return false;
	}
	
	@java.lang.Override public boolean detach(Node child) {
		if (this.rawConstants().remove(child)) return true;
		if (this.rawMembers().remove(child)) return true;
		return false;
	}
	
	@java.lang.Override public void accept(lombok.ast.AstVisitor visitor) {
		if (visitor.visitEnumTypeBody(this)) return;
		for (lombok.ast.Node child : this.constants.asIterable()) {
			child.accept(visitor);
		}
		for (lombok.ast.Node child : this.members.asIterable()) {
			child.accept(visitor);
		}
		visitor.afterVisitEnumTypeBody(this);
		visitor.endVisit(this);
	}
	
	@java.lang.Override public EnumTypeBody copy() {
		EnumTypeBody result = new EnumTypeBody();
		for (Node n : this.constants.backingList()) {
			result.rawConstants().addToEnd(n == null ? null : n.copy());
		}
		for (Node n : this.members.backingList()) {
			result.rawMembers().addToEnd(n == null ? null : n.copy());
		}
		return result;
	}
	
	public ConstructorInvocation upIfAnonymousClassToConstructorInvocation() {
		return lombok.ast.EnumTypeBodyTemplate.upIfAnonymousClassToConstructorInvocation(this);
	}
	
	public EnumConstant upToEnumConstant() {
		return lombok.ast.EnumTypeBodyTemplate.upToEnumConstant(this);
	}
	
}
