From 1b6c3752df591d1a68af201c3d798d4e085dd8dd Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 28 May 2009 22:55:23 +0000 Subject: [PATCH] Helpy helper functions! --- .../depot/expression/IntervalExp.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/java/com/samskivert/depot/expression/IntervalExp.java b/src/java/com/samskivert/depot/expression/IntervalExp.java index 85820ae..9d850e0 100644 --- a/src/java/com/samskivert/depot/expression/IntervalExp.java +++ b/src/java/com/samskivert/depot/expression/IntervalExp.java @@ -40,6 +40,54 @@ public class IntervalExp /** The number of units for this interval. */ public final int amount; + /** + * Creates an interval for the specified number of years. + */ + public static IntervalExp years (int amount) + { + return new IntervalExp(Unit.YEAR, amount); + } + + /** + * Creates an interval for the specified number of months. + */ + public static IntervalExp months (int amount) + { + return new IntervalExp(Unit.MONTH, amount); + } + + /** + * Creates an interval for the specified number of days. + */ + public static IntervalExp days (int amount) + { + return new IntervalExp(Unit.DAY, amount); + } + + /** + * Creates an interval for the specified number of hours. + */ + public static IntervalExp hours (int amount) + { + return new IntervalExp(Unit.HOUR, amount); + } + + /** + * Creates an interval for the specified number of minutes. + */ + public static IntervalExp minutes (int amount) + { + return new IntervalExp(Unit.MINUTE, amount); + } + + /** + * Creates an interval for the specified number of seconds. + */ + public static IntervalExp seconds (int amount) + { + return new IntervalExp(Unit.SECOND, amount); + } + public IntervalExp (Unit unit, int amount) { this.unit = unit;