org.eclipse.january.dataset

## Class AggregateDataset

- java.lang.Object
- - org.eclipse.january.dataset.LazyDatasetBase
  - - org.eclipse.january.dataset.AggregateDataset

- All Implemented Interfaces:
    Serializable, ILazyDataset, IMetadataProvider, INameable

      public class AggregateDataset
      extends LazyDatasetBase
      implements ILazyDataset

  Class to aggregate a set of lazy datasets and present them as a single lazy dataset where the first position value accesses the aggregation
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AggregateDataset` | `base`

    - ### Fields inherited from class org.eclipse.january.dataset.LazyDatasetBase

      `catchExceptions, logger, metadata, name, shape`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AggregateDataset(boolean extend, ILazyDataset... datasets)` Create an aggregate dataset

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int[][]` | `calcShapes(boolean extend, ILazyDataset... datasets)` Calculate (possibly extended) shapes from given datasets
    `AggregateDataset` | `clone()` Clone dataset
    `int` | `getDType()`
    `Class<?>` | `getElementClass()`
    `int` | `getElementsPerItem()`
    `ILazyDataset` | `getErrors()` Get the errors, if any.
    `int` | `getSize()` The size of the dataset is the number of items in the array
    `Dataset` | `getSlice(IMonitor monitor, int[] start, int[] stop, int[] step)` Get a slice of the dataset.
    `Dataset` | `getSlice(IMonitor monitor, Slice... slice)` Get a slice of the dataset.
    `Dataset` | `getSlice(IMonitor monitor, SliceND slice)` Get a slice of the dataset.
    `Dataset` | `getSlice(int[] start, int[] stop, int[] step)` Get a slice of the dataset.
    `Dataset` | `getSlice(Slice... slice)` Get a slice of the dataset.
    `Dataset` | `getSlice(SliceND slice)` Get a slice of the dataset.
    `AggregateDataset` | `getSliceView(int[] start, int[] stop, int[] step)` Get a slice of the dataset.
    `AggregateDataset` | `getSliceView(Slice... slice)` Get a slice of the dataset.
    `AggregateDataset` | `getSliceView(SliceND slice)` Get a slice of the dataset.
    `AggregateDataset` | `getTransposedView(int... axes)` Permute copy of dataset's axes so that given order is old order:
    `void` | `setErrors(Serializable errors)` Set the errors.
    `void` | `setShape(int... shape)` Set a compatible shape for dataset.
    `ILazyDataset` | `squeezeEnds()` Remove dimensions of 1 from ends of shape of the dataset
    `String` | `toString()`

    - ### Methods inherited from class org.eclipse.january.dataset.LazyDatasetBase

      `addMetadata, checkPermutatedAxes, clearMetadata, copyMetadata, copyMetadata, createFromSerializable, dirtyMetadata, equals, findMetadataTypeSubInterfaces, getErrorMetadata, getFirstMetadata, getMetadata, getMetadata, getName, getRank, getShape, hasErrors, hashCode, reshapeMetadata, restoreMetadata, setMetadata, setName, sliceMetadata, transposeMetadata`

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

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.january.dataset.ILazyDataset

      `addMetadata, clearMetadata, getRank, getShape, hasErrors, setMetadata`

    - ### Methods inherited from interface org.eclipse.january.dataset.IMetadataProvider

      `getFirstMetadata, getMetadata, getMetadata`

    - ### Methods inherited from interface org.eclipse.january.INameable

      `getName, setName`

- - ### Field Detail

    - #### base

          protected AggregateDataset base

  - ### Constructor Detail

    - #### AggregateDataset

          public AggregateDataset(boolean extend,
                          ILazyDataset... datasets)

      Create an aggregate dataset
      Parameters:
        `extend` - if true, extend rank by one
        `datasets` -

  - ### Method Detail

    - #### calcShapes

          public static int[][] calcShapes(boolean extend,
                           ILazyDataset... datasets)

      Calculate (possibly extended) shapes from given datasets
      Parameters:
        `extend` - if true, extend rank by one
        `datasets` -
      Returns:
        array of shapes

    - #### getElementClass

          public Class<?> getElementClass()

      Specified by:
        `getElementClass` in interface `ILazyDataset`
      Overrides:
        `getElementClass` in class `LazyDatasetBase`
      Returns:
        Boxed class of element

    - #### getElementsPerItem

          public int getElementsPerItem()

      Specified by:
        `getElementsPerItem` in interface `ILazyDataset`
      Returns:
        Number of elements per item

    - #### getDType

          public int getDType()

      Specified by:
        `getDType` in class `LazyDatasetBase`
      Returns:
        type of dataset item

    - #### getSize

          public int getSize()

      Description copied from interface: `ILazyDataset`
      The size of the dataset is the number of items in the array
      Specified by:
        `getSize` in interface `ILazyDataset`
      Returns:
        number of data items

    - #### setShape

          public void setShape(int... shape)

      Description copied from interface: `ILazyDataset`
      Set a compatible shape for dataset. A shape is compatible if it has the capacity to contain the same number of items
      Specified by:
        `setShape` in interface `ILazyDataset`

    - #### squeezeEnds

          public ILazyDataset squeezeEnds()

      Description copied from interface: `ILazyDataset`
      Remove dimensions of 1 from ends of shape of the dataset
      Specified by:
        `squeezeEnds` in interface `ILazyDataset`

    - #### getSlice

          public Dataset getSlice(int[] start,
                         int[] stop,
                         int[] step)
                           throws DatasetException

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned dataset is a copied selection of items
      Specified by:
        `getSlice` in interface `ILazyDataset`
      Parameters:
        `start` - specifies the starting indexes (can be null for origin)
        `stop` - specifies the stopping indexes (can be null for end)
        `step` - specifies the steps in the slice (can be null for unit steps)
      Returns:
        The dataset of the sliced data
      Throws:
        `DatasetException`

    - #### getSlice

          public Dataset getSlice(IMonitor monitor,
                         int[] start,
                         int[] stop,
                         int[] step)
                           throws DatasetException

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned dataset is a copied selection of items
      Specified by:
        `getSlice` in interface `ILazyDataset`
        `start` - specifies the starting indexes (can be null for origin)
        `stop` - specifies the stopping indexes (can be null for end)
        `step` - specifies the steps in the slice (can be null for unit steps)
      Returns:
        The dataset of the sliced data
      Throws:
        `DatasetException`

    - #### getSlice

          public Dataset getSlice(IMonitor monitor,
                         SliceND slice)
                           throws DatasetException

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned dataset is a copied selection of items
      Specified by:
        `getSlice` in interface `ILazyDataset`
        `slice` - an n-D slice
      Returns:
        The dataset of the sliced data
      Throws:
        `DatasetException`

    - #### getSlice

          public Dataset getSlice(Slice... slice)
                           throws DatasetException

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned dataset is a copied selection of items
      Specified by:
        `getSlice` in interface `ILazyDataset`
      Parameters:
        `slice` - an array of slice objects (the array can be null or contain nulls)
      Returns:
        The dataset of the sliced data
      Throws:
        `DatasetException`

    - #### getSlice

          public Dataset getSlice(SliceND slice)
                           throws DatasetException

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned dataset is a copied selection of items
      Specified by:
        `getSlice` in interface `ILazyDataset`
      Parameters:
        `slice` - an n-D slice
      Returns:
        The dataset of the sliced data
      Throws:
        `DatasetException`

    - #### getSlice

          public Dataset getSlice(IMonitor monitor,
                         Slice... slice)
                           throws DatasetException

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned dataset is a copied selection of items
      Specified by:
        `getSlice` in interface `ILazyDataset`
        `slice` - an array of slice objects (the array can be null or contain nulls)
      Returns:
        The dataset of the sliced data
      Throws:
        `DatasetException`

    - #### getSliceView

          public AggregateDataset getSliceView(Slice... slice)

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned lazy dataset is a view on a selection of items
      Specified by:
        `getSliceView` in interface `ILazyDataset`
      Parameters:
        `slice` - an array of slice objects (the array can be null or contain nulls)
      Returns:
        The sliced view of a lazy dataset

    - #### getSliceView

          public AggregateDataset getSliceView(int[] start,
                                      int[] stop,
                                      int[] step)

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned lazy dataset is a view on a selection of items
      Specified by:
        `getSliceView` in interface `ILazyDataset`
      Parameters:
        `start` - specifies the starting indexes (can be null for origin)
        `stop` - specifies the stopping indexes (can be null for end)
        `step` - specifies the steps in the slice (can be null for unit steps)
      Returns:
        The sliced view of a lazy dataset

    - #### getSliceView

          public AggregateDataset getSliceView(SliceND slice)

      Description copied from interface: `ILazyDataset`
      Get a slice of the dataset. The returned lazy dataset is a view on a selection of items
      Specified by:
        `getSliceView` in interface `ILazyDataset`
      Parameters:
        `slice` - an n-D slice
      Returns:
        The sliced view of a lazy dataset

    - #### getTransposedView

          public AggregateDataset getTransposedView(int... axes)

      Description copied from interface: `ILazyDataset`
      Permute copy of dataset's axes so that given order is old order:

            axisPerm = (p(0), p(1),...) => newdata(n(0), n(1),...) = olddata(o(0), o(1), ...)
            such that n(i) = o(p(i)) for all i

      I.e. for a 3D dataset (1,0,2) implies the new dataset has its 1st dimension running along the old dataset's 2nd dimension and the new 2nd is the old 1st. The 3rd dimension is left unchanged.
      Specified by:
        `getTransposedView` in interface `ILazyDataset`
      Parameters:
        `axes` - if zero length then axes order reversed
      Returns:
        remapped view of data

    - #### clone

          public AggregateDataset clone()

      Description copied from interface: `ILazyDataset`
      Clone dataset
      Specified by:
        `clone` in interface `ILazyDataset`
      Overrides:
        `clone` in class `LazyDatasetBase`
      Returns:
        a (shallow) copy of dataset

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### setErrors

          public void setErrors(Serializable errors)

      Description copied from interface: `ILazyDataset`
      Set the errors. It may be a single double, a double array or a whole dataset that can broadcast to the dataset
      Specified by:
        `setErrors` in interface `ILazyDataset`
      Overrides:
        `setErrors` in class `LazyDatasetBase`
      Parameters:
        `errors` - - may be null to remove the error set

    - #### getErrors

          public ILazyDataset getErrors()

      Description copied from interface: `ILazyDataset`
      Get the errors, if any. These will be in a shape that can broadcast to the dataset
      Specified by:
        `getErrors` in interface `ILazyDataset`
      Overrides:
        `getErrors` in class `LazyDatasetBase`

Copyright © 2017. All rights reserved.