Interface Composite

    • Method Detail

      • setDescription

        void setDescription​(java.lang.String desc)
        Sets the string describing this data type.
        Specified by:
        setDescription in interface DataType
        Parameters:
        desc - the new description.
      • getNumComponents

        int getNumComponents()
        Gets the number of component data types in this data type.
        Returns:
        the number of components that make up this data prototype
      • getComponent

        DataTypeComponent getComponent​(int ordinal)
        Returns the component of this data type with the indicated ordinal.
        Parameters:
        ordinal - the component's ordinal (zero based).
        Returns:
        the data type component.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - if the ordinal is out of bounds
      • getComponents

        DataTypeComponent[] getComponents()
        Returns an array of Data Type Components that make up this data type. Returns an array of length 0 if there are no subcomponents.
      • add

        DataTypeComponent add​(DataType dataType)
        Adds a new datatype to the end of this composite.
        Parameters:
        dataType - the datatype to add.
        Returns:
        the DataTypeComponent created.
        Throws:
        java.lang.IllegalArgumentException - if the specified data type is not allowed to be added to this composite data type. For example, suppose dt1 contains dt2. Therefore it is not valid to add dt1 to dt2 since this would cause a cyclic dependency.
      • add

        DataTypeComponent add​(DataType dataType,
                              int length)
        Adds a new datatype to the end of this composite.
        Parameters:
        dataType - the datatype to add.
        length - the length to associate with the datatype.
        Returns:
        the componentDataType created.
        Throws:
        java.lang.IllegalArgumentException - if the dataType.getLength() is positive and does not match the given length parameter.
        java.lang.IllegalArgumentException - if the specified data type is not allowed to be added to this composite data type. For example, suppose dt1 contains dt2. Therefore it is not valid to add dt1 to dt2 since this would cause a cyclic dependency.
      • add

        DataTypeComponent add​(DataType dataType,
                              java.lang.String name,
                              java.lang.String comment)
        Adds a new datatype to the end of this composite.
        Parameters:
        dataType - the datatype to add.
        name - the field name to associate with this component.
        comment - the comment to associate with this component.
        Returns:
        the componentDataType created.
        Throws:
        java.lang.IllegalArgumentException - if the specified data type is not allowed to be added to this composite data type. For example, suppose dt1 contains dt2. Therefore it is not valid to add dt1 to dt2 since this would cause a cyclic dependency.
      • add

        DataTypeComponent add​(DataType dataType,
                              int length,
                              java.lang.String name,
                              java.lang.String comment)
        Adds a new datatype to the end of this composite.
        Parameters:
        dataType - the datatype to add.
        length - the length to associate with the datatype.
        name - the field name to associate with this component.
        comment - the comment to associate with this component.
        Returns:
        the componentDataType created.
        Throws:
        java.lang.IllegalArgumentException - if the dataType.getLength() is positive and does not match the given length parameter.
        java.lang.IllegalArgumentException - if the specified data type is not allowed to be added to this composite data type. For example, suppose dt1 contains dt2. Therefore it is not valid to add dt1 to dt2 since this would cause a cyclic dependency.
      • insert

        DataTypeComponent insert​(int ordinal,
                                 DataType dataType)
        Inserts a new datatype at the specified ordinal position in this composite.
        Note: For an aligned structure the ordinal position will get adjusted automatically to provide the proper alignment.
        Parameters:
        ordinal - the ordinal where the new datatype is to be inserted.
        dataType - the datatype to insert.
        Returns:
        the componentDataType created.
        Throws:
        java.lang.IllegalArgumentException - if the specified data type is not allowed to be inserted into this composite data type. For example, suppose dt1 contains dt2. Therefore it is not valid to insert dt1 to dt2 since this would cause a cyclic dependency.
      • insert

        DataTypeComponent insert​(int ordinal,
                                 DataType dataType,
                                 int length)
        Inserts a new datatype at the specified ordinal position in this composite.
        Note: For an aligned structure the ordinal position will get adjusted automatically to provide the proper alignment.
        Parameters:
        ordinal - the ordinal where the new datatype is to be inserted.
        dataType - the datatype to insert.
        length - the length to associate with the datatype.
        Returns:
        the componentDataType created.
        Throws:
        java.lang.IllegalArgumentException - if the dataType.getLength() is positive and does not match the given length parameter.
        java.lang.IllegalArgumentException - if the specified data type is not allowed to be inserted into this composite data type. For example, suppose dt1 contains dt2. Therefore it is not valid to insert dt1 to dt2 since this would cause a cyclic dependency.
      • insert

        DataTypeComponent insert​(int ordinal,
                                 DataType dataType,
                                 int length,
                                 java.lang.String name,
                                 java.lang.String comment)
        Inserts a new datatype at the specified ordinal position in this composite.
        Note: For an aligned structure the ordinal position will get adjusted automatically to provide the proper alignment.
        Parameters:
        ordinal - the ordinal where the new datatype is to be inserted.
        dataType - the datatype to insert.
        length - the length to associate with the datatype.
        name - the field name to associate with this component.
        comment - the comment to associate with this component.
        Returns:
        the componentDataType created.
        Throws:
        java.lang.IllegalArgumentException - if the dataType.getLength() is positive and does not match the given length parameter.
        java.lang.IllegalArgumentException - if the specified data type is not allowed to be inserted into this composite data type. For example, suppose dt1 contains dt2. Therefore it is not valid to insert dt1 to dt2 since this would cause a cyclic dependency.
      • delete

        void delete​(int ordinal)
        Deletes the component at the given ordinal position.
        Note: For an aligned structure the delete will have no effect if the ordinal position is a component that provides alignment padding.
        Parameters:
        ordinal - the ordinal of the component to be deleted.
      • delete

        void delete​(int[] ordinals)
        Deletes the components at the given ordinal positions.
        Note: For an aligned structure the delete will have no effect if the ordinal position is a component that provides alignment padding.
        Parameters:
        ordinals - the ordinals of the component to be deleted.
      • isPartOf

        boolean isPartOf​(DataType dataType)
        Check if a data type is part of this data type. A data type could be part of another by:
        Being the same data type.
        containing the data type directly
        containing another data type that has the data type as a part of it.
        Parameters:
        dataType - the data type to look for.
        Returns:
        true if the indicated data type is part of a sub-component of this data type.
      • realign

        void realign()
        Updates the composite to any changes in the data organization. If the composite is not internally aligned, this method does nothing.
      • isInternallyAligned

        boolean isInternallyAligned()
        Determine if this data type has its internal components currently aligned.
        Returns:
        true if this data type's components are aligned relative to each other using the current data organization. When internally aligned the end of this data type will be padded to a multiple of its actual alignment.
      • setInternallyAligned

        void setInternallyAligned​(boolean aligned)
        Sets whether this data type's internal components are currently aligned or unaligned.
        Parameters:
        aligned - true means align the internal components of this data type. false means don't align it. True also causes the end of this data type to be padded to a multiple of its actual alignment.
      • dataTypeAlignmentChanged

        void dataTypeAlignmentChanged​(DataType dt)
        The overall (external) alignment changed for the specified data type. In other words, the data type has a different alignment when placed inside other structures.
        Parameters:
        dt - the data type whose alignment changed.
      • getPackingValue

        int getPackingValue()
        Gets the current packing value (typically a power of 2). If this isn't a packed data type then NOT_PACKING is returned. The packing value only pertains to internally aligned composite data types. Aligned structures allow packing.
        Returns:
        the current packing value or NOT_PACKING.
      • setPackingValue

        void setPackingValue​(int packingValue)
                      throws InvalidInputException
        Sets the current packing value (usually a power of 2). A value of NOT_PACKING should be passed if this isn't a packed data type. Otherwise this value indicates a maximum alignment for any component within this data type. Calling this method will cause the data type to become an internally aligned data type.
        Note: If a component's data type has a specific external alignment, it will override this value if necessary.
        Parameters:
        packingValue - the new packing value or 0NOT_PACKING.
        Throws:
        InvalidInputException - if the packingValue isn't valid.
      • getMinimumAlignment

        int getMinimumAlignment()
        Get the external alignment (a minimum alignment) for this DataType. This controls where this data type will get aligned within other data types. It also causes the end of this data type to get padded so its length is a multiple of the alignment.
        Returns:
        the external alignment for this DataType or DEFAULT_ALIGNMENT_VALUE.
      • setMinimumAlignment

        void setMinimumAlignment​(int minimumAlignment)
                          throws InvalidInputException
        Sets the external alignment (a minimum alignment) for this DataType. This controls where this data type will get aligned within other data types. It also causes the end of this data type to get padded so its length is a multiple of the alignment. Calling this method will cause the data type to become an internally aligned data type.
        Parameters:
        minimumAlignment - the external (minimum) alignment for this DataType.
        Throws:
        InvalidInputException - if the external alignment isn't valid.
      • setToDefaultAlignment

        void setToDefaultAlignment()
        Sets this data type's external (minimum) alignment to the default alignment. This data type's external alignment will be based upon the components it contains. This should be used when a data type doesn't have an alignment attribute specified. Calling this method will cause the data type to become an internally aligned data type.
      • setToMachineAlignment

        void setToMachineAlignment()
        Sets this data type's external (minimum) alignment to a multiple of the machine alignment that is specified in the DataOrganization. The machine alignment is defined as the maximum useful alignment for the target machine. This should be used when a data type has an alignment attribute specified without a size (indicating to use the machine alignment). Calling this method will cause the data type to become an internally aligned data type.
      • isDefaultAligned

        boolean isDefaultAligned()
        Whether or not this data type is using the default external (minimum) alignment.
        Returns:
        true if this data type has the default external alignment.
      • isMachineAligned

        boolean isMachineAligned()
        Whether or not this data type is using the machine alignment value from the DataOrganization for its external (minimum) alignment.
        Returns:
        true if this data type is using the machine alignment as the minimum alignment.