org.eclipse.january.dataset

## Class InterfaceUtils

- java.lang.Object
- - org.eclipse.january.dataset.InterfaceUtils

-     public class InterfaceUtils
      extends Object

  Since:
    2.3

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InterfaceUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Object` | `fromDoublesToBiggestPrimitives(Class<? extends Dataset> clazz, double[] x)` Convert double array to primitive array
    `static Number` | `fromDoubleToBiggestNumber(Class<? extends Dataset> clazz, double x)` Convert double to number
    `static Class<? extends Dataset>` | `getBestFloatInterface(Class<? extends Dataset> clazz)` Find floating point dataset interface that best fits given types.
    `static Class<? extends Dataset>` | `getBestInterface(Class<? extends Dataset> a, Class<? extends Dataset> b)` Find dataset interface that best fits given classes.
    `static Class<? extends Dataset>` | `getElementalInterface(Class<? extends Dataset> clazz)`
    `static Class<?>` | `getElementClass(Class<? extends Dataset> clazz)`
    `static int` | `getElementsPerItem(Class<? extends Dataset> clazz)`
    `static Class<? extends Dataset>` | `getInterface(Object obj)` Get dataset interface from an object.
    `static Class<? extends Dataset>` | `getInterfaceFromClass(int elementsPerItem, Class<?> elementClass)`
    `static int` | `getItemBytes(int isize, Class<? extends Dataset> clazz)`
    `static Class<? extends Dataset>` | `getLargestInterface(Dataset a)` The largest dataset type suitable for a summation of around a few thousand items without changing from the "kind" of dataset
    `static boolean` | `isComplex(Class<? extends Dataset> clazz)`
    `static boolean` | `isCompound(Class<? extends Dataset> clazz)`
    `static boolean` | `isElemental(Class<? extends Dataset> clazz)`
    `static boolean` | `isElemental(ILazyDataset a)`
    `static boolean` | `isElementSupported(Class<? extends Object> clazz)`
    `static boolean` | `isFloating(Class<? extends Dataset> clazz)`
    `static boolean` | `isFloating(ILazyDataset a)`
    `static boolean` | `isInteger(Class<? extends Dataset> clazz)`
    `static boolean` | `isInteger(ILazyDataset a)`
    `static boolean` | `isNumerical(Class<? extends Dataset> clazz)`
    `static Number` | `toBiggestNumber(Class<? extends Dataset> clazz, Number x)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### InterfaceUtils

          public InterfaceUtils()

  - ### Method Detail

    - #### isElementSupported

          public static boolean isElementSupported(Class<? extends Object> clazz)

      Parameters:
        `clazz` -
      Returns:
        true if supported as an element class (note, Object is not supported)

    - #### getElementClass

          public static Class<?> getElementClass(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` - dataset class
      Returns:
        (boxed) class of constituent element

    - #### getInterface

          public static Class<? extends Dataset> getInterface(Object obj)

      Get dataset interface from an object. The following are supported: Java Number objects, Apache common math Complex objects, Java arrays and lists
      Parameters:
        `obj` -
      Returns:
        dataset interface

    - #### getInterfaceFromClass

          public static Class<? extends Dataset> getInterfaceFromClass(int elementsPerItem,
                                                                       Class<?> elementClass)

      Parameters:
        `elementsPerItem` -
        `elementClass` -
      Returns:
        dataset interface

    - #### getElementalInterface

          public static Class<? extends Dataset> getElementalInterface(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` - dataset interface
      Returns:
        elemental dataset interface available for given dataset interface

    - #### isElemental

          public static boolean isElemental(ILazyDataset a)

      Parameters:
        `a` - dataset
      Returns:
        true if dataset is not compound or complex

    - #### isElemental

          public static boolean isElemental(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` -
      Returns:
        true if dataset interface is not compound or complex

    - #### isCompound

          public static boolean isCompound(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` -
      Returns:
        true if dataset interface is compound (not complex)

    - #### isInteger

          public static boolean isInteger(ILazyDataset a)

      Parameters:
        `a` - dataset
      Returns:
        true if dataset has integer elements

    - #### isFloating

          public static boolean isFloating(ILazyDataset a)

      Parameters:
        `a` - dataset
      Returns:
        true if dataset has floating point elements

    - #### isInteger

          public static boolean isInteger(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` -
      Returns:
        true if dataset interface has integer elements

    - #### isFloating

          public static boolean isFloating(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` -
      Returns:
        true if dataset interface has floating point elements

    - #### isComplex

          public static boolean isComplex(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` -
      Returns:
        true if dataset interface has complex items

    - #### isNumerical

          public static boolean isNumerical(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` -
      Returns:
        true if dataset interface has numerical elements

    - #### getElementsPerItem

          public static int getElementsPerItem(Class<? extends Dataset> clazz)

      Parameters:
        `clazz` -
      Returns:
        number of elements per item

    - #### getBestInterface

          public static Class<? extends Dataset> getBestInterface(Class<? extends Dataset> a,
                                                                  Class<? extends Dataset> b)

      Find dataset interface that best fits given classes. The best class takes into account complex and array datasets
      Parameters:
        `a` - first dataset class
        `b` - second dataset class
      Returns:
        best dataset interface

    - #### getLargestInterface

          public static Class<? extends Dataset> getLargestInterface(Dataset a)

      The largest dataset type suitable for a summation of around a few thousand items without changing from the "kind" of dataset
      Parameters:
        `otype` -
      Returns:
        largest dataset type available for given dataset type

    - #### getBestFloatInterface

          public static Class<? extends Dataset> getBestFloatInterface(Class<? extends Dataset> clazz)

      Find floating point dataset interface that best fits given types. The best type takes into account complex and array datasets
      Parameters:
        `clazz` - old dataset class
      Returns:
        best dataset interface

    - #### getItemBytes

          public static int getItemBytes(int isize,
                                         Class<? extends Dataset> clazz)

      Parameters:
        `isize` - number of elements in an item
        `dtype` -
      Returns:
        length of single item in bytes

    - #### fromDoublesToBiggestPrimitives

          public static Object fromDoublesToBiggestPrimitives(Class<? extends Dataset> clazz,
                                                              double[] x)

      Convert double array to primitive array
      Parameters:
        `clazz` - dataset interface
        `x` -
      Returns:
        biggest native primitive array if integer. Return null if not interface is not numerical

    - #### fromDoubleToBiggestNumber

          public static Number fromDoubleToBiggestNumber(Class<? extends Dataset> clazz,
                                                         double x)

      Convert double to number
      Parameters:
        `clazz` - dataset interface
        `x` -
      Returns:
        biggest number if integer. Return null if not interface is not numerical

    - #### toBiggestNumber

          public static Number toBiggestNumber(Class<? extends Dataset> clazz,
                                               Number x)

      Parameters:
        `clazz` - dataset interface
        `x` -
      Returns:
        biggest native primitive if integer
      Since:
        2.3

Copyright © 2014–2019 Eclipse Foundation. All rights reserved.