V - the type of the value of the scalarpublic final class ImmutableScalar<V> extends AbstractScalar<V> implements java.io.Serializable
of(Object) method. An immutable scalar with a non-empty context can
be created by chaining the of(Object) method with the withContext(Position) method.| Modifier and Type | Method and Description |
|---|---|
Position |
context()
Retrieves the context of the tensor, which is nothing else than a position.
|
static <V> ImmutableScalar<V> |
of(V value)
Factory method for a scalar with an empty context.
|
java.lang.String |
toString() |
V |
value()
Has to retrieve the value of the scalar.
|
ImmutableScalar<V> |
withContext(java.lang.Object... coordinates)
Returns a new scalar with the same value as this scalar, but the context overridden by a position constructed
from the given coordinates.
|
ImmutableScalar<V> |
withContext(Position newContext)
Returns a new scalar with the same value as this scalar, but the context overridden by the given one.
|
contains, get, get, shapeequals, hashCodepublic static <V> ImmutableScalar<V> of(V value)
value - the value of the scalarjava.lang.NullPointerException - if the given value is nullpublic final ImmutableScalar<V> withContext(Position newContext)
newContext - the context for the new scalar instancejava.lang.NullPointerException - if the given context is nullpublic final ImmutableScalar<V> withContext(java.lang.Object... coordinates)
coordinates - the coordinates for the context of the new scalar instancejava.lang.NullPointerException - if the given context is nullpublic Position context()
Tensor
Implementations have to guarantee that the returned value here is never null.
public V value()
ScalarTensoric.get(Object...) with an empty array of coordinates and with calling Tensoric.get(Position) with an empty
position.public java.lang.String toString()
toString in class java.lang.Object