Package com.yahoo.tensor
Class TensorAddress
java.lang.Object
com.yahoo.tensor.TensorAddress
- All Implemented Interfaces:
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
Modifier and TypeClassDescriptionstatic class
Builder of a tensor addressstatic class
Builder of an address to a subset of the dimensions of a tensor type -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(TensorAddress other) boolean
int
hashCode()
final boolean
isEmpty()
abstract String
label
(int i) Returns the i'th label in thisstatic String
labelToString
(String label) Returns a label as a string with appropriate quoting/escaping when necessaryabstract long
numericLabel
(int i) Returns the i'th label in this as a long.static TensorAddress
of
(long... labels) static TensorAddress
static TensorAddress
abstract int
size()
Returns the number of labels in thisfinal String
toString
(TensorType type) Returns this as a string on the appropriate form given the typeabstract TensorAddress
withLabel
(int labelIndex, long label)
-
Constructor Details
-
TensorAddress
public TensorAddress()
-
-
Method Details
-
of
-
ofLabels
-
of
-
size
public abstract int size()Returns the number of labels in this -
label
Returns the i'th label in this- Throws:
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:
IllegalArgumentException
- if there is no label at this index
-
withLabel
-
isEmpty
public final boolean isEmpty() -
compareTo
- Specified by:
compareTo
in interfaceComparable<TensorAddress>
-
hashCode
public int hashCode() -
equals
-
toString
Returns this as a string on the appropriate form given the type -
labelToString
Returns a label as a string with appropriate quoting/escaping when necessary
-