Package org.mitre.synthea.identity
Class Period
- java.lang.Object
-
- org.mitre.synthea.identity.Period
-
public class Period extends java.lang.Object
A simple representation of a time period with a start and end date. End date may be null for usage with Seeds to represent an open-ended range, if it is the last Seed for an Entity.
-
-
Constructor Summary
Constructors Constructor Description Period(java.time.LocalDate start, java.time.LocalDate end)
Constructs a Period with a start and end date.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(long timestamp)
Determines whether the timestamp is within this period.boolean
contains(java.time.LocalDate date)
Checks if the given date is within this period.java.time.LocalDate
getEnd()
Gets the end date of the period.java.time.LocalDate
getStart()
Gets the start date of the period.
-
-
-
Method Detail
-
contains
public boolean contains(java.time.LocalDate date)
Checks if the given date is within this period.- Parameters:
date
- the date to check- Returns:
- true if the date is within the period, inclusive of start and end
-
contains
public boolean contains(long timestamp)
Determines whether the timestamp is within this period.- Parameters:
timestamp
- to check- Returns:
- true if it is a part of this period inclusive of start and end
-
getStart
public java.time.LocalDate getStart()
Gets the start date of the period.- Returns:
- the start date
-
getEnd
public java.time.LocalDate getEnd()
Gets the end date of the period.- Returns:
- the end date, or null if open-ended
-
-