Class EnumDataType

    • Constructor Detail

      • EnumDataType

        public EnumDataType​(java.lang.String name,
                            int length)
      • EnumDataType

        public EnumDataType​(CategoryPath path,
                            java.lang.String name,
                            int length)
    • Method Detail

      • getValue

        public long getValue​(java.lang.String valueName)
                      throws java.util.NoSuchElementException
        Description copied from interface: Enum
        Get the value for the given name.
        Specified by:
        getValue in interface Enum
        Parameters:
        valueName - name of the entry
        Returns:
        the value
        Throws:
        java.util.NoSuchElementException - if the name does not exist in this Enum
      • getName

        public java.lang.String getName​(long value)
        Description copied from interface: Enum
        Get the name for the given value.
        Specified by:
        getName in interface Enum
        Parameters:
        value - value of the enum entry.
        Returns:
        null if the name with the given value was not found.
      • getValues

        public long[] getValues()
        Description copied from interface: Enum
        Get the values of the enum entries.
        Specified by:
        getValues in interface Enum
        Returns:
        values sorted in ascending order
      • getNames

        public java.lang.String[] getNames()
        Description copied from interface: Enum
        Get the names of the enum entries.
        Specified by:
        getNames in interface Enum
      • getCount

        public int getCount()
        Description copied from interface: Enum
        Get the number of entries in this Enum.
        Specified by:
        getCount in interface Enum
      • add

        public void add​(java.lang.String valueName,
                        long value)
        Description copied from interface: Enum
        Add a enum entry.
        Specified by:
        add in interface Enum
        Parameters:
        valueName - name of the new entry
        value - value of the new entry
      • remove

        public void remove​(java.lang.String valueName)
        Description copied from interface: Enum
        Remove the enum entry with the given name.
        Specified by:
        remove in interface Enum
        Parameters:
        valueName - name of entry to remove.
      • copy

        public DataType copy​(DataTypeManager dtm)
        Description copied from interface: DataType
        Returns a new instance of this DataType with a new identity. Note: for built-in DataType's, clone and copy should have the same affect.
        Specified by:
        copy in interface DataType
        Parameters:
        dtm - the data-type manager instance whose data-organization should apply.
      • clone

        public DataType clone​(DataTypeManager dtm)
        Description copied from interface: DataType
        Returns a new instance of this DataType with its universalID and SourceArchive identity retained. Note: for built-in DataType's, clone and copy should have the same affect.
        Specified by:
        clone in interface DataType
        Parameters:
        dtm - the data-type manager instance whose data-organization should apply.
      • getLength

        public int getLength()
        Description copied from interface: DataType
        Get the length (number of 8-bit bytes) of this DataType.
        Specified by:
        getLength in interface DataType
        Returns:
        the length of this DataType
      • setLength

        public void setLength​(int length)
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: DataType
        Get a String briefly describing this DataType.
        Specified by:
        getDescription in interface DataType
        Returns:
        a one-liner describing this DataType.
      • setDescription

        public void setDescription​(java.lang.String description)
        Description copied from class: DataTypeImpl
        Sets a String briefly describing this DataType.
        If a data type that extends this class wants to allow the description to be changed, then it must override this method.
        Specified by:
        setDescription in interface DataType
        Specified by:
        setDescription in interface Enum
        Overrides:
        setDescription in class DataTypeImpl
        Parameters:
        description - a one-liner describing this DataType.
      • getValue

        public java.lang.Object getValue​(MemBuffer buf,
                                         Settings settings,
                                         int valueLength)
        Description copied from interface: DataType
        Get the data in the form of the appropriate Object for this DataType. For instance if the data type is an AddressDT, return an Address object. a Byte, return a Scalar* (maybe this should be a Byte) a Float, return a Float
        Specified by:
        getValue in interface DataType
        Parameters:
        buf - the data buffer.
        settings - the settings to use.
        valueLength - the number of bytes to get the value from.
        Returns:
        the data Object.
      • getValueClass

        public java.lang.Class<?> getValueClass​(Settings settings)
        Description copied from interface: DataType
        Get the Class of the value to be returned by this data type.
        Specified by:
        getValueClass in interface DataType
        Overrides:
        getValueClass in class DataTypeImpl
        Parameters:
        settings - the relevant settings to use or null for default.
        Returns:
        Class of the value to be returned by this data type or null if it can vary or is unspecified. Types which correspond to a string or char array will return the String class.
      • getRepresentation

        public java.lang.String getRepresentation​(MemBuffer buf,
                                                  Settings settings,
                                                  int valueLength)
        Description copied from interface: DataType
        Get bytes from memory in a printable format for this type.
        Specified by:
        getRepresentation in interface DataType
        Parameters:
        buf - the data.
        settings - the settings to use for the representation.
        valueLength - the number of bytes to represent.
        Returns:
        the representation of the data in this format, never null.
      • getRepresentation

        public java.lang.String getRepresentation​(java.math.BigInteger bigInt,
                                                  Settings settings,
                                                  int bitLength)
        Description copied from interface: Enum
        Get enum representation of the big-endian value.
        Specified by:
        getRepresentation in interface Enum
        Parameters:
        bigInt - BigInteger value with the appropriate sign
        settings - integer format settings (PADDING, FORMAT, etc.)
        Returns:
        formatted integer string
      • isEquivalent

        public boolean isEquivalent​(DataType dt)
        Description copied from interface: DataType
        Returns true if the given dataType is equivalent to this dataType. The precise meaning of "equivalent" is dataType dependent.
        Specified by:
        isEquivalent in interface DataType
        Parameters:
        dt - the dataType being tested for equivalence.
        Returns:
        true if the if the given dataType is equivalent to this dataType.
      • replaceWith

        public void replaceWith​(DataType dataType)
        Description copied from interface: DataType
        For dataTypes that support change, this method replaces the internals of this dataType with the internals of the given dataType. The dataTypes must be of the same "type" (i.e. structure can only be replacedWith another structure.
        Specified by:
        replaceWith in interface DataType
        Overrides:
        replaceWith in class DataTypeImpl
        Parameters:
        dataType - the dataType that contains the internals to upgrade to.
      • getDefaultLabelPrefix

        public java.lang.String getDefaultLabelPrefix()
        Description copied from interface: DataType
        Returns the appropriate string to use as the default label prefix in the absence of any data.
        Specified by:
        getDefaultLabelPrefix in interface DataType
        Overrides:
        getDefaultLabelPrefix in class AbstractDataType
        Returns:
        the default label prefix or null if none specified.