Class Period

java.lang.Object
org.mitre.synthea.identity.Period

public class Period extends 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 Details

    • Period

      public Period(LocalDate start, LocalDate end)
      Constructs a Period with a start and end date.
      Parameters:
      start - the start date of the period
      end - the end date of the period, may be null for open-ended periods
  • Method Details

    • contains

      public boolean contains(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 LocalDate getStart()
      Gets the start date of the period.
      Returns:
      the start date
    • getEnd

      public LocalDate getEnd()
      Gets the end date of the period.
      Returns:
      the end date, or null if open-ended