Class NoisyStructureBuilder


  • public class NoisyStructureBuilder
    extends java.lang.Object
    Build a structure from a "noisy" source of field information. Feed it field records, either via addDataType(), when we have more definitive info about the size of the field, or via addReference() when we have a pointer reference to the field with possibly less info about the field size. As records come in, overlaps and conflicts in specific field data-types are resolved. In a conflict, less specific data-types are replaced. After all information is collected a final Structure can be built by iterating over the final field entries.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDataType​(long offset, DataType dt)
      Add data-type information about a specific field
      void addReference​(long offset, DataType dt)
      Adds information for a field given a pointer reference.
      long getSize()  
      java.util.Iterator<java.util.Map.Entry<java.lang.Long,​DataType>> iterator()  
      void populateOriginalStructure​(Structure dt)
      Populate this builder with fields from a preexisting Structure.
      void setMinimumSize​(long size)
      We may have partial information about the size of the structure.
      • Methods inherited from class java.lang.Object

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

      • NoisyStructureBuilder

        public NoisyStructureBuilder()
    • Method Detail

      • getSize

        public long getSize()
        Returns:
        the size of the structure in bytes (given current information)
      • addDataType

        public void addDataType​(long offset,
                                DataType dt)
        Add data-type information about a specific field
        Parameters:
        offset - of the field within the structure
        dt - is the data-type of field if known (null otherwise)
      • addReference

        public void addReference​(long offset,
                                 DataType dt)
        Adds information for a field given a pointer reference. The data-type information is not used unless it is a pointer.
        Parameters:
        offset - is the offset of the field within the structure
        dt - is the data-type of the pointer to the field (or null)
      • setMinimumSize

        public void setMinimumSize​(long size)
        We may have partial information about the size of the structure. This method feeds it to the builder as a minimum size for the structure.
        Parameters:
        size - is the minimum size in bytes
      • iterator

        public java.util.Iterator<java.util.Map.Entry<java.lang.Long,​DataType>> iterator()
        Returns:
        an iterator to the current field entries
      • populateOriginalStructure

        public void populateOriginalStructure​(Structure dt)
        Populate this builder with fields from a preexisting Structure. The builder presumes it is rebuilding this Structure so it can check for pathological containment issues.
        Parameters:
        dt - is the preexisting Structure