FactPattern fp = new FactPattern( pattern.getFactType() );
fp.setBoundName( pattern.getBoundName() );
fp.setNegated( pattern.isNegated() );
fp.setWindow( pattern.getWindow() );
if ( pattern.getEntryPointName() != null && pattern.getEntryPointName().length() > 0 ) {
FromEntryPointFactPattern fep = new FromEntryPointFactPattern();
fep.setEntryPointName( pattern.getEntryPointName() );
fep.setFactPattern( fp );
patterns.add( fep );
ifp = fep;
} else {
patterns.add( fp );
ifp = fp;
}
}
//Extract the FactPattern from the IFactPattern
FactPattern fp;
if ( ifp instanceof FactPattern ) {
fp = (FactPattern) ifp;
} else if ( ifp instanceof FromEntryPointFactPattern ) {
FromEntryPointFactPattern fep = (FromEntryPointFactPattern) ifp;
fp = fep.getFactPattern();
} else {
throw new IllegalArgumentException( "Inexpected IFactPattern implementation found." );
}
//Add the constraint from this cell