Class DecodedInstruction


  • public class DecodedInstruction
    extends java.lang.Object
    A decoded, but not yet disassembled instruction.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int key, byte[] bits)
      Adds the recognized subrule-returning variant to the instruction.
      void add​(int key, java.lang.String string, int constant)
      Adds the recognized string-returning variant to the instruction.
      int get​(int key)
      Returns the constant value to which the given key is mapped.
      byte[] getBits​(int key)
      Returns the bit sequence to which the given key is mapped.
      byte[] getBits​(int key, boolean reverseBytes)
      Returns the bit sequence to which the given key is mapped.
      byte[] getImage()
      Returns the binary image of the whole instruction.
      java.util.Set<java.lang.Integer> getKeys()
      Returns the set of all keys contained in this instruction.
      int getLength()
      Returns the length of the instruction in the memory.
      java.lang.String getString​(int key)
      Returns the string value to which the given key is mapped.
      boolean hasKey​(int key)
      Returns true if the instruction contains the specified key.
      void setImage​(byte[] image)
      Sets the binary image of the whole instruction.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DecodedInstruction

        public DecodedInstruction()
    • Method Detail

      • add

        public void add​(int key,
                        java.lang.String string,
                        int constant)
        Adds the recognized string-returning variant to the instruction.
        Parameters:
        key - the key (rule code)
        string - the string which the recognized variant returned
        constant - the constant obtained from the string
      • add

        public void add​(int key,
                        byte[] bits)
        Adds the recognized subrule-returning variant to the instruction.
        Parameters:
        key - the rule code
        bits - the bit sequence, padded to whole bytes
      • hasKey

        public boolean hasKey​(int key)
        Returns true if the instruction contains the specified key.
        Parameters:
        key - the rule code
        Returns:
        true if the instruction contains the key, false otherwise
      • get

        public int get​(int key)
        Returns the constant value to which the given key is mapped.
        Parameters:
        key - the key
        Returns:
        the constant; or -1 if the key is not mapped to a constant
      • getString

        public java.lang.String getString​(int key)
        Returns the string value to which the given key is mapped.
        Parameters:
        key - the key
        Returns:
        the string; or null if the key is not mapped to a string
      • getBits

        public byte[] getBits​(int key)
        Returns the bit sequence to which the given key is mapped.
        Parameters:
        key - the key
        Returns:
        the bit sequence; or null if the key is not mapped to bits
      • getBits

        public byte[] getBits​(int key,
                              boolean reverseBytes)
        Returns the bit sequence to which the given key is mapped.
        Parameters:
        key - the key
        reverseBytes - reverse the byte order - this is useful to convert the data from Little to Big Endian (Java uses Big Endian)
        Returns:
        the bit sequence; or null if the key is not mapped to bits
      • getImage

        public byte[] getImage()
        Returns the binary image of the whole instruction.
        Returns:
        the binary image
      • setImage

        public void setImage​(byte[] image)
        Sets the binary image of the whole instruction.
        Parameters:
        image - the binary image
      • getLength

        public int getLength()
        Returns the length of the instruction in the memory.
        Returns:
        the length, in bytes
      • getKeys

        public java.util.Set<java.lang.Integer> getKeys()
        Returns the set of all keys contained in this instruction.
        Returns:
        the set of keys