Added equals() and hashCode() to types. Added type management to context.
authorVinayak Ravindra Borkar <vinayakb@apache.org>
Fri, 15 Jun 2012 02:00:34 +0000 (02:00 +0000)
committerVinayak Ravindra Borkar <vinayakb@apache.org>
Fri, 15 Jun 2012 02:00:34 +0000 (02:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/vxquery/branches/vxquery_algebricks@1350443 13f79535-47bb-0310-9956-ffa450edef68

33 files changed:
vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryExpressionJobGen.java
vxquery-core/src/main/java/org/apache/vxquery/context/DelegatingStaticContextImpl.java
vxquery-core/src/main/java/org/apache/vxquery/context/RootStaticContextImpl.java
vxquery-core/src/main/java/org/apache/vxquery/context/StaticContext.java
vxquery-core/src/main/java/org/apache/vxquery/context/StaticContextImpl.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/CodedQNamePointable.java [moved from vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/QNamePointable.java with 91% similarity]
vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/AttributeNodePointable.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/ElementNodePointable.java
vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml
vxquery-core/src/main/java/org/apache/vxquery/types/AnyItemType.java
vxquery-core/src/main/java/org/apache/vxquery/types/AnyNodeType.java
vxquery-core/src/main/java/org/apache/vxquery/types/AnySimpleType.java
vxquery-core/src/main/java/org/apache/vxquery/types/AnyType.java
vxquery-core/src/main/java/org/apache/vxquery/types/AttributeType.java
vxquery-core/src/main/java/org/apache/vxquery/types/BuiltinAtomicType.java
vxquery-core/src/main/java/org/apache/vxquery/types/BuiltinTypeConstants.java
vxquery-core/src/main/java/org/apache/vxquery/types/BuiltinTypeRegistry.java
vxquery-core/src/main/java/org/apache/vxquery/types/CommentType.java
vxquery-core/src/main/java/org/apache/vxquery/types/ComposedType.java [deleted file]
vxquery-core/src/main/java/org/apache/vxquery/types/Composer.java [deleted file]
vxquery-core/src/main/java/org/apache/vxquery/types/DocumentType.java
vxquery-core/src/main/java/org/apache/vxquery/types/ElementType.java
vxquery-core/src/main/java/org/apache/vxquery/types/EmptySequenceType.java
vxquery-core/src/main/java/org/apache/vxquery/types/NameTest.java
vxquery-core/src/main/java/org/apache/vxquery/types/NoneType.java
vxquery-core/src/main/java/org/apache/vxquery/types/ProcessingInstructionType.java
vxquery-core/src/main/java/org/apache/vxquery/types/QuantifiedType.java [deleted file]
vxquery-core/src/main/java/org/apache/vxquery/types/SequenceType.java
vxquery-core/src/main/java/org/apache/vxquery/types/TextType.java
vxquery-core/src/main/java/org/apache/vxquery/types/TypeOperations.java [deleted file]
vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java

index b6b9d08..ac0a867 100644 (file)
@@ -85,72 +85,76 @@ public class VXQuery {
         if (!opts.compileOnly) {
             startLocalHyracks();
         }
-        for (String query : opts.arguments) {
-            String qStr = slurp(query);
-            if (opts.showQuery) {
-                System.err.println(qStr);
-            }
-            XQueryCompilationListener listener = new XQueryCompilationListener() {
-                @Override
-                public void notifyCodegenResult(Module module) {
-                    if (opts.showRP) {
-                        JobSpecification jobSpec = module.getHyracksJobSpecification();
-                        System.err.println(jobSpec.toString());
-                    }
+        try {
+            for (String query : opts.arguments) {
+                String qStr = slurp(query);
+                if (opts.showQuery) {
+                    System.err.println(qStr);
                 }
+                XQueryCompilationListener listener = new XQueryCompilationListener() {
+                    @Override
+                    public void notifyCodegenResult(Module module) {
+                        if (opts.showRP) {
+                            JobSpecification jobSpec = module.getHyracksJobSpecification();
+                            System.err.println(jobSpec.toString());
+                        }
+                    }
 
-                @Override
-                public void notifyTranslationResult(Module module) {
-                    if (opts.showTET) {
-                        try {
-                            LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
-                            StringBuilder buffer = new StringBuilder();
-                            PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
-                            System.err.println(buffer.toString());
-                        } catch (AlgebricksException e) {
-                            e.printStackTrace();
+                    @Override
+                    public void notifyTranslationResult(Module module) {
+                        if (opts.showTET) {
+                            try {
+                                LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
+                                StringBuilder buffer = new StringBuilder();
+                                PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
+                                System.err.println(buffer.toString());
+                            } catch (AlgebricksException e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
-                }
 
-                @Override
-                public void notifyTypecheckResult(Module module) {
-                }
+                    @Override
+                    public void notifyTypecheckResult(Module module) {
+                    }
 
-                @Override
-                public void notifyOptimizedResult(Module module) {
-                    if (opts.showOET) {
-                        try {
-                            LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
-                            StringBuilder buffer = new StringBuilder();
-                            PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
-                            System.err.println(buffer.toString());
-                        } catch (AlgebricksException e) {
-                            e.printStackTrace();
+                    @Override
+                    public void notifyOptimizedResult(Module module) {
+                        if (opts.showOET) {
+                            try {
+                                LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
+                                StringBuilder buffer = new StringBuilder();
+                                PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
+                                System.err.println(buffer.toString());
+                            } catch (AlgebricksException e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
-                }
 
-                @Override
-                public void notifyParseResult(ModuleNode moduleNode) {
-                    if (opts.showAST) {
-                        System.err.println(new XStream(new DomDriver()).toXML(moduleNode));
+                    @Override
+                    public void notifyParseResult(ModuleNode moduleNode) {
+                        if (opts.showAST) {
+                            System.err.println(new XStream(new DomDriver()).toXML(moduleNode));
+                        }
                     }
+                };
+                File result = createTempFile("test");
+                XMLQueryCompiler compiler = new XMLQueryCompiler(listener);
+                CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(
+                        RootStaticContextImpl.INSTANCE), new FileSplit[] { new FileSplit("nc1",
+                        result.getAbsolutePath()) });
+                compiler.compile(query, new StringReader(qStr), ccb, opts.optimizationLevel);
+                if (opts.compileOnly) {
+                    continue;
                 }
-            };
-            File result = createTempFile("test");
-            XMLQueryCompiler compiler = new XMLQueryCompiler(listener);
-            CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(RootStaticContextImpl.INSTANCE),
-                    new FileSplit[] { new FileSplit("nc1", result.getAbsolutePath()) });
-            compiler.compile(query, new StringReader(qStr), ccb, opts.optimizationLevel);
-            if (opts.compileOnly) {
-                continue;
-            }
 
-            runInProcess(compiler.getModule().getHyracksJobSpecification(), result);
-        }
-        if (!opts.compileOnly) {
-            stopLocalHyracks();
+                runInProcess(compiler.getModule().getHyracksJobSpecification(), result);
+            }
+        } finally {
+            if (!opts.compileOnly) {
+                stopLocalHyracks();
+            }
         }
     }
 
index 85bcb6f..b897cd8 100644 (file)
@@ -11,47 +11,47 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.StatefulFunctionC
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.UnnestingFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
 import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IRunningAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ISerializableAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
 import edu.uci.ics.hyracks.algebricks.runtime.evaluators.ConstantEvalFactory;
 
 public class VXQueryExpressionJobGen implements ILogicalExpressionJobGen {
     @Override
-    public IEvaluatorFactory createEvaluatorFactory(ILogicalExpression expr, IVariableTypeEnvironment env,
+    public ICopyEvaluatorFactory createEvaluatorFactory(ILogicalExpression expr, IVariableTypeEnvironment env,
             IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
         if (expr.getExpressionTag() == LogicalExpressionTag.CONSTANT) {
             VXQueryConstantValue cv = (VXQueryConstantValue) ((ConstantExpression) expr).getValue();
             return new ConstantEvalFactory(cv.getValue());
         }
-        return null;
+        throw new UnsupportedOperationException("Cannot create runtime for " + expr.getExpressionTag());
     }
 
     @Override
-    public IAggregateFunctionFactory createAggregateFunctionFactory(AggregateFunctionCallExpression expr,
+    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(AggregateFunctionCallExpression expr,
             IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
             throws AlgebricksException {
         return null;
     }
 
     @Override
-    public ISerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
+    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
             AggregateFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas,
             JobGenContext context) throws AlgebricksException {
         return null;
     }
 
     @Override
-    public IRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(StatefulFunctionCallExpression expr,
-            IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
-            throws AlgebricksException {
+    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(
+            StatefulFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas,
+            JobGenContext context) throws AlgebricksException {
         return null;
     }
 
     @Override
-    public IUnnestingFunctionFactory createUnnestingFunctionFactory(UnnestingFunctionCallExpression expr,
+    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(UnnestingFunctionCallExpression expr,
             IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
             throws AlgebricksException {
         return null;
index ac48867..e23f9fc 100644 (file)
@@ -222,6 +222,21 @@ public abstract class DelegatingStaticContextImpl implements StaticContext {
     }
 
     @Override
+    public int lookupSequenceType(SequenceType type) {
+        return parent.lookupSequenceType(type);
+    }
+
+    @Override
+    public int encodeSequenceType(SequenceType type) {
+        return parent.encodeSequenceType(type);
+    }
+
+    @Override
+    public int getMaxSequenceTypeCode() {
+        return parent.getMaxSequenceTypeCode();
+    }
+
+    @Override
     public void registerVariable(XQueryVariable var) {
         parent.registerVariable(var);
     }
index 86038ad..72f604e 100644 (file)
@@ -28,6 +28,7 @@ import org.apache.vxquery.functions.Function;
 import org.apache.vxquery.types.AttributeType;
 import org.apache.vxquery.types.BuiltinTypeRegistry;
 import org.apache.vxquery.types.ElementType;
+import org.apache.vxquery.types.ItemType;
 import org.apache.vxquery.types.SchemaType;
 import org.apache.vxquery.types.SequenceType;
 import org.apache.vxquery.xmlquery.query.XQueryConstants;
@@ -51,17 +52,25 @@ public final class RootStaticContextImpl extends StaticContextImpl {
         INSTANCE.setDefaultFunctionNamespaceUri(XQueryConstants.FN_NSURI);
 
         // Types
-        for (Map.Entry<QName, SchemaType> type : BuiltinTypeRegistry.TYPE_MAP.entrySet()) {
-            INSTANCE.registerSchemaType(type.getKey(), type.getValue());
+        for (Map.Entry<QName, SchemaType> e : BuiltinTypeRegistry.TYPE_MAP.entrySet()) {
+            QName typeName = e.getKey();
+            SchemaType type = e.getValue();
+            INSTANCE.registerSchemaType(typeName, type);
+        }
+
+        for (Map.Entry<ItemType, SequenceType[]> e : SequenceType.BUILTIN_SEQ_TYPES.entrySet()) {
+            for (SequenceType st : e.getValue()) {
+                INSTANCE.encodeSequenceType(st);
+            }
         }
 
         // Functions
         for (Function fn : BuiltinFunctions.FUNCTION_COLLECTION) {
             INSTANCE.registerFunction(fn);
         }
-        
+
         INSTANCE.registerCollation(CodepointCollation.URI, CodepointCollation.INSTANCE);
-        
+
         INSTANCE.setDefaultCollation(CodepointCollation.URI);
 
         ((RootStaticContextImpl) INSTANCE).sealed = true;
@@ -140,6 +149,12 @@ public final class RootStaticContextImpl extends StaticContextImpl {
     }
 
     @Override
+    public int encodeSequenceType(SequenceType type) {
+        checkSealed();
+        return super.encodeSequenceType(type);
+    }
+
+    @Override
     public void setBaseUri(String baseUri) {
         checkSealed();
         super.setBaseUri(baseUri);
index 71e7837..68da944 100644 (file)
@@ -30,103 +30,109 @@ import org.apache.vxquery.types.SchemaType;
 import org.apache.vxquery.types.SequenceType;
 
 public interface StaticContext {
-    public abstract DataspaceContext getDataspaceContext();
+    public DataspaceContext getDataspaceContext();
 
-    public abstract StaticContext getParent();
+    public StaticContext getParent();
 
     public String lookupNamespaceUri(String prefix);
 
     public void registerNamespaceUri(String prefix, String uri);
 
-    public abstract Collation lookupCollation(String collationName);
+    public Collation lookupCollation(String collationName);
 
-    public abstract void registerCollation(String collationName, Collation collation);
+    public void registerCollation(String collationName, Collation collation);
 
-    public abstract Function lookupFunction(QName functionName, int arity);
+    public Function lookupFunction(QName functionName, int arity);
 
-    public abstract Function[] lookupFunctions(QName functionName);
+    public Function[] lookupFunctions(QName functionName);
 
-    public abstract void registerFunction(Function function);
+    public void registerFunction(Function function);
 
-    public abstract Iterator<Function> listFunctions();
+    public Iterator<Function> listFunctions();
 
-    public abstract SequenceType lookupDocumentType(String docUri);
+    public SequenceType lookupDocumentType(String docUri);
 
-    public abstract void registerDocumentType(String docUri, SequenceType type);
+    public void registerDocumentType(String docUri, SequenceType type);
 
-    public abstract XQueryVariable lookupVariable(QName name);
+    public XQueryVariable lookupVariable(QName name);
 
-    public abstract void registerVariable(XQueryVariable var);
+    public void registerVariable(XQueryVariable var);
 
-    public abstract Iterator<XQueryVariable> listVariables();
+    public Iterator<XQueryVariable> listVariables();
 
-    public abstract SequenceType lookupCollectionType(String collectionUri);
+    public SequenceType lookupCollectionType(String collectionUri);
 
-    public abstract void registerCollectionType(String collectionUri, SequenceType type);
+    public void registerCollectionType(String collectionUri, SequenceType type);
 
-    public abstract Iterator<Pair<String, List<String>>> listModules();
+    public Iterator<Pair<String, List<String>>> listModules();
 
-    public abstract void registerModuleImport(String uri, List<String> locations);
+    public void registerModuleImport(String uri, List<String> locations);
 
-    public abstract Iterator<Pair<String, List<String>>> listSchemas();
+    public Iterator<Pair<String, List<String>>> listSchemas();
 
-    public abstract void registerSchemaImport(String uri, List<String> locations);
+    public void registerSchemaImport(String uri, List<String> locations);
 
-    public abstract SchemaType lookupSchemaType(QName name);
+    public SchemaType lookupSchemaType(QName name);
 
-    public abstract void registerSchemaType(QName name, SchemaType type);
+    public void registerSchemaType(QName name, SchemaType type);
 
-    public abstract AttributeType lookupAttributeDeclaration(QName name);
+    public int lookupSequenceType(SequenceType type);
 
-    public abstract void registerAttributeDeclaration(QName name, AttributeType attrDecl);
+    public int encodeSequenceType(SequenceType type);
 
-    public abstract ElementType lookupElementDeclaration(QName name);
+    public int getMaxSequenceTypeCode();
 
-    public abstract void registerElementDeclaration(QName name, ElementType elemDecl);
+    public AttributeType lookupAttributeDeclaration(QName name);
 
-    public abstract BoundarySpaceProperty getBoundarySpaceProperty();
+    public void registerAttributeDeclaration(QName name, AttributeType attrDecl);
 
-    public abstract void setBoundarySpaceProperty(BoundarySpaceProperty boundarySpaceProperty);
+    public ElementType lookupElementDeclaration(QName name);
 
-    public abstract String getDefaultFunctionNamespaceUri();
+    public void registerElementDeclaration(QName name, ElementType elemDecl);
 
-    public abstract void setDefaultFunctionNamespaceUri(String uri);
+    public BoundarySpaceProperty getBoundarySpaceProperty();
 
-    public abstract String getDefaultElementNamespaceUri();
+    public void setBoundarySpaceProperty(BoundarySpaceProperty boundarySpaceProperty);
 
-    public abstract void setDefaultElementNamespaceUri(String uri);
+    public String getDefaultFunctionNamespaceUri();
 
-    public abstract OrderingModeProperty getOrderingModeProperty();
+    public void setDefaultFunctionNamespaceUri(String uri);
 
-    public abstract void setOrderingModeProperty(OrderingModeProperty orderingMode);
+    public String getDefaultElementNamespaceUri();
 
-    public abstract EmptyOrderProperty getEmptyOrderProperty();
+    public void setDefaultElementNamespaceUri(String uri);
 
-    public abstract void setEmptyOrderProperty(EmptyOrderProperty emptyOrder);
+    public OrderingModeProperty getOrderingModeProperty();
 
-    public abstract String getDefaultCollation();
+    public void setOrderingModeProperty(OrderingModeProperty orderingMode);
 
-    public abstract void setDefaultCollation(String defaultCollation);
+    public EmptyOrderProperty getEmptyOrderProperty();
 
-    public abstract String getBaseUri();
+    public void setEmptyOrderProperty(EmptyOrderProperty emptyOrder);
 
-    public abstract void setBaseUri(String baseUri);
+    public String getDefaultCollation();
 
-    public abstract ConstructionModeProperty getConstructionModeProperty();
+    public void setDefaultCollation(String defaultCollation);
 
-    public abstract void setConstructionModeProperty(ConstructionModeProperty constructionMode);
+    public String getBaseUri();
 
-    public abstract CopyNamespacesModeProperty getCopyNamespacesModeProperty();
+    public void setBaseUri(String baseUri);
 
-    public abstract void setCopyNamespacesModeProperty(CopyNamespacesModeProperty copyNamespacesMode);
+    public ConstructionModeProperty getConstructionModeProperty();
 
-    public abstract SequenceType getDefaultCollectionType();
+    public void setConstructionModeProperty(ConstructionModeProperty constructionMode);
 
-    public abstract void setDefaultCollectionType(SequenceType type);
+    public CopyNamespacesModeProperty getCopyNamespacesModeProperty();
 
-    public abstract void setOption(QName name, String value);
+    public void setCopyNamespacesModeProperty(CopyNamespacesModeProperty copyNamespacesMode);
 
-    public abstract String getOption(QName name);
+    public SequenceType getDefaultCollectionType();
+
+    public void setDefaultCollectionType(SequenceType type);
+
+    public void setOption(QName name, String value);
+
+    public String getOption(QName name);
 
     public enum BoundarySpaceProperty {
         PRESERVE,
index 6c5d595..2b46d50 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.vxquery.context;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -55,6 +56,8 @@ public class StaticContextImpl implements StaticContext {
 
     protected final Map<QName, SchemaType> schemaTypeMap;
 
+    protected final Map<SequenceType, Integer> sequenceTypeMap;
+
     protected final Map<QName, AttributeType> attributeDeclarationMap;
 
     protected final Map<QName, ElementType> elementDeclarationMap;
@@ -81,6 +84,8 @@ public class StaticContextImpl implements StaticContext {
 
     private SequenceType defaultCollectionType;
 
+    private int typeCounter;
+
     public StaticContextImpl(StaticContext parent) {
         this.parent = parent;
         namespaceMap = new LinkedHashMap<String, String>();
@@ -92,9 +97,11 @@ public class StaticContextImpl implements StaticContext {
         moduleImports = new ArrayList<Pair<String, List<String>>>();
         schemaImports = new ArrayList<Pair<String, List<String>>>();
         schemaTypeMap = new LinkedHashMap<QName, SchemaType>();
+        sequenceTypeMap = new HashMap<SequenceType, Integer>();
         attributeDeclarationMap = new LinkedHashMap<QName, AttributeType>();
         elementDeclarationMap = new LinkedHashMap<QName, ElementType>();
         options = new LinkedHashMap<QName, String>();
+        typeCounter = parent == null ? 0 : parent.getMaxSequenceTypeCode();
     }
 
     @Override
@@ -346,6 +353,39 @@ public class StaticContextImpl implements StaticContext {
     }
 
     @Override
+    public int lookupSequenceType(SequenceType type) {
+        if (sequenceTypeMap.containsKey(type)) {
+            return sequenceTypeMap.get(type);
+        }
+        if (parent != null) {
+            return parent.lookupSequenceType(type);
+        }
+        return -1;
+    }
+
+    @Override
+    public int encodeSequenceType(SequenceType type) {
+        int code = lookupSequenceType(type);
+        if (code == -1) {
+            code = typeCounter++;
+            sequenceTypeMap.put(type, code);
+            return code;
+        }
+        if (sequenceTypeMap.containsKey(type)) {
+            return sequenceTypeMap.get(type);
+        }
+        if (parent != null) {
+            return parent.lookupSequenceType(type);
+        }
+        return -1;
+    }
+
+    @Override
+    public int getMaxSequenceTypeCode() {
+        return typeCounter;
+    }
+
+    @Override
     public AttributeType lookupAttributeDeclaration(QName name) {
         if (attributeDeclarationMap.containsKey(name)) {
             return attributeDeclarationMap.get(name);
@@ -3,7 +3,7 @@ package org.apache.vxquery.datamodel.accessors.atomic;
 import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
 import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
 
-public class QNamePointable extends AbstractPointable {
+public class CodedQNamePointable extends AbstractPointable {
     public static final int SIZE = 12;
 
     private static final int OFF_PREFIX = 0;
index 5da3cfb..aafe684 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.vxquery.datamodel.accessors.nodes;
 
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.datamodel.accessors.atomic.QNamePointable;
+import org.apache.vxquery.datamodel.accessors.atomic.CodedQNamePointable;
 
 import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
 import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
@@ -17,11 +17,11 @@ import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
 public class AttributeNodePointable extends AbstractPointable {
     private static final int LOCAL_NODE_ID_SIZE = 4;
 
-    public void getName(QNamePointable name) {
+    public void getName(CodedQNamePointable name) {
         name.set(bytes, getNameOffset(), getNameSize());
     }
 
-    public void getTypeName(NodeTreePointable nodeTree, QNamePointable typeName) {
+    public void getTypeName(NodeTreePointable nodeTree, CodedQNamePointable typeName) {
         if (nodeTree.typeExists()) {
             typeName.set(bytes, getTypeOffset(), getTypeSize(nodeTree));
         } else {
@@ -42,7 +42,7 @@ public class AttributeNodePointable extends AbstractPointable {
     }
 
     private int getNameSize() {
-        return QNamePointable.SIZE;
+        return CodedQNamePointable.SIZE;
     }
 
     private int getTypeOffset() {
@@ -50,7 +50,7 @@ public class AttributeNodePointable extends AbstractPointable {
     }
 
     private int getTypeSize(NodeTreePointable nodeTree) {
-        return nodeTree.typeExists() ? QNamePointable.SIZE : 0;
+        return nodeTree.typeExists() ? CodedQNamePointable.SIZE : 0;
     }
 
     private int getLocalNodeIdOffset(NodeTreePointable nodeTree) {
index dd517d3..351461f 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.vxquery.datamodel.accessors.nodes;
 
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
-import org.apache.vxquery.datamodel.accessors.atomic.QNamePointable;
+import org.apache.vxquery.datamodel.accessors.atomic.CodedQNamePointable;
 
 import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
 import edu.uci.ics.hyracks.data.std.primitive.BytePointable;
@@ -59,11 +59,11 @@ public class ElementNodePointable extends AbstractPointable {
         return (getHeader() & CHILDREN_CHUNK_EXISTS_MASK) != 0;
     }
 
-    public void getName(QNamePointable name) {
+    public void getName(CodedQNamePointable name) {
         name.set(bytes, getNameOffset(), getNameSize());
     }
 
-    public void getTypeName(NodeTreePointable nodeTree, QNamePointable typeName) {
+    public void getTypeName(NodeTreePointable nodeTree, CodedQNamePointable typeName) {
         if (nodeTree.typeExists()) {
             typeName.set(bytes, getTypeOffset(), getTypeSize(nodeTree));
         } else {
@@ -126,7 +126,7 @@ public class ElementNodePointable extends AbstractPointable {
     }
 
     private int getNameSize() {
-        return QNamePointable.SIZE;
+        return CodedQNamePointable.SIZE;
     }
 
     private int getTypeOffset() {
@@ -134,7 +134,7 @@ public class ElementNodePointable extends AbstractPointable {
     }
 
     private int getTypeSize(NodeTreePointable nodeTree) {
-        return nodeTree.typeExists() ? QNamePointable.SIZE : 0;
+        return nodeTree.typeExists() ? CodedQNamePointable.SIZE : 0;
     }
 
     private int getLocalNodeIdOffset(NodeTreePointable nodeTree) {
index 38fb6dc..1220028 100644 (file)
@@ -20,7 +20,6 @@
     <function name="fn:abs">
         <param name="arg" type="xsext:numeric?"/>
         <return type="xsext:numeric?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnAbsIterator"/>
     </function>
     
     <!-- fn:adjust-date-to-timezone( $arg as xs:date?) as  xs:date? -->
     <function name="fn:base-uri">
         <param name="arg" type="node()?"/>
         <return type="xs:anyURI?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnBaseUriIterator"/>
     </function>
 
     <!-- fn:boolean($arg as  item()*) as xs:boolean -->
     <function name="fn:boolean">
         <param name="arg" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnBooleanIterator"/>
     </function>
 
     <!-- fn:ceiling($arg as  numeric?) as numeric? -->
     <function name="fn:ceiling">
         <param name="arg" type="xsext:numeric?"/>
         <return type="xsext:numeric?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnCeilingIterator"/>
     </function>
     
     <!-- fn:codepoint-equal($comparand1  as xs:string?, $comparand2 as xs:string?)  as xs:boolean? -->
         <param name="comparand1" type="xs:string?"/>
         <param name="comparand2" type="xs:string?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnCodepointEqualIterator"/>
     </function>
     
     <!-- fn:codepoints-to-string( $arg as xs:integer*)  as xs:string -->
     <function name="fn:codepoints-to-string">
         <param name="arg" type="xs:integer*"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnCodepointsToStringIterator"/>
     </function>
     
     <!-- fn:collection() as  node()* -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnConcatIterator"/>
     </function>
  
     <!-- fn:contains($arg1  as xs:string?, $arg2 as xs:string?)  as xs:boolean -->
         <param name="arg1" type="xs:string?"/>
         <param name="arg2" type="xs:string?"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnContainsIterator"/>
     </function>
  
     <!-- fn:contains($arg1  as xs:string?, $arg2 as xs:string?, $collation as xs:string)  as xs:boolean -->
         <param name="arg2" type="xs:string?"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnContainsIterator"/>
     </function>
 
     <!-- fn:count($arg as  item()*) as xs:integer -->
     <function name="fn:count">
         <param name="arg" type="item()*"/>
         <return type="xs:integer"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnCountIterator"/>
     </function>
 
     <!-- fn:current-date() as  xs:date -->
     <!-- fn:current-dateTime()  as xs:dateTime -->
     <function name="fn:current-dateTime">
         <return type="xs:dateTime"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnCurrentDateTimeIterator"/>
     </function>
 
     <!-- fn:current-time() as  xs:time -->
     <function name="fn:current-time">
         <return type="xs:time"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnCurrentTimeIterator"/>
     </function>
 
     <!-- fn:data($arg as  item()*) as xs:anyAtomicType* -->
     <function name="fn:data">
         <param name="arg" type="item()*"/>
         <return type="xs:anyAtomicType*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDataIterator"/>
     </function>
 
     <!-- fn:dateTime($arg1  as xs:date?, $arg2 as xs:time?)  as xs:dateTime?  -->
     <function name="fn:day-from-date">
         <param name="arg" type="xs:date?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDayFromDateIterator"/>
     </function>
 
     <!-- fn:day-from-dateTime( $arg as xs:dateTime?)  as xs:integer?  -->
     <function name="fn:day-from-dateTime">
         <param name="arg" type="xs:dateTime?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDayFromDateTimeIterator"/>
     </function>
 
     <!-- fn:days-from-duration( $arg as xs:duration?)  as xs:integer?  -->
     <function name="fn:days-from-duration">
         <param name="arg" type="xs:duration?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDaysFromDurationIterator"/>
     </function>
 
     <!-- fn:deep-equal($parameter1  as item()*, $parameter2 as item()*)  as xs:boolean -->
         <param name="parameter1" type="item()*"/>
         <param name="parameter2" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDeepEqualIterator"/>
     </function>
 
     <!-- fn:deep-equal($parameter1  as item()*, $parameter2 as item()*, $collation as xs:string) as xs:boolean -->
         <param name="parameter2" type="item()*"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDeepEqualIterator"/>
     </function>
 
     <!-- fn:default-collation()  as xs:string -->
     <function name="fn:default-collation">
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDefaultCollationIterator"/>
     </function>
 
     <!-- fn:distinct-values($arg  as xs:anyAtomicType*) as  xs:anyAtomicType* -->
     <function name="fn:doc">
         <param name="uri" type="xs:string?"/>
         <return type="document-node()?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDocIterator"/>
     </function>
 
     <!-- fn:doc-available($uri  as xs:string?) as  xs:boolean -->
     <function name="fn:document-uri">
         <param name="arg" type="node()?"/>
         <return type="xs:anyURI?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnDocumentUriIterator"/>
     </function>
 
     <!-- fn:empty($arg as  item()*) as xs:boolean -->
     <function name="fn:empty">
         <param name="arg" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnEmptyIterator"/>
     </function>
 
     <!-- fn:encode-for-uri($uri-part  as xs:string?) as  xs:string -->
     <function name="fn:encode-for-uri">
         <param name="uri-part" type="xs:string?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnEncodeForUriIterator"/>
     </function>
 
     <!-- fn:ends-with($arg1  as xs:string?, $arg2 as xs:string?)  as xs:boolean -->
         <param name="arg1" type="xs:string?"/>
         <param name="arg2" type="xs:string?"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnEndsWithIterator"/>
     </function>
 
     <!-- fn:ends-with($arg1  as xs:string?, $arg2 as xs:string?, $collation as xs:string)  as xs:boolean -->
         <param name="arg2" type="xs:string?"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnEndsWithIterator"/>
     </function>
 
     <!-- fn:error() as  none -->
     <function name="fn:exactly-one">
         <param name="arg" type="item()*"/>
         <return type="item()"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnExactlyOneIterator"/>
     </function>
 
     <!-- fn:exists($arg as  item()*) as xs:boolean -->
     <function name="fn:exists">
         <param name="arg" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnExistsIterator"/>
     </function>
 
     <!-- fn:false() as  xs:boolean -->
     <function name="fn:false">
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnFalseIterator"/>
     </function>
 
     <!-- fn:floor($arg as  numeric?) as numeric?  -->
     <function name="fn:floor">
         <param name="arg" type="xsext:numeric?"/>
         <return type="xsext:numeric?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnFloorIterator"/>
     </function>
 
     <!-- fn:hours-from-dateTime( $arg as xs:dateTime?)  as xs:integer?  -->
     <function name="fn:hours-from-dateTime">
         <param name="arg" type="xs:dateTime?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnHoursFromDateTimeIterator"/>
     </function>
 
     <!-- fn:hours-from-duration( $arg as xs:duration?)  as xs:integer?  -->
     <function name="fn:hours-from-duration">
         <param name="arg" type="xs:duration?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnHoursFromDurationIterator"/>
     </function>
 
     <!-- fn:hours-from-time($arg  as xs:time?) as  xs:integer?  -->
     <function name="fn:hours-from-time">
         <param name="arg" type="xs:time?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnHoursFromTimeIterator"/>
     </function>
 
     <!-- fn:id($arg as  xs:string*) as element()* -->
         <param name="seqParam" type="xs:anyAtomicType*"/>
         <param name="srcParam" type="xs:anyAtomicType"/>
         <return type="xs:integer*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnIndexOfIterator"/>
     </function>
 
     <!-- fn:index-of($seqParam  as xs:anyAtomicType*, $srchParam as xs:anyAtomicType, $collation as xs:string)  as xs:integer* -->
         <param name="srcParam" type="xs:anyAtomicType"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:integer*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnIndexOfIterator"/>
     </function>
 
     <!-- fn:insert-before($target  as item()*, $position as xs:integer, $inserts as item()*)  as item()* -->
         <param name="position" type="xs:integer"/>
         <param name="inserts" type="item()*"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnInsertBeforeIterator"/>
     </function>
 
     <!-- fn:iri-to-uri($iri  as xs:string?) as  xs:string -->
     <function name="fn:local-name">
         <param name="arg" type="node()?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnLocalNameIterator"/>
     </function>
 
     <!-- fn:local-name-from-QName( $arg as xs:QName?) as  xs:NCName?  -->
     <function name="fn:local-name-from-QName">
         <param name="arg" type="xs:QName?"/>
         <return type="xs:NCName?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnLocalNameFromQNameIterator"/>
     </function>
 
     <!-- fn:lower-case($arg  as xs:string?) as  xs:string -->
     <function name="fn:lower-case">
         <param name="arg" type="xs:string?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnLowerCaseIterator"/>
     </function>
 
     <!-- fn:matches($input  as xs:string?, $pattern as xs:string)  as xs:boolean -->
     <function name="fn:max">
         <param name="arg" type="xs:anyAtomicType*"/>
         <return type="xs:anyAtomicType"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMaxIterator"/>
     </function>
 
     <!-- fn:max($arg as  xs:anyAtomicType*, $collation as string)  as xs:anyAtomicType?  -->
         <param name="arg" type="xs:anyAtomicType*"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:anyAtomicType"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMaxIterator"/>
     </function>
 
     <!-- fn:min($arg as  xs:anyAtomicType*) as xs:anyAtomicType?  -->
     <function name="fn:min">
         <param name="arg" type="xs:anyAtomicType*"/>
         <return type="xs:anyAtomicType"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMinIterator"/>
     </function>
 
     <!-- fn:min($arg as  xs:anyAtomicType*, $collation as string)  as xs:anyAtomicType?  -->
         <param name="arg" type="xs:anyAtomicType*"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:anyAtomicType"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMaxIterator"/>
     </function>
 
     <!-- fn:minutes-from-dateTime( $arg as xs:dateTime?)  as xs:integer?  -->
     <function name="fn:minutes-from-dateTime">
         <param name="arg" type="xs:dateTime?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMinutesFromDateTimeIterator"/>
     </function>
 
     <!-- fn:minutes-from-duration( $arg as xs:duration?)  as xs:integer?  -->
     <function name="fn:minutes-from-duration">
         <param name="arg" type="xs:duration?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMinutesFromDurationIterator"/>
     </function>
 
     <!-- fn:minutes-from-time( $arg as xs:time?) as  xs:integer?  -->
     <function name="fn:minutes-from-time">
         <param name="arg" type="xs:time?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMinutesFromTimeIterator"/>
     </function>
 
     <!-- fn:month-from-date($arg  as xs:date?) as  xs:integer?  -->
     <function name="fn:month-from-date">
         <param name="arg" type="xs:date?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMonthFromDateIterator"/>
     </function>
 
     <!-- fn:month-from-dateTime( $arg as xs:dateTime?)  as xs:integer?  -->
     <function name="fn:month-from-dateTime">
         <param name="arg" type="xs:dateTime?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMonthFromDateTimeIterator"/>
     </function>
 
     <!-- fn:months-from-duration( $arg as xs:duration?)  as xs:integer?  -->
     <function name="fn:months-from-duration">
         <param name="arg" type="xs:duration?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnMonthsFromDurationIterator"/>
     </function>
 
     <!-- fn:name() as  xs:string -->
     <function name="fn:name">
         <param name="arg" type="node()?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnNameIterator"/>
     </function>
 
     <!-- fn:namespace-uri() as  xs:anyURI -->
     <function name="fn:namespace-uri">
         <param name="arg" type="node()?"/>
         <return type="xs:anyURI"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnNamespaceUriIterator"/>
     </function>
 
     <!-- fn:namespace-uri-for-prefix( $prefix as xs:string?, $element as element())  as xs:anyURI?  -->
     <function name="fn:namespace-uri-from-QName">
         <param name="arg" type="xs:QName?"/>
         <return type="xs:anyURI?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnNamespaceUriFromQNameIterator"/>
     </function>
 
     <!-- fn:nilled($arg as  node()?) as xs:boolean?  -->
     <function name="fn:nilled">
         <param name="arg" type="node()?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnNilledIterator"/>
     </function>
 
     <!-- fn:node-name($arg  as node()?) as  xs:QName?  -->
     <function name="fn:node-name">
         <param name="arg" type="node()?"/>
         <return type="xs:QName?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnNodeNameIterator"/>
     </function>
 
     <!-- fn:normalize-space() as  xs:string -->
     <function name="fn:normalize-space">
         <param name="arg" type="xs:string?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnNormalizeSpaceIterator"/>
     </function>
 
     <!-- fn:normalize-unicode( $arg as xs:string?)  as xs:string -->
     <function name="fn:not">
         <param name="arg" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnNotIterator"/>
     </function>
 
     <!-- fn:number() as  xs:double -->
     <function name="fn:number">
         <param name="arg" type="xs:anyAtomicType?"/>
         <return type="xs:double"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnNumberIterator"/>
     </function>
 
     <!-- fn:one-or-more($arg  as item()*) as  item()+ -->
     <function name="fn:one-or-more">
         <param name="arg" type="item()*"/>
         <return type="item()+"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnOneOrMoreIterator"/>
     </function>
 
     <!-- fn:position() as  xs:integer -->
     <function name="fn:prefix-from-QName">
         <param name="arg" type="xs:QName?"/>
         <return type="xs:NCName?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnPrefixFromQNameIterator"/>
     </function>
 
     <!-- fn:QName($paramURI  as xs:string?, $paramQName as xs:string)  as xs:QName -->
         <param name="target" type="item()*"/>
         <param name="position" type="xs:integer"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnRemoveIterator"/>
     </function>
 
     <!-- fn:replace($input  as xs:string?, $pattern as xs:string, $replacement as xs:string)  as xs:string -->
     <function name="fn:reverse">
         <param name="arg" type="item()*"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnReverseIterator"/>
     </function>
 
     <!-- fn:root() as  node() -->
     <function name="fn:round">
         <param name="arg" type="xsext:numeric?"/>
         <return type="xsext:numeric?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnRoundIterator"/>
     </function>
 
     <!-- fn:round-half-to-even( $arg as numeric?) as  numeric?  -->
     <function name="fn:round-half-to-even">
         <param name="arg" type="xsext:numeric?"/>
         <return type="xsext:numeric?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnRoundHalfToEvenIterator"/>
     </function>
 
     <!-- fn:round-half-to-even( $arg as numeric?, $precision as xs:integer)  as numeric?  -->
         <param name="arg" type="xsext:numeric?"/>
         <param name="precision" type="xs:integer"/>
         <return type="xsext:numeric?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnRoundHalfToEvenIteratorWithPrecision"/>
     </function>
 
     <!-- fn:seconds-from-dateTime( $arg as xs:dateTime?)  as xs:decimal?  -->
     <function name="fn:seconds-from-dateTime">
         <param name="arg" type="xs:dateTime?"/>
         <return type="xs:decimal?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSecondsFromDateTimeIterator"/>
     </function>
 
     <!-- fn:seconds-from-duration( $arg as xs:duration?)  as xs:decimal?  -->
     <function name="fn:seconds-from-duration">
         <param name="arg" type="xs:duration?"/>
         <return type="xs:decimal?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSecondsFromDurationIterator"/>
     </function>
 
     <!-- fn:seconds-from-time( $arg as xs:time?) as  xs:decimal?  -->
     <function name="fn:seconds-from-time">
         <param name="arg" type="xs:time?"/>
         <return type="xs:decimal?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSecondsFromTimeIterator"/>
     </function>
 
     <!-- fn:starts-with($arg1  as xs:string?, $arg2 as xs:string?)  as xs:boolean -->
         <param name="arg1" type="xs:string?"/>
         <param name="arg2" type="xs:string?"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnStartsWithIterator"/>
     </function>
 
     <!-- fn:starts-with($arg1  as xs:string?, $arg2 as xs:string?, $collation as xs:string)  as xs:boolean -->
         <param name="arg2" type="xs:string?"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnStartsWithIterator"/>
     </function>
 
     <!-- fn:static-base-uri() as  xs:anyURI?  -->
     <function name="fn:static-base-uri">
         <return type="xs:anyURI?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnStaticBaseUriIterator"/>
     </function>
 
     <!-- fn:string() as  xs:string -->
     <function name="fn:string">
         <param name="arg" type="item()?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnStringIterator"/>
     </function>
 
     <!-- fn:string-join($arg1  as xs:string*, $arg2 as xs:string)  as xs:string -->
         <param name="arg1" type="xs:string*"/>
         <param name="arg2" type="xs:string"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnStringJoinIterator"/>
     </function>
 
     <!-- fn:string-length() as  xs:integer -->
     <function name="fn:string-length">
         <param name="arg" type="xs:string?"/>
         <return type="xs:integer"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnStringLengthIterator"/>
     </function>
 
     <!-- fn:string-to-codepoints( $arg as xs:string?)  as xs:integer* -->
     <function name="fn:string-to-codepoints">
         <param name="arg" type="xs:string?"/>
         <return type="xs:integer*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnStringToCodepointsIterator"/>
     </function>
 
     <!-- fn:subsequence($sourceSeq  as item()*, $startingLoc as xs:double)  as item()* -->
         <param name="sourceSeq" type="item()*"/>
         <param name="startingLoc" type="xs:double"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSubsequenceIterator"/>
     </function>
 
     <!-- fn:subsequence($sourceSeq  as item()*, $startingLoc as xs:double, $length as xs:double)  as item()* -->
         <param name="startingLoc" type="xs:double"/>
         <param name="length" type="xs:double"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSubsequenceIterator"/>
     </function>
 
     <!-- fn:substring($sourceString  as xs:string?, $startingLoc as xs:double)  as xs:string -->
         <param name="sourceSeq" type="xs:string?"/>
         <param name="startingLoc" type="xs:double"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSubstringIterator"/>
     </function>
 
     <!-- fn:substring($sourceString  as xs:string?, $startingLoc as xs:double, $length as xs:double)  as xs:string -->
         <param name="startingLoc" type="xs:double"/>
         <param name="length" type="xs:double"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSubstringIterator"/>
     </function>
 
     <!-- fn:substring-after($arg1  as xs:string?, $arg2 as xs:string?)  as xs:string -->
         <param name="arg1" type="xs:string?"/>
         <param name="arg2" type="xs:string?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSubstringAfterIterator"/>
     </function>
 
     <!-- fn:substring-after($arg1  as xs:string?, $arg2 as xs:string?, $collation as xs:string)  as xs:string -->
         <param name="arg2" type="xs:string?"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSubstringAfterIterator"/>
     </function>
 
     <!-- fn:substring-before( $arg1 as xs:string?, $arg2 as xs:string?)  as xs:string -->
         <param name="arg1" type="xs:string?"/>
         <param name="arg2" type="xs:string?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSubstringBeforeIterator"/>
     </function>
 
     <!-- fn:substring-before( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string)  as xs:string -->
         <param name="arg2" type="xs:string?"/>
         <param name="collation" type="xs:string"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnSubstringBeforeIterator"/>
     </function>
 
     <!-- fn:sum($arg as  xs:anyAtomicType*) as xs:anyAtomicType -->
     <function name="fn:timezone-from-date">
         <param name="arg" type="xs:date?"/>
         <return type="xs:dayTimeDuration?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnTimezoneFromDateIterator"/>
     </function>
 
     <!-- fn:timezone-from-dateTime( $arg as xs:dateTime?)  as xs:dayTimeDuration?  -->
     <function name="fn:timezone-from-dateTime">
         <param name="arg" type="xs:dateTime?"/>
         <return type="xs:dayTimeDuration?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnTimezoneFromDateTimeIterator"/>
     </function>
 
     <!-- fn:timezone-from-time( $arg as xs:time?) as  xs:dayTimeDuration?  -->
     <function name="fn:timezone-from-time">
         <param name="arg" type="xs:time?"/>
         <return type="xs:dayTimeDuration?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnTimezoneFromTimeIterator"/>
     </function>
 
     <!-- fn:tokenize($input  as xs:string?, $pattern as xs:string)  as xs:string* -->
         <param name="value" type="item()*"/>
         <param name="label" type="xs:string"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnTraceIterator"/>
     </function>
 
     <!-- fn:translate($arg  as xs:string?, $mapString as xs:string, $transString as xs:string)  as xs:string -->
         <param name="mapString" type="xs:string"/>
         <param name="transString" type="xs:string"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnTranslateIterator"/>
     </function>
 
     <!-- fn:true() as  xs:boolean -->
     <function name="fn:true">
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnTrueIterator"/>
     </function>
 
     <!-- fn:unordered($sourceSeq  as item()*) as  item()* -->
     <function name="fn:upper-case">
         <param name="arg" type="xs:string?"/>
         <return type="xs:string"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnUpperCaseIterator"/>
     </function>
 
     <!-- fn:year-from-date($arg  as xs:date?) as  xs:integer?  -->
     <function name="fn:year-from-date">
         <param name="arg" type="xs:date?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnYearFromDateIterator"/>
     </function>
 
     <!-- fn:year-from-dateTime( $arg as xs:dateTime?)  as xs:integer?  -->
     <function name="fn:year-from-dateTime">
         <param name="arg" type="xs:dateTime?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnYearFromDateTimeIterator"/>
     </function>
 
     <!-- fn:years-from-duration( $arg as xs:duration?)  as xs:integer?  -->
     <function name="fn:years-from-duration">
         <param name="arg" type="xs:duration?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnYearsFromDurationIterator"/>
     </function>
 
     <!-- fn:zero-or-one($arg  as item()*) as  item()?  -->
     <function name="fn:zero-or-one">
         <param name="arg" type="item()*"/>
         <return type="item()?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.FnZeroOrOneIterator"/>
     </function>
 </functions>
index e03ff62..1638119 100644 (file)
@@ -97,7 +97,6 @@
     <operator name="op:concatenate" varargs="true">
         <param name="arg" type="item()*"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.ConcatenateIterator"/>
     </operator>
 
     <!-- op:date-equal($arg1  as xs:date, $arg2 as xs:date)  as xs:boolean -->
         <param name="parameter2" type="node()*"/>
         <return type="node()*"/>
         <!-- implementation assumes input in document order -->
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpExceptIterator"/>
     </operator>
 
     <!-- op:gDay-equal($arg1  as xs:gDay, $arg2 as xs:gDay)  as xs:boolean -->
         <param name="parameter2" type="node()*"/>
         <return type="node()*"/>
         <!-- implementation assumes input in document order -->
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpIntersectIterator"/>
     </operator>
 
     <!-- op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean -->
         <param name="parameter1" type="node()?"/>
         <param name="parameter2" type="node()?"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpIsSameNodeIterator"/>
     </operator>
 
     <!-- op:multiply-dayTimeDuration( $arg1 as xs:dayTimeDuration, $arg2 as xs:double)  as xs:dayTimeDuration -->
         <param name="parameter1" type="node()?"/>
         <param name="parameter2" type="node()?"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpNodeAfterIterator"/>
     </operator>
 
     <!-- op:node-before($parameter1  as node(), $parameter2 as node())  as xs:boolean -->
         <param name="parameter1" type="node()?"/>
         <param name="parameter2" type="node()?"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpNodeBeforeIterator"/>
     </operator>
 
     <!-- op:NOTATION-equal($arg1  as xs:NOTATION, $arg2 as xs:NOTATION)  as xs:boolean -->
         <param name="arg1" type="xsext:numeric"/>
         <param name="arg2" type="xsext:numeric"/>
         <return type="xs:integer"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.IntegerDivideArithmeticOperationIterator"/>
     </operator>
 
     <!-- op:numeric-less-than( $arg1 as numeric, $arg2 as numeric)  as xs:boolean -->
     <operator name="op:numeric-unary-minus">
         <param name="arg1" type="xsext:numeric"/>
         <return type="xsext:numeric"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.NumericUnaryMinusIterator"/>
     </operator>
 
     <!-- op:numeric-unary-plus( $arg as numeric) as  numeric -->
         <param name="firstval" type="xs:integer"/>
         <param name="lastval" type="xs:integer"/>
         <return type="xs:integer*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpToIterator"/>
     </operator>
 
     <!-- op:union($parameter1  as node()*, $parameter2 as node()*)  as node()* -->
         <return type="node()*"/>
         <!-- as we do the doc-order-sort and the duplicate elimination -->
         <!-- after the concatenation, we can reuse the concat iterator -->
-        <runtime class="org.apache.vxquery.v0runtime.functions.ConcatenateIterator"/>
     </operator>
 
     <!-- op:yearMonthDuration-greater-than( $arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration)  as xs:boolean -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.ValueEqComparisonIterator"/>
     </operator>
 
     <!-- opext:value-ne($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.ValueNeComparisonIterator"/>
     </operator>
 
     <!-- opext:value-lt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.ValueLtComparisonIterator"/>
     </operator>
 
     <!-- opext:value-le($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.ValueLeComparisonIterator"/>
     </operator>
 
     <!-- opext:value-gt($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.ValueGtComparisonIterator"/>
     </operator>
 
     <!-- opext:value-ge($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:boolean? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.ValueGeComparisonIterator"/>
     </operator>
 
     <!-- opext:general-eq($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
         <param name="arg1" type="item()*"/>
         <param name="arg2" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.GeneralEqComparisonIterator"/>
     </operator>
 
     <!-- opext:general-ne($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
         <param name="arg1" type="item()*"/>
         <param name="arg2" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.GeneralNeComparisonIterator"/>
     </operator>
 
     <!-- opext:general-lt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
         <param name="arg1" type="item()*"/>
         <param name="arg2" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.GeneralLtComparisonIterator"/>
     </operator>
 
     <!-- opext:general-le($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
         <param name="arg1" type="item()*"/>
         <param name="arg2" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.GeneralLeComparisonIterator"/>
     </operator>
 
     <!-- opext:general-gt($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
         <param name="arg1" type="item()*"/>
         <param name="arg2" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.GeneralGtComparisonIterator"/>
     </operator>
 
     <!-- opext:general-ge($arg1 as item()*, $arg2 as item()*) as xs:boolean -->
         <param name="arg1" type="item()*"/>
         <param name="arg2" type="item()*"/>
         <return type="xs:boolean"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.GeneralGeComparisonIterator"/>
     </operator>
 
     <!-- opext:add($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:anyAtomicType?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.AddArithmeticOperationIterator"/>
     </operator>
 
     <!-- opext:subtract($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:anyAtomicType?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.SubtractArithmeticOperationIterator"/>
     </operator>
 
     <!-- opext:multiply($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:anyAtomicType?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.MultiplyArithmeticOperationIterator"/>
     </operator>
 
     <!-- opext:divide($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
         <param name="arg1" type="xs:anyAtomicType?"/>
         <param name="arg2" type="xs:anyAtomicType?"/>
         <return type="xs:anyAtomicType?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.DivideArithmeticOperationIterator"/>
     </operator>
 
     <!-- opext:idiv($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
         <param name="arg1" type="xsext:numeric?"/>
         <param name="arg2" type="xsext:numeric?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.IntegerDivideArithmeticOperationIterator"/>
     </operator>
 
     <!-- opext:mod($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:anyAtomicType? -->
         <param name="arg1" type="xsext:numeric?"/>
         <param name="arg2" type="xsext:numeric?"/>
         <return type="xs:integer?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.ModArithmeticOperationIterator"/>
     </operator>
 
     <!-- opext:and($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
         <param name="arg1" type="xs:boolean?"/>
         <param name="arg2" type="xs:boolean?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.BooleanAndIterator"/>
     </operator>
 
     <!-- opext:or($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean? -->
         <param name="arg1" type="xs:boolean?"/>
         <param name="arg2" type="xs:boolean?"/>
         <return type="xs:boolean?"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.BooleanOrIterator"/>
     </operator>
 
     <!-- opext:sort-nodes-asc($arg as node()*) as node()* -->
     <operator name="opext:sort-nodes-asc">
         <param name="arg" type="node()*"/>
         <return type="node()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpExtSortNodesAscIterator"/>
     </operator>
 
     <!-- opext:sort-nodes-asc($arg as node()*) as node()* -->
     <operator name="opext:sort-distinct-nodes-asc">
         <param name="arg" type="node()*"/>
         <return type="node()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpExtSortAndDistinctNodesAscIterator"/>
     </operator>
 
     <!-- opext:sort-nodes-asc-or-atomics($arg as item()*) as item()* -->
     <operator name="opext:sort-distinct-nodes-asc-or-atomics">
         <param name="arg" type="item()*"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpExtSortAndDistinctNodesAscOrAtomicsIterator"/>
     </operator>
 
     <!-- opext:sort-nodes-desc($arg as node()*) as node()* -->
     <operator name="opext:sort-nodes-desc">
         <param name="arg" type="node()*"/>
         <return type="node()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpExtSortNodesDescIterator"/>
     </operator>
 
     <!-- opext:sort-nodes-desc($arg as node()*) as node()* -->
     <operator name="opext:sort-distinct-nodes-desc">
         <param name="arg" type="node()*"/>
         <return type="node()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpExtSortAndDistinctNodesDescIterator"/>
     </operator>
 
     <!-- opext:sort-nodes-desc-or-atomics($arg as item()*) as item()* -->
     <operator name="opext:sort-distinct-nodes-desc-or-atomics">
         <param name="arg" type="item()*"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpExtSortAndDistinctNodesDescOrAtomicsIterator"/>
     </operator>
 
     <!-- opext:deflate-sequences($arg as item()*) as item()* -->
     <operator name="opext:deflate-sequences">
         <param name="arg" type="item()*"/>
         <return type="item()*"/>
-        <runtime class="org.apache.vxquery.v0runtime.functions.OpExtDeflateSequencesIterator"/>
     </operator>
 
     <!-- opext:pi-constructor($target as xs:sring, $content as xs:string) as node() -->
     <!-- opext:promote($arg as item()*, $type as xsext:type) as item()* -->
     <operator name="opext:promote">
         <param name="arg" type="item()*"/>
-        <param name="type" type="xsext:type"/>
+        <param name="type" type="xs:int"/>
         <return type="item()*"/>
     </operator>
 
     <!-- opext:treat($arg as item()*, $type as xsext:type) as item()* -->
     <operator name="opext:treat">
         <param name="arg" type="item()*"/>
-        <param name="type" type="xsext:type"/>
+        <param name="type" type="xs:int"/>
         <return type="item()*"/>
     </operator>
 
     <!-- opext:cast($arg as item()*, $type as xsext:type) as item()* -->
     <operator name="opext:cast">
         <param name="arg" type="item()*"/>
-        <param name="type" type="xsext:type"/>
+        <param name="type" type="xs:int"/>
         <return type="item()*"/>
     </operator>
 
     <!-- opext:castable($arg as item()*, $type as xsext:type) as xs:boolean -->
     <operator name="opext:castable">
         <param name="arg" type="item()*"/>
-        <param name="type" type="xsext:type"/>
+        <param name="type" type="xs:int"/>
         <return type="xs:boolean"/>
     </operator>
 
     <!-- opext:instance-of($arg as item()*, $type as xsext:type) as xs:boolean -->
     <operator name="opext:instance-of">
         <param name="arg" type="item()*"/>
-        <param name="type" type="xsext:type"/>
+        <param name="type" type="xs:int"/>
         <return type="xs:boolean"/>
     </operator>
 </operators>
index 8d24ee2..ce7de21 100644 (file)
@@ -26,4 +26,14 @@ public final class AnyItemType implements ItemType {
     public boolean isAtomicType() {
         return false;
     }
+
+    @Override
+    public int hashCode() {
+        return AnyItemType.class.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof AnyItemType;
+    }
 }
\ No newline at end of file
index ff0d320..a40e703 100644 (file)
@@ -26,4 +26,14 @@ public final class AnyNodeType extends AbstractNodeType {
     public NodeKind getNodeKind() {
         return NodeKind.ANY;
     }
+
+    @Override
+    public int hashCode() {
+        return AnyNodeType.class.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof AnyNodeType;
+    }
 }
\ No newline at end of file
index 0ef6a1b..7781656 100644 (file)
@@ -51,4 +51,14 @@ public final class AnySimpleType implements SimpleType {
     public boolean isSimpleType() {
         return true;
     }
+
+    @Override
+    public int hashCode() {
+        return AnySimpleType.class.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof AnySimpleType;
+    }
 }
\ No newline at end of file
index 7a1fab9..b8911fa 100644 (file)
@@ -51,4 +51,14 @@ public final class AnyType implements ComplexType {
     public boolean isSimpleType() {
         return false;
     }
+
+    @Override
+    public int hashCode() {
+        return AnyType.class.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof AnyType;
+    }
 }
\ No newline at end of file
index 980c493..69f5e28 100644 (file)
@@ -40,4 +40,35 @@ public final class AttributeType extends AbstractNodeType {
     public SchemaType getContentType() {
         return contentType;
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((contentType == null) ? 0 : contentType.hashCode());
+        result = prime * result + ((nameTest == null) ? 0 : nameTest.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        AttributeType other = (AttributeType) obj;
+        if (contentType == null) {
+            if (other.contentType != null)
+                return false;
+        } else if (!contentType.equals(other.contentType))
+            return false;
+        if (nameTest == null) {
+            if (other.nameTest != null)
+                return false;
+        } else if (!nameTest.equals(other.nameTest))
+            return false;
+        return true;
+    }
 }
\ No newline at end of file
index 8ec4a74..9ca75e7 100644 (file)
@@ -61,4 +61,23 @@ final class BuiltinAtomicType implements AtomicType {
     public String toString() {
         return String.valueOf(BuiltinTypeRegistry.INSTANCE.getTypeName(id));
     }
+
+    @Override
+    public int hashCode() {
+        return id;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        BuiltinAtomicType other = (BuiltinAtomicType) obj;
+        if (id != other.id)
+            return false;
+        return true;
+    }
 }
\ No newline at end of file
index 88cd1d2..3e78819 100644 (file)
@@ -72,7 +72,5 @@ public class BuiltinTypeConstants {
     public static final int XS_NMTOKENS_TYPE_ID = 50;
     public static final int XS_ENTITIES_TYPE_ID = 51;
 
-    public static final int XSEXT_TYPE_TYPE_ID = 52;
-
-    public static final int BUILTIN_TYPE_COUNT = 53;
+    public static final int BUILTIN_TYPE_COUNT = 52;
 }
\ No newline at end of file
index 2603eae..ccecae0 100644 (file)
@@ -17,7 +17,7 @@
 package org.apache.vxquery.types;
 
 import java.util.Collections;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
@@ -161,9 +161,6 @@ public final class BuiltinTypeRegistry {
     public static final BuiltinAtomicType XS_NOTATION = new BuiltinAtomicType(BuiltinTypeConstants.XS_NOTATION_TYPE_ID,
             XS_ANY_ATOMIC, DerivationProcess.RESTRICTION);
 
-    public static final BuiltinAtomicType XSEXT_TYPE = new BuiltinAtomicType(BuiltinTypeConstants.XSEXT_TYPE_TYPE_ID,
-            XS_ANY_ATOMIC, DerivationProcess.RESTRICTION);
-
     public static final BuiltinTypeRegistry INSTANCE = new BuiltinTypeRegistry();
 
     private final SchemaType[] types;
@@ -219,7 +216,6 @@ public final class BuiltinTypeRegistry {
         types[BuiltinTypeConstants.XS_ANY_URI_TYPE_ID] = XS_ANY_URI;
         types[BuiltinTypeConstants.XS_QNAME_TYPE_ID] = XS_QNAME;
         types[BuiltinTypeConstants.XS_NOTATION_TYPE_ID] = XS_NOTATION;
-        types[BuiltinTypeConstants.XSEXT_TYPE_TYPE_ID] = XSEXT_TYPE;
 
         typeNames = new QName[BuiltinTypeConstants.BUILTIN_TYPE_COUNT];
         typeNames[BuiltinTypeConstants.XS_ANY_SIMPLE_TYPE_ID] = BuiltinTypeQNames.XS_ANY_SIMPLE_TYPE_QNAME;
@@ -269,7 +265,6 @@ public final class BuiltinTypeRegistry {
         typeNames[BuiltinTypeConstants.XS_ANY_URI_TYPE_ID] = BuiltinTypeQNames.XS_ANY_URI_TYPE_QNAME;
         typeNames[BuiltinTypeConstants.XS_QNAME_TYPE_ID] = BuiltinTypeQNames.XS_QNAME_TYPE_QNAME;
         typeNames[BuiltinTypeConstants.XS_NOTATION_TYPE_ID] = BuiltinTypeQNames.XS_NOTATION_TYPE_QNAME;
-        typeNames[BuiltinTypeConstants.XSEXT_TYPE_TYPE_ID] = BuiltinTypeQNames.XSEXT_TYPE_TYPE_QNAME;
     }
 
     public SchemaType getSchemaTypeById(int id) {
@@ -294,7 +289,7 @@ public final class BuiltinTypeRegistry {
     public static final Map<QName, SchemaType> TYPE_MAP;
 
     static {
-        Map<QName, SchemaType> typeMap = new HashMap<QName, SchemaType>();
+        Map<QName, SchemaType> typeMap = new LinkedHashMap<QName, SchemaType>();
         typeMap.put(BuiltinTypeQNames.XS_ANY_SIMPLE_TYPE_QNAME, AnySimpleType.INSTANCE);
         typeMap.put(BuiltinTypeQNames.XS_ANY_ATOMIC_TYPE_QNAME, XS_ANY_ATOMIC);
         typeMap.put(BuiltinTypeQNames.XS_STRING_TYPE_QNAME, XS_STRING);
@@ -342,7 +337,6 @@ public final class BuiltinTypeRegistry {
         typeMap.put(BuiltinTypeQNames.XS_ANY_URI_TYPE_QNAME, XS_ANY_URI);
         typeMap.put(BuiltinTypeQNames.XS_QNAME_TYPE_QNAME, XS_QNAME);
         typeMap.put(BuiltinTypeQNames.XS_NOTATION_TYPE_QNAME, XS_NOTATION);
-        typeMap.put(BuiltinTypeQNames.XSEXT_TYPE_TYPE_QNAME, XSEXT_TYPE);
         TYPE_MAP = Collections.unmodifiableMap(typeMap);
     }
 }
\ No newline at end of file
index 9dd8844..8300e0a 100644 (file)
@@ -26,4 +26,14 @@ public final class CommentType extends AbstractNodeType {
     public NodeKind getNodeKind() {
         return NodeKind.COMMENT;
     }
+
+    @Override
+    public int hashCode() {
+        return CommentType.class.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof CommentType;
+    }
 }
\ No newline at end of file
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/types/ComposedType.java b/vxquery-core/src/main/java/org/apache/vxquery/types/ComposedType.java
deleted file mode 100644 (file)
index c4b5b75..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.vxquery.types;
-
-import java.util.List;
-
-public class ComposedType implements XQType {
-    private List<XQType> contentTypes;
-    private Composer composer;
-
-    public ComposedType(List<XQType> contentTypes, Composer composer) {
-        this.contentTypes = contentTypes;
-        this.composer = composer;
-    }
-
-    public List<XQType> getContentTypes() {
-        return contentTypes;
-    }
-
-    public Composer getComposer() {
-        return composer;
-    }
-}
\ No newline at end of file
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/types/Composer.java b/vxquery-core/src/main/java/org/apache/vxquery/types/Composer.java
deleted file mode 100644 (file)
index 44a7f2a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.apache.vxquery.types;
-
-public enum Composer {
-    SEQUENCE, UNION, SHUFFLE
-}
index 2a18240..f06fb71 100644 (file)
@@ -33,4 +33,29 @@ public final class DocumentType extends AbstractNodeType {
     public ElementType getElementType() {
         return elementType;
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((elementType == null) ? 0 : elementType.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        DocumentType other = (DocumentType) obj;
+        if (elementType == null) {
+            if (other.elementType != null)
+                return false;
+        } else if (!elementType.equals(other.elementType))
+            return false;
+        return true;
+    }
 }
\ No newline at end of file
index bd3b3e3..343f18b 100644 (file)
@@ -47,6 +47,40 @@ public final class ElementType extends AbstractNodeType {
     }
 
     @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((contentType == null) ? 0 : contentType.hashCode());
+        result = prime * result + ((nameTest == null) ? 0 : nameTest.hashCode());
+        result = prime * result + (nilled ? 1231 : 1237);
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ElementType other = (ElementType) obj;
+        if (contentType == null) {
+            if (other.contentType != null)
+                return false;
+        } else if (!contentType.equals(other.contentType))
+            return false;
+        if (nameTest == null) {
+            if (other.nameTest != null)
+                return false;
+        } else if (!nameTest.equals(other.nameTest))
+            return false;
+        if (nilled != other.nilled)
+            return false;
+        return true;
+    }
+
+    @Override
     public String toString() {
         return "NodeTest(" + nameTest + ", " + contentType + ", nilled = " + nilled + ")";
     }
index 1e5db3e..6eca7c4 100644 (file)
@@ -26,4 +26,14 @@ public final class EmptySequenceType implements ItemType {
     public boolean isAtomicType() {
         return false;
     }
+
+    @Override
+    public int hashCode() {
+        return EmptySequenceType.class.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof EmptySequenceType;
+    }
 }
\ No newline at end of file
index 80014a5..96e487a 100644 (file)
@@ -50,4 +50,35 @@ public final class NameTest {
     public String toString() {
         return "NameTest(" + asQName() + ")";
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((localName == null) ? 0 : localName.hashCode());
+        result = prime * result + ((uri == null) ? 0 : uri.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        NameTest other = (NameTest) obj;
+        if (localName == null) {
+            if (other.localName != null)
+                return false;
+        } else if (!localName.equals(other.localName))
+            return false;
+        if (uri == null) {
+            if (other.uri != null)
+                return false;
+        } else if (!uri.equals(other.uri))
+            return false;
+        return true;
+    }
 }
\ No newline at end of file
index 420c2c9..2eeb1d4 100644 (file)
@@ -16,7 +16,7 @@
  */
 package org.apache.vxquery.types;
 
-public class NoneType implements ItemType {
+public final class NoneType implements ItemType {
     public static final NoneType INSTANCE = new NoneType();
 
     private NoneType() {
@@ -26,4 +26,14 @@ public class NoneType implements ItemType {
     public boolean isAtomicType() {
         return false;
     }
+
+    @Override
+    public int hashCode() {
+        return NoneType.class.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof NoneType;
+    }
 }
\ No newline at end of file
index 2a2c311..6a86d97 100644 (file)
@@ -33,4 +33,29 @@ public final class ProcessingInstructionType extends AbstractNodeType {
     public String getTarget() {
         return target;
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((target == null) ? 0 : target.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ProcessingInstructionType other = (ProcessingInstructionType) obj;
+        if (target == null) {
+            if (other.target != null)
+                return false;
+        } else if (!target.equals(other.target))
+            return false;
+        return true;
+    }
 }
\ No newline at end of file
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/types/QuantifiedType.java b/vxquery-core/src/main/java/org/apache/vxquery/types/QuantifiedType.java
deleted file mode 100644 (file)
index a2d9996..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.vxquery.types;
-
-public class QuantifiedType implements XQType {
-    private XQType contentType;
-    private Quantifier quantifier;
-
-    public QuantifiedType(XQType contentType, Quantifier quantifier) {
-        this.contentType = contentType;
-        this.quantifier = quantifier;
-    }
-
-    public XQType getContentType() {
-        return contentType;
-    }
-
-    public Quantifier getQuantifier() {
-        return quantifier;
-    }
-
-    @Override
-    public String toString() {
-        return "QuantifiedType[" + contentType + ":" + quantifier + "]";
-    }
-}
\ No newline at end of file
index e4a4b61..1bb3571 100644 (file)
 package org.apache.vxquery.types;
 
 import java.util.Collections;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 public final class SequenceType {
-    private static final Map<ItemType, SequenceType[]> BUILTIN_SEQ_TYPES;
+    public static final Map<ItemType, SequenceType[]> BUILTIN_SEQ_TYPES;
 
     private ItemType itemType;
     private Quantifier quantifier;
 
     static {
-        Map<ItemType, SequenceType[]> types = new HashMap<ItemType, SequenceType[]>();
+        Map<ItemType, SequenceType[]> types = new LinkedHashMap<ItemType, SequenceType[]>();
 
         createBuiltinEntry(types, BuiltinTypeRegistry.XS_ANY_ATOMIC);
         createBuiltinEntry(types, BuiltinTypeRegistry.XS_STRING);
@@ -116,8 +116,32 @@ public final class SequenceType {
         return quantifier;
     }
 
-    public XQType toXQType() {
-        return TypeOperations.quantified(itemType, quantifier);
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((itemType == null) ? 0 : itemType.hashCode());
+        result = prime * result + ((quantifier == null) ? 0 : quantifier.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        SequenceType other = (SequenceType) obj;
+        if (itemType == null) {
+            if (other.itemType != null)
+                return false;
+        } else if (!itemType.equals(other.itemType))
+            return false;
+        if (quantifier != other.quantifier)
+            return false;
+        return true;
     }
 
     public String toString() {
index 391844c..1e55bda 100644 (file)
@@ -26,4 +26,14 @@ public final class TextType extends AbstractNodeType {
     public NodeKind getNodeKind() {
         return NodeKind.TEXT;
     }
+
+    @Override
+    public int hashCode() {
+        return TextType.class.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return other instanceof TextType;
+    }
 }
\ No newline at end of file
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/types/TypeOperations.java b/vxquery-core/src/main/java/org/apache/vxquery/types/TypeOperations.java
deleted file mode 100644 (file)
index 702c6ab..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.vxquery.types;
-
-import java.util.Arrays;
-
-public class TypeOperations {
-    public static Quantifier quantifier(XQType type) {
-        if (type instanceof QuantifiedType) {
-            return ((QuantifiedType) type).getQuantifier();
-        } else if (type instanceof ItemType) {
-            return Quantifier.QUANT_ONE;
-        }
-        return Quantifier.QUANT_STAR;
-    }
-
-    public static XQType primeType(XQType type) {
-        if (type instanceof QuantifiedType) {
-            return ((QuantifiedType) type).getContentType();
-        } else if (type instanceof ItemType) {
-            return type;
-        }
-        return AnyItemType.INSTANCE;
-    }
-
-    public static XQType quantified(XQType t, Quantifier q) {
-        return Quantifier.QUANT_ONE.equals(q) ? t : new QuantifiedType(t, q);
-    }
-
-    public static XQType union(XQType... types) {
-        return new ComposedType(Arrays.asList(types), Composer.UNION);
-    }
-
-    public static XQType sequence(XQType... types) {
-        return new ComposedType(Arrays.asList(types), Composer.SEQUENCE);
-    }
-
-    public static XQType shuffle(XQType... types) {
-        return new ComposedType(Arrays.asList(types), Composer.SHUFFLE);
-    }
-
-    public static XQType intersect(XQType t1, XQType t2) {
-        return AnyItemType.INSTANCE;
-    }
-
-    public static boolean isSubtypeOf(XQType subtype, XQType supertype) {
-        if (subtype instanceof SchemaType && supertype instanceof SchemaType) {
-            SchemaType subSchType = (SchemaType) subtype;
-            SchemaType supSchType = (SchemaType) supertype;
-            SchemaType temp = subSchType;
-            while (temp != null) {
-                if (temp.getTypeId() == supSchType.getTypeId()) {
-                    return true;
-                }
-                temp = temp.getBaseType();
-            }
-            return false;
-        } else if (supertype instanceof AnyItemType && subtype instanceof ItemType) {
-            return true;
-        } else if (subtype instanceof QuantifiedType || supertype instanceof QuantifiedType) {
-            XQType pSubType = primeType(subtype);
-            XQType pSupType = primeType(supertype);
-            Quantifier subQuant = quantifier(subtype);
-            Quantifier supQuant = quantifier(supertype);
-
-            boolean isSubtype = isSubtypeOf(pSubType, pSupType);
-            if (isSubtype) {
-                return supQuant.isSubQuantifier(subQuant);
-            }
-        }
-
-        return false;
-    }
-}
\ No newline at end of file
index 0d70b0f..5dd6355 100644 (file)
@@ -1426,9 +1426,10 @@ public class XMLQueryTranslator {
                     }
                     Function axisFn = translateAxis(axis);
                     NodeType nt = translateNodeTest(axis, axisNode.getNodeTest());
+                    int ntCode = currCtx.lookupSequenceType(SequenceType.create(nt, Quantifier.QUANT_ONE));
                     ctxExpr = sfce(axisFn,
                             treat(ctxExpr, SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_STAR)),
-                            ce(SequenceType.create(BuiltinTypeRegistry.XSEXT_TYPE, Quantifier.QUANT_ONE), nt));
+                            ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), ntCode));
                     asc = isForwardAxis(axis);
                 } else if (ASTTag.FILTER_EXPRESSION.equals(pathNode.getTag())) {
                     FilterExprNode filterNode = (FilterExprNode) pathNode;
@@ -1811,41 +1812,41 @@ public class XMLQueryTranslator {
                     }
                     break;
                 }
-                case BuiltinTypeConstants.XS_INTEGER_TYPE_ID: {
+                case BuiltinTypeConstants.XS_INT_TYPE_ID: {
                     baaos.reset();
                     try {
-                        dOut.write((byte) BuiltinTypeConstants.XS_INTEGER_TYPE_ID);
-                        dOut.writeLong(((Long) value).longValue());
+                        dOut.write((byte) BuiltinTypeConstants.XS_INT_TYPE_ID);
+                        dOut.writeInt(((Number) value).intValue());
                     } catch (IOException e) {
                         throw new SystemException(ErrorCode.SYSE0001, e);
                     }
                     break;
                 }
-                case BuiltinTypeConstants.XS_DOUBLE_TYPE_ID: {
+                case BuiltinTypeConstants.XS_INTEGER_TYPE_ID: {
                     baaos.reset();
                     try {
-                        dOut.write((byte) BuiltinTypeConstants.XS_DOUBLE_TYPE_ID);
-                        dOut.writeDouble(((Double) value).doubleValue());
+                        dOut.write((byte) BuiltinTypeConstants.XS_INTEGER_TYPE_ID);
+                        dOut.writeLong(((Number) value).longValue());
                     } catch (IOException e) {
                         throw new SystemException(ErrorCode.SYSE0001, e);
                     }
                     break;
                 }
-                case BuiltinTypeConstants.XS_STRING_TYPE_ID: {
+                case BuiltinTypeConstants.XS_DOUBLE_TYPE_ID: {
                     baaos.reset();
                     try {
-                        dOut.write((byte) BuiltinTypeConstants.XS_STRING_TYPE_ID);
-                        stringVB.write((CharSequence) value, dOut);
+                        dOut.write((byte) BuiltinTypeConstants.XS_DOUBLE_TYPE_ID);
+                        dOut.writeDouble(((Number) value).doubleValue());
                     } catch (IOException e) {
                         throw new SystemException(ErrorCode.SYSE0001, e);
                     }
                     break;
                 }
-                case BuiltinTypeConstants.XSEXT_TYPE_TYPE_ID: {
-                    SequenceType st = (SequenceType) value;
+                case BuiltinTypeConstants.XS_STRING_TYPE_ID: {
                     baaos.reset();
                     try {
-                        dOut.write((byte) BuiltinTypeConstants.XSEXT_TYPE_TYPE_ID);
+                        dOut.write((byte) BuiltinTypeConstants.XS_STRING_TYPE_ID);
+                        stringVB.write((CharSequence) value, dOut);
                     } catch (IOException e) {
                         throw new SystemException(ErrorCode.SYSE0001, e);
                     }
@@ -1913,28 +1914,33 @@ public class XMLQueryTranslator {
     }
 
     private ILogicalExpression promote(ILogicalExpression expr, SequenceType type) throws SystemException {
+        int typeCode = currCtx.lookupSequenceType(type);
         return sfce(BuiltinOperators.PROMOTE, expr,
-                ce(SequenceType.create(BuiltinTypeRegistry.XSEXT_TYPE, Quantifier.QUANT_ONE), type));
+                ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), typeCode));
     }
 
     private ILogicalExpression treat(ILogicalExpression expr, SequenceType type) throws SystemException {
+        int typeCode = currCtx.lookupSequenceType(type);
         return sfce(BuiltinOperators.TREAT, expr,
-                ce(SequenceType.create(BuiltinTypeRegistry.XSEXT_TYPE, Quantifier.QUANT_ONE), type));
+                ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), typeCode));
     }
 
     private ILogicalExpression cast(ILogicalExpression expr, SequenceType type) throws SystemException {
+        int typeCode = currCtx.lookupSequenceType(type);
         return sfce(BuiltinOperators.CAST, expr,
-                ce(SequenceType.create(BuiltinTypeRegistry.XSEXT_TYPE, Quantifier.QUANT_ONE), type));
+                ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), typeCode));
     }
 
     private ILogicalExpression castable(ILogicalExpression expr, SequenceType type) throws SystemException {
+        int typeCode = currCtx.lookupSequenceType(type);
         return sfce(BuiltinOperators.CASTABLE, expr,
-                ce(SequenceType.create(BuiltinTypeRegistry.XSEXT_TYPE, Quantifier.QUANT_ONE), type));
+                ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), typeCode));
     }
 
     private ILogicalExpression instanceOf(ILogicalExpression expr, SequenceType type) throws SystemException {
+        int typeCode = currCtx.lookupSequenceType(type);
         return sfce(BuiltinOperators.INSTANCE_OF, expr,
-                ce(SequenceType.create(BuiltinTypeRegistry.XSEXT_TYPE, Quantifier.QUANT_ONE), type));
+                ce(SequenceType.create(BuiltinTypeRegistry.XS_INT, Quantifier.QUANT_ONE), typeCode));
     }
 
     private List<LogicalVariable> translateExpressionList(List<ASTNode> expressions, TranslationContext tCtx)