// Autogenerated AST node
package org.python.pydev.parser.jython.ast;

import org.python.pydev.parser.jython.SimpleNode;
import java.util.Arrays;

public final class Num extends exprType implements num_typeType {
    public Object n;
    public int type;
    public String num;

    public Num(Object n, int type, String num) {
        this.n = n;
        this.type = type;
        this.num = num;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((n == null) ? 0 : n.hashCode());
        result = prime * result + type;
        result = prime * result + ((num == null) ? 0 : num.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Num other = (Num) obj;
        if (n == null) {
            if (other.n != null)
                return false;
        } else if (!n.equals(other.n))
            return false;
        if (this.type != other.type)
            return false;
        if (num == null) {
            if (other.num != null)
                return false;
        } else if (!num.equals(other.num))
            return false;
        return true;
    }

    @Override
    public Num createCopy() {
        return createCopy(true);
    }

    @Override
    public Num createCopy(boolean copyComments) {
        Num temp = new Num(n, type, num);
        temp.beginLine = this.beginLine;
        temp.beginColumn = this.beginColumn;
        if (this.specialsBefore != null && copyComments) {
            for (Object o : this.specialsBefore) {
                if (o instanceof commentType) {
                    commentType commentType = (commentType) o;
                    temp.getSpecialsBefore().add(commentType.createCopy(copyComments));
                }
            }
        }
        if (this.specialsAfter != null && copyComments) {
            for (Object o : this.specialsAfter) {
                if (o instanceof commentType) {
                    commentType commentType = (commentType) o;
                    temp.getSpecialsAfter().add(commentType.createCopy(copyComments));
                }
            }
        }
        return temp;
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer("Num[");
        sb.append("n=");
        sb.append(dumpThis(this.n));
        sb.append(", ");
        sb.append("type=");
        sb.append(dumpThis(this.type, num_typeType.num_typeTypeNames));
        sb.append(", ");
        sb.append("num=");
        sb.append(dumpThis(this.num));
        sb.append("]");
        return sb.toString();
    }

    @Override
    public Object accept(VisitorIF visitor) throws Exception {
        return visitor.visitNum(this);
    }

    @Override
    public void traverse(VisitorIF visitor) throws Exception {
    }

}
