<commit_before>package org.umlg.sqlg.strategy;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;

import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WherePredicateStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
import org.umlg.sqlg.predicate.FullText;
import org.umlg.sqlg.sql.parse.ReplacedStep;
import org.umlg.sqlg.structure.SqlgGraph;

/**
 * When a Where step uses a FullText predicate, we attach it to the step itself as a special hasContainer
 * @author jpmoresmau
 *
 */
public class SqlgWhereStrategy extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy> implements TraversalStrategy.OptimizationStrategy{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5608856947238999912L;

	public SqlgWhereStrategy() {
		
	}
	
	@SuppressWarnings("resource")
	@Override
	public void apply(Admin<?, ?> traversal) {
		if (!(traversal.getGraph().get() instanceof SqlgGraph)) {
            return;
        }
        SqlgGraph sqlgGraph = (SqlgGraph) traversal.getGraph().get();
        //This is because in normal BatchMode the new vertices are cached with it edges.
        //The query will read from the cache if this is for a cached vertex
        if (sqlgGraph.features().supportsBatchMode() && sqlgGraph.tx().isInNormalBatchMode()) {
            sqlgGraph.tx().flush();
        }
        List<Step<?,?>> steps = new ArrayList<>(traversal.asAdmin().getSteps());
        ListIterator<Step<?,?>> stepIterator = steps.listIterator();
        // get all steps per label
        Map<String, Object> stepsByLabel=new HashMap<>();
        stepIterator = steps.listIterator();
        Step<?,?> previous=null;<commit_msg>remove generic <> to make the class compile<commit_after>package org.umlg.sqlg.strategy;

import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WherePredicateStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
import org.umlg.sqlg.predicate.FullText;
import org.umlg.sqlg.sql.parse.ReplacedStep;
import org.umlg.sqlg.structure.SqlgGraph;

import java.util.*;

/**
 * When a Where step uses a FullText predicate, we attach it to the step itself as a special hasContainer
 * @author jpmoresmau
 *
 */
public class SqlgWhereStrategy extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy> implements TraversalStrategy.OptimizationStrategy{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5608856947238999912L;

	public SqlgWhereStrategy() {
		
	}
	
	@SuppressWarnings("resource")
	@Override
	public void apply(Admin<?, ?> traversal) {
		if (!(traversal.getGraph().get() instanceof SqlgGraph)) {
            return;
        }
        SqlgGraph sqlgGraph = (SqlgGraph) traversal.getGraph().get();
        //This is because in normal BatchMode the new vertices are cached with it edges.
        //The query will read from the cache if this is for a cached vertex
        if (sqlgGraph.features().supportsBatchMode() && sqlgGraph.tx().isInNormalBatchMode()) {
            sqlgGraph.tx().flush();
        }
        List<Step<?,?>> steps = new ArrayList(traversal.asAdmin().getSteps());
        ListIterator<Step<?,?>> stepIterator = steps.listIterator();
        // get all steps per label
        Map<String, Object> stepsByLabel=new HashMap<>();
        stepIterator = steps.listIterator();
        Step<?,?> previous=null;
{'fraction_non_alphanumeric': 0.11316568047337278, 'fraction_numerical': 0.009368836291913214, 'mean_word_length': 4.148477157360406, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6817294', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1181, 'n_words': 263}