Class TensorAddress

java.lang.Object
com.yahoo.tensor.TensorAddress
All Implemented Interfaces:
Comparable<TensorAddress>

public abstract class TensorAddress extends Object implements 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
  • Constructor Details

    • TensorAddress

      public TensorAddress()
  • Method Details

    • of

      public static TensorAddress of(String[] labels)
    • ofLabels

      public static TensorAddress ofLabels(String... labels)
    • of

      public static TensorAddress of(long... labels)
    • size

      public abstract int size()
      Returns the number of labels in this
    • label

      public abstract String label(int i)
      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

      public abstract TensorAddress withLabel(int labelIndex, long label)
    • isEmpty

      public final boolean isEmpty()
    • compareTo

      public int compareTo(TensorAddress other)
      Specified by:
      compareTo in interface Comparable<TensorAddress>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public final String toString(TensorType type)
      Returns this as a string on the appropriate form given the type
    • labelToString

      public static String labelToString(String label)
      Returns a label as a string with appropriate quoting/escaping when necessary