public class RangeHolder extends Object
If necessary, dates are adjusted. Adjustment is upwards for the start of the range and downwards for the end.
Constructor and Description |
---|
RangeHolder()
Construct a range holder in the daily time domain and
initialized with the current time.
|
RangeHolder(Range range)
Construct a range holder for the given range.
|
RangeHolder(RangeHolder model)
Construct a range holder as a copy of the given model.
|
RangeHolder(TimeDomain domain)
Construct a range holder with the given time domain and
initialized with the current time.
|
Modifier and Type | Method and Description |
---|---|
String |
getBeginText()
Return the text of the day expression set with
setBegin . |
String |
getEndText()
Return the text of the day expression set with
setEnd . |
Range |
getRange()
Get the range evaluated in the time domain of the range holder.
|
Range |
getRange(Range context)
Get the range evaluated in the context of the given range.
|
Range |
getRange(TimeDomain context)
Get the range evaluated in the context of the given domain.
|
TimeDomain |
getTimeDomain()
Return the time domain.
|
void |
incrBegin(boolean up,
boolean large)
Increase or decrease the beginning of the range by a unit or by a large amount.
|
void |
incrBegin(int increment)
Increment the beginning of the range by the given amount.
|
void |
incrEnd(boolean up,
boolean large)
Increase or decrease the end of the range by a unit or by a large amount.
|
void |
incrEnd(int increment)
Increment the end of the range by the given amount.
|
boolean |
needContext()
Return true if the range holder needs a context for evaluating dates.
|
void |
reset(Range range)
Change the range to the given range.
|
void |
reset(TimeDomain domain)
Change the time domain of the range holder.
|
void |
setBegin(String date)
Set the date for the range beginning.
|
void |
setEnd(String date)
Set the date for the range end.
|
public RangeHolder(TimeDomain domain)
domain
- a non-null time domainpublic RangeHolder()
public RangeHolder(Range range)
range
- a non-null rangepublic RangeHolder(RangeHolder model)
model
- a non-null range holderpublic TimeDomain getTimeDomain()
public void reset(Range range)
range
- a non-null rangepublic void reset(TimeDomain domain) throws T2Exception
domain
- a non-null domainT2Exception
public void setBegin(String date) throws T2Exception
DayExpression
for the valid syntax of dates.date
- a day expressionT2Exception
public void setEnd(String date) throws T2Exception
DayExpression
for the valid syntax of dates.date
- a day expressionT2Exception
public void incrBegin(int increment) throws T2Exception
increment
- a positive or negative numberT2Exception
public void incrBegin(boolean up, boolean large) throws T2Exception
up
- if true increase, else decreaselarge
- if true use a large amount, else a single unitT2Exception
public void incrEnd(int increment) throws T2Exception
increment
- a positive or negative numberT2Exception
public void incrEnd(boolean up, boolean large) throws T2Exception
up
- if true increase, else decreaselarge
- if true use a large amount, else a single unitT2Exception
public String getBeginText()
setBegin
.
If a date was never set, an empty string is returned.
To get the resolved date, use one of the getRange
methods.
The method never returns null.public String getEndText()
setEnd
.
If a date was never set, an empty string is returned.
To get the resolved date, use one of the getRange
methods.
The method never returns null.public Range getRange() throws T2Exception
T2Exception
public Range getRange(TimeDomain context) throws T2Exception
context
- a non-null time domainT2Exception
public Range getRange(Range context) throws T2Exception
context
- non-null rangeT2Exception
public boolean needContext()
Copyright © 2017. All rights reserved.