Class AbstractScalar<V>

  • Type Parameters:
    V - the type of the value of the scalar
    All Implemented Interfaces:
    Scalar<V>, Tensor<V>, Tensoric<V>
    Direct Known Subclasses:
    ImmutableScalar

    public abstract class AbstractScalar<V>
    extends AbstractTensor<V>
    implements Scalar<V>
    A base class for scalars, that already guarantees the shape and the correct delegation of the get() methods to the value method.
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractScalar()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(Position position)
      Returns true if the tensoric object contains the given position, false otherwise.
      V get​(java.lang.Object... coordinates)  
      V get​(Position position)  
      Shape shape()
      Retrieves the shape of the tensor.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.tensorics.core.tensor.Scalar

        value
      • Methods inherited from interface org.tensorics.core.tensor.Tensor

        context
    • Constructor Detail

      • AbstractScalar

        public AbstractScalar()
    • Method Detail

      • get

        public final V get​(Position position)
        Specified by:
        get in interface Tensoric<V>
        Parameters:
        position - the position in the N-dimensional space where to find the value.
        Returns:
        the value at the given position
      • get

        public final V get​(java.lang.Object... coordinates)
        Specified by:
        get in interface Tensoric<V>
        Parameters:
        coordinates - form N-dimensional space where to find the value.
        Returns:
        a value at the given coordinates.
      • shape

        public final Shape shape()
        Description copied from interface: Tensor
        Retrieves the shape of the tensor. As shape we understand simply the structure of a tensor: Its dimensions and the available positions.

        Implementations have to take care that the returned value here is never null.

        Specified by:
        shape in interface Tensor<V>
        Returns:
        the shape of the tensor.
      • contains

        public boolean contains​(Position position)
        Description copied from interface: Tensoric
        Returns true if the tensoric object contains the given position, false otherwise.
        Specified by:
        contains in interface Tensoric<V>
        Parameters:
        position - the position to be checked
        Returns:
        true if the position is contained in the tensoric object, false otherwise.