com.ebasetech.ufs.utility
Class TimeInterval

java.lang.Object
  extended bycom.ebasetech.ufs.utility.TimeInterval
All Implemented Interfaces:
java.io.Serializable

public class TimeInterval
extends java.lang.Object
implements java.io.Serializable

Represents a time interval (that is, a number of months, or days, etc). It separately represents a number of months, etc., in an interval

See Also:
Serialized Form

Field Summary
private  int _days
          The number of days in this interval
private  int _hours
          The number of hours in this interval
private  int _minutes
          The number of minutes in this interval
private  int _months
          The number of months in this interval
private  int _seconds
          The number of seconds in this interval
private  int _weeks
          The number of weeks in this interval
private static java.lang.String COMMA
           
static TimeInterval NULL_SENTINEL
          null sentinel for checking for a zero time interval
 
Constructor Summary
TimeInterval()
          Default constructor which just creates an interval with all data set to zero
TimeInterval(int days)
          A simple constructor, that seems useful in the real world, for just setting the number of days in an interval
TimeInterval(int months, int weeks, int days, int hours, int minutes, int seconds)
          Constructor that sets all internal data in one swell foop.
TimeInterval(java.lang.String interval)
          Constructor that takes a string such as that generated by the toString method
TimeInterval(TimeInterval clonee)
          Construct a new timeinterval based on the supplied one
 
Method Summary
 boolean equals(java.lang.Object other)
           
 int getDays()
           
 int getHours()
           
 int getMinutes()
           
 int getMonths()
           
 int getSeconds()
           
 int getWeeks()
           
 java.util.Date offsetFrom(java.util.Date date, boolean absolute, com.ebasetech.ufs.kernel.calendar.OrganisationCalendar organisationCalendar)
          Given a date, answer the date that is the former offset by the amount of the receiver.
 void setDays(int days)
           
 void setHours(int hours)
           
 void setMinutes(int minutes)
           
 void setMonths(int months)
           
 void setSeconds(int seconds)
           
 void setWeeks(int weeks)
           
 java.lang.String toString()
          toString method that generates a stringified form of the interval that may also be used for construction of interval objects
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_SENTINEL

public static final TimeInterval NULL_SENTINEL
null sentinel for checking for a zero time interval


_months

private int _months
The number of months in this interval


_weeks

private int _weeks
The number of weeks in this interval


_days

private int _days
The number of days in this interval


_hours

private int _hours
The number of hours in this interval


_minutes

private int _minutes
The number of minutes in this interval


_seconds

private int _seconds
The number of seconds in this interval


COMMA

private static final java.lang.String COMMA
See Also:
Constant Field Values
Constructor Detail

TimeInterval

public TimeInterval()
Default constructor which just creates an interval with all data set to zero


TimeInterval

public TimeInterval(java.lang.String interval)
Constructor that takes a string such as that generated by the toString method


TimeInterval

public TimeInterval(int months,
                    int weeks,
                    int days,
                    int hours,
                    int minutes,
                    int seconds)
Constructor that sets all internal data in one swell foop.


TimeInterval

public TimeInterval(TimeInterval clonee)
Construct a new timeinterval based on the supplied one


TimeInterval

public TimeInterval(int days)
A simple constructor, that seems useful in the real world, for just setting the number of days in an interval

Method Detail

toString

public java.lang.String toString()
toString method that generates a stringified form of the interval that may also be used for construction of interval objects


equals

public boolean equals(java.lang.Object other)

getMonths

public int getMonths()

getWeeks

public int getWeeks()

getDays

public int getDays()

getHours

public int getHours()

getMinutes

public int getMinutes()

getSeconds

public int getSeconds()

setMonths

public void setMonths(int months)

setWeeks

public void setWeeks(int weeks)

setDays

public void setDays(int days)

setHours

public void setHours(int hours)

setMinutes

public void setMinutes(int minutes)

setSeconds

public void setSeconds(int seconds)

offsetFrom

public java.util.Date offsetFrom(java.util.Date date,
                                 boolean absolute,
                                 com.ebasetech.ufs.kernel.calendar.OrganisationCalendar organisationCalendar)
                          throws PersistenceException
Given a date, answer the date that is the former offset by the amount of the receiver. When the offset is absolute it is just done directly from the days. If the offset is not absolute AND iff it is expressed as a number of days these are taken to be working days and the offset is calculated with respect to the working days supplied by the calendar

Throws:
PersistenceException