Class 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 Detail

      • TensorAddress

        public TensorAddress()
    • Method Detail

      • 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()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode 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