/*
 *  eXist Open Source Native XML Database
 *  Copyright (C) 2001-03 Wolfgang M. Meier
 *  wolfgang@exist-db.org
 *  http://exist.sourceforge.net
 *  
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *  
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *  
 *  $Id$
 */
package org.exist.xquery;

/**
 * Declares various constants and flags used by the query engine:
 * axis specifiers, operators.
 * 
 * @author wolf
 */
public interface Constants {

	/** Axis names */
    public final static String[] AXISSPECIFIERS = {
						"ancestor",
					    "ancestor-or-self",
					    "parent",
					    "preceding",
					    "preceding-sibling",
					    "child",
					    "attribute",
					    "descendant",
					    "descendant-or-self",
					    "following",
					    "following-sibling",
					    "namespace",
					    "self",
					    "attribute-descendant"
	};

    /*
     * XPath axis constants:
     */
    
    // Reverse axes
    public final static int ANCESTOR_AXIS = 0;
    public final static int ANCESTOR_SELF_AXIS = 1;
    public final static int PARENT_AXIS =  2;
    public final static int PRECEDING_AXIS = 3;
    public final static int PRECEDING_SIBLING_AXIS = 4;
    
    // Forward axes
    public final static int CHILD_AXIS = 5;
    public final static int ATTRIBUTE_AXIS = 6;
    public final static int DESCENDANT_AXIS = 7;
    public final static int DESCENDANT_SELF_AXIS = 8;
    public final static int FOLLOWING_AXIS = 9;
    public final static int FOLLOWING_SIBLING_AXIS = 10;
    public final static int NAMESPACE_AXIS = 11;
    public final static int SELF_AXIS = 12;
	public final static int DESCENDANT_ATTRIBUTE_AXIS = 13;
	
    /**
     * These constants represent the
     * different node types in <i>XPath</i>.
     */
    public final static String[] NODETYPES = {"node",
				       "root",
				       "*",
				       "text",
				       "attribute",
				       "namespace",
				       "comment",
				       "processing-instruction"};

    public final static short TYPE_UNKNOWN = -1;

    /*
     * Node types
     */
    
    public final static int NODE_TYPE = 0;
    public final static int ROOT_NODE = 1;
    public final static int ELEMENT_NODE = 2;
    public final static int TEXT_NODE = 3;
    public final static int ATTRIBUTE_NODE = 4;
    public final static int NAMESPACE_NODE = 5;
    public final static int COMMENT_NODE = 6;
    public final static int PROCESSING_NODE = 7;

    /*
     * Comparison operators
     */
    public final static int LT  = 0;
    public final static int GT  = 1;
    public final static int GTEQ = 2;
    public final static int LTEQ = 3;
    public final static int EQ  = 4;
    public final static int NEQ = 5;
    public final static int IN = 6;
    public final static int REGEXP = 7;

    /*
     * String truncation operators
     */
    public final static int TRUNC_NONE = -1;
    public final static int TRUNC_RIGHT = 0;
    public final static int TRUNC_LEFT = 1;
    public final static int TRUNC_BOTH = 2;

    /*
     * Arithmetic operators
     */
	public final static int PLUS = 8;
	public final static int MINUS = 9;
	public final static int MULT = 10;
	public final static int DIV = 11;
	public final static int MOD = 12;
	public final static int IDIV = 13;

	/*
	 * Identity operators
	 */
	public final static int IS = 14;
	public final static int ISNOT = 15;
	public final static int BEFORE = 16;
	public final static int AFTER = 17;
	
	public final static String[] OPS = 
	{ "<", ">", ">=", "<=", "=", "!=", "IN" , "=~", "+", 
	  "-", "*", "div", "mod", "idiv", "is", "isnot", "<<", ">>" };

    public final static int KEEP_UNION = 0;
    public final static int KEEP_INTER = 1;
    public final static int KEEP_AFTER = 2;
    public final static int KEEP_BEFORE = 3;

    public final static int TYPE_ANY      = 0;
    public final static int TYPE_NODELIST = 1;
    public final static int TYPE_NODE     = 2;
    public final static int TYPE_STRING   = 3;
    public final static int TYPE_NUM      = 4;
    public final static int TYPE_BOOL     = 5;

    public final static int FULLTEXT_OR = 0;
    public final static int FULLTEXT_AND = 1;
    
    
}
@@ -1492,25 +1492,26 @@
 %0A%09%7D;%0A%0A    /*
+*
 %0A
-
      * XPath
@@ -1537,21 +1537,23 @@
    *
-/
 %0A    
+%3Cbr%3E
 %0A    
-//
+*
  Rev
@@ -1557,24 +1557,27 @@
 Reverse axes
+ */
 %0A    public 
@@ -1824,17 +1824,18 @@
   %0A    /
-/
+**
  Forward
@@ -1839,16 +1839,19 @@
 ard axes
+ */
 %0A    pub
@@ -2658,32 +2658,33 @@
 WN = -1;%0A%0A    /*
+*
 %0A     * Node typ
@@ -3064,32 +3064,33 @@
 ODE = 7;%0A%0A    /*
+*
 %0A     * Comparis
@@ -3409,32 +3409,33 @@
 EXP = 7;%0A%0A    /*
+*
 %0A     * String t
@@ -3647,16 +3647,17 @@
 %0A%0A    /*
+*
 %0A     * 
@@ -3899,19 +3899,20 @@
  = 13;%0A%0A
-
 %09/*
+*
 %0A%09 * Ide

transform plain comments in javadoc