Package io.github.ai4ci.abm
Class ImmutablePersonHistory.Builder
java.lang.Object
io.github.ai4ci.abm.ImmutablePersonHistory.Builder
- Enclosing class:
- ImmutablePersonHistory
Builds instances of type
ImmutablePersonHistory
.
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 TypeMethodDescriptionaddAllTodaysTests
(Iterable<? extends TestResult> elements) Adds elements totodaysTests
list.addTodaysTest
(TestResult element) Adds one element totodaysTests
list.addTodaysTests
(TestResult... elements) Adds elements totodaysTests
list.build()
Builds a newImmutablePersonHistory
.from
(PersonHistory instance) Fill a builder with attribute values from the providedio.github.ai4ci.abm.PersonHistory
instance.from
(PersonTemporalState instance) Fill a builder with attribute values from the providedio.github.ai4ci.abm.PersonTemporalState
instance.setContactExposure
(double contactExposure) Initializes the value for thecontactExposure
attribute.setDead
(boolean dead) Initializes the value for thedead
attribute.Initializes the value for theentity
attribute.setInfectious
(boolean infectious) Initializes the value for theinfectious
attribute.setNormalisedSeverity
(double normalisedSeverity) Initializes the value for thenormalisedSeverity
attribute.setNormalisedViralLoad
(double normalisedViralLoad) Initializes the value for thenormalisedViralLoad
attribute.setPresumedLocalPrevalence
(double presumedLocalPrevalence) Initializes the value for thepresumedLocalPrevalence
attribute.setReportedSymptomatic
(boolean reportedSymptomatic) Initializes the value for thereportedSymptomatic
attribute.setRequiringHospitalisation
(boolean requiringHospitalisation) Initializes the value for therequiringHospitalisation
attribute.setSymptomatic
(boolean symptomatic) Initializes the value for thesymptomatic
attribute.Initializes the value for thetime
attribute.setTodaysContacts
(Contact... todaysContacts) Initializes the value for thetodaysContacts
attribute.setTodaysExposures
(Exposure... todaysExposures) Initializes the value for thetodaysExposures
attribute.setTodaysTests
(Iterable<? extends TestResult> elements) Sets or replaces all elements fortodaysTests
list.
-
Method Details
-
from
Fill a builder with attribute values from the providedio.github.ai4ci.abm.PersonHistory
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
from
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder from(PersonTemporalState instance) Fill a builder with attribute values from the providedio.github.ai4ci.abm.PersonTemporalState
instance.- 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
-
setTime
Initializes the value for thetime
attribute.- Parameters:
time
- The value for time- Returns:
this
builder for use in a chained invocation
-
setInfectious
Initializes the value for theinfectious
attribute.- Parameters:
infectious
- The value for infectious- Returns:
this
builder for use in a chained invocation
-
setSymptomatic
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setSymptomatic(boolean symptomatic) Initializes the value for thesymptomatic
attribute.- Parameters:
symptomatic
- The value for symptomatic- Returns:
this
builder for use in a chained invocation
-
setReportedSymptomatic
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setReportedSymptomatic(boolean reportedSymptomatic) Initializes the value for thereportedSymptomatic
attribute.- Parameters:
reportedSymptomatic
- The value for reportedSymptomatic- Returns:
this
builder for use in a chained invocation
-
setRequiringHospitalisation
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setRequiringHospitalisation(boolean requiringHospitalisation) Initializes the value for therequiringHospitalisation
attribute.- Parameters:
requiringHospitalisation
- The value for requiringHospitalisation- Returns:
this
builder for use in a chained invocation
-
setDead
Initializes the value for thedead
attribute.- Parameters:
dead
- The value for dead- Returns:
this
builder for use in a chained invocation
-
setNormalisedSeverity
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setNormalisedSeverity(double normalisedSeverity) Initializes the value for thenormalisedSeverity
attribute.- Parameters:
normalisedSeverity
- The value for normalisedSeverity- Returns:
this
builder for use in a chained invocation
-
setNormalisedViralLoad
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setNormalisedViralLoad(double normalisedViralLoad) Initializes the value for thenormalisedViralLoad
attribute.- Parameters:
normalisedViralLoad
- The value for normalisedViralLoad- Returns:
this
builder for use in a chained invocation
-
setContactExposure
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setContactExposure(double contactExposure) Initializes the value for thecontactExposure
attribute.- Parameters:
contactExposure
- The value for contactExposure- Returns:
this
builder for use in a chained invocation
-
setPresumedLocalPrevalence
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setPresumedLocalPrevalence(double presumedLocalPrevalence) Initializes the value for thepresumedLocalPrevalence
attribute.- Parameters:
presumedLocalPrevalence
- The value for presumedLocalPrevalence- Returns:
this
builder for use in a chained invocation
-
addTodaysTest
Adds one element totodaysTests
list.- Parameters:
element
- A todaysTests element- Returns:
this
builder for use in a chained invocation
-
addTodaysTests
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder addTodaysTests(TestResult... elements) Adds elements totodaysTests
list.- Parameters:
elements
- An array of todaysTests elements- Returns:
this
builder for use in a chained invocation
-
setTodaysTests
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setTodaysTests(Iterable<? extends TestResult> elements) Sets or replaces all elements fortodaysTests
list.- Parameters:
elements
- An iterable of todaysTests elements- Returns:
this
builder for use in a chained invocation
-
addAllTodaysTests
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder addAllTodaysTests(Iterable<? extends TestResult> elements) Adds elements totodaysTests
list.- Parameters:
elements
- An iterable of todaysTests elements- Returns:
this
builder for use in a chained invocation
-
setTodaysContacts
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setTodaysContacts(Contact... todaysContacts) Initializes the value for thetodaysContacts
attribute.- Parameters:
todaysContacts
- The elements for todaysContacts- Returns:
this
builder for use in a chained invocation
-
setTodaysExposures
@CanIgnoreReturnValue public final ImmutablePersonHistory.Builder setTodaysExposures(Exposure... todaysExposures) Initializes the value for thetodaysExposures
attribute.- Parameters:
todaysExposures
- The elements for todaysExposures- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutablePersonHistory
.- Returns:
- An immutable instance of PersonHistory
- Throws:
IllegalStateException
- if any required attributes are missing
-