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 of
Histogram.
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<pl.poznan.put.circular.Histogram.Bin>bins()doublebinWidth()static ImmutableHistogram.Builderbuilder()Creates a builder forImmutableHistogram.static ImmutableHistogramCreates an immutable copy of aHistogramvalue.data()booleanThis 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.toString()Prints the immutable valueHistogramwith attribute values.final ImmutableHistogramwithBinWidth(double value) Copy the current immutable object by setting a value for thebinWidthattribute.final 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 Details
-
data
-
binWidth
public double binWidth() -
withData
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
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
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
Prints the immutable valueHistogramwith attribute values. -
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
Construct a new immutableHistograminstance.- Parameters:
data- The value for thedataattributebinWidth- The value for thebinWidthattribute- Returns:
- An immutable Histogram instance
-
copyOf
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
Creates a builder forImmutableHistogram.ImmutableHistogram.builder() .data(Collection<pl.poznan.put.circular.Angle>) // requireddata.binWidth(double) // requiredbinWidth.build();- Returns:
- A new ImmutableHistogram builder
-