private void setOrdinal( FlowElement previous, Pipe current, Scope scope )
{
if( current instanceof Splice )
{
Splice splice = (Splice) current;
Integer ordinal;
if( previous instanceof Tap ) // revert to pipe name
ordinal = splice.getPipePos().get( scope.getName() );
else // GroupBy allows for duplicate pipe names, this guarantees correct ordinality
ordinal = FlowElements.findOrdinal( splice, (Pipe) previous );
scope.setOrdinal( ordinal );
Set<Scope> scopes = new HashSet<>( incomingEdgesOf( current ) );
scopes.remove( scope );
for( Scope other : scopes )
{
if( other.getOrdinal() == scope.getOrdinal() )
throw new IllegalStateException( "duplicate ordinals" );
}
if( splice.isJoin() && ordinal != 0 )
scope.setNonBlocking( false );
}
}