Class ImmutableDistanceMatrix

  • All Implemented Interfaces:
    DistanceMatrix

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    public final class ImmutableDistanceMatrix
    extends Object
    implements DistanceMatrix
    Immutable implementation of DistanceMatrix.

    Use the builder to create immutable instances: ImmutableDistanceMatrix.builder(). Use the static factory method to create immutable instances: ImmutableDistanceMatrix.of().

    • Method Detail

      • matrix

        public double[][] matrix()
        Specified by:
        matrix in interface DistanceMatrix
        Returns:
        A cloned matrix array
      • withNames

        public final ImmutableDistanceMatrix withNames​(String... elements)
        Copy the current immutable object with elements that replace the content of names.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withNames

        public final ImmutableDistanceMatrix withNames​(Iterable<String> elements)
        Copy the current immutable object with elements that replace the content of names. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of names elements to set
        Returns:
        A modified copy of this object
      • withMatrix

        public final ImmutableDistanceMatrix withMatrix​(double[]... elements)
        Copy the current immutable object with elements that replace the content of matrix. The array is cloned before being saved as attribute values.
        Parameters:
        elements - The non-null elements for matrix
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableDistanceMatrix that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: names, matrix.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value DistanceMatrix with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • of

        public static ImmutableDistanceMatrix of​(List<String> names,
                                                 double[][] matrix)
        Construct a new immutable DistanceMatrix instance.
        Parameters:
        names - The value for the names attribute
        matrix - The value for the matrix attribute
        Returns:
        An immutable DistanceMatrix instance
      • of

        public static ImmutableDistanceMatrix of​(Iterable<String> names,
                                                 double[][] matrix)
        Construct a new immutable DistanceMatrix instance.
        Parameters:
        names - The value for the names attribute
        matrix - The value for the matrix attribute
        Returns:
        An immutable DistanceMatrix instance
      • copyOf

        public static ImmutableDistanceMatrix copyOf​(DistanceMatrix instance)
        Creates an immutable copy of a DistanceMatrix value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable DistanceMatrix instance