//generated by abstract-syntax-gen
package de.peeeq.wurstscript.jassIm;
import java.util.*;

@SuppressWarnings({"cast", "unused", "rawtypes"})
class ImVoidImpl implements ImVoid{
    ImVoidImpl() {
    }

    private Element parent;
    public Element getParent() { return parent; }
    public void setParent(Element parent) {
        if (parent != null && this.parent != null) {
            throw new Error("Cannot change parent of element " + this.getClass().getSimpleName() + ", as it is already used in another tree."
                + "Use the copy method to create a new tree or remove the tree from its old parent or set the parent to null before moving the tree. ");
        }
        this.parent = parent;
    }

    public void replaceBy(Element other) {
        if (parent == null)
            throw new RuntimeException("Node not attached to tree.");
        for (int i=0; i<parent.size(); i++) {
            if (parent.get(i) == this) {
                parent.set(i, other);
                return;
            }
        }
    }

    public Element get(int i) {
        switch (i) {
            default: throw new IllegalArgumentException("Index out of range: " + i);
        }
    }
    public Element set(int i, Element newElem) {
        Element oldElem;
        switch (i) {
            default: throw new IllegalArgumentException("Index out of range: " + i);
        }
    }

    @Override
    public void forEachElement(java.util.function.Consumer<? super Element> action) {
    }
    public int size() {
        return 0;
    }
    @Override public ImVoid copy() {
        ImVoid result = new ImVoidImpl();
        return result;
    }

    @Override public ImVoid copyWithRefs() {
        ImVoid res = copy();
        return res;
    }

    @Override public void clearAttributes() {
        clearAttributesLocal();
    }
    @Override public void clearAttributesLocal() {
        zzattr_defaultValue_state = 0;
    }
    @Override public void accept(Visitor v) {
        v.visit(this);
    }
    @Override public <T> T match(ImType.Matcher<T> matcher) {
        return matcher.case_ImVoid(this);
    }
    @Override public void match(ImType.MatcherVoid matcher) {
        matcher.case_ImVoid(this);
    }

    @Override public <T> T match(ImPrintable.Matcher<T> matcher) {
        return matcher.case_ImVoid(this);
    }
    @Override public void match(ImPrintable.MatcherVoid matcher) {
        matcher.case_ImVoid(this);
    }

    @Override public <T> T match(Element.Matcher<T> matcher) {
        return matcher.case_ImVoid(this);
    }
    @Override public void match(Element.MatcherVoid matcher) {
        matcher.case_ImVoid(this);
    }

    public boolean structuralEquals(Element e) {
        return e instanceof ImVoid;
    }
// circular = null
    private int zzattr_defaultValue_state = 0;
    private de.peeeq.wurstscript.intermediatelang.ILconst zzattr_defaultValue_cache;
    /** */
    public de.peeeq.wurstscript.intermediatelang.ILconst defaultValue() {
        if (zzattr_defaultValue_state == 0) {
            try {
                zzattr_defaultValue_state = 1;
                zzattr_defaultValue_cache = de.peeeq.wurstscript.translation.imtojass.DefaultValue.get((ImVoid)this);
            } finally {
                zzattr_defaultValue_state = 0;
            }
            zzattr_defaultValue_state = 2;
        } else if (zzattr_defaultValue_state == 1) {
            throw new CyclicDependencyError(this, "defaultValue");
        }
        return zzattr_defaultValue_cache;
    }
    /** */
    public void print(java.lang.Appendable sb, int indent) {
        de.peeeq.wurstscript.translation.imtranslation.ImPrinter.print((ImVoid)this, sb, indent);
    }
    /** */
    public String toString() {
        return de.peeeq.wurstscript.translation.imtranslation.ImPrinter.asString((ImVoid)this);
    }
    /** */
    public ImFunction getNearestFunc() {
        return de.peeeq.wurstscript.translation.imtojass.ImAttributes.getNearestFunc((ImVoid)this);
    }
    /** */
    public boolean equalsType(ImType other) {
        return de.peeeq.wurstscript.translation.imtojass.TypeEquality.isEqualType((ImVoid)this, other);
    }
    /** */
    public String translateType() {
        return de.peeeq.wurstscript.translation.imtojass.ImAttributes.translateType((ImVoid)this);
    }
    /** */
    public de.peeeq.wurstscript.ast.Element attrTrace() {
        return de.peeeq.wurstscript.translation.imtojass.ImAttributes.getTrace((ImVoid)this);
    }
    /** */
    public ImProg attrProg() {
        return de.peeeq.wurstscript.translation.imtojass.ImAttributes.getProg((ImVoid)this);
    }
}