package clucene;
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.25
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */


public class QueryParser {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  protected QueryParser(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(QueryParser obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      CLjavaJNI.delete_QueryParser(swigCPtr);
    }
    swigCPtr = 0;
  }

  public QueryParser(String field, Analyzer analyzer) {
    this(CLjavaJNI.new_QueryParser(field, Analyzer.getCPtr(analyzer)), true);
  }

  public Query parse(String query) {
    long cPtr = CLjavaJNI.QueryParser_parse__SWIG_0(swigCPtr, query);
    return (cPtr == 0) ? null : new Query(cPtr, true);
  }

  public Query parse(Reader reader) {
    long cPtr = CLjavaJNI.QueryParser_parse__SWIG_1(swigCPtr, Reader.getCPtr(reader));
    return (cPtr == 0) ? null : new Query(cPtr, true);
  }

  public static Query parse(String query, String field, Analyzer analyzer) {
    long cPtr = CLjavaJNI.QueryParser_parse__SWIG_2(query, field, Analyzer.getCPtr(analyzer));
    return (cPtr == 0) ? null : new Query(cPtr, true);
  }

}
