Class LocalVariable


  • public class LocalVariable
    extends java.lang.Object
    LocalVariable represents a local variable index operand to various instructions.
    • Constructor Summary

      Constructors 
      Constructor Description
      LocalVariable​(int index)
      Constructor.
      LocalVariable​(java.lang.String name, Type type, int index)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Check if an object is equal to this variable.
      int hashCode()
      Hash the local variable.
      int index()
      Get the index into the local variable array.
      java.lang.String name()
      Get the name of the local variable.
      java.lang.String toString()
      Convert the variable to a string.
      Type type()
      Get the type of the local variable.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • LocalVariable

        public LocalVariable​(int index)
        Constructor.
        Parameters:
        index - The index of the local variable in the method's local variable array.
      • LocalVariable

        public LocalVariable​(java.lang.String name,
                             Type type,
                             int index)
        Constructor.
        Parameters:
        name - The name of the local variable.
        type - The descriptor (or index into the constant pool) representing the variable type.
        index - The index of the local variable in the method's local variable array.
    • Method Detail

      • hashCode

        public int hashCode()
        Hash the local variable. A stricter hashing than using the index will break Hashtable lookups since a variable could have a name assigned to it after its first use.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hash code.
      • equals

        public boolean equals​(java.lang.Object obj)
        Check if an object is equal to this variable. A stricter comparison than comparing indices will break Hashtable lookups since a variable could have a name assigned to it after its first use.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The object to compare against.
        Returns:
        true if equal, false if not.
      • name

        public java.lang.String name()
        Get the name of the local variable.
        Returns:
        The name of the local variable.
      • type

        public Type type()
        Get the type of the local variable.
        Returns:
        The type of the local variable.
      • index

        public int index()
        Get the index into the local variable array.
        Returns:
        The index into the local variable array.
      • toString

        public java.lang.String toString()
        Convert the variable to a string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the variable.