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()
double
binWidth()
static ImmutableHistogram.Builder
builder()
Creates a builder forImmutableHistogram
.static ImmutableHistogram
Creates an immutable copy of aHistogram
value.data()
boolean
This instance is equal to all instances ofImmutableHistogram
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:data
,binWidth
.static ImmutableHistogram
of
(Collection<Angle> data, double binWidth) Construct a new immutableHistogram
instance.toString()
Prints the immutable valueHistogram
with attribute values.final ImmutableHistogram
withBinWidth
(double value) Copy the current immutable object by setting a value for thebinWidth
attribute.final ImmutableHistogram
withData
(Collection<Angle> value) Copy the current immutable object by setting a value for thedata
attribute.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 thedata
attribute. 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
this
object
-
withBinWidth
Copy the current immutable object by setting a value for thebinWidth
attribute. 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
this
object
-
equals
This instance is equal to all instances ofImmutableHistogram
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:data
,binWidth
. -
toString
Prints the immutable valueHistogram
with attribute values. -
bins
Returns a lazily initialized value of the
bins
attribute. 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 immutableHistogram
instance.- Parameters:
data
- The value for thedata
attributebinWidth
- The value for thebinWidth
attribute- Returns:
- An immutable Histogram instance
-
copyOf
Creates an immutable copy of aHistogram
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 Histogram instance
-
builder
Creates a builder forImmutableHistogram
.ImmutableHistogram.builder() .data(Collection<pl.poznan.put.circular.Angle>) // required
data
.binWidth(double) // requiredbinWidth
.build();- Returns:
- A new ImmutableHistogram builder
-