Class OperandFieldLocation

All Implemented Interfaces:
Cloneable, Comparable<ProgramLocation>
Direct Known Subclasses:
ArrayElementFieldLocation, EquateOperandFieldLocation, ResourceFieldLocation

public class OperandFieldLocation extends CodeUnitLocation
The OperandFieldLocation class contains specific location information within the OPERAND field of a CodeUnitLocation object.
  • Constructor Details

    • OperandFieldLocation

      public OperandFieldLocation(Program program, Address addr, int[] componentPath, Address refAddr, String rep, int opIndex, int characterOffset)
      Construct a new OperandFieldLocation object.
      Parameters:
      program - the program of the location.
      addr - address of the location; should not be null.
      componentPath - array of indexes for each nested data component; the index is the data component's index within its parent; may be null.
      refAddr - the reference 'to' address.
      rep - the String representation of the operand.
      opIndex - the index of the operand at this location.
      characterOffset - the character position from the beginning of the operand.
    • OperandFieldLocation

      public OperandFieldLocation(Program program, Address addr, int[] componentPath, Address refAddr, String rep, int opIndex, int subOpIndex, int characterOffset)
      Construct a new OperandFieldLocation object.
      Parameters:
      program - the program of the location.
      addr - address of the location; should not be null.
      componentPath - array of indexes for each nested data component; the index is the data component's index within its parent; may be null .
      refAddr - the "referred to" address if the location is over a reference; may be null.
      rep - the String representation of the operand.
      opIndex - the index indicating the operand the location is on.
      subOpIndex - the index of the Object within the operand, this can be used to call an instructions getOpObjects() method.
      characterOffset - the character position from the beginning of the operand field.
    • OperandFieldLocation

      public OperandFieldLocation(Program program, Address addr, VariableOffset variableOffset, Address refAddr, String rep, int opIndex, int subOpIndex, int characterOffset)
      Construct a new OperandFieldLocation object for an instruction operand.
      Parameters:
      program - the program of the location.
      addr - address of the location; should not be null.
      variableOffset - associated variable offset or null.
      refAddr - the "referred to" address if the location is over a reference; may be null.
      rep - the String representation of the operand.
      opIndex - the index indicating the operand the location is on.
      subOpIndex - the index of the Object within the operand, this can be used to call an instructions getOpObjects() method.
      characterOffset - the character position from the beginning of the operand field.
    • OperandFieldLocation

      public OperandFieldLocation()
      Default constructor needed for restoring an operand field location from XML.
  • Method Details

    • getVariableOffset

      public VariableOffset getVariableOffset()
      Returns VariableOffset object if applicable or null.
      Returns:
      the variable offset.
    • getOperandRepresentation

      public String getOperandRepresentation()
      Returns a string representation of the operand at this location.
      Returns:
      the representation.
    • getOperandIndex

      public int getOperandIndex()
      Returns the index of the operand at this location.
      Returns:
      the index
    • getSubOperandIndex

      public int getSubOperandIndex()
      Returns the sub operand index at this location.

      This index can be used on the instruction.getOpObjects() to find the actual object (Address, Register, Scalar) the cursor is over.

      Returns:
      0-n if over a valid OpObject, -1 otherwise
    • toString

      public String toString()
      Overrides:
      toString in class ProgramLocation
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ProgramLocation
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class ProgramLocation
    • restoreState

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

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