Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.ebusiness
Class DateRange

    java.lang.Object
      |
      +--com.compoze.ebusiness.DateRange

All Implemented Interfaces:
  java.lang.Comparable, java.io.Serializable

public class DateRange
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

This class represents a duration in time, consisting of a start and an end date. Either date may be null, which indicates that the duration extends infinitely in time in that direction. It is always assured upon construction and modification of the starting and ending dates that the start is before the end.

See Also:
  Serialized Form

Field Summary
`static int` | `OVERLAP_ADJACENT` The combination of flags indicating that the second duration in time is adjacent to the first.
`static int` | `OVERLAP_ADJACENT_AFTER` The flag indicating that the second duration in time occurs partially after the first duration.
`static int` | `OVERLAP_ADJACENT_BEFORE` The flag indicating that the second duration in time occurs before the first duration, and its end is equal to the start of the first duration.
`static int` | `OVERLAP_ANY` The combination of flags indicating that the second duration in time occurs partially before, within, equal to, encompassing, or partially after the first duration.
`static int` | `OVERLAP_EARLIER` The combination of flags indicating that the second duration in time occurs either totally, adjacent to or partially before the first duration.
`static int` | `OVERLAP_ENCOMPASS` The flag indicating that the second duration in time totally encompasses the first duration.
`static int` | `OVERLAP_EQUAL` The flag indicating that the first and second durations are equal.
`static int` | `OVERLAP_LATER` The combination of flags indicating that the second duration in time occurs either totally, adjacent to or partially after the first duration.
`static int` | `OVERLAP_NONE` The combination of flags indicating that the second duration in time does not in any way overlap, or is merely adjacent to the first duration.
`static int` | `OVERLAP_PARTIALLY_AFTER` The flag indicating that the second duration in time occurs partially after the first duration.
`static int` | `OVERLAP_PARTIALLY_BEFORE` The flag indicating that the second duration in time occurs partially before the first duration.
`static int` | `OVERLAP_TOTALLY_AFTER` The flag indicating that the second duration in time occurs totally after the first duration.
`static int` | `OVERLAP_TOTALLY_BEFORE` The flag indicating that the second duration in time occurs totally before the first duration.
`static int` | `OVERLAP_WITHIN` The flag indicating that the second duration in time occurs totally within the first duration.

Constructor Summary
`DateRange()` Constructor.
`DateRange(java.util.Date start, java.util.Date end)` Constructor.
`DateRange(java.util.Date start, int iField, int iAmount)` Constructor.
`DateRange(java.util.Date start, long lDuration)` Constructor.
`DateRange(int iField, int iAmount, java.util.Date end)` Constructor.
`DateRange(long lDuration, java.util.Date end)` Constructor.

Method Summary
`long` | `addDuration(DateRange duration)` Adds this duration to another duration.
`java.util.Date` | `addDurationToDate(java.util.Date start)` Adds this duration to another date.
`void` | `assignDuration(long lDuration)` Sets the duration of the event by changing the end date if necessary.
`int` | `compareTo(java.lang.Object o)` Compares this date range with the specified date range for ordering.
`boolean` | `equals(java.lang.Object o)` Equals.
`long` | `getDuration()` Gets the duration between the starting and ending dates.
`java.util.Date` | `getEnd()` Gets the ending date.
`java.util.Date` | `getStart()` Gets the starting date.
`int` | `overlap(DateRange duration)` Evaluates the overlap between this and a second duration.
`void` | `setEnd(java.util.Date end)` Sets the ending date.
`void` | `setStart(java.util.Date start)` Sets the starting date.
`java.lang.String` | `toString()` Creates a string representation of the date range.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### OVERLAP_TOTALLY_BEFORE

    public static final int OVERLAP_TOTALLY_BEFORE

  The flag indicating that the second duration in time occurs totally before the first duration.

### OVERLAP_ADJACENT_BEFORE

    public static final int OVERLAP_ADJACENT_BEFORE

  The flag indicating that the second duration in time occurs before the first duration, and its end is equal to the start of the first duration.

### OVERLAP_PARTIALLY_BEFORE

    public static final int OVERLAP_PARTIALLY_BEFORE

  The flag indicating that the second duration in time occurs partially before the first duration.

### OVERLAP_WITHIN

    public static final int OVERLAP_WITHIN

  The flag indicating that the second duration in time occurs totally within the first duration.

### OVERLAP_EQUAL

    public static final int OVERLAP_EQUAL

  The flag indicating that the first and second durations are equal.

### OVERLAP_ENCOMPASS

    public static final int OVERLAP_ENCOMPASS

  The flag indicating that the second duration in time totally encompasses the first duration.

### OVERLAP_PARTIALLY_AFTER

    public static final int OVERLAP_PARTIALLY_AFTER

  The flag indicating that the second duration in time occurs partially after the first duration.

### OVERLAP_ADJACENT_AFTER

    public static final int OVERLAP_ADJACENT_AFTER

  The flag indicating that the second duration in time occurs partially after the first duration.

### OVERLAP_TOTALLY_AFTER

    public static final int OVERLAP_TOTALLY_AFTER

  The flag indicating that the second duration in time occurs totally after the first duration.

### OVERLAP_ANY

    public static final int OVERLAP_ANY

  The combination of flags indicating that the second duration in time occurs partially before, within, equal to, encompassing, or partially after the first duration.

### OVERLAP_NONE

    public static final int OVERLAP_NONE

  The combination of flags indicating that the second duration in time does not in any way overlap, or is merely adjacent to the first duration.

### OVERLAP_EARLIER

    public static final int OVERLAP_EARLIER

  The combination of flags indicating that the second duration in time occurs either totally, adjacent to or partially before the first duration.

### OVERLAP_LATER

    public static final int OVERLAP_LATER

  The combination of flags indicating that the second duration in time occurs either totally, adjacent to or partially after the first duration.

### OVERLAP_ADJACENT

    public static final int OVERLAP_ADJACENT

  The combination of flags indicating that the second duration in time is adjacent to the first.

Constructor Detail

### DateRange

    public DateRange()

  Constructor. NOTE: This default constructor technically leaves the date range in an invalid state. The start and/or end dates should be set before the object is used.
  See Also:
    `setStart(java.util.Date)`, `setEnd(java.util.Date)`

### DateRange

    public DateRange(java.util.Date start,
                     java.util.Date end)

  Constructor.
  Parameters:
    `start` - the starting date
    `end` - the ending date

### DateRange

    public DateRange(java.util.Date start,
                     long lDuration)

  Constructor.
  Parameters:
    `start` - the starting date (may not be `null`)
    `lDuration` - the duration (in milliseconds)

### DateRange

    public DateRange(java.util.Date start,
                     int iField,
                     int iAmount)

  Constructor.
  Parameters:
    `start` - the starting date (may not be `null`)
    `iField` - the time field
    `iAmount` - the amount of date or time to be added to the field

### DateRange

    public DateRange(long lDuration,
                     java.util.Date end)

  Constructor.
  Parameters:
    `lDuration` - the duration (in milliseconds)
    `end` - the ending date (may not be `null`)

### DateRange

    public DateRange(int iField,
                     int iAmount,
                     java.util.Date end)

  Constructor.
  Parameters:
    `iField` - the time field
    `iAmount` - the amount of date or time to be subtracted from the field
    `end` - the ending date (may not be `null`)

Method Detail

### setStart

    public void setStart(java.util.Date start)

  Sets the starting date.
  Parameters:
    `start` - the starting date

### getStart

    public java.util.Date getStart()

  Gets the starting date.
  Returns:
    the starting date

### setEnd

    public void setEnd(java.util.Date end)

  Sets the ending date.
  Parameters:
    `end` - the ending date

### getEnd

    public java.util.Date getEnd()

  Gets the ending date.
  Returns:
    the ending date

### assignDuration

    public void assignDuration(long lDuration)

  Sets the duration of the event by changing the end date if necessary. The starting date must not be null.
  Parameters:
    `lDuration` - the new duration

### getDuration

    public long getDuration()

  Gets the duration between the starting and ending dates.
  Returns:
    the duration between the start and end (in milliseconds)
  Throws:
    `java.lang.ArithmeticException` - if the duration is infinite

### addDurationToDate

    public java.util.Date addDurationToDate(java.util.Date start)

  Adds this duration to another date.
  Parameters:
    `startDate` - the starting date to add the duration to
  Returns:
    a date representing the starting date plus this duration
  Throws:
    `java.lang.ArithmeticException` - if the duration is infinite

### addDuration

    public long addDuration(DateRange duration)

  Adds this duration to another duration.
  Parameters:
    `duration` - the second duration
  Returns:
    the total duration (in milliseconds)
  Throws:
    `java.lang.ArithmeticException` - if the resulting duration is infinite

### overlap

    public int overlap(DateRange duration)

  Evaluates the overlap between this and a second duration.
  Parameters:
    `duration` - the second duration
  Returns:
    see OVERLAP_ constants in this class

### equals

    public boolean equals(java.lang.Object o)

  Equals.
  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `o` - duration to compare to
  Returns:
    true if the durations are equal (their start and end dates are equal)

### compareTo

    public int compareTo(java.lang.Object o)

  Compares this date range with the specified date range for ordering. The start date is used for comparison.
  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  Parameters:
    `o` - the other date range
  Returns:
    a negative integer, zero, or a positive integer as this object is less then, equal to or greater than the specified object

### toString

    public java.lang.String toString()

  Creates a string representation of the date range.
  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the string representation of the date range

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.