Class AbstractStorage<T extends AbstractStorage<T>>

java.lang.Object
org.djunits.value.storage.AbstractStorage<T>
Type Parameters:
T - the vector or matrix data type
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
DoubleMatrixData, DoubleVectorData, FloatMatrixData, FloatVectorData

public abstract class AbstractStorage<T extends AbstractStorage<T>>
extends Object
implements Cloneable, Serializable
StorageInterface.java.

Copyright (c) 2019-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.

Author:
Alexander Verbraeck
See Also:
Serialized Form
  • Constructor Details

    • AbstractStorage

      public AbstractStorage​(StorageType storageType)
      Construct a new Data store.
      Parameters:
      storageType - StorageType; the data type
  • Method Details

    • getStorageType

      public final StorageType getStorageType()
      Return the StorageType (DENSE, SPARSE, etc.) for the stored indexed value.
      Returns:
      the StorageType (DENSE, SPARSE, etc.) for the stored indexed value
    • isDense

      public final boolean isDense()
      Is this indexed value dense?
      Returns:
      boolean; true if the data storage type is dense; false if the data storage type is not dense
    • isSparse

      public final boolean isSparse()
      Is this indexed value sparse?
      Returns:
      boolean; true if the data storage type is sparse; false if the data storage type is not sparse
    • cardinality

      public abstract int cardinality()
      Compute and return the number of non-zero cells in this indexed value.
      Returns:
      int; the number of non-zero cells
    • copy

      public abstract T copy()
      Create and return a deep copy of the data.
      Returns:
      T; a deep copy of the data