Class AbstractIndexedValue<U extends Unit<U>,​S extends Scalar<U,​S>,​T extends AbstractIndexedValue<U,​S,​T,​D>,​D extends AbstractStorage<D>>

    • Constructor Detail

      • AbstractIndexedValue

        protected AbstractIndexedValue​(U unit)
        Construct a new AbstractIndexedValue.
        Parameters:
        unit - U; the unit
    • Method Detail

      • getData

        protected abstract D getData()
        Retrieve the data object. Method can only be used within package and by subclasses.
        Returns:
        D; the internal data
      • setData

        protected abstract void setData​(D data)
        Set the data object. Method can only be used within package and by subclasses.
        Parameters:
        data - D; the internal data
      • checkCopyOnWrite

        protected final void checkCopyOnWrite()
        Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag.
        Throws:
        ValueRuntimeException - if the vector is immutable
      • isCopyOnWrite

        protected final boolean isCopyOnWrite()
        Retrieve the value of the copyOnWrite flag.
        Returns:
        boolean
      • setCopyOnWrite

        protected final void setCopyOnWrite​(boolean copyOnWrite)
        Change the copyOnWrite flag.
        Parameters:
        copyOnWrite - boolean; the new value for the copyOnWrite flag
      • setMutable

        protected final void setMutable​(boolean mutable)
        Set helper flag to indicate whether the data is mutable or not.
        Parameters:
        mutable - boolean; helper flag to indicate whether the data is mutable or not
      • mutable

        public final T mutable()
        Turn the immutable flag off for this internal storage.
        Specified by:
        mutable in interface IndexedValue<U extends Unit<U>,​S extends Scalar<U,​S>,​T extends AbstractIndexedValue<U,​S,​T,​D>>
        Returns:
        T; the internal storage with a cleared immutable flag
      • isDense

        public final boolean isDense()
        Return whether the internal storage type of the indexed value is dense or not.
        Specified by:
        isDense in interface IndexedValue<U extends Unit<U>,​S extends Scalar<U,​S>,​T extends AbstractIndexedValue<U,​S,​T,​D>>
        Returns:
        boolean; whether the internal storage type of the indexed value is dense or not
      • isSparse

        public final boolean isSparse()
        Return whether the internal storage type of the indexed value is sparse or not.
        Specified by:
        isSparse in interface IndexedValue<U extends Unit<U>,​S extends Scalar<U,​S>,​T extends AbstractIndexedValue<U,​S,​T,​D>>
        Returns:
        boolean; whether the internal storage type of the indexed value is sparse or not
      • cardinality

        public final int cardinality()
        Count the number of cells that have a non-zero SI value.
        Specified by:
        cardinality in interface IndexedValue<U extends Unit<U>,​S extends Scalar<U,​S>,​T extends AbstractIndexedValue<U,​S,​T,​D>>
        Returns:
        int; the number of cells having non-zero SI value
      • clone

        public T clone()
        Overrides:
        clone in class Object