public BindingSink toCode( HowTo howTo, BindingSink out )
{
final Set<Binding> deductions = new HashSet<Binding>();
final List<Node[]> queue = new ArrayList<Node[]>();
BindingSink sink = new BindingSink.Filter( out )
{
@Override public void consume( Node[] item )
{
if (deductions.add( new Binding( item ) ) )
{
sink.consume( item );
queue.add( item );
}
}
};
PrefixMapping pm = createPrefixMapping().withDefaultMappings( PrefixMapping.Standard );
List<BindingSink> inputs = new ArrayList<BindingSink>();
for (Rule r: rules) inputs.add( r.toCode( pm, howTo, sink ) );
BindingSink fanOut = BindingSink.toAll( inputs );
return new BindingSink.Filter( fanOut )
{
@Override public void start()
{ sink.start(); }