public PulseCondition( DiscreteElement<T> element, T pulsedValue, T nonPulsedValue, int numPulses) { this.element = element; this.pulsedValue = element.elementMask(pulsedValue); this.nonPulsedValue = element.elementMask(nonPulsedValue); this.maxPulses = numPulses; }
@Override public boolean check() { lastValue = element.getValue(); if (lastValue.equals(pulsedValue)) { pulses++; } else if (pulses >= maxPulses && lastValue.equals(nonPulsedValue)) { return true; } return false; }