Package io.github.ai4ci.abm.riskmodel
Class ImmutableRiskModel.Builder
java.lang.Object
io.github.ai4ci.abm.riskmodel.ImmutableRiskModel.Builder
- Enclosing class:
- ImmutableRiskModel
Builds instances of type
ImmutableRiskModel
.
Initialize attributes and then invoke the build()
method to create an
immutable instance.
Builder
is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableRiskModel
.Fill a builder with attribute values from the providedRiskModel
instance.setContactsKernel
(Kernel contactsKernel) Initializes the value for thecontactsKernel
attribute.setDirectLogOdds
(double... directLogOdds) Initializes the value for thedirectLogOdds
attribute.Initializes the value for theentity
attribute.setSymptomKernel
(Kernel symptomKernel) Initializes the value for thesymptomKernel
attribute.setTestKernel
(Kernel testKernel) Initializes the value for thetestKernel
attribute.setTime
(int time) Initializes the value for thetime
attribute.
-
Method Details
-
from
Fill a builder with attribute values from the providedRiskModel
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
setEntity
Initializes the value for theentity
attribute.- Parameters:
entity
- The value for entity- Returns:
this
builder for use in a chained invocation
-
setSymptomKernel
@CanIgnoreReturnValue public final ImmutableRiskModel.Builder setSymptomKernel(Kernel symptomKernel) Initializes the value for thesymptomKernel
attribute.- Parameters:
symptomKernel
- The value for symptomKernel- Returns:
this
builder for use in a chained invocation
-
setTestKernel
Initializes the value for thetestKernel
attribute.- Parameters:
testKernel
- The value for testKernel- Returns:
this
builder for use in a chained invocation
-
setContactsKernel
@CanIgnoreReturnValue public final ImmutableRiskModel.Builder setContactsKernel(Kernel contactsKernel) Initializes the value for thecontactsKernel
attribute.- Parameters:
contactsKernel
- The value for contactsKernel- Returns:
this
builder for use in a chained invocation
-
setDirectLogOdds
@CanIgnoreReturnValue public final ImmutableRiskModel.Builder setDirectLogOdds(double... directLogOdds) Initializes the value for thedirectLogOdds
attribute.If not set, this attribute will have a default value as defined by
directLogOdds
.- Parameters:
directLogOdds
- The elements for directLogOdds- Returns:
this
builder for use in a chained invocation
-
setTime
Initializes the value for thetime
attribute.- Parameters:
time
- The value for time- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableRiskModel
.- Returns:
- An immutable instance of RiskModel
- Throws:
IllegalStateException
- if any required attributes are missing
-