// Path: src/main/java/de/ids_mannheim/korap/query/serialize/util/StatusCodes.java
// public class StatusCodes {
//     public final static int NO_QUERY = 301;
//     public final static int MALFORMED_QUERY = 302;
//     public final static int DEPRECATED_QUERY_ELEMENT = 303;
//     public final static int INVALID_CLASS_REFERENCE = 304;
//     public final static int INCOMPATIBLE_OPERATOR_AND_OPERAND = 305;
//     public final static int UNKNOWN_QUERY_ELEMENT = 306;
// 	public final static int UNKNOWN_QUERY_LANGUAGE = 307;
//     public final static int UNBOUND_ANNIS_RELATION = 308;
// 	public final static int MISSING_VERSION = 309;
// 	public final static int UNSUPPORTED_VERSION = 310;
// 	public final static int QUERY_TOO_COMPLEX = 311;
// 	public final static int UNKNOWN_QUERY_ERROR = 399;
// 	public final static int SERIALIZATION_FAILED = 300;
// }


import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.z3950.zing.cql.CQLAndNode;
import org.z3950.zing.cql.CQLBooleanNode;
import org.z3950.zing.cql.CQLNode;
import org.z3950.zing.cql.CQLOrNode;
import org.z3950.zing.cql.CQLParseException;
import org.z3950.zing.cql.CQLParser;
import org.z3950.zing.cql.CQLRelation;
import org.z3950.zing.cql.CQLTermNode;
import org.z3950.zing.cql.Modifier;
import de.ids_mannheim.korap.query.serialize.util.StatusCodes;
    private static final String OPERATION_SEQUENCE = "operation:sequence";
    private static final String OPERATION_POSITION = "operation:position";

    private String version;
    private boolean isCaseSensitive; // default true

    public CqlQueryProcessor (String query) {
        this(query, VERSION_1_2, true);
    }

    public CqlQueryProcessor (String query, String version) {
        this(query, version, true);
    }

    public CqlQueryProcessor (String query, String version,
            boolean isCaseSensitive) {
        super();
        this.version = version;
        this.isCaseSensitive = isCaseSensitive;
        process(query);
    }

    @Override
    public Map<String, Object> getRequestMap() {
        return this.requestMap;
    }

    @Override
    public void process(String query) {
        if ((query == null) || query.isEmpty())
// Path: src/main/java/de/ids_mannheim/korap/query/serialize/util/StatusCodes.java
// public class StatusCodes {
//     public final static int NO_QUERY = 301;
//     public final static int MALFORMED_QUERY = 302;
//     public final static int DEPRECATED_QUERY_ELEMENT = 303;
//     public final static int INVALID_CLASS_REFERENCE = 304;
//     public final static int INCOMPATIBLE_OPERATOR_AND_OPERAND = 305;
//     public final static int UNKNOWN_QUERY_ELEMENT = 306;
// 	public final static int UNKNOWN_QUERY_LANGUAGE = 307;
//     public final static int UNBOUND_ANNIS_RELATION = 308;
// 	public final static int MISSING_VERSION = 309;
// 	public final static int UNSUPPORTED_VERSION = 310;
// 	public final static int QUERY_TOO_COMPLEX = 311;
// 	public final static int UNKNOWN_QUERY_ERROR = 399;
// 	public final static int SERIALIZATION_FAILED = 300;
// }


// Path: src/main/java/de/ids_mannheim/korap/query/serialize/CqlQueryProcessor.java
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.z3950.zing.cql.CQLAndNode;
import org.z3950.zing.cql.CQLBooleanNode;
import org.z3950.zing.cql.CQLNode;
import org.z3950.zing.cql.CQLOrNode;
import org.z3950.zing.cql.CQLParseException;
import org.z3950.zing.cql.CQLParser;
import org.z3950.zing.cql.CQLRelation;
import org.z3950.zing.cql.CQLTermNode;
import org.z3950.zing.cql.Modifier;
import de.ids_mannheim.korap.query.serialize.util.StatusCodes;

    private static final String OPERATION_SEQUENCE = "operation:sequence";
    private static final String OPERATION_POSITION = "operation:position";

    private String version;
    private boolean isCaseSensitive; // default true

    public CqlQueryProcessor (String query) {
        this(query, VERSION_1_2, true);
    }

    public CqlQueryProcessor (String query, String version) {
        this(query, version, true);
    }

    public CqlQueryProcessor (String query, String version,
            boolean isCaseSensitive) {
        super();
        this.version = version;
        this.isCaseSensitive = isCaseSensitive;
        process(query);
    }

    @Override
    public Map<String, Object> getRequestMap() {
        return this.requestMap;
    }

    @Override
    public void process(String query) {
        if ((query == null) || query.isEmpty())
            addError(StatusCodes.NO_QUERY,