Package com.sun.jna

Class IntegerType

    • Constructor Detail

      • IntegerType

        public IntegerType​(int size)
        Create a zero-valued signed IntegerType.
      • IntegerType

        public IntegerType​(int size,
                           boolean unsigned)
        Create a zero-valued optionally unsigned IntegerType.
      • IntegerType

        public IntegerType​(int size,
                           long value)
        Create a signed IntegerType with the given value.
      • IntegerType

        public IntegerType​(int size,
                           long value,
                           boolean unsigned)
        Create an optionally signed IntegerType with the given value.
    • Method Detail

      • setValue

        public void setValue​(long value)
        Change the value for this data.
        Parameters:
        value - value to set
      • toNative

        public Object toNative()
        Description copied from interface: NativeMapped
        Convert this object into a supported native type.
        Specified by:
        toNative in interface NativeMapped
        Returns:
        Java representation of the original Java object converted to a native type.
      • fromNative

        public Object fromNative​(Object nativeValue,
                                 FromNativeContext context)
        Description copied from interface: NativeMapped
        Convert the given native object into its Java representation using the given context.
        Specified by:
        fromNative in interface NativeMapped
        Parameters:
        nativeValue - Java representation of the native type to be converted.
        context - Context in which the conversion is taking place.
        Returns:
        Converted object.
      • nativeType

        public Class<?> nativeType()
        Description copied from interface: NativeMapped
        Indicate the native type used by this converter.
        Specified by:
        nativeType in interface NativeMapped
        Returns:
        Java class representation of the native type.
      • intValue

        public int intValue()
        Specified by:
        intValue in class Number
      • longValue

        public long longValue()
        Specified by:
        longValue in class Number
      • floatValue

        public float floatValue()
        Specified by:
        floatValue in class Number
      • doubleValue

        public double doubleValue()
        Specified by:
        doubleValue in class Number
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • compare

        public static <T extends IntegerType> int compare​(T v1,
                                                          T v2)
        Compares 2 derived IntegerType values - Note: a null value is considered greater than any non-null one (i.e., null values are "pushed" to the end of a sorted array / list of values)
        Type Parameters:
        T - the derived integer type
        Parameters:
        v1 - The 1st value
        v2 - The 2nd value
        Returns:
        0 if values are equal - including if both are null, negative if 1st value less than 2nd one, positive otherwise. Note: the comparison uses the longValue().
        See Also:
        compare(long, long)
      • compare

        public static int compare​(IntegerType v1,
                                  long v2)
        Compares a IntegerType value with a long one. Note: if the IntegerType value is null then it is consider greater than any long value.
        Parameters:
        v1 - The IntegerType value
        v2 - The long value
        Returns:
        0 if values are equal, negative if 1st value less than 2nd one, positive otherwise. Note: the comparison uses the longValue().
        See Also:
        compare(long, long)
      • compare

        public static final int compare​(long v1,
                                        long v2)