public class DayFilter extends Object implements Serializable
Please note that days can be either trading or non-trading, and this distinction can be either based on rules (e.g. weekends) or dictated by special occasions (e.g. holidays). Different filters treat this distinction differently - some accept only trading days, some only non-trading, and some ignore type of day altogether.
Modifier and Type | Field and Description |
---|---|
static DayFilter |
ANY
Accepts any day - useful for pure calendar navigation.
|
protected int |
dayOfWeekMask
Bitwise mask of required days (2 for Monday, 4 for Tuesday, 128 for Sunday),
0 if not relevant. |
static DayFilter |
FRIDAY
Accepts Fridays only - those with
( . |
protected Boolean |
holiday
Required holiday flag,
null if not relevant. |
static DayFilter |
HOLIDAY
Accepts holidays only - those with
( . |
static DayFilter |
MONDAY
Accepts Mondays only - those with
( . |
static DayFilter |
NON_TRADING
Accepts non-trading days only - those with
( . |
static DayFilter |
SATURDAY
Accepts Saturdays only - those with
( . |
static DayFilter |
SHORT_DAY
Accepts short days only - those with
( . |
protected Boolean |
shortDay
Required short day flag,
null if not relevant. |
static DayFilter |
SUNDAY
Accepts Sundays only - those with
( . |
static DayFilter |
THURSDAY
Accepts Thursdays only - those with
( . |
protected Boolean |
trading
Required trading flag,
null if not relevant. |
static DayFilter |
TRADING
Accepts trading days only - those with
( . |
static DayFilter |
TUESDAY
Accepts Tuesdays only - those with
( . |
static DayFilter |
WEDNESDAY
Accepts Wednesdays only - those with
( . |
static DayFilter |
WEEK_DAY
Accepts week-days only - those with
( . |
static DayFilter |
WEEK_END
Accepts weekends only - those with
( . |
Constructor and Description |
---|
DayFilter(int dayOfWeekMask,
Boolean holiday,
Boolean shortDay,
Boolean trading)
Creates filter with specified conditions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Day day)
Tests whether or not the specified day is an acceptable result.
|
boolean |
equals(Object object) |
int |
hashCode() |
String |
toString() |
public static final DayFilter ANY
public static final DayFilter TRADING
(Day.isTrading()
== true)
.public static final DayFilter NON_TRADING
(Day.isTrading()
== false)
.public static final DayFilter HOLIDAY
(Day.isHoliday()
== true)
.public static final DayFilter SHORT_DAY
(Day.isShortDay()
== true)
.public static final DayFilter MONDAY
(Day.getDayOfWeek()
== 1)
.public static final DayFilter TUESDAY
(Day.getDayOfWeek()
== 2)
.public static final DayFilter WEDNESDAY
(Day.getDayOfWeek()
== 3)
.public static final DayFilter THURSDAY
(Day.getDayOfWeek()
== 4)
.public static final DayFilter FRIDAY
(Day.getDayOfWeek()
== 5)
.public static final DayFilter SATURDAY
(Day.getDayOfWeek()
== 6)
.public static final DayFilter SUNDAY
(Day.getDayOfWeek()
== 7)
.public static final DayFilter WEEK_DAY
(Day.getDayOfWeek()
<= 5)
.public static final DayFilter WEEK_END
(Day.getDayOfWeek()
>= 6)
.protected final int dayOfWeekMask
0
if not relevant.protected final Boolean holiday
null
if not relevant.protected final Boolean shortDay
null
if not relevant.protected final Boolean trading
null
if not relevant.public DayFilter(int dayOfWeekMask, Boolean holiday, Boolean shortDay, Boolean trading)
The dayOfWeekMask
is a bitwise mask with individual bits for each day of week.
For the day of week number N the N'th bit is used - the Day will be accepted if corresponding bit is set.
If no bits is set (if mask is zero) then day of week attribute is ignored (any value is accepted).
The boolean parameters specify what value corresponding attributes should have.
If some parameter is null
then corresponding attribute is ignored (any value is accepted).
dayOfWeekMask
- bitwise mask of required days (2 for Monday, 4 for Tuesday, 128 for Sunday), 0
if not relevantholiday
- required holiday flag, null
if not relevantshortDay
- required short day flag, null
if not relevanttrading
- required trading flag, null
if not relevantpublic boolean accept(Day day)
day
- the day to be testedtrue
if specified day is acceptedCopyright © 2002–2023 Devexperts LLC. All rights reserved.