com.dxfeed.schedule
Class DayFilter

java.lang.Object
  extended by com.dxfeed.schedule.DayFilter
All Implemented Interfaces:
java.io.Serializable

public class DayFilter
extends java.lang.Object
implements java.io.Serializable

A filter for days used by various search methods. This class provides predefined filters for certain Day attributes, although users can create their own filters to suit their needs.

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.

See Also:
Serialized Form

Field Summary
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 (Day.getDayOfWeek() == 5).
protected  java.lang.Boolean holiday
          Required holiday flag, null if not relevant.
static DayFilter HOLIDAY
          Accepts holidays only - those with (Day.isHoliday() == true).
static DayFilter MONDAY
          Accepts Mondays only - those with (Day.getDayOfWeek() == 1).
static DayFilter NO_TRADING
          Deprecated. use NON_TRADING filter instead.
static DayFilter NON_TRADING
          Accepts non-trading days only - those with (Day.isTrading() == false).
static DayFilter SATURDAY
          Accepts Saturdays only - those with (Day.getDayOfWeek() == 6).
static DayFilter SHORT_DAY
          Accepts short days only - those with (Day.isShortDay() == true).
protected  java.lang.Boolean shortDay
          Required short day flag, null if not relevant.
static DayFilter SUNDAY
          Accepts Sundays only - those with (Day.getDayOfWeek() == 7).
static DayFilter THURSDAY
          Accepts Thursdays only - those with (Day.getDayOfWeek() == 4).
protected  java.lang.Boolean trading
          Required trading flag, null if not relevant.
static DayFilter TRADING
          Accepts trading days only - those with (Day.isTrading() == true).
static DayFilter TUESDAY
          Accepts Tuesdays only - those with (Day.getDayOfWeek() == 2).
static DayFilter WEDNESDAY
          Accepts Wednesdays only - those with (Day.getDayOfWeek() == 3).
static DayFilter WEEK_DAY
          Accepts week-days only - those with (Day.getDayOfWeek() <= 5).
static DayFilter WEEK_END
          Accepts weekends only - those with (Day.getDayOfWeek() >= 6).
 
Constructor Summary
DayFilter(int dayOfWeekMask, java.lang.Boolean holiday, java.lang.Boolean shortDay, java.lang.Boolean trading)
          Creates filter with specified conditions.
 
Method Summary
 boolean accept(Day day)
          Tests whether or not the specified day is an acceptable result.
 boolean equals(java.lang.Object object)
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANY

public static final DayFilter ANY
Accepts any day - useful for pure calendar navigation.


TRADING

public static final DayFilter TRADING
Accepts trading days only - those with (Day.isTrading() == true).


NON_TRADING

public static final DayFilter NON_TRADING
Accepts non-trading days only - those with (Day.isTrading() == false).


NO_TRADING

@Deprecated
public static final DayFilter NO_TRADING
Deprecated. use NON_TRADING filter instead.

HOLIDAY

public static final DayFilter HOLIDAY
Accepts holidays only - those with (Day.isHoliday() == true).


SHORT_DAY

public static final DayFilter SHORT_DAY
Accepts short days only - those with (Day.isShortDay() == true).


MONDAY

public static final DayFilter MONDAY
Accepts Mondays only - those with (Day.getDayOfWeek() == 1).


TUESDAY

public static final DayFilter TUESDAY
Accepts Tuesdays only - those with (Day.getDayOfWeek() == 2).


WEDNESDAY

public static final DayFilter WEDNESDAY
Accepts Wednesdays only - those with (Day.getDayOfWeek() == 3).


THURSDAY

public static final DayFilter THURSDAY
Accepts Thursdays only - those with (Day.getDayOfWeek() == 4).


FRIDAY

public static final DayFilter FRIDAY
Accepts Fridays only - those with (Day.getDayOfWeek() == 5).


SATURDAY

public static final DayFilter SATURDAY
Accepts Saturdays only - those with (Day.getDayOfWeek() == 6).


SUNDAY

public static final DayFilter SUNDAY
Accepts Sundays only - those with (Day.getDayOfWeek() == 7).


WEEK_DAY

public static final DayFilter WEEK_DAY
Accepts week-days only - those with (Day.getDayOfWeek() <= 5).


WEEK_END

public static final DayFilter WEEK_END
Accepts weekends only - those with (Day.getDayOfWeek() >= 6).


dayOfWeekMask

protected final int dayOfWeekMask
Bitwise mask of required days (2 for Monday, 4 for Tuesday, 128 for Sunday), 0 if not relevant.


holiday

protected final java.lang.Boolean holiday
Required holiday flag, null if not relevant.


shortDay

protected final java.lang.Boolean shortDay
Required short day flag, null if not relevant.


trading

protected final java.lang.Boolean trading
Required trading flag, null if not relevant.

Constructor Detail

DayFilter

public DayFilter(int dayOfWeekMask,
                 java.lang.Boolean holiday,
                 java.lang.Boolean shortDay,
                 java.lang.Boolean trading)
Creates filter with specified conditions.

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).

Parameters:
dayOfWeekMask - bitwise mask of required days (2 for Monday, 4 for Tuesday, 128 for Sunday), 0 if not relevant
holiday - required holiday flag, null if not relevant
shortDay - required short day flag, null if not relevant
trading - required trading flag, null if not relevant
Method Detail

accept

public boolean accept(Day day)
Tests whether or not the specified day is an acceptable result.

Parameters:
day - the day to be tested
Returns:
true if specified day is accepted

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object