static Predicate < DateValue > bySecondFilter ( int [ ] seconds ) { long secondsByBit = 0 ; for ( int second : seconds ) { secondsByBit |= 1L << second ; } if ( ( secondsByBit & LOW_60_BITS ) == LOW_60_BITS ) { return Predicates . alwaysTrue ( ) ; } final long bitField = secondsByBit ; return new Predicate < DateValue > ( ) { public boolean apply ( DateValue date ) { if ( ! ( date instanceof TimeValue ) ) { return false ; } TimeValue tv = ( TimeValue ) date ; return ( bitField & ( 1L << tv . second ( ) ) ) != 0 ; } } ; }
constructs a second filter based on a BYMINUTE rule .