Package pl.poznan.put.types
Class ImmutableDistanceMatrix.Builder
- java.lang.Object
-
- pl.poznan.put.types.ImmutableDistanceMatrix.Builder
-
- Enclosing class:
- ImmutableDistanceMatrix
@NotThreadSafe public static final class ImmutableDistanceMatrix.Builder extends Object
Builds instances of typeImmutableDistanceMatrix. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableDistanceMatrix.BuilderaddAllNames(Iterable<String> elements)Adds elements tonameslist.ImmutableDistanceMatrix.BuilderaddNames(String element)Adds one element tonameslist.ImmutableDistanceMatrix.BuilderaddNames(String... elements)Adds elements tonameslist.ImmutableDistanceMatrixbuild()Builds a newImmutableDistanceMatrix.ImmutableDistanceMatrix.Builderfrom(DistanceMatrix instance)Fill a builder with attribute values from the providedDistanceMatrixinstance.ImmutableDistanceMatrix.Buildermatrix(double[]... matrix)Initializes the value for thematrixattribute.ImmutableDistanceMatrix.Buildernames(Iterable<String> elements)Sets or replaces all elements fornameslist.
-
-
-
Method Detail
-
from
public final ImmutableDistanceMatrix.Builder from(DistanceMatrix instance)
Fill a builder with attribute values from the providedDistanceMatrixinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
addNames
public final ImmutableDistanceMatrix.Builder addNames(String element)
Adds one element tonameslist.- Parameters:
element- A names element- Returns:
thisbuilder for use in a chained invocation
-
addNames
public final ImmutableDistanceMatrix.Builder addNames(String... elements)
Adds elements tonameslist.- Parameters:
elements- An array of names elements- Returns:
thisbuilder for use in a chained invocation
-
names
public final ImmutableDistanceMatrix.Builder names(Iterable<String> elements)
Sets or replaces all elements fornameslist.- Parameters:
elements- An iterable of names elements- Returns:
thisbuilder for use in a chained invocation
-
addAllNames
public final ImmutableDistanceMatrix.Builder addAllNames(Iterable<String> elements)
Adds elements tonameslist.- Parameters:
elements- An iterable of names elements- Returns:
thisbuilder for use in a chained invocation
-
matrix
public final ImmutableDistanceMatrix.Builder matrix(double[]... matrix)
Initializes the value for thematrixattribute.- Parameters:
matrix- The elements for matrix- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableDistanceMatrix build()
Builds a newImmutableDistanceMatrix.- Returns:
- An immutable instance of DistanceMatrix
- Throws:
IllegalStateException- if any required attributes are missing
-
-