/**
 * QueryType.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.3 Oct 05, 2005 (05:23:37 EDT) WSDL2Java emitter.
 */

package org.ecoinformatics.ecogrid.queryservice.query;


/**
 * An XML-based query structure for combining XPath 
 *             pattern matching expressions using logical operators.
 */
public class QueryType  implements java.io.Serializable {
    /* The namespace element identifies
     *                         the scope for the query by giving one or more
     * 
     *                         namespaces to which the query conditions should
     * be 
     *                         applied.  For example, to query EML documents,
     * one 
     *                         would indicate a namespace of 
     *                         "eml://ecoinformatics.org/eml-2.0.0". When
     * more than
     *                         one namespace is given, then the query conditions
     * 
     *                         should be applied to all of those document
     * types within
     *                         the EcoGrid repository node. */
    private org.ecoinformatics.ecogrid.queryservice.query.QueryTypeNamespace[] namespace;

    /* An optional limited XPath expression that
     *                     defines a field that should be returned in the
     * resultset 
     *                     document.  The result record constructed will
     * contain a 
     *                     well-formed xml file that combines all of the
     * returnfields 
     *                     into a single tree structure.  If a returnfield
     * is specified
     *                     as a leaf node that is a SimpleType, the value
     * and all 
     *                     parent elements leading to that value will be
     * included in 
     *                     the result.  If a specified returnfield is not
     * a leaf node, 
     *                     then all element and value content below that
     * node will be 
     *                     included in the result along with the parent elements
     * 
     *                     leading to the matched node. */
    private java.lang.String[] returnField;

    /* An optional title that names and 
     *                     describes the query. */
    private java.lang.String[] title;

    private org.ecoinformatics.ecogrid.queryservice.query.ANDType AND;

    private org.ecoinformatics.ecogrid.queryservice.query.ORType OR;

    private org.ecoinformatics.ecogrid.queryservice.query.ConditionType condition;

    private java.lang.String queryId;  // attribute

    private org.apache.axis.types.URI system;  // attribute

    public QueryType() {
    }

    public QueryType(
           org.ecoinformatics.ecogrid.queryservice.query.QueryTypeNamespace[] namespace,
           java.lang.String[] returnField,
           java.lang.String[] title,
           org.ecoinformatics.ecogrid.queryservice.query.ANDType AND,
           org.ecoinformatics.ecogrid.queryservice.query.ORType OR,
           org.ecoinformatics.ecogrid.queryservice.query.ConditionType condition,
           java.lang.String queryId,
           org.apache.axis.types.URI system) {
           this.namespace = namespace;
           this.returnField = returnField;
           this.title = title;
           this.AND = AND;
           this.OR = OR;
           this.condition = condition;
           this.queryId = queryId;
           this.system = system;
    }


    /**
     * Gets the namespace value for this QueryType.
     * 
     * @return namespace   * The namespace element identifies
     *                         the scope for the query by giving one or more
     * 
     *                         namespaces to which the query conditions should
     * be 
     *                         applied.  For example, to query EML documents,
     * one 
     *                         would indicate a namespace of 
     *                         "eml://ecoinformatics.org/eml-2.0.0". When
     * more than
     *                         one namespace is given, then the query conditions
     * 
     *                         should be applied to all of those document
     * types within
     *                         the EcoGrid repository node.
     */
    public org.ecoinformatics.ecogrid.queryservice.query.QueryTypeNamespace[] getNamespace() {
        return namespace;
    }


    /**
     * Sets the namespace value for this QueryType.
     * 
     * @param namespace   * The namespace element identifies
     *                         the scope for the query by giving one or more
     * 
     *                         namespaces to which the query conditions should
     * be 
     *                         applied.  For example, to query EML documents,
     * one 
     *                         would indicate a namespace of 
     *                         "eml://ecoinformatics.org/eml-2.0.0". When
     * more than
     *                         one namespace is given, then the query conditions
     * 
     *                         should be applied to all of those document
     * types within
     *                         the EcoGrid repository node.
     */
    public void setNamespace(org.ecoinformatics.ecogrid.queryservice.query.QueryTypeNamespace[] namespace) {
        this.namespace = namespace;
    }

    public org.ecoinformatics.ecogrid.queryservice.query.QueryTypeNamespace getNamespace(int i) {
        return this.namespace[i];
    }

    public void setNamespace(int i, org.ecoinformatics.ecogrid.queryservice.query.QueryTypeNamespace _value) {
        this.namespace[i] = _value;
    }


    /**
     * Gets the returnField value for this QueryType.
     * 
     * @return returnField   * An optional limited XPath expression that
     *                     defines a field that should be returned in the
     * resultset 
     *                     document.  The result record constructed will
     * contain a 
     *                     well-formed xml file that combines all of the
     * returnfields 
     *                     into a single tree structure.  If a returnfield
     * is specified
     *                     as a leaf node that is a SimpleType, the value
     * and all 
     *                     parent elements leading to that value will be
     * included in 
     *                     the result.  If a specified returnfield is not
     * a leaf node, 
     *                     then all element and value content below that
     * node will be 
     *                     included in the result along with the parent elements
     * 
     *                     leading to the matched node.
     */
    public java.lang.String[] getReturnField() {
        return returnField;
    }


    /**
     * Sets the returnField value for this QueryType.
     * 
     * @param returnField   * An optional limited XPath expression that
     *                     defines a field that should be returned in the
     * resultset 
     *                     document.  The result record constructed will
     * contain a 
     *                     well-formed xml file that combines all of the
     * returnfields 
     *                     into a single tree structure.  If a returnfield
     * is specified
     *                     as a leaf node that is a SimpleType, the value
     * and all 
     *                     parent elements leading to that value will be
     * included in 
     *                     the result.  If a specified returnfield is not
     * a leaf node, 
     *                     then all element and value content below that
     * node will be 
     *                     included in the result along with the parent elements
     * 
     *                     leading to the matched node.
     */
    public void setReturnField(java.lang.String[] returnField) {
        this.returnField = returnField;
    }

    public java.lang.String getReturnField(int i) {
        return this.returnField[i];
    }

    public void setReturnField(int i, java.lang.String _value) {
        this.returnField[i] = _value;
    }


    /**
     * Gets the title value for this QueryType.
     * 
     * @return title   * An optional title that names and 
     *                     describes the query.
     */
    public java.lang.String[] getTitle() {
        return title;
    }


    /**
     * Sets the title value for this QueryType.
     * 
     * @param title   * An optional title that names and 
     *                     describes the query.
     */
    public void setTitle(java.lang.String[] title) {
        this.title = title;
    }

    public java.lang.String getTitle(int i) {
        return this.title[i];
    }

    public void setTitle(int i, java.lang.String _value) {
        this.title[i] = _value;
    }


    /**
     * Gets the AND value for this QueryType.
     * 
     * @return AND
     */
    public org.ecoinformatics.ecogrid.queryservice.query.ANDType getAND() {
        return AND;
    }


    /**
     * Sets the AND value for this QueryType.
     * 
     * @param AND
     */
    public void setAND(org.ecoinformatics.ecogrid.queryservice.query.ANDType AND) {
        this.AND = AND;
    }


    /**
     * Gets the OR value for this QueryType.
     * 
     * @return OR
     */
    public org.ecoinformatics.ecogrid.queryservice.query.ORType getOR() {
        return OR;
    }


    /**
     * Sets the OR value for this QueryType.
     * 
     * @param OR
     */
    public void setOR(org.ecoinformatics.ecogrid.queryservice.query.ORType OR) {
        this.OR = OR;
    }


    /**
     * Gets the condition value for this QueryType.
     * 
     * @return condition
     */
    public org.ecoinformatics.ecogrid.queryservice.query.ConditionType getCondition() {
        return condition;
    }


    /**
     * Sets the condition value for this QueryType.
     * 
     * @param condition
     */
    public void setCondition(org.ecoinformatics.ecogrid.queryservice.query.ConditionType condition) {
        this.condition = condition;
    }


    /**
     * Gets the queryId value for this QueryType.
     * 
     * @return queryId
     */
    public java.lang.String getQueryId() {
        return queryId;
    }


    /**
     * Sets the queryId value for this QueryType.
     * 
     * @param queryId
     */
    public void setQueryId(java.lang.String queryId) {
        this.queryId = queryId;
    }


    /**
     * Gets the system value for this QueryType.
     * 
     * @return system
     */
    public org.apache.axis.types.URI getSystem() {
        return system;
    }


    /**
     * Sets the system value for this QueryType.
     * 
     * @param system
     */
    public void setSystem(org.apache.axis.types.URI system) {
        this.system = system;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof QueryType)) return false;
        QueryType other = (QueryType) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true && 
            ((this.namespace==null && other.getNamespace()==null) || 
             (this.namespace!=null &&
              java.util.Arrays.equals(this.namespace, other.getNamespace()))) &&
            ((this.returnField==null && other.getReturnField()==null) || 
             (this.returnField!=null &&
              java.util.Arrays.equals(this.returnField, other.getReturnField()))) &&
            ((this.title==null && other.getTitle()==null) || 
             (this.title!=null &&
              java.util.Arrays.equals(this.title, other.getTitle()))) &&
            ((this.AND==null && other.getAND()==null) || 
             (this.AND!=null &&
              this.AND.equals(other.getAND()))) &&
            ((this.OR==null && other.getOR()==null) || 
             (this.OR!=null &&
              this.OR.equals(other.getOR()))) &&
            ((this.condition==null && other.getCondition()==null) || 
             (this.condition!=null &&
              this.condition.equals(other.getCondition()))) &&
            ((this.queryId==null && other.getQueryId()==null) || 
             (this.queryId!=null &&
              this.queryId.equals(other.getQueryId()))) &&
            ((this.system==null && other.getSystem()==null) || 
             (this.system!=null &&
              this.system.equals(other.getSystem())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getNamespace() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getNamespace());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getNamespace(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        if (getReturnField() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getReturnField());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getReturnField(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        if (getTitle() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getTitle());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getTitle(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        if (getAND() != null) {
            _hashCode += getAND().hashCode();
        }
        if (getOR() != null) {
            _hashCode += getOR().hashCode();
        }
        if (getCondition() != null) {
            _hashCode += getCondition().hashCode();
        }
        if (getQueryId() != null) {
            _hashCode += getQueryId().hashCode();
        }
        if (getSystem() != null) {
            _hashCode += getSystem().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(QueryType.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("http://ecoinformatics.org/query-1.0.1", "QueryType"));
        org.apache.axis.description.AttributeDesc attrField = new org.apache.axis.description.AttributeDesc();
        attrField.setFieldName("queryId");
        attrField.setXmlName(new javax.xml.namespace.QName("", "queryId"));
        attrField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        typeDesc.addFieldDesc(attrField);
        attrField = new org.apache.axis.description.AttributeDesc();
        attrField.setFieldName("system");
        attrField.setXmlName(new javax.xml.namespace.QName("", "system"));
        attrField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyURI"));
        typeDesc.addFieldDesc(attrField);
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("namespace");
        elemField.setXmlName(new javax.xml.namespace.QName("", "namespace"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://ecoinformatics.org/query-1.0.1", ">QueryType>namespace"));
        elemField.setNillable(false);
        elemField.setMaxOccursUnbounded(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("returnField");
        elemField.setXmlName(new javax.xml.namespace.QName("", "returnField"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        elemField.setMaxOccursUnbounded(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("title");
        elemField.setXmlName(new javax.xml.namespace.QName("", "title"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        elemField.setMaxOccursUnbounded(true);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("AND");
        elemField.setXmlName(new javax.xml.namespace.QName("", "AND"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://ecoinformatics.org/query-1.0.1", "ANDType"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("OR");
        elemField.setXmlName(new javax.xml.namespace.QName("", "OR"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://ecoinformatics.org/query-1.0.1", "ORType"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("condition");
        elemField.setXmlName(new javax.xml.namespace.QName("", "condition"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://ecoinformatics.org/query-1.0.1", "ConditionType"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}
