@Test public void isSatisfied() { assertFalse(satisfiedRule.and(BooleanRule.FALSE).isSatisfied(0)); assertFalse(BooleanRule.FALSE.and(satisfiedRule).isSatisfied(0)); assertFalse(unsatisfiedRule.and(BooleanRule.FALSE).isSatisfied(0)); assertFalse(BooleanRule.FALSE.and(unsatisfiedRule).isSatisfied(0)); assertTrue(satisfiedRule.and(BooleanRule.TRUE).isSatisfied(10)); assertTrue(BooleanRule.TRUE.and(satisfiedRule).isSatisfied(10)); assertFalse(unsatisfiedRule.and(BooleanRule.TRUE).isSatisfied(10)); assertFalse(BooleanRule.TRUE.and(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; }
AndRule 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; } }
AndRule 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; } AndRule(Rule rule1, Rule rule2); }
AndRule 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; } AndRule(Rule rule1, Rule rule2); @Override boolean isSatisfied(int index, TradingRecord tradingRecord); Rule getRule1(); Rule getRule2(); }
AndRule 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; } AndRule(Rule rule1, Rule rule2); @Override boolean isSatisfied(int index, TradingRecord tradingRecord); Rule getRule1(); Rule getRule2();  }