pkg.getRules().size() );
final RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
assertEquals( 5,
rule.getLhs().getDescrs().size() );
final PatternDescr eventA = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
assertEquals( "$a",
eventA.getIdentifier() );
assertEquals( "EventA",
eventA.getObjectType() );
final PatternDescr eventB = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
assertEquals( "$b",
eventB.getIdentifier() );
assertEquals( "EventB",
eventB.getObjectType() );
assertEquals( 1,
eventB.getConstraint().getDescrs().size() );
assertEquals( 1,
eventB.getConstraint().getDescrs().size() );
final ExprConstraintDescr fcdB = (ExprConstraintDescr) eventB.getConstraint().getDescrs().get( 0 );
assertEquals( "this after[1,10] $a || this not after[15,20] $a",
fcdB.getExpression() );
final PatternDescr eventC = (PatternDescr) rule.getLhs().getDescrs().get( 2 );
assertEquals( "$c",
eventC.getIdentifier() );
assertEquals( "EventC",
eventC.getObjectType() );
assertEquals( 1,
eventC.getConstraint().getDescrs().size() );
final ExprConstraintDescr fcdC = (ExprConstraintDescr) eventC.getConstraint().getDescrs().get( 0 );
assertEquals( "this finishes $b",
fcdC.getExpression() );
final PatternDescr eventD = (PatternDescr) rule.getLhs().getDescrs().get( 3 );
assertEquals( "$d",
eventD.getIdentifier() );
assertEquals( "EventD",
eventD.getObjectType() );
assertEquals( 1,
eventD.getConstraint().getDescrs().size() );
final ExprConstraintDescr fcdD = (ExprConstraintDescr) eventD.getConstraint().getDescrs().get( 0 );
assertEquals( "this not starts $a",
fcdD.getExpression() );
final PatternDescr eventE = (PatternDescr) rule.getLhs().getDescrs().get( 4 );
assertEquals( "$e",
eventE.getIdentifier() );
assertEquals( "EventE",
eventE.getObjectType() );
assertEquals( 1,
eventE.getConstraint().getDescrs().size() );
ExprConstraintDescr fcdE = (ExprConstraintDescr) eventE.getConstraint().getDescrs().get( 0 );
assertEquals( "this not before[1, 10] $b || after[1, 10] $c && this after[1, 5] $d",
fcdE.getExpression() );
}