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

org.qbicc.graph.MonitorEnter 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.definition.element.ExecutableElement;

/**
 *
 */
public class MonitorEnter extends AbstractNode implements Action, InstanceOperation, OrderedNode {
    private final Node dependency;
    private final Value instance;

    MonitorEnter(final Node callSite, final ExecutableElement element, final int line, final int bci, final Node dependency, final Value instance) {
        super(callSite, element, line, bci);
        this.dependency = dependency;
        this.instance = instance;
    }

    public Value getInstance() {
        return instance;
    }

    @Override
    public Node getDependency() {
        return dependency;
    }

    public boolean maySafePoint() {
        return true;
    }

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

    int calcHashCode() {
        return Objects.hash(MonitorEnter.class, dependency, instance);
    }

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

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

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

    public boolean equals(final MonitorEnter other) {
        return this == other || other != null
            && dependency.equals(other.dependency)
            && instance.equals(other.instance);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy