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

org.jruby.ir.operands.TemporaryVariable Maven / Gradle / Ivy

package org.jruby.ir.operands;

import org.jruby.ir.IRVisitor;

public abstract class TemporaryVariable extends Variable {
    public TemporaryVariable() {
        super();
    }

    @Override
    public OperandType getOperandType() {
        return OperandType.TEMPORARY_VARIABLE;
    }

    /**
     * Differentiates between different types of TemporaryVariables (useful for switch and persistence).
     */
    public abstract TemporaryVariableType getType();

    @Override
    public int hashCode() {
        return getId().hashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (other == null || !(other instanceof TemporaryVariable)) return false;

        return ((TemporaryVariable)other).getId().equals(getId());
    }

    @Override
    public int compareTo(Object other) {
        if (!(other instanceof TemporaryVariable)) return 0;

        return getId().compareTo(((TemporaryVariable) other).getId());
    }

    @Override
    public void visit(IRVisitor visitor) {
        visitor.TemporaryVariable(this);
    }

    @Override
    public String toString() {
        return getId();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy