Class Age
java.lang.Object
org.monarchinitiative.lirical.core.model.Age
Convenience class to represent the age of a subject.
We represent both postnatal and gestational age. Use isGestational()
or isPostnatal()
to tell them apart.
The postnatal age has getYears()
, getMonths()
, and getDays()
fields set
and getWeeks()
should be ignored.
The gestational age uses getWeeks()
and getDays()
fields.
- Author:
- Peter Robinson
-
Method Summary
Modifier and TypeMethodDescriptionstatic Age
ageInDays
(int d) Create a postnatal age to representd
days of age.static Age
ageInMonths
(int m) Create a postnatal age to representm
months of age.static Age
ageInYears
(int y) Create a postnatal age to representy
years of age.boolean
static Age
gestationalAge
(int weeks, int days) Create a gestational age to representweeks
anddays
.int
getDays()
int
int
getWeeks()
int
getYears()
int
hashCode()
boolean
boolean
static Age
of
(int years, int months, int days) Create a postnatal age from given inputs.static Age
toString()
-
Method Details
-
getYears
public int getYears() -
getMonths
public int getMonths() -
getWeeks
public int getWeeks() -
getDays
public int getDays() -
isGestational
public boolean isGestational() -
isPostnatal
public boolean isPostnatal() -
ageInYears
Create a postnatal age to representy
years of age.- Parameters:
y
- a non-negative number of years.
-
ageInMonths
Create a postnatal age to representm
months of age.- Parameters:
m
- a non-negative number of months.
-
ageInDays
Create a postnatal age to representd
days of age.- Parameters:
d
- a non-negative number of days.
-
parse
- Parameters:
period
- representing postnatal (not gestational) age.
-
gestationalAge
Create a gestational age to representweeks
anddays
.weeks
should generally be not be greater than 42, and it must not be negative.days
must be in range[0,6]
.- Parameters:
weeks
- a non-negative number of completed gestational weeks.days
- the number of completed gestational days.
-
of
Create a postnatal age from given inputs. -
equals
-
hashCode
public int hashCode() -
toString
-