if ( patternSource instanceof AccumulateDescr ) {
AccumulateDescr accumulate = (AccumulateDescr) patternSource;
FromAccumulateCompositeFactPattern fac = new FromAccumulateCompositeFactPattern();
fac.setSourcePattern( parseBaseDescr( m, accumulate.getInput(), boundParams, dmo ) );
FactPattern factPattern = new FactPattern( pattern.getObjectType() );
factPattern.setBoundName( pattern.getIdentifier() );
boundParams.put( factPattern.getBoundName(),
factPattern.getFactType() );
parseConstraint( m,
factPattern,
pattern.getConstraint(),
boundParams,
dmo );
fac.setFactPattern( factPattern );
for ( AccumulateDescr.AccumulateFunctionCallDescr func : accumulate.getFunctions() ) {
String funcName = func.getFunction();
boolean first = true;
StringBuilder sb = new StringBuilder();
for ( String param : func.getParams() ) {
if ( first ) {
first = false;
} else {
sb.append( ", " );
}
sb.append( param );
}
fac.setFunction( funcName + "(" + sb + ")" );
break;
}
return fac;
} else if ( patternSource instanceof CollectDescr ) {
CollectDescr collect = (CollectDescr) patternSource;
FromCollectCompositeFactPattern fac = new FromCollectCompositeFactPattern();
fac.setRightPattern( parseBaseDescr( m,
collect.getInputPattern(),
boundParams,
dmo ) );
fac.setFactPattern( getFactPattern( m,
pattern,
boundParams,
dmo ) );
return fac;
} else if ( patternSource instanceof EntryPointDescr ) {
EntryPointDescr entryPoint = (EntryPointDescr) patternSource;
FromEntryPointFactPattern fep = new FromEntryPointFactPattern();
fep.setEntryPointName( entryPoint.getText() );
fep.setFactPattern( getFactPattern( m,
pattern,
boundParams,
dmo ) );
return fep;
} else if ( patternSource instanceof FromDescr ) {
FromDescr from = (FromDescr) patternSource;
FromCompositeFactPattern fcfp = new FromCompositeFactPattern();
FactPattern factPattern = new FactPattern( pattern.getObjectType() );
factPattern.setBoundName( pattern.getIdentifier() );
parseConstraint( m,
factPattern,
pattern.getConstraint(),
boundParams,
dmo );