@Test public void isSatisfiedWithInnerRule() { JustOnceRule rule = new JustOnceRule(new FixedRule(1, 3, 5)); assertFalse(rule.isSatisfied(0)); assertTrue(rule.isSatisfied(1)); assertFalse(rule.isSatisfied(2)); assertFalse(rule.isSatisfied(3)); assertFalse(rule.isSatisfied(4)); assertFalse(rule.isSatisfied(5)); assertFalse(rule.isSatisfied(1)); }
@Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { if (satisfied) { return false; } else if (rule == null) { satisfied = true; traceIsSatisfied(index, true); return true; } this.satisfied = this.rule.isSatisfied(index, tradingRecord); return this.satisfied; }
JustOnceRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { if (satisfied) { return false; } else if (rule == null) { satisfied = true; traceIsSatisfied(index, true); return true; } this.satisfied = this.rule.isSatisfied(index, tradingRecord); return this.satisfied; } }
JustOnceRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { if (satisfied) { return false; } else if (rule == null) { satisfied = true; traceIsSatisfied(index, true); return true; } this.satisfied = this.rule.isSatisfied(index, tradingRecord); return this.satisfied; } JustOnceRule(Rule rule);  JustOnceRule(); }
JustOnceRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { if (satisfied) { return false; } else if (rule == null) { satisfied = true; traceIsSatisfied(index, true); return true; } this.satisfied = this.rule.isSatisfied(index, tradingRecord); return this.satisfied; } JustOnceRule(Rule rule);  JustOnceRule(); @Override boolean isSatisfied(int index, TradingRecord tradingRecord); }
JustOnceRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { if (satisfied) { return false; } else if (rule == null) { satisfied = true; traceIsSatisfied(index, true); return true; } this.satisfied = this.rule.isSatisfied(index, tradingRecord); return this.satisfied; } JustOnceRule(Rule rule);  JustOnceRule(); @Override boolean isSatisfied(int index, TradingRecord tradingRecord);  }