org.eclipse.january.dataset

## Class LazyWriteableDataset

- java.lang.Object
- - org.eclipse.january.dataset.LazyDatasetBase
  - - org.eclipse.january.dataset.LazyDataset
    - - org.eclipse.january.dataset.LazyDynamicDataset
      - - org.eclipse.january.dataset.LazyWriteableDataset

- All Implemented Interfaces:
    Serializable, Cloneable, IDynamicDataset, IDynamicShape, ILazyDataset, ILazyWriteableDataset, IMetadataProvider, INameable

      public class LazyWriteableDataset
      extends LazyDynamicDataset
      implements ILazyWriteableDataset

  Subclass of lazy dataset that allows setting slices
  See Also:
    Serialized Form

- - ### Field Summary

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

      `checker, eventDelegate, maxShape`

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

      `base, begSlice, delSlice, dtype, isize, loader, map, oMetadata, oShape, postShape, prepShape, size`

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

      `catchExceptions, logger, metadata, name, shape`

    - ### Fields inherited from interface org.eclipse.january.dataset.ILazyWriteableDataset

      `UNLIMITED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LazyWriteableDataset(String name, Class<?> clazz, int[] shape, int[] maxShape, int[] chunks, ILazySaver saver)` Create a lazy dataset
    `LazyWriteableDataset(String name, Class<?> clazz, int elements, int[] shape, int[] maxShape, int[] chunks, ILazySaver saver)` Create a lazy dataset
    `LazyWriteableDataset(String name, int dtype, int[] shape, int[] maxShape, int[] chunks, ILazySaver saver)` Create a lazy dataset
    `LazyWriteableDataset(String name, int dtype, int elements, int[] shape, int[] maxShape, int[] chunks, ILazySaver saver)` Create a lazy dataset

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `LazyWriteableDataset` | `clone()` Clone dataset
    `static LazyWriteableDataset` | `createLazyDataset(Dataset dataset)` Create a lazy writeable dataset based on in-memory data (handy for testing)
    `static LazyWriteableDataset` | `createLazyDataset(Dataset dataset, int[] maxShape)` Create a lazy writeable dataset based on in-memory data (handy for testing)
    `protected SliceND` | `createSlice(int[] nstart, int[] nstop, int[] nstep)`
    `int[]` | `getChunking()` Get chunking
    `Object` | `getFillValue()` Get the value used to fill an un-initialized dataset
    `LazyWriteableDataset` | `getSliceView(int[] start, int[] stop, int[] step)` Get a slice of the dataset.
    `LazyWriteableDataset` | `getSliceView(Slice... slice)` Get a slice of the dataset.
    `LazyWriteableDataset` | `getSliceView(SliceND slice)` Get a slice of the dataset.
    `LazyWriteableDataset` | `getTransposedView(int... axes)` Permute copy of dataset's axes so that given order is old order:
    `void` | `setChunking(int... chunks)` Set chunking
    `void` | `setFillValue(Object fill)` Set the value used to fill an un-initialized dataset
    `void` | `setSaver(ILazySaver saver)` Set saver (and also loader)
    `void` | `setSlice(IDataset data, SliceND slice)` Set a slice of the dataset
    `void` | `setSlice(IMonitor monitor, IDataset data, int[] start, int[] stop, int[] step)` Set a slice of the dataset
    `void` | `setSlice(IMonitor monitor, IDataset data, SliceND slice)` Set a slice of the dataset
    `void` | `setSliceSync(IMonitor monitor, IDataset data, SliceND slice)` Set a slice of the dataset synchronously
    `void` | `setWritingAsync(boolean async)` Set writing slices as asynchronous

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

      `addDataListener, fireDataListeners, getDataset, getMaxShape, refreshShape, removeDataListener, resize, setMaxShape, startUpdateChecker`

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

      `calcTrueSlice, equals, getDType, getElementsPerItem, getMaxSliceLength, getSize, getSlice, getSlice, getSlice, getSlice, getSlice, getSlice, setShape, squeezeEnds, toString, transformInput`

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

      `addMetadata, checkPermutatedAxes, clearMetadata, copyMetadata, copyMetadata, createFromSerializable, dirtyMetadata, findMetadataTypeSubInterfaces, getElementClass, getErrorMetadata, getErrors, getFirstMetadata, getMetadata, getMetadata, getName, getRank, getShape, hasErrors, hashCode, reshapeMetadata, restoreMetadata, setErrors, 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, getElementClass, getElementsPerItem, getErrors, getRank, getShape, getSize, getSlice, getSlice, getSlice, getSlice, getSlice, getSlice, hasErrors, setErrors, setMetadata, setShape, squeezeEnds`

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

      `getFirstMetadata, getMetadata, getMetadata`

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

      `getName, setName`

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

      `addDataListener, fireDataListeners, getDataset, getMaxShape, refreshShape, removeDataListener, resize, setMaxShape, startUpdateChecker`

- - ### Constructor Detail

    - #### LazyWriteableDataset

          public LazyWriteableDataset(String name,
                              int dtype,
                              int elements,
                              int[] shape,
                              int[] maxShape,
                              int[] chunks,
                              ILazySaver saver)

      Create a lazy dataset
      Parameters:
        `name` -
        `dtype` - dataset type
        `elements` -
        `shape` -
        `maxShape` -
        `chunks` -
        `saver` -

    - #### LazyWriteableDataset

          public LazyWriteableDataset(String name,
                              int dtype,
                              int[] shape,
                              int[] maxShape,
                              int[] chunks,
                              ILazySaver saver)

      Create a lazy dataset
      Parameters:
        `name` -
        `dtype` - dataset type
        `shape` -
        `maxShape` -
        `chunks` -
        `saver` -

    - #### LazyWriteableDataset

          public LazyWriteableDataset(String name,
                              Class<?> clazz,
                              int elements,
                              int[] shape,
                              int[] maxShape,
                              int[] chunks,
                              ILazySaver saver)

      Create a lazy dataset
      Parameters:
        `name` -
        `clazz` - dataset element class
        `elements` -
        `shape` -
        `maxShape` -
        `chunks` -
        `saver` -

    - #### LazyWriteableDataset

          public LazyWriteableDataset(String name,
                              Class<?> clazz,
                              int[] shape,
                              int[] maxShape,
                              int[] chunks,
                              ILazySaver saver)

      Create a lazy dataset
      Parameters:
        `name` -
        `clazz` - dataset element class
        `shape` -
        `maxShape` -
        `chunks` -
        `saver` -

  - ### Method Detail

    - #### createLazyDataset

          public static LazyWriteableDataset createLazyDataset(Dataset dataset)

      Create a lazy writeable dataset based on in-memory data (handy for testing)
      Parameters:
        `dataset` -

    - #### createLazyDataset

          public static LazyWriteableDataset createLazyDataset(Dataset dataset,
                                               int[] maxShape)

      Create a lazy writeable dataset based on in-memory data (handy for testing)
      Parameters:
        `dataset` -

    - #### getChunking

          public int[] getChunking()

      Description copied from interface: `ILazyWriteableDataset`
      Get chunking
      Specified by:
        `getChunking` in interface `ILazyWriteableDataset`
      Returns:
        chunks (can be null)

    - #### setChunking

          public void setChunking(int... chunks)

      Description copied from interface: `ILazyWriteableDataset`
      Set chunking
      Specified by:
        `setChunking` in interface `ILazyWriteableDataset`
      Parameters:
        `chunks` - chunk shape

    - #### clone

          public LazyWriteableDataset clone()

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

    - #### getSliceView

          public LazyWriteableDataset 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`
      Overrides:
        `getSliceView` in class `LazyDataset`
      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 LazyWriteableDataset 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`
      Overrides:
        `getSliceView` in class `LazyDataset`
      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 LazyWriteableDataset 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`
      Overrides:
        `getSliceView` in class `LazyDataset`
      Parameters:
        `slice` - an n-D slice
      Returns:
        The sliced view of a lazy dataset

    - #### getTransposedView

          public LazyWriteableDataset 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`
      Overrides:
        `getTransposedView` in class `LazyDataset`
      Parameters:
        `axes` - if zero length then axes order reversed
      Returns:
        remapped view of data

    - #### setWritingAsync

          public void setWritingAsync(boolean async)

      Description copied from interface: `ILazyWriteableDataset`
      Set writing slices as asynchronous
      Specified by:
        `setWritingAsync` in interface `ILazyWriteableDataset`

    - #### setSlice

          public void setSlice(IDataset data,
                      SliceND slice)
                        throws DatasetException

      Set a slice of the dataset
      Parameters:
        `data` -
        `slice` - an n-D slice
      Throws:
        `DatasetException`

    - #### setSlice

          public void setSlice(IMonitor monitor,
                      IDataset data,
                      int[] start,
                      int[] stop,
                      int[] step)
                        throws DatasetException

      Description copied from interface: `ILazyWriteableDataset`
      Set a slice of the dataset
      Specified by:
        `setSlice` in interface `ILazyWriteableDataset`
        `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)
      Throws:
        `DatasetException`

    - #### setSlice

          public void setSlice(IMonitor monitor,
                      IDataset data,
                      SliceND slice)
                        throws DatasetException

      Description copied from interface: `ILazyWriteableDataset`
      Set a slice of the dataset
      Specified by:
        `setSlice` in interface `ILazyWriteableDataset`
        `slice` - an n-D slice
      Throws:
        `DatasetException`

    - #### setSliceSync

          public void setSliceSync(IMonitor monitor,
                          IDataset data,
                          SliceND slice)
                            throws DatasetException

      Description copied from interface: `ILazyWriteableDataset`
      Set a slice of the dataset synchronously
      Specified by:
        `setSliceSync` in interface `ILazyWriteableDataset`
        `slice` - an n-D slice
      Throws:
        `DatasetException`

    - #### setSaver

          public void setSaver(ILazySaver saver)

      Set saver (and also loader)
      Specified by:
        `setSaver` in interface `ILazyWriteableDataset`
      Parameters:
        `saver` -

    - #### createSlice

          protected SliceND createSlice(int[] nstart,
                            int[] nstop,
                            int[] nstep)

      Overrides:
        `createSlice` in class `LazyDataset`

    - #### getFillValue

          public Object getFillValue()

      Description copied from interface: `ILazyWriteableDataset`
      Get the value used to fill an un-initialized dataset
      Specified by:
        `getFillValue` in interface `ILazyWriteableDataset`
      Returns:
        fill value

    - #### setFillValue

          public void setFillValue(Object fill)

      Description copied from interface: `ILazyWriteableDataset`
      Set the value used to fill an un-initialized dataset
      Specified by:
        `setFillValue` in interface `ILazyWriteableDataset`

Copyright © 2017. All rights reserved.