@Test public void isSatisfied() { assertTrue(satisfiedRule.or(BooleanRule.FALSE).isSatisfied(0)); assertTrue(BooleanRule.FALSE.or(satisfiedRule).isSatisfied(0)); assertFalse(unsatisfiedRule.or(BooleanRule.FALSE).isSatisfied(0)); assertFalse(BooleanRule.FALSE.or(unsatisfiedRule).isSatisfied(0)); assertTrue(satisfiedRule.or(BooleanRule.TRUE).isSatisfied(10)); assertTrue(BooleanRule.TRUE.or(satisfiedRule).isSatisfied(10)); assertTrue(unsatisfiedRule.or(BooleanRule.TRUE).isSatisfied(10)); assertTrue(BooleanRule.TRUE.or(unsatisfiedRule).isSatisfied(10)); }
@Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { final boolean satisfied = rule1.isSatisfied(index, tradingRecord) || rule2.isSatisfied(index, tradingRecord); traceIsSatisfied(index, satisfied); return satisfied; }
OrRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { final boolean satisfied = rule1.isSatisfied(index, tradingRecord) || rule2.isSatisfied(index, tradingRecord); traceIsSatisfied(index, satisfied); return satisfied; } }
OrRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { final boolean satisfied = rule1.isSatisfied(index, tradingRecord) || rule2.isSatisfied(index, tradingRecord); traceIsSatisfied(index, satisfied); return satisfied; } OrRule(Rule rule1, Rule rule2); }
OrRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { final boolean satisfied = rule1.isSatisfied(index, tradingRecord) || rule2.isSatisfied(index, tradingRecord); traceIsSatisfied(index, satisfied); return satisfied; } OrRule(Rule rule1, Rule rule2); @Override boolean isSatisfied(int index, TradingRecord tradingRecord); Rule getRule1(); Rule getRule2(); }
OrRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { final boolean satisfied = rule1.isSatisfied(index, tradingRecord) || rule2.isSatisfied(index, tradingRecord); traceIsSatisfied(index, satisfied); return satisfied; } OrRule(Rule rule1, Rule rule2); @Override boolean isSatisfied(int index, TradingRecord tradingRecord); Rule getRule1(); Rule getRule2();  }