FactPattern fp = new FactPattern( p.getFactType() );
fp.setBoundName( p.getBoundName() );
fp.setNegated( p.isNegated() );
fp.setWindow( p.getWindow() );
if ( p.getEntryPointName() != null && p.getEntryPointName().length() > 0 ) {
FromEntryPointFactPattern fep = new FromEntryPointFactPattern();
fep.setEntryPointName( p.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