Package pl.poznan.put.types
Class ImmutableDistanceMatrix
- java.lang.Object
-
- pl.poznan.put.types.ImmutableDistanceMatrix
-
- All Implemented Interfaces:
DistanceMatrix
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableDistanceMatrix extends Object implements DistanceMatrix
Immutable implementation ofDistanceMatrix.Use the builder to create immutable instances:
ImmutableDistanceMatrix.builder(). Use the static factory method to create immutable instances:ImmutableDistanceMatrix.of().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableDistanceMatrix.BuilderBuilds instances of typeImmutableDistanceMatrix.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableDistanceMatrix.Builderbuilder()Creates a builder forImmutableDistanceMatrix.static ImmutableDistanceMatrixcopyOf(DistanceMatrix instance)Creates an immutable copy of aDistanceMatrixvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableDistanceMatrixthat have equal attribute values.inthashCode()Computes a hash code from attributes:names,matrix.double[][]matrix()List<String>names()static ImmutableDistanceMatrixof(Iterable<String> names, double[][] matrix)Construct a new immutableDistanceMatrixinstance.static ImmutableDistanceMatrixof(List<String> names, double[][] matrix)Construct a new immutableDistanceMatrixinstance.StringtoString()Prints the immutable valueDistanceMatrixwith attribute values.ImmutableDistanceMatrixwithMatrix(double[]... elements)Copy the current immutable object with elements that replace the content ofmatrix.ImmutableDistanceMatrixwithNames(Iterable<String> elements)Copy the current immutable object with elements that replace the content ofnames.ImmutableDistanceMatrixwithNames(String... elements)Copy the current immutable object with elements that replace the content ofnames.
-
-
-
Method Detail
-
names
public List<String> names()
- Specified by:
namesin interfaceDistanceMatrix- Returns:
- The value of the
namesattribute
-
matrix
public double[][] matrix()
- Specified by:
matrixin interfaceDistanceMatrix- Returns:
- A cloned
matrixarray
-
withNames
public final ImmutableDistanceMatrix withNames(String... elements)
Copy the current immutable object with elements that replace the content ofnames.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withNames
public final ImmutableDistanceMatrix withNames(Iterable<String> elements)
Copy the current immutable object with elements that replace the content ofnames. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of names elements to set- Returns:
- A modified copy of
thisobject
-
withMatrix
public final ImmutableDistanceMatrix withMatrix(double[]... elements)
Copy the current immutable object with elements that replace the content ofmatrix. The array is cloned before being saved as attribute values.- Parameters:
elements- The non-null elements for matrix- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableDistanceMatrixthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:names,matrix.
-
toString
public String toString()
Prints the immutable valueDistanceMatrixwith attribute values.
-
of
public static ImmutableDistanceMatrix of(List<String> names, double[][] matrix)
Construct a new immutableDistanceMatrixinstance.- Parameters:
names- The value for thenamesattributematrix- The value for thematrixattribute- Returns:
- An immutable DistanceMatrix instance
-
of
public static ImmutableDistanceMatrix of(Iterable<String> names, double[][] matrix)
Construct a new immutableDistanceMatrixinstance.- Parameters:
names- The value for thenamesattributematrix- The value for thematrixattribute- Returns:
- An immutable DistanceMatrix instance
-
copyOf
public static ImmutableDistanceMatrix copyOf(DistanceMatrix instance)
Creates an immutable copy of aDistanceMatrixvalue. 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
-
builder
public static ImmutableDistanceMatrix.Builder builder()
Creates a builder forImmutableDistanceMatrix.ImmutableDistanceMatrix.builder() .addNames|addAllNames(String) //nameselements .matrix(double[]) // requiredmatrix.build();- Returns:
- A new ImmutableDistanceMatrix builder
-
-