Top Fields Constructors Methods
net.fortuna.ical4j.model

public Class DateRange

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@Deprecated
Imports
org.apache.commons.lang3.builder.EqualsBuilder, .HashCodeBuilder, java.io.Serializable, java.util.Date

Deprecated

We can no longer use DateRange to compare dates reliably due to supporting incompatible temporal types. Use org.threeten.extra.Interval instead.

Author
fortuna

Field Summary

Modifier and TypeField and Description
public static final int
INCLUSIVE_END

A flag indicating whether to include the end of the period in test functions.

public static final int
INCLUSIVE_START

A flag indicating whether to include the start of the period in test functions.

private final Date
private final Date
private static final long

Constructor Summary

AccessConstructor and Description
public
DateRange(Date
the start of the range
start
,
Date
the end of the range
end
)

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

true if one period immediately follows the other, false otherwise
adjacent
(final DateRange
a period to test for adjacency
range
)
References Deprecated DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

Decides whether these periods are serial without a gap.

public final boolean

Returns:

true if the specified period end before this periods starts, otherwise false
after
(final DateRange
a period that may or may not end before this period starts
range
)
References Deprecated DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

Decides whether this period starts after the given period ends.

public final boolean

Returns:

true if the specified period starts after this periods ends, otherwise false
before
(final DateRange
a period that may or may not start after this period ends
range
)
References Deprecated DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

Decides whether this period is completed before the given period starts.

public final boolean

Returns:

true if this period covers all the dates of the specified period, otherwise false
contains
(final DateRange
the period that may be contained by this one
range
)
References Deprecated DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

Decides whether the given period is completely contained within this one.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Date

Returns:

the rangeEnd
getRangeEnd
()

public Date

Returns:

the rangeStart
getRangeStart
()

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public final boolean

Returns:

true if the specified date occurs within the current period
includes
(final Date
a date to test for inclusion
date
)

Determines if the specified date occurs within this period (inclusive of period start and end).

public final boolean

Returns:

true if the date is in the period, false otherwise
includes
(final Date
the date to be tested
date
,
final int
specifies whether period start and end are included in the calculation
inclusiveMask
)

Decides whether a date falls within this period.

public final boolean

Returns:

true if the specified period intersects this one, false otherwise.
intersects
(final DateRange
a possible intersecting period
range
)
References Deprecated DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

Decides whether this period intersects with another one.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

INCLUSIVE_ENDback to summary
public static final int INCLUSIVE_END

A flag indicating whether to include the end of the period in test functions.

INCLUSIVE_STARTback to summary
public static final int INCLUSIVE_START

A flag indicating whether to include the start of the period in test functions.

rangeEndback to summary
private final Date rangeEnd
rangeStartback to summary
private final Date rangeStart
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

DateRangeback to summary
public DateRange(Date start, Date end)
Parameters
start:Date

the start of the range

end:Date

the end of the range

Method Detail

adjacentback to summary
public final boolean adjacent(final DateRange range)

References Deprecated

DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Decides whether these periods are serial without a gap.

Parameters
range:DateRange

a period to test for adjacency

Returns:boolean

true if one period immediately follows the other, false otherwise

afterback to summary
public final boolean after(final DateRange range)

References Deprecated

DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Decides whether this period starts after the given period ends.

Parameters
range:DateRange

a period that may or may not end before this period starts

Returns:boolean

true if the specified period end before this periods starts, otherwise false

beforeback to summary
public final boolean before(final DateRange range)

References Deprecated

DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Decides whether this period is completed before the given period starts.

Parameters
range:DateRange

a period that may or may not start after this period ends

Returns:boolean

true if the specified period starts after this periods ends, otherwise false

containsback to summary
public final boolean contains(final DateRange range)

References Deprecated

DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Decides whether the given period is completely contained within this one.

Parameters
range:DateRange

the period that may be contained by this one

Returns:boolean

true if this period covers all the dates of the specified period, otherwise false

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getRangeEndback to summary
public Date getRangeEnd()
Returns:Date

the rangeEnd

getRangeStartback to summary
public Date getRangeStart()
Returns:Date

the rangeStart

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
includesback to summary
public final boolean includes(final Date date)

Determines if the specified date occurs within this period (inclusive of period start and end).

Parameters
date:Date

a date to test for inclusion

Returns:boolean

true if the specified date occurs within the current period

includesback to summary
public final boolean includes(final Date date, final int inclusiveMask)

Decides whether a date falls within this period.

Parameters
date:Date

the date to be tested

inclusiveMask:int

specifies whether period start and end are included in the calculation

Returns:boolean

true if the date is in the period, false otherwise

intersectsback to summary
public final boolean intersects(final DateRange range)

References Deprecated

DateRange is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Decides whether this period intersects with another one.

Parameters
range:DateRange

a possible intersecting period

Returns:boolean

true if the specified period intersects this one, false otherwise.