Package com.yahoo.tensor
Class TensorAddress
- java.lang.Object
-
- com.yahoo.tensor.TensorAddress
-
- All Implemented Interfaces:
java.lang.Comparable<TensorAddress>
public abstract class TensorAddress extends java.lang.Object implements java.lang.Comparable<TensorAddress>
An immutable address to a tensor cell. This simply supplies a value to each dimension in a particular tensor type. By itself it is just a list of cell labels, it's meaning depends on its accompanying type.- Author:
- bratseth
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TensorAddress.Builder
Supports building of a tensor address
-
Constructor Summary
Constructors Constructor Description TensorAddress()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(TensorAddress other)
boolean
equals(java.lang.Object o)
int
hashCode()
boolean
isEmpty()
abstract java.lang.String
label(int i)
Returns the i'th label in thisabstract long
numericLabel(int i)
Returns the i'th label in this as a long.static TensorAddress
of(long... labels)
static TensorAddress
of(java.lang.String[] labels)
abstract int
size()
Returns the number of labels in thisjava.lang.String
toString(TensorType type)
Returns this as a string on the appropriate form given the typeabstract TensorAddress
withLabel(int labelIndex, long label)
-
-
-
Method Detail
-
of
public static TensorAddress of(java.lang.String[] labels)
-
of
public static TensorAddress of(long... labels)
-
size
public abstract int size()
Returns the number of labels in this
-
label
public abstract java.lang.String label(int i)
Returns the i'th label in this- Throws:
java.lang.IllegalArgumentException
- if there is no label at this index
-
numericLabel
public abstract long numericLabel(int i)
Returns the i'th label in this as a long. Prefer this if you know that this is a numeric address, but not otherwise.- Throws:
java.lang.IllegalArgumentException
- if there is no label at this index
-
withLabel
public abstract TensorAddress withLabel(int labelIndex, long label)
-
isEmpty
public final boolean isEmpty()
-
compareTo
public int compareTo(TensorAddress other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<TensorAddress>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public final java.lang.String toString(TensorType type)
Returns this as a string on the appropriate form given the type
-
-