All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.qbicc.graph.ClassOf Maven / Gradle / Ivy

There is a newer version: 0.77.0
Show newest version
package org.qbicc.graph;

import java.util.Objects;

import org.qbicc.type.ReferenceType;
import org.qbicc.type.definition.element.ExecutableElement;

/**
 * The class object for a given type ID value.
 */
public final class ClassOf extends AbstractValue implements UnaryValue {
    private final Value input;
    private final Value dimensions;
    private final ReferenceType type;

    ClassOf(final Node callSite, final ExecutableElement element, final int line, final int bci, final Value input, Value dimensions, final ReferenceType type) {
        super(callSite, element, line, bci);
        this.input = input;
        this.dimensions = dimensions;
        this.type = type;
    }

    public Value getInput() {
        return input;
    }

    public Value getDimensions() { return dimensions; }

    public ReferenceType getType() {
        return type;
    }

    public  R accept(final ValueVisitor visitor, final T param) {
        return visitor.visit(param, this);
    }

    int calcHashCode() {
        return Objects.hash(ClassOf.class, input, dimensions);
    }

    @Override
    String getNodeName() {
        return "ClassOf";
    }

    @Override
    public boolean isNullable() {
        return false;
    }

    public boolean equals(final Object other) {
        return other instanceof ClassOf && equals((ClassOf) other);
    }

    @Override
    public StringBuilder toString(StringBuilder b) {
        super.toString(b);
        b.append('(');
        input.toReferenceString(b);
        b.append(',');
        dimensions.toReferenceString(b);
        b.append(')');
        return b;
    }

    public boolean equals(final ClassOf other) {
        return this == other || other != null
            && input.equals(other.input)
            && dimensions.equals(other.dimensions);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy