Class Storage<T extends Storage<T>>

java.lang.Object
org.djunits.value.storage.Storage<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 Storage<T extends Storage<T>> extends Object implements Cloneable, Serializable
StorageInterface.java.

Copyright (c) 2019-2024 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:
  • Constructor Details

    • Storage

      public Storage(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