public RuleConditionElement build(final RuleBuildContext context,
final BaseDescr descr,
final Pattern prefixPattern) {
final CollectDescr collectDescr = (CollectDescr) descr;
final PatternBuilder patternBuilder = (PatternBuilder) context.getDialect().getBuilder( PatternDescr.class );
final Pattern sourcePattern = (Pattern) patternBuilder.build( context,
collectDescr.getInputPattern() );
if ( sourcePattern == null ) {
return null;
}
final String className = "collect" + context.getNextId();
collectDescr.setClassMethodName( className );
Pattern resultPattern = (Pattern) context.getBuildStack().peek();
final Collect collect = new Collect( sourcePattern,
resultPattern );