Package epam.flipflop
Class FlipFlopPredicate<T>
java.lang.Object
epam.flipflop.FlipFlopPredicate<T>
- Type Parameters:
T
- The type of the input to the predicate
- All Implemented Interfaces:
Predicate<T>
A predicate that emulates flip-flop logic similar to the two-dots flip-flop in Perl or Ruby.
The predicate takes two input predicates, a start condition, and an end condition.
When the start condition is met, the predicate returns true for all subsequent inputs
until the end condition is met, at which point it returns true and resets its internal state.
-
Constructor Summary
ConstructorsConstructorDescriptionFlipFlopPredicate
(Predicate<T> startCondition, Predicate<T> endCondition) Constructs a new FlipFlopPredicate with the given start and end conditions. -
Method Summary
-
Constructor Details
-
FlipFlopPredicate
Constructs a new FlipFlopPredicate with the given start and end conditions.- Parameters:
startCondition
- The predicate that represents the start conditionendCondition
- The predicate that represents the end condition
-
-
Method Details