protected boolean areCompatibleEdges( int v1, int v2, int v3, int v4 ) { List<ScopeExpression> matchers = matchGraph.getAllEdgesList( v1, v2 ); // if there is any edge between the nodes, capture all and return true if( matchers.size() == 1 && matchers.get( 0 ).acceptsAll() ) { if( LOG.isDebugEnabled() ) debugCompatibleEdges( elementGraph.getAllEdgesList( v3, v4 ), v1, v2, matchers ); return true; } List<Scope> scopes = elementGraph.getAllEdgesList( v3, v4 ); Collection<Scope> results = areCompatibleEdges( plannerContext, elementGraph.getElementGraph(), matchers, scopes ); if( LOG.isDebugEnabled() && results != null ) debugCompatibleEdges( results, v1, v2, matchers ); return results != null; }
private boolean areCompatibleNodes( int node1, int node2 ) { Expression expression = matchGraph.getVertex( node1 ); FlowElement flowElement = elementGraph.getVertex( node2 ); boolean result; if( ( (ElementExpression) expression ).getCapture() == ElementCapture.Primary && !finderContext.getRequiredElements().isEmpty() ) result = finderContext.isRequired( flowElement ); else if( finderContext.isExcluded( flowElement ) || finderContext.isIgnored( flowElement ) ) result = false; else result = expression.applies( plannerContext, elementGraph.getElementGraph(), flowElement ); if( LOG.isDebugEnabled() && result ) LOG.debug( "compatible nodes: {}:{} matched {}:{}", node1, expression, node2, flowElement ); return result; }