Package io.github.ai4ci.abm.riskmodel
Class ImmutableKernel
java.lang.Object
io.github.ai4ci.abm.riskmodel.ImmutableKernel
- All Implemented Interfaces:
Kernel
,Serializable
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableKernel
extends Object
implements Kernel
Immutable implementation of
Kernel
.
Use the builder to create immutable instances:
ImmutableKernel.builder()
.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableKernel.Builder
builder()
Creates a builder forImmutableKernel
.static ImmutableKernel
Creates an immutable copy of aKernel
value.boolean
This instance is equal to all instances ofImmutableKernel
that have equal attribute values.double[]
Kernel values, offset as required, compared to a convolution this is in reverse order.int
index of zero point in values. positive values mean that the kernel is 2 sided. zero means only left sided. negatives don't make particular sense but should work consistentlyint
hashCode()
Computes a hash code from attributes:density
,offset
.Creates a builder forImmutableKernel
.prefilled with attibute values ofthis
instance to easily create modified copies.toString()
Prints the immutable valueKernel
with attribute values.final ImmutableKernel
withDensity
(double... elements) Copy the current immutable object with elements that replace the content ofdensity
.final ImmutableKernel
withOffset
(int value) Copy the current immutable object by setting a value for theoffset
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.ai4ci.abm.riskmodel.Kernel
getDensity, normaliseTo, prospectiveSize, retrospectiveSize, scale, size
-
Method Details
-
getDensity
public double[] getDensity()Kernel values, offset as required, compared to a convolution this is in reverse order. The first value in this array is applied to the most recent data point, which may be in the future (prospective).- Specified by:
getDensity
in interfaceKernel
-
getOffset
public int getOffset()index of zero point in values. positive values mean that the kernel is 2 sided. zero means only left sided. negatives don't make particular sense but should work consistently -
withDensity
Copy the current immutable object with elements that replace the content ofdensity
. The array is cloned before being saved as attribute values.- Parameters:
elements
- The non-null elements for density- Returns:
- A modified copy of
this
object
-
withOffset
Copy the current immutable object by setting a value for theoffset
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for offset- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableKernel
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:density
,offset
. -
toString
Prints the immutable valueKernel
with attribute values. -
copyOf
Creates an immutable copy of aKernel
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 Kernel instance
-
toBuilder
Creates a builder forImmutableKernel
.prefilled with attibute values ofthis
instance to easily create modified copies.- Returns:
- A new ImmutableKernel builder with attributes of
this
instance
-
builder
Creates a builder forImmutableKernel
.ImmutableKernel.builder() .setDensity(double) // required
density
.setOffset(int) // requiredoffset
.build();- Returns:
- A new ImmutableKernel builder
-