@Test
public void testBindingList() {
final RuleModel model = new RuleModel();
model.lhs = new IPattern[3];
final FactPattern x = new FactPattern( "Car" );
model.lhs[0] = x;
x.setBoundName( "x" );
final FactPattern y = new FactPattern( "Car" );
model.lhs[1] = y;
y.setBoundName( "y" );
final SingleFieldConstraint[] cons = new SingleFieldConstraint[2];
y.constraintList = new CompositeFieldConstraint();
y.constraintList.constraints = cons;
cons[0] = new SingleFieldConstraint( "age" );
cons[0].setFieldBinding( "qbc" );
cons[0].setFieldType( "String" );
cons[0].connectives = new ConnectiveConstraint[1];
cons[0].connectives[0] = new ConnectiveConstraint( "age",
"String",
"&",
"x" );
cons[0].connectives[0].setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
cons[1] = new SingleFieldConstraint( "make" );
cons[1].setFieldType( "Long" );
cons[1].connectives = new ConnectiveConstraint[1];
cons[1].connectives[0] = new ConnectiveConstraint( "make",
"Long",
"=",
"2" );
cons[1].connectives[0].setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
final FactPattern other = new FactPattern( "House" );
model.lhs[2] = other;
final List fb = model.getAllVariables();
assertEquals( 3,
fb.size() );