Class DataTypeComponentImpl

    • Constructor Detail

      • DataTypeComponentImpl

        public DataTypeComponentImpl​(DataType dataType,
                                     CompositeDataTypeImpl parent,
                                     int length,
                                     int ordinal,
                                     int offset,
                                     java.lang.String fieldName,
                                     java.lang.String comment)
        Create a new DataTypeComponent
        Parameters:
        dataType - the dataType for this component
        parent - the dataType that this component belongs to
        length - the length of the dataType in this component.
        ordinal - the index within its parent.
        offset - the byte offset within the parent
        fieldName - the name associated with this component
        comment - the comment associated with this component
      • DataTypeComponentImpl

        public DataTypeComponentImpl​(DataType dataType,
                                     CompositeDataTypeImpl parent,
                                     int length,
                                     int ordinal,
                                     int offset)
        Create a new DataTypeComponent
        Parameters:
        dataType - the dataType for this component
        parent - the dataType that this component belongs to
        length - the length of the dataType in this component.
        ordinal - the index of this component within its parent.
        offset - the byte offset within the parent
    • Method Detail

      • isFlexibleArrayComponent

        public boolean isFlexibleArrayComponent()
        Description copied from interface: DataTypeComponent
        Determine if this component corresponds to a unsized flexible array which is permitted as the trailing component within a structure.
        Specified by:
        isFlexibleArrayComponent in interface DataTypeComponent
        Returns:
        true if component is a trailing flexible array component.
      • isBitFieldComponent

        public boolean isBitFieldComponent()
        Description copied from interface: DataTypeComponent
        Determine if the specified component corresponds to a bit-field.
        Specified by:
        isBitFieldComponent in interface DataTypeComponent
        Returns:
        true if bit-field else false
      • isZeroBitFieldComponent

        public boolean isZeroBitFieldComponent()
        Description copied from interface: DataTypeComponent
        Determine if the specified component corresponds to a zero-length bit-field.
        Specified by:
        isZeroBitFieldComponent in interface DataTypeComponent
        Returns:
        true if zer-length bit-field else false
      • getOffset

        public int getOffset()
        Description copied from interface: DataTypeComponent
        Get the byte offset of where this component begins relative to the start of the parent data type.

        NOTE: The special case of a structure flexible array component returns an offset equal to the length of the parent structure since the flexible array component is not included in a structure's length.

        Specified by:
        getOffset in interface DataTypeComponent
        Returns:
        offset of start of component relative to the start of the parent data type.
      • getEndOffset

        public int getEndOffset()
        Description copied from interface: DataTypeComponent
        Get the byte offset of where this component ends relative to the start of the parent data type.

        NOTE: The special case of a structure flexible array component returns -1 since its length is undefined.

        Specified by:
        getEndOffset in interface DataTypeComponent
        Returns:
        offset of end of component relative to the start of the parent data type.
      • setComment

        public void setComment​(java.lang.String comment)
        Description copied from interface: DataTypeComponent
        Sets the comment for the component.
        Specified by:
        setComment in interface DataTypeComponent
        Parameters:
        comment - this components comment.
      • getFieldName

        public java.lang.String getFieldName()
        Description copied from interface: DataTypeComponent
        Get the name of the field name as a component of a Data Type.
        Specified by:
        getFieldName in interface DataTypeComponent
        Returns:
        the name as a component of another Data Type.
      • setFieldName

        public void setFieldName​(java.lang.String name)
                          throws DuplicateNameException
        Description copied from interface: DataTypeComponent
        Sets the field name. If the field name is empty it will be set to null, which is the default field name. An exception is thrown if one of the parent's other components already has the specified field name.
        Specified by:
        setFieldName in interface DataTypeComponent
        Parameters:
        name - the new field name for this component.
        Throws:
        DuplicateNameException - if another component of the parent has the specified field name.
      • getDataType

        public DataType getDataType()
        Description copied from interface: DataTypeComponent
        Returns the dataType in this component.

        NOTE: If this component corresponds to a structure flexible array the returned data type reflects the base type of the array (e.g., char is returned for a flexible char array).

        Specified by:
        getDataType in interface DataTypeComponent
        Returns:
        the dataType in this component
      • getParent

        public DataType getParent()
        Description copied from interface: DataTypeComponent
        returns the dataType that contains this component.
        Specified by:
        getParent in interface DataTypeComponent
        Returns:
        the dataType that contains this component.
      • update

        public void update​(int ordinal,
                           int offset,
                           int length)
        Description copied from interface: InternalDataTypeComponent
        Update component ordinal, offset and length during alignment
        Specified by:
        update in interface InternalDataTypeComponent
        Parameters:
        ordinal - updated ordinal
        offset - updated offset
        length - updated byte length
      • getLength

        public int getLength()
        Description copied from interface: DataTypeComponent
        Get the length of this component.

        NOTE: The special case of a structure flexible array component returns 0 since its length is undefined.

        Specified by:
        getLength in interface DataTypeComponent
        Returns:
        the length of this component or 0 for a structure flexible array.
      • getDefaultSettings

        public Settings getDefaultSettings()
        Description copied from interface: DataTypeComponent
        Gets the default settings for this data type component.
        Specified by:
        getDefaultSettings in interface DataTypeComponent
        Returns:
        a Settings object that is the set of default values for this dataType component
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • isEquivalent

        public boolean isEquivalent​(DataTypeComponent dtc)
        Description copied from interface: DataTypeComponent
        Returns true if the given dataTypeComponent is equivalent to this dataTypeComponent. A dataTypeComponent is "equivalent" if the other component has a data type that is equivalent to this component's data type. The dataTypeComponents must also have the same offset, length, ordinal, field name, and comment.
        Specified by:
        isEquivalent in interface DataTypeComponent
        Parameters:
        dtc - the dataTypeComponent being tested for equivalence.
        Returns:
        true if the given dataTypeComponent is equivalent to this dataTypeComponent.
      • toString

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