Package pl.poznan.put.circular
Class ImmutableHistogram
- java.lang.Object
-
- pl.poznan.put.circular.Histogram
-
- pl.poznan.put.circular.ImmutableHistogram
-
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableHistogram extends Histogram
Immutable implementation ofHistogram.Use the builder to create immutable instances:
ImmutableHistogram.builder(). Use the static factory method to create immutable instances:ImmutableHistogram.of().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableHistogram.BuilderBuilds instances of typeImmutableHistogram.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<pl.poznan.put.circular.Histogram.Bin>bins()doublebinWidth()static ImmutableHistogram.Builderbuilder()Creates a builder forImmutableHistogram.static ImmutableHistogramcopyOf(Histogram instance)Creates an immutable copy of aHistogramvalue.Collection<Angle>data()booleanequals(Object another)This instance is equal to all instances ofImmutableHistogramthat have equal attribute values.inthashCode()Computes a hash code from attributes:data,binWidth.static ImmutableHistogramof(Collection<Angle> data, double binWidth)Construct a new immutableHistograminstance.StringtoString()Prints the immutable valueHistogramwith attribute values.ImmutableHistogramwithBinWidth(double value)Copy the current immutable object by setting a value for thebinWidthattribute.ImmutableHistogramwithData(Collection<Angle> value)Copy the current immutable object by setting a value for thedataattribute.-
Methods inherited from class pl.poznan.put.circular.Histogram
check, findBin, largestBinSize
-
-
-
-
Method Detail
-
data
public Collection<Angle> data()
-
binWidth
public double binWidth()
-
withData
public final ImmutableHistogram withData(Collection<Angle> value)
Copy the current immutable object by setting a value for thedataattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for data- Returns:
- A modified copy of the
thisobject
-
withBinWidth
public final ImmutableHistogram withBinWidth(double value)
Copy the current immutable object by setting a value for thebinWidthattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for binWidth- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableHistogramthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:data,binWidth.
-
toString
public String toString()
Prints the immutable valueHistogramwith attribute values.
-
bins
protected Collection<pl.poznan.put.circular.Histogram.Bin> bins()
Returns a lazily initialized value of the
binsattribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.
-
of
public static ImmutableHistogram of(Collection<Angle> data, double binWidth)
Construct a new immutableHistograminstance.- Parameters:
data- The value for thedataattributebinWidth- The value for thebinWidthattribute- Returns:
- An immutable Histogram instance
-
copyOf
public static ImmutableHistogram copyOf(Histogram instance)
Creates an immutable copy of aHistogramvalue. 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 Histogram instance
-
builder
public static ImmutableHistogram.Builder builder()
Creates a builder forImmutableHistogram.ImmutableHistogram.builder() .data(Collection<pl.poznan.put.circular.Angle>) // requireddata.binWidth(double) // requiredbinWidth.build();- Returns:
- A new ImmutableHistogram builder
-
-