sclass DateStructures { asclass SomeDate {} asclass SomeDateDate > SomeDate {} // day or higher granularity asclass SomeTime > SomeDate {} asclass SomeWeek > SomeDateDate {} asclass DateProp > SomeDate {} // proposition on a date, e.g. a date range // years static transformable record Year(int year) > SomeDateDate {} static transformable record CurrentYearPlus(int nYears) > SomeDateDate {} // months static transformable record Month(int month, Year year) > SomeDateDate { Month(int month) { this(month, null); } } static transformable record CurrentMonthPlus(int nMonths) > SomeDateDate {} // weeks static transformable record Week(int week, Year year) > SomeWeek {} static transformable record CurrentWeekPlus(int nWeeks) > SomeWeek {} // days static transformable record Day(int day, Month month) > SomeDate {} static transformable record TodayPlus(int nDays) > SomeDate {} // weekdays static transformable record Weekday(int weekday, SomeWeek week) > SomeDateDate { // weekday is in Java count (1=Sunday) Weekday(int weekday) { this.weekday = weekday; } } // hours static transformable record Hour(int hour, Bool isPM, Day day) > SomeTime { Hour(int hour, Bool isPM) { this(hour, isPM, null); } } static transformable record CurrentHourPlus(int nHours) > SomeTime {} // minutes static transformable record Minute(int minute, Hour hour) > SomeTime {} static transformable record CurrentMinutePlus(int nMinutes) > SomeTime {} // seconds static transformable record Second(int second, Minute minute) > SomeTime {} // special stuff static transformable record BeginningOfTime > SomeDate {} static transformable record EndOfTime > SomeDate {} // date ranges & boolean operations static transformable record Between(SomeDate from, SomeDate to) > DateProp {} static transformable record Or(DateProp a, DateProp b) > DateProp {} static transformable record And(DateProp a, DateProp b) > DateProp {} static transformable record Not(DateProp a) > DateProp {} // some utility functions sbool containsTimes(SomeDate d) { ret defaultMetaTransformer().any(o -> o instanceof SomeTime, d); } sbool containsDateDates(SomeDate d) { ret defaultMetaTransformer().any(o -> o instanceof SomeDateDate, d); } }