Class VariableLocation

All Implemented Interfaces:
Cloneable, Comparable<ProgramLocation>
Direct Known Subclasses:
VariableCommentFieldLocation, VariableLocFieldLocation, VariableNameFieldLocation, VariableTypeFieldLocation, VariableXRefFieldLocation

public class VariableLocation extends FunctionLocation
VariableLocation provides information about the location on a variable within a Function.
  • Constructor Details

    • VariableLocation

      public VariableLocation()
      Default constructor needed for restoring a variable location from XML.
    • VariableLocation

      public VariableLocation(Program program, Address locationAddr, Variable var, int index, int charOffset)
      Create a new VariableLocation.
      Parameters:
      program - the program of the location
      locationAddr - the address of the listing location (i.e., referent code unit)
      var - the variable associated with this location.
      index - the index of the sub-piece on that variable (only the xrefs have subpieces
      charOffset - the character position on the piece.
    • VariableLocation

      public VariableLocation(Program program, Variable var, int index, int charOffset)
      Create a new VariableLocation.
      Parameters:
      program - the program of the location
      var - the variable associated with this location.
      index - the index of the sub-piece on that variable (only the xrefs have subpieces
      charOffset - the character position on the piece.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class FunctionLocation
    • getVariable

      public Variable getVariable()
      Get the variable associated with this variable location
      Returns:
      associated function variable
    • isLocationFor

      public boolean isLocationFor(Variable var)
      Checks to see if this location is for the indicated variable.
      Parameters:
      var - the variable
      Returns:
      true if this location is for the specified variable.
    • isParameter

      public boolean isParameter()
    • isReturn

      public boolean isReturn()
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class FunctionLocation
      See Also:
    • compareTo

      public int compareTo(ProgramLocation pl)
      Specified by:
      compareTo in interface Comparable<ProgramLocation>
      Overrides:
      compareTo in class ProgramLocation
    • restoreState

      public void restoreState(Program p, SaveState obj)
      Description copied from class: FunctionLocation
      Restore this function location using the given program and save state object.
      Overrides:
      restoreState in class FunctionLocation
      Parameters:
      p - the program containing the function location
      obj - the save state object for saving the location
    • saveState

      public void saveState(SaveState obj)
      Description copied from class: FunctionLocation
      Save this function location to the given save state object.
      Overrides:
      saveState in class FunctionLocation
      Parameters:
      obj - the save state object for saving the location
    • isValid

      public boolean isValid(Program p)
      Description copied from class: ProgramLocation
      Returns true if this location represents a valid location in the given program.
      Overrides:
      isValid in class FunctionLocation
      Parameters:
      p - the program to test if this location is valid.
      Returns:
      true if this location represents a valid location in the given program.