code: private NextNodeAndQuery optimizeJoinOrFilter(IntermediateQuery currentQuery, JoinOrFilterNode currentNode) {
  
          /**
           * Tries to build a PushDownBooleanExpressionProposal for the current node
           */
          Optional<PushDownBooleanExpressionProposal> optionalProposal = makeProposal(
                  currentQuery, currentNode);
  
          /**
           * Applies it and extracts from the results the necessary information
           * for continuing the navigation
           */
          if (optionalProposal.isPresent()) {
              PushDownBooleanExpressionProposal proposal = optionalProposal.get();
  
              // Applies the proposal and casts the results
              NodeCentricOptimizationResults<JoinOrFilterNode> results;
              try {
                  results = currentQuery.applyProposal(proposal);
              } catch (EmptyQueryException e) {
                  throw new IllegalStateException("Unexpected empty query exception while pushing down boolean expressions");
              }
  
              return getNextNodeAndQuery(currentQuery, results);
          } else {
              return new NextNodeAndQuery(getDepthFirstNextNode(currentQuery, currentNode), currentQuery);
          }
      }
docs: Tries to optimize one JoinOrFilterNode.
  Returns information for the continuing the navigation in the possibly new IntermediateQuery.