public class TimeRange extends Object
| Constructor and Description |
|---|
TimeRange(Calendar from,
Calendar to)
The constructor guarantees that 'from' is always before 'to'.
|
| Modifier and Type | Method and Description |
|---|---|
void |
constrainTo(TimeRange otherRange)
Force this time range to be within the given time range
|
boolean |
endsWithin(TimeRange other)
Check whether this time range ends within the given time range
|
long |
getElapsed()
The range extension, in milliseconds
|
Calendar |
getFrom()
Getter for 'from'
|
Calendar |
getTo()
Getter for 'to'
|
boolean |
isAfter(TimeRange range)
Whether this range starts before 'range' ends
|
boolean |
isBefore(TimeRange range)
Whether this range ends before 'range' starts
|
boolean |
isClosed()
Check if from and to are set
|
boolean |
isOutside(TimeRange otherRange)
Check whether this time range enrirely falls outside the the given time
range
|
boolean |
isUndefined() |
boolean |
isWithin(TimeRange range)
Whether this range is entirely within 'range'
|
boolean |
startsWithin(TimeRange other)
Check whether this time range starts within the given time range
|
public Calendar getFrom()
public Calendar getTo()
public boolean isClosed()
public boolean isUndefined()
public boolean endsWithin(TimeRange other)
other - public boolean startsWithin(TimeRange other)
other - public boolean isOutside(TimeRange otherRange)
other - public void constrainTo(TimeRange otherRange)
from - to - public boolean isWithin(TimeRange range)
range - public boolean isBefore(TimeRange range)
range - public boolean isAfter(TimeRange range)
range - public long getElapsed()
Copyright © 2015. All Rights Reserved.