Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.swingx.calendar
Class DateSpan

    java.lang.Object
      org.jdesktop.swingx.calendar.DateSpan

    public class DateSpan

extends java.lang.Object

An immutable representation of a time range. The time range is internally represented as two longs. The methods that take and return `Date`s create the `Date`s as needed, so that if you modify returned `Date`s you will not effect the `DateSpan`. The end points are inclusive.

Version:
  $Revision: 542 $

Constructor Summary
`DateSpan(java.util.Date start, java.util.Date end)` Creates a `DateSpan` between the two end points.
`DateSpan(long start, long end)` Creates a `DateSpan` between the two end points.

Method Summary
`DateSpan` | `add(DateSpan span)` Returns a new `DateSpan` that is the union of this `DateSpan` and `span`.
`DateSpan` | `add(long start, long end)` Returns a new `DateSpan` that is the union of this `DateSpan` and the passed in span.
`boolean` | `contains(DateSpan span)` Returns true if this `DateSpan` contains the specified `DateSpan`.
`boolean` | `contains(long time)` Returns whether or not this `DateSpan` contains the specified time.
`boolean` | `contains(long start, long end)` Returns whether or not this `DateSpan` contains the specified date span.
`boolean` | `equals(java.lang.Object o)`
`long` | `getEnd()` Returns the end of the date span.
`java.util.Date` | `getEndAsDate()` Returns the end of the date span as a `Date`.
`long` | `getStart()` Returns the start of the date span.
`java.util.Date` | `getStartAsDate()` Returns the start of the date span as a `Date`.
`int` | `hashCode()`
`boolean` | `intersects(DateSpan span)` Returns true if the this `DateSpan` intersects with the specified `DateSpan`.
`boolean` | `intersects(long start, long end)` Returns true if the this `DateSpan` intersects with the specified time.
`java.lang.String` | `toString()`

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

Constructor Detail

### DateSpan

    public DateSpan(long start,
                    long end)

  Creates a `DateSpan` between the two end points.

  Parameters:
    `start` - Beginning date
    `end` - Ending date
  Throws:
    `java.lang.IllegalArgumentException` - if `start` is after `end`

### DateSpan

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

  Creates a `DateSpan` between the two end points. This is a conveniance constructor that is equivalent to `new Date(start.getTime(), end.getTime());`.

  Parameters:
    `start` - Beginning date
    `end` - Ending date

Method Detail

### getStart

    public long getStart()

  Returns the start of the date span.

  Returns:
    start of the span.

### getEnd

    public long getEnd()

  Returns the end of the date span.

  Returns:
    end of the span.

### getStartAsDate

    public java.util.Date getStartAsDate()

  Returns the start of the date span as a `Date`.

  Returns:
    start of the span.

### getEndAsDate

    public java.util.Date getEndAsDate()

  Returns the end of the date span as a `Date`.

  Returns:
    end of the span.

### contains

    public boolean contains(DateSpan span)

  Returns true if this `DateSpan` contains the specified `DateSpan`.

  Parameters:
    `span` - Date to check
  Returns:
    true if this DateSpan contains `span`.

### contains

    public boolean contains(long time)

  Returns whether or not this `DateSpan` contains the specified time.

  Parameters:
    `time` - time check
  Returns:
    true if this DateSpan contains `time`.

### contains

    public boolean contains(long start,
                            long end)

  Returns whether or not this `DateSpan` contains the specified date span.

  Parameters:
    `start` - Start of time span
    `end` - End of time
  Returns:
    true if this `DateSpan` contains the specified date span.

### intersects

    public boolean intersects(long start,
                              long end)

  Returns true if the this `DateSpan` intersects with the specified time.

  Parameters:
    `start` - Start time
    `end` - End time
  Returns:
    true if this `DateSpan` intersects with the specified time.

### intersects

    public boolean intersects(DateSpan span)

  Returns true if the this `DateSpan` intersects with the specified `DateSpan`.

  Parameters:
    `span` - DateSpan to compare to
  Returns:
    true if this `DateSpan` intersects with the specified time.

### add

    public DateSpan add(DateSpan span)

  Returns a new `DateSpan` that is the union of this `DateSpan` and `span`.

  Parameters:
    `span` - DateSpan to add
  Returns:
    union of this DateSpan and `span`

### add

    public DateSpan add(long start,
                        long end)

  Returns a new `DateSpan` that is the union of this `DateSpan` and the passed in span.

  Parameters:
    `start` - Start of region to add
    `end` - End of region to end
  Returns:
    union of this DateSpan and `start`, `end`

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.