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

      • TensorAddress

        public TensorAddress()
    • Method Detail

      • of

        public static TensorAddress of​(java.lang.String[] labels)
      • ofLabels

        public static TensorAddress ofLabels​(java.lang.String... 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 interface java.lang.Comparable<TensorAddress>
      • hashCode

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toString

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

        public static java.lang.String labelToString​(java.lang.String label)
        Returns a label as a string with approriate quoting/escaping when necessary