Skip to content

Commit

Permalink
Merge pull request #159 from ielis/add_static_constructors_for_time_e…
Browse files Browse the repository at this point in the history
…lements

Increase granularity of static constructors for `TimeElement`s.
  • Loading branch information
ielis authored Jan 9, 2023
2 parents c4a4f4a + 2befb0a commit 84e4cde
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,27 @@ public static TimeElement gestationalAge(int weeks) {
return TimeElement.newBuilder().setGestationalAge(GestationalAge.newBuilder().setWeeks(weeks)).build();
}

public static TimeElement age(Age age) {
return TimeElement.newBuilder().setAge(age).build();
}
public static TimeElement age(String iso8601duration) {
Age age = Ages.age(iso8601duration);
return TimeElement.newBuilder().setAge(age).build();
return age(age);
}

public static TimeElement ageRange(String iso8601start, String iso8601End) {
AgeRange ageRange = Ages.ageRange(iso8601start, iso8601End);
return ageRange(ageRange);
}

public static TimeElement ageRange(AgeRange ageRange) {
return TimeElement.newBuilder().setAgeRange(ageRange).build();
}

public static TimeElement ontologyClass(String id, String label) {
return ontologyClass(OntologyClassBuilder.ontologyClass(id, label));
}

public static TimeElement ontologyClass(OntologyClass clz) {
return TimeElement.newBuilder().setOntologyClass(clz).build();
}
Expand Down

0 comments on commit 84e4cde

Please sign in to comment.