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, chunks, eventDelegate, maxShape`

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

      `begSlice, delSlice, isize, loader, map, oMetadata, oShape, padding, size, sShape`

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

      `metadata, name, shape`

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

      `UNLIMITED`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `LazyWriteableDataset(ILazySaver saver, String name, Class<? extends Dataset> clazz, int[] shape, int[] maxShape, int[] chunks)` Create a lazy dataset
    `` | `LazyWriteableDataset(ILazySaver saver, String name, int elements, Class<? extends Dataset> clazz, int[] shape, int[] maxShape, int[] chunks)` Create a lazy dataset
    `protected` | `LazyWriteableDataset(LazyWriteableDataset other)`
    `` | `LazyWriteableDataset(String name, Class<?> eClass, int[] shape, int[] maxShape, int[] chunks, ILazySaver saver)` Create a lazy dataset using element class
    `` | `LazyWriteableDataset(String name, Class<?> eClass, int elements, int[] shape, int[] maxShape, int[] chunks, ILazySaver saver)` Create a lazy dataset using element class
    `` | `LazyWriteableDataset(String name, int dtype, int[] shape, int[] maxShape, int[] chunks, ILazySaver saver)` Deprecated. Use `LazyWriteableDataset(ILazySaver, String, int, Class, int[], int[], int[])`
    `` | `LazyWriteableDataset(String name, int dtype, int elements, int[] shape, int[] maxShape, int[] chunks, ILazySaver saver)` Deprecated. Use `LazyWriteableDataset(ILazySaver, String, int, Class, int[], int[], int[])`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete 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)
    `boolean` | `equals(Object obj)`
    `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:
    `int` | `hashCode()`
    `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
    `LazyWriteableDataset` | `squeezeEnds()` Remove dimensions of 1 from ends of shape of the dataset

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

      `addDataListener, checkSliceND, createSlice, fireDataListeners, getChunking, getDataset, getMaxShape, refreshShape, removeDataListener, resize, setChunking, setMaxShape, startUpdateChecker`

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

      `calcTrueSlice, getDType, getElementClass, getElementsPerItem, getInterface, getMaxSliceLength, getSize, getSlice, getSlice, getSlice, getSlice, getSlice, getSlice, internalGetSlice, internalGetSliceView, setInterface, setShape, toString`

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

      `addMetadata, checkPermutatedAxes, clearMetadata, copyMetadata, copyMetadata, createFromSerializable, dirtyMetadata, findMetadataTypeSubInterfaces, getErrorMetadata, getErrors, getFirstMetadata, getMetadata, getMetadata, getMetadataMap, getName, getRank, getShape, hasErrors, reshapeMetadata, restoreMetadata, setDirty, 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.IDynamicDataset

      `getChunking, setChunking`

    - ### 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`

    - ### 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

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

      Deprecated. Use `LazyWriteableDataset(ILazySaver, String, int, Class, int[], int[], int[])`
      Create a lazy dataset
      Parameters:
        `name` - of dataset
        `dtype` - dataset type
        `elements` - item size
        `shape` - dataset shape
        `maxShape` - maximum shape
        `chunks` - chunk shape
        `saver` - lazy saver

    - #### LazyWriteableDataset

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

      Create a lazy dataset
      Parameters:
        `saver` - lazy saver
        `name` - of dataset
        `clazz` - dataset sub-interface
        `shape` - dataset shape
        `maxShape` - maximum shape
        `chunks` - chunk shape
      Since:
        2.3

    - #### LazyWriteableDataset

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

      Create a lazy dataset
      Parameters:
        `saver` - lazy saver
        `name` - of dataset
        `elements` - item size
        `clazz` - dataset sub-interface
        `shape` - dataset shape
        `maxShape` - maximum shape
        `chunks` - chunk shape
      Since:
        2.3

    - #### LazyWriteableDataset

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

      Deprecated. Use `LazyWriteableDataset(ILazySaver, String, int, Class, int[], int[], int[])`
      Create a lazy dataset
      Parameters:
        `name` - of dataset
        `dtype` - dataset type
        `shape` - dataset shape
        `maxShape` - maximum shape
        `chunks` - chunk shape
        `saver` - lazy saver

    - #### LazyWriteableDataset

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

      Create a lazy dataset using element class
      Parameters:
        `name` - of dataset
        `eClass` - element class
        `elements` - item size
        `shape` - dataset shape
        `maxShape` - maximum shape
        `chunks` - chunk shape
        `saver` - lazy saver

    - #### LazyWriteableDataset

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

      Create a lazy dataset using element class
      Parameters:
        `name` - of dataset
        `eClass` - element class
        `shape` - dataset shape
        `maxShape` - maximum shape
        `chunks` - chunk shape
        `saver` - lazy saver

    - #### LazyWriteableDataset

          protected LazyWriteableDataset(LazyWriteableDataset other)

      Parameters:
        `other` - dataset
      Since:
        2.2

  - ### Method Detail

    - #### createLazyDataset

          public static LazyWriteableDataset createLazyDataset(Dataset dataset)

      Create a lazy writeable dataset based on in-memory data (handy for testing)
      Parameters:
        `dataset` - input
      Returns:
        lazy writeable 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` - input
        `maxShape` - maximum shape
      Returns:
        lazy writeable dataset

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `LazyDynamicDataset`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `LazyDynamicDataset`

    - #### 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`
      Parameters:
        `async` - true if writing should be asynchronous

    - #### setSlice

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

      Set a slice of the dataset
      Parameters:
        `data` - to set
        `slice` - an n-D slice
      Throws:
        `DatasetException` - when cannot write data

    - #### 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`
      Parameters:
        `monitor` - can be null
        `data` - input
        `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` - when cannot write data

    - #### 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`
      Parameters:
        `monitor` - can be null
        `data` - input
        `slice` - an n-D slice
      Throws:
        `DatasetException` - when cannot write data

    - #### 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`
      Parameters:
        `monitor` - can be null
        `data` - input
        `slice` - an n-D slice
      Throws:
        `DatasetException` - when cannot write data

    - #### setSaver

          public void setSaver(ILazySaver saver)

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

    - #### 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`
      Parameters:
        `fill` - value

    - #### squeezeEnds

          public LazyWriteableDataset squeezeEnds()

      Description copied from interface: `ILazyDataset`
      Remove dimensions of 1 from ends of shape of the dataset
      Specified by:
        `squeezeEnds` in interface `ILazyDataset`
      Specified by:
        `squeezeEnds` in interface `ILazyWriteableDataset`
      Overrides:
        `squeezeEnds` in class `LazyDataset`
      Returns:
        this

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