All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prerna.query.interpreters.IQueryInterpreter Maven / Gradle / Ivy

The newest version!
package prerna.query.interpreters;

import java.util.List;
import java.util.Vector;

import org.apache.logging.log4j.Logger;

import prerna.query.querystruct.AbstractQueryStruct;

public interface IQueryInterpreter {
	
	/*
	 * Always define these as lower case for consistency
	 */
	
	String SEARCH_COMPARATOR = "?like";
	String NOT_SEARCH_COMPARATOR = "?nlike";
	String BEGINS_COMPARATOR = "?begins";
	String NOT_BEGINS_COMPARATOR = "?nbegins";
	String ENDS_COMPARATOR = "?ends";
	String NOT_ENDS_COMPARATOR = "?nends";

	void setQueryStruct(AbstractQueryStruct qs);

	String composeQuery();

	void setDistinct(boolean isDistinct);
	
	boolean isDistinct();
	
	void setLogger(Logger logger);
	
	static List getAllSearchComparators() {
		return QuerySideEffect.searchComparators;
	}
	
	static List getPosSearchComparators() {
		return QuerySideEffect.posSearchComparators;
	}
	static List getNegSearchComparators() {
		return QuerySideEffect.negSearchComparators;
	}
}

// TODO :::: SHOULDN'T THIS BE MERGED WITH IQueryFilter SINCE IT HAS A LOT OF STATIC METHODS ALREADY???
class QuerySideEffect {
	
	static List searchComparators = new Vector<>();
	static {
		searchComparators.add(IQueryInterpreter.SEARCH_COMPARATOR);
		searchComparators.add(IQueryInterpreter.NOT_SEARCH_COMPARATOR);
		searchComparators.add(IQueryInterpreter.BEGINS_COMPARATOR);
		searchComparators.add(IQueryInterpreter.NOT_BEGINS_COMPARATOR);
		searchComparators.add(IQueryInterpreter.ENDS_COMPARATOR);
		searchComparators.add(IQueryInterpreter.NOT_ENDS_COMPARATOR);
	}
	
	static List posSearchComparators = new Vector<>();
	static {
		posSearchComparators.add(IQueryInterpreter.SEARCH_COMPARATOR);
		posSearchComparators.add(IQueryInterpreter.BEGINS_COMPARATOR);
		posSearchComparators.add(IQueryInterpreter.ENDS_COMPARATOR);
	}
	
	static List negSearchComparators = new Vector<>();
	static {
		negSearchComparators.add(IQueryInterpreter.NOT_SEARCH_COMPARATOR);
		negSearchComparators.add(IQueryInterpreter.NOT_BEGINS_COMPARATOR);
		negSearchComparators.add(IQueryInterpreter.NOT_ENDS_COMPARATOR);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy