Class ByteMappingScheme


  • public class ByteMappingScheme
    extends java.lang.Object
    ByteMappingScheme facilitate byte mapping/decimation scheme for a mapped sub-block to an underlying source memory region.
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteMappingScheme​(int mappedByteCount, int mappedSourceByteCount)
      Construct byte mapping scheme specified as a ratio of mapped bytes to source bytes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getMappedByteCount()
      Get the mapped-byte-count (left-hand value in mapping ratio)
      Address getMappedSourceAddress​(Address mappedSourceBaseAddress, long offsetInSubBlock)
      Calculate the mapped source address for a specified offset with the mapped sub-block.
      int getMappedSourceByteCount()
      Get the mapped-source-byte-count (right-hand value in mapping ratio)
      boolean isOneToOneMapping()
      Determine this scheme corresponds to a 1:1 byte mapping
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • ByteMappingScheme

        public ByteMappingScheme​(int mappedByteCount,
                                 int mappedSourceByteCount)
        Construct byte mapping scheme specified as a ratio of mapped bytes to source bytes.
        Parameters:
        mappedByteCount - number of mapped bytes per mappedSourcebyteCount (1..127). This value must be less-than or equal to schemeSrcByteCount.
        mappedSourceByteCount - number of source bytes for mapping ratio (1..127)
        Throws:
        java.lang.IllegalArgumentException - if invalid mapping scheme specified
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isOneToOneMapping

        public boolean isOneToOneMapping()
        Determine this scheme corresponds to a 1:1 byte mapping
        Returns:
        true if 1:1 mapping else false
      • getMappedByteCount

        public int getMappedByteCount()
        Get the mapped-byte-count (left-hand value in mapping ratio)
        Returns:
        mapped-byte-count
      • getMappedSourceByteCount

        public int getMappedSourceByteCount()
        Get the mapped-source-byte-count (right-hand value in mapping ratio)
        Returns:
        mapped-source-byte-count
      • getMappedSourceAddress

        public Address getMappedSourceAddress​(Address mappedSourceBaseAddress,
                                              long offsetInSubBlock)
                                       throws AddressOverflowException
        Calculate the mapped source address for a specified offset with the mapped sub-block.
        Parameters:
        mappedSourceBaseAddress - mapped source base address for sub-block
        offsetInSubBlock - byte offset within sub-block to be mapped into source
        Returns:
        mapped source address
        Throws:
        AddressOverflowException - if offset in sub-block produces a wrap condition in the mapped source address space.