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

@SuppressWarnings({"cast", "unused", "rawtypes"})
class ModVarargImpl implements ModVararg{
    ModVarargImpl(de.peeeq.wurstscript.parser.WPos source) {
        if (source == null)
            throw new IllegalArgumentException("Element source must not be null.");
        this.source = source;
    }

    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;
            }
        }
    }

    private de.peeeq.wurstscript.parser.WPos source;
    public void setSource(de.peeeq.wurstscript.parser.WPos source) {
        if (source == null) throw new IllegalArgumentException();
        this.source = source;
    } 
    public de.peeeq.wurstscript.parser.WPos getSource() { return source; }

    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 ModVararg copy() {
        ModVararg result = new ModVarargImpl(source);
        return result;
    }

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

    @Override public void clearAttributes() {
        clearAttributesLocal();
    }
    @Override public void clearAttributesLocal() {
    }
    @Override public void accept(Visitor v) {
        v.visit(this);
    }
    @Override public <T> T match(AstElementWithSource.Matcher<T> matcher) {
        return matcher.case_ModVararg(this);
    }
    @Override public void match(AstElementWithSource.MatcherVoid matcher) {
        matcher.case_ModVararg(this);
    }

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

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

    @Override public String toString() {
        return "ModVararg(" + source+")";
    }
    public boolean structuralEquals(Element e) {
        if (e instanceof ModVararg) {
            ModVararg o = (ModVararg) e;
            return java.util.Objects.equals(source, o.getSource());
        } else {
            return false;
        }
    }
    /** */
    public boolean attrIsDynamicContext() {
        return de.peeeq.wurstscript.attributes.IsDynamicContext.calculate((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable PackageOrGlobal attrNearestPackage() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestPackage((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable NamedScope attrNearestNamedScope() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestNamedScope((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable WScope attrNearestScope() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestScope((ModVararg)this);
    }
    /** */
    public String attrPathDescription() {
        return de.peeeq.wurstscript.attributes.PathDescription.get((ModVararg)this);
    }
    /** */
    public CompilationUnit attrCompilationUnit() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestCompilationUnit((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable ClassDef attrNearestClassDef() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassDef((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable ClassOrInterface attrNearestClassOrInterface() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassOrInterface((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable ClassOrModule attrNearestClassOrModule() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassOrModule((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable StructureDef attrNearestStructureDef() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestStructureDef((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable FunctionImplementation attrNearestFuncDef() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestFuncDef((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable ExprClosure attrNearestExprClosure() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestExprClosure((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable ExprStatementsBlock attrNearestExprStatementsBlock() {
        return de.peeeq.wurstscript.attributes.AttrNearest.nearestExprStatementsBlock((ModVararg)this);
    }
    /** "returns the element itself if it is a NameDef or returns the referenced NameDef if the elem is a reference or returns null otherwise "*/
    public @org.eclipse.jdt.annotation.Nullable NameDef tryGetNameDef() {
        return de.peeeq.wurstscript.attributes.AttrNameDef.tryGetNameDef((ModVararg)this);
    }
    /** */
    public de.peeeq.wurstscript.parser.WPos attrSource() {
        return de.peeeq.wurstscript.attributes.AttrPos.getPos((ModVararg)this);
    }
    /** "returns the position where errors are marked"*/
    public de.peeeq.wurstscript.parser.WPos attrErrorPos() {
        return de.peeeq.wurstscript.attributes.AttrPos.getErrorPos((ModVararg)this);
    }
    /** */
    public WurstModel getModel() {
        return de.peeeq.wurstscript.attributes.AttrImportedPackage.getModel((ModVararg)this);
    }
    /** */
    public void addError(String msg) {
        de.peeeq.wurstscript.attributes.ErrorHandling.addError((ModVararg)this, msg);
    }
    /** */
    public void addWarning(String msg) {
        de.peeeq.wurstscript.attributes.ErrorHandling.addWarning((ModVararg)this, msg);
    }
    /** */
    public de.peeeq.wurstscript.attributes.ErrorHandler getErrorHandler() {
        return de.peeeq.wurstscript.attributes.ErrorHandling.getErrorHandler((ModVararg)this);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable TypeDef lookupType(String name, boolean showErrors) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupType((ModVararg)this, name, showErrors);
    }
    /** */
    public de.peeeq.wurstscript.attributes.names.PackageLink lookupPackage(String name, boolean showErrors) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupPackage((ModVararg)this, name, showErrors);
    }
    /** */
    public de.peeeq.wurstscript.attributes.names.NameLink lookupVar(String name, boolean showErrors) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVar((ModVararg)this, name, showErrors);
    }
    /** */
    public de.peeeq.wurstscript.attributes.names.NameLink lookupVarNoConfig(String name, boolean showErrors) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVarNoConfig((ModVararg)this, name, showErrors);
    }
    /** */
    public de.peeeq.wurstscript.attributes.names.NameLink lookupMemberVar(de.peeeq.wurstscript.types.WurstType receiverType, String name, boolean showErrors) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupMemberVar((ModVararg)this, receiverType, name, showErrors);
    }
    /** */
    public com.google.common.collect.ImmutableCollection<de.peeeq.wurstscript.attributes.names.FuncLink> lookupFuncs(String name, boolean showErrors) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncs((ModVararg)this, name, showErrors);
    }
    /** */
    public com.google.common.collect.ImmutableCollection<de.peeeq.wurstscript.attributes.names.FuncLink> lookupFuncsNoConfig(String name, boolean showErrors) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncsNoConfig((ModVararg)this, name, showErrors);
    }
    /** */
    public com.google.common.collect.ImmutableCollection<de.peeeq.wurstscript.attributes.names.FuncLink> lookupMemberFuncs(de.peeeq.wurstscript.types.WurstType receiverType, String name, boolean showErrors) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupMemberFuncs((ModVararg)this, receiverType, name, showErrors);
    }
    /** */
    public @org.eclipse.jdt.annotation.Nullable TypeDef lookupType(String name) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupTypeShort((ModVararg)this, name);
    }
    /** */
    public de.peeeq.wurstscript.attributes.names.PackageLink lookupPackage(String name) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupPackageShort((ModVararg)this, name);
    }
    /** */
    public de.peeeq.wurstscript.attributes.names.NameLink lookupVar(String name) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVarShort((ModVararg)this, name);
    }
    /** */
    public de.peeeq.wurstscript.attributes.names.NameLink lookupMemberVar(de.peeeq.wurstscript.types.WurstType receiverType, String name) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupMemberVarShort((ModVararg)this, receiverType, name);
    }
    /** */
    public com.google.common.collect.ImmutableCollection<de.peeeq.wurstscript.attributes.names.FuncLink> lookupFuncs(String name) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncsShort((ModVararg)this, name);
    }
    /** */
    public com.google.common.collect.ImmutableCollection<de.peeeq.wurstscript.attributes.names.FuncLink> lookupMemberFuncs(de.peeeq.wurstscript.types.WurstType receiverType, String name) {
        return de.peeeq.wurstscript.attributes.names.NameResolution.lookupMemberFuncsShort((ModVararg)this, receiverType, name);
    }
    /** */
    public com.google.common.collect.ImmutableCollection<WPackage> attrUsedPackages() {
        return de.peeeq.wurstscript.attributes.UsedPackages.usedPackages((ModVararg)this);
    }
    /** */
    public String description() {
        return de.peeeq.wurstscript.attributes.Description.description((ModVararg)this);
    }
    /** */
    public String descriptionHtml() {
        return de.peeeq.wurstscript.attributes.DescriptionHtml.description((ModVararg)this);
    }
    /** */
    public boolean isSubtreeOf(Element other) {
        return de.peeeq.wurstscript.attributes.SmallHelpers.isSubtreeOf((ModVararg)this, other);
    }
    /** */
    public void prettyPrint(de.peeeq.wurstscript.attributes.prettyPrint.Spacer spacer, StringBuilder sb, int indent) {
        de.peeeq.wurstscript.attributes.prettyPrint.PrettyPrinter.prettyPrint((ModVararg)this, spacer, sb, indent);
    }
}