mondrian.util
Class ScheduleUtil

java.lang.Object
  extended by mondrian.util.ScheduleUtil

 class ScheduleUtil
extends Object

Utility functions for Schedule and supporting classes.

 

Field Summary
(package private) static Calendar epochDay
           
(package private) static Calendar midnightTime
           
 
Constructor Summary
ScheduleUtil()
           
 
Method Summary
static void assertTrue(boolean b)
           
static void assertTrue(boolean b, String s)
           
static Calendar ceiling(Calendar calendar)
          Returns a calendar rounded up to the next midnight, unless it is already midnight.
static Calendar createCalendar(Date date)
          Creates a calendar in UTC, and initializes it to date.
static Calendar createCalendar(int year, int month, int day, int hour, int minute, int second)
          Creates a calendar in UTC, and initializes it to a given year, month, day, hour, minute, second.
static Calendar createDateCalendar(int year, int month, int dayOfMonth)
          Creates a calendar and sets it to a given year, month, date.
static Time createTime(int hour, int minutes, int second)
          Creates a Time
static Calendar createTimeCalendar(int hours, int minutes, int seconds)
          Creates a calendar and sets it to a given hours, minutes, seconds.
static Calendar createTimeCalendar(Time time)
          Creates a calendar from a time.
static Calendar floor(Calendar calendar)
          Returns a calendar rounded down to the previous midnight.
static Calendar getTime(Calendar calendar)
          Extracts the time part of a date.
static boolean is0000(Calendar calendar)
           
static boolean isTime(Calendar calendar)
           
static int julianDay(Calendar calendar)
          Returns the julian day number of a given date.
static boolean lessThan(Date d1, Date d2, boolean strict)
           
static boolean lessThan(Time t1, Time t2, boolean strict)
           
static Error newInternal()
           
static Error newInternal(String s)
           
static Error newInternal(Throwable e, String s)
           
static int timezoneOffset(TimeZone tz, Calendar calendar)
          Returns the offset from UTC in milliseconds in this timezone on a given date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

epochDay

static final Calendar epochDay

midnightTime

static final Calendar midnightTime
Constructor Detail

ScheduleUtil

ScheduleUtil()
Method Detail

assertTrue

public static void assertTrue(boolean b)

assertTrue

public static void assertTrue(boolean b,
                              String s)

newInternal

public static Error newInternal()

newInternal

public static Error newInternal(Throwable e,
                                String s)

newInternal

public static Error newInternal(String s)

lessThan

public static boolean lessThan(Time t1,
                               Time t2,
                               boolean strict)

lessThan

public static boolean lessThan(Date d1,
                               Date d2,
                               boolean strict)

is0000

public static boolean is0000(Calendar calendar)

isTime

public static boolean isTime(Calendar calendar)

floor

public static Calendar floor(Calendar calendar)
Returns a calendar rounded down to the previous midnight.


ceiling

public static Calendar ceiling(Calendar calendar)
Returns a calendar rounded up to the next midnight, unless it is already midnight.


getTime

public static Calendar getTime(Calendar calendar)
Extracts the time part of a date. Given a null date, returns null.


createCalendar

public static Calendar createCalendar(Date date)
Creates a calendar in UTC, and initializes it to date.

Pre-condition:
date != null
Post-condition:
return != null

createCalendar

public static Calendar createCalendar(int year,
                                      int month,
                                      int day,
                                      int hour,
                                      int minute,
                                      int second)
Creates a calendar in UTC, and initializes it to a given year, month, day, hour, minute, second. NOTE: month is 1-based


createTimeCalendar

public static Calendar createTimeCalendar(Time time)
Creates a calendar from a time. Milliseconds are ignored.

Pre-condition:
time != null
Post-condition:
return != null

createTimeCalendar

public static Calendar createTimeCalendar(int hours,
                                          int minutes,
                                          int seconds)
Creates a calendar and sets it to a given hours, minutes, seconds.


createDateCalendar

public static Calendar createDateCalendar(int year,
                                          int month,
                                          int dayOfMonth)
Creates a calendar and sets it to a given year, month, date.


createTime

public static Time createTime(int hour,
                              int minutes,
                              int second)
Creates a Time


julianDay

public static int julianDay(Calendar calendar)
Returns the julian day number of a given date. (Is there a better way to do this?)


timezoneOffset

public static int timezoneOffset(TimeZone tz,
                                 Calendar calendar)
Returns the offset from UTC in milliseconds in this timezone on a given date.


SourceForge.net_Logo