incubator-vxquery-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject svn commit: r1387834 - in /incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions: arithmetic/ comparison/ comparison/general/ qname/ sequence/ util/
Date Thu, 20 Sep 2012 01:04:43 GMT
Author: prestonc
Date: Thu Sep 20 01:04:42 2012
New Revision: 1387834

URL: http://svn.apache.org/viewvc?rev=1387834&view=rev
Log:
Refactored the comparison functions for value and general. Also updated general to support sequences.

Modified:
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/AbstractArithmeticScalarEvaluatorFactory.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/AbstractValueComparisonScalarEvaluatorFactory.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnPrefixFromQNameScalarEvaluatorFactory.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnDistinctValuesScalarEvaluatorFactory.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnIndexOfScalarEvaluatorFactory.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/AbstractArithmeticScalarEvaluatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/AbstractArithmeticScalarEvaluatorFactory.java?rev=1387834&r1=1387833&r2=1387834&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/AbstractArithmeticScalarEvaluatorFactory.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/AbstractArithmeticScalarEvaluatorFactory.java Thu Sep 20 01:04:42 2012
@@ -104,7 +104,7 @@ public abstract class AbstractArithmetic
                         case ValueTag.XS_BYTE_TAG:
                         case ValueTag.XS_UNSIGNED_BYTE_TAG:
                             abvsArgument1.reset();
-                            FunctionHelper.getIntegerPointable(tp1, tvp1, dOutArgument1);
+                            FunctionHelper.getIntegerPointable(tvp1, dOutArgument1);
                             longp1.set(abvsArgument1.getByteArray(), abvsArgument1.getStartOffset() + 1,
                                     LongPointable.TYPE_TRAITS.getFixedLength());
                             break;
@@ -137,7 +137,7 @@ public abstract class AbstractArithmetic
                         case ValueTag.XS_BYTE_TAG:
                         case ValueTag.XS_UNSIGNED_BYTE_TAG:
                             abvsArgument2.reset();
-                            FunctionHelper.getIntegerPointable(tp2, tvp2, dOutArgument2);
+                            FunctionHelper.getIntegerPointable(tvp2, dOutArgument2);
                             longp2.set(abvsArgument2.getByteArray(), abvsArgument2.getStartOffset() + 1,
                                     LongPointable.TYPE_TRAITS.getFixedLength());
                         case ValueTag.XS_DOUBLE_TAG:

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/AbstractValueComparisonScalarEvaluatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/AbstractValueComparisonScalarEvaluatorFactory.java?rev=1387834&r1=1387833&r2=1387834&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/AbstractValueComparisonScalarEvaluatorFactory.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/AbstractValueComparisonScalarEvaluatorFactory.java Thu Sep 20 01:04:42 2012
@@ -51,12 +51,17 @@ public abstract class AbstractValueCompa
         final AbstractValueComparisonOperation aOp = createValueComparisonOperation();
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
 
+        final ArrayBackedValueStorage abvsInteger1 = new ArrayBackedValueStorage();
+        final DataOutput dOutInteger1 = abvsInteger1.getDataOutput();
+        final ArrayBackedValueStorage abvsInteger2 = new ArrayBackedValueStorage();
+        final DataOutput dOutInteger2 = abvsInteger2.getDataOutput();
+
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             @Override
             protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                 TaggedValuePointable tvp1 = args[0];
                 TaggedValuePointable tvp2 = args[1];
-                boolean booleanResult = compareTaggedValues(aOp, tvp1, tvp2, dCtx);
+                boolean booleanResult = transformThenCompareTaggedValues(aOp, tvp1, tvp2, dCtx);
 
                 try {
                     abvs.reset();
@@ -68,380 +73,37 @@ public abstract class AbstractValueCompa
                 }
             }
 
-        };
-    }
-
-    public static boolean compareTaggedValues(AbstractValueComparisonOperation aOp, TaggedValuePointable tvp1,
-            TaggedValuePointable tvp2, DynamicContext dCtx) throws SystemException {
-        final ArrayBackedValueStorage abvsInteger1 = new ArrayBackedValueStorage();
-        final DataOutput dOutInteger1 = abvsInteger1.getDataOutput();
-        final ArrayBackedValueStorage abvsInteger2 = new ArrayBackedValueStorage();
-        final DataOutput dOutInteger2 = abvsInteger2.getDataOutput();
-        final LongPointable longp1 = (LongPointable) LongPointable.FACTORY.createPointable();
-        final LongPointable longp2 = (LongPointable) LongPointable.FACTORY.createPointable();
-        final FunctionHelper.TypedPointables tp1 = new FunctionHelper.TypedPointables();
-        final FunctionHelper.TypedPointables tp2 = new FunctionHelper.TypedPointables();
-
-        boolean booleanResult = false;
-        int tid1 = FunctionHelper.getBaseTypeForComparisons(tvp1.getTag());
-        int tid2 = FunctionHelper.getBaseTypeForComparisons(tvp2.getTag());
-        try {
-            switch (tvp1.getTag()) {
-                case ValueTag.XS_INTEGER_TAG:
-                case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                case ValueTag.XS_LONG_TAG:
-                case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                case ValueTag.XS_UNSIGNED_LONG_TAG:
-                case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                case ValueTag.XS_INT_TAG:
-                case ValueTag.XS_UNSIGNED_INT_TAG:
-                case ValueTag.XS_SHORT_TAG:
-                case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                case ValueTag.XS_BYTE_TAG:
-                case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                    abvsInteger1.reset();
-                    FunctionHelper.getIntegerPointable(tp1, tvp1, dOutInteger1);
-                    longp1.set(abvsInteger1.getByteArray(), abvsInteger1.getStartOffset() + 1,
-                            LongPointable.TYPE_TRAITS.getFixedLength());
-            }
-            switch (tvp2.getTag()) {
-                case ValueTag.XS_INTEGER_TAG:
-                case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                case ValueTag.XS_LONG_TAG:
-                case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                case ValueTag.XS_UNSIGNED_LONG_TAG:
-                case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                case ValueTag.XS_INT_TAG:
-                case ValueTag.XS_UNSIGNED_INT_TAG:
-                case ValueTag.XS_SHORT_TAG:
-                case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                case ValueTag.XS_BYTE_TAG:
-                case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                    abvsInteger2.reset();
-                    FunctionHelper.getIntegerPointable(tp2, tvp2, dOutInteger2);
-                    longp2.set(abvsInteger2.getByteArray(), abvsInteger2.getStartOffset() + 1,
-                            LongPointable.TYPE_TRAITS.getFixedLength());
-            }
-            switch (tid1) {
-                case ValueTag.XS_DECIMAL_TAG:
-                    tvp1.getValue(tp1.decp);
-                    switch (tid2) {
-                        case ValueTag.XS_DECIMAL_TAG:
-                            tvp2.getValue(tp2.decp);
-                            booleanResult = aOp.operateDecimalDecimal(tp1.decp, tp2.decp);
-                            break;
-
-                        case ValueTag.XS_INTEGER_TAG:
-                            booleanResult = aOp.operateDecimalInteger(tp1.decp, longp2);
-                            break;
-
-                        case ValueTag.XS_FLOAT_TAG:
-                            tvp2.getValue(tp2.floatp);
-                            booleanResult = aOp.operateDecimalFloat(tp1.decp, tp2.floatp);
-                            break;
-
-                        case ValueTag.XS_DOUBLE_TAG:
-                            tvp2.getValue(tp2.doublep);
-                            booleanResult = aOp.operateDecimalDouble(tp1.decp, tp2.doublep);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_INTEGER_TAG:
-                    switch (tid2) {
-                        case ValueTag.XS_DECIMAL_TAG:
-                            tvp2.getValue(tp2.decp);
-                            booleanResult = aOp.operateIntegerDecimal(longp1, tp2.decp);
-                            break;
-
-                        case ValueTag.XS_INTEGER_TAG:
-                            booleanResult = aOp.operateIntegerInteger(longp1, longp2);
-                            break;
-
-                        case ValueTag.XS_FLOAT_TAG:
-                            tvp2.getValue(tp2.floatp);
-                            booleanResult = aOp.operateIntegerFloat(longp1, tp2.floatp);
-                            break;
-
-                        case ValueTag.XS_DOUBLE_TAG:
-                            tvp2.getValue(tp2.doublep);
-                            booleanResult = aOp.operateIntegerDouble(longp1, tp2.doublep);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_FLOAT_TAG:
-                    tvp1.getValue(tp1.floatp);
-                    switch (tid2) {
-                        case ValueTag.XS_DECIMAL_TAG:
-                            tvp2.getValue(tp2.decp);
-                            booleanResult = aOp.operateFloatDecimal(tp1.floatp, tp2.decp);
-                            break;
-
-                        case ValueTag.XS_INTEGER_TAG:
-                            booleanResult = aOp.operateFloatInteger(tp1.floatp, longp2);
-                            break;
-
-                        case ValueTag.XS_FLOAT_TAG:
-                            tvp2.getValue(tp2.floatp);
-                            booleanResult = aOp.operateFloatFloat(tp1.floatp, tp2.floatp);
-                            break;
-
-                        case ValueTag.XS_DOUBLE_TAG:
-                            tvp2.getValue(tp2.doublep);
-                            booleanResult = aOp.operateFloatDouble(tp1.floatp, tp2.doublep);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_DOUBLE_TAG:
-                    tvp1.getValue(tp1.doublep);
-                    switch (tid2) {
-                        case ValueTag.XS_DECIMAL_TAG:
-                            tvp2.getValue(tp2.decp);
-                            booleanResult = aOp.operateDoubleDecimal(tp1.doublep, tp2.decp);
-                            break;
-
-                        case ValueTag.XS_INTEGER_TAG:
-                            booleanResult = aOp.operateDoubleInteger(tp1.doublep, longp2);
-                            break;
-
-                        case ValueTag.XS_FLOAT_TAG:
-                            tvp2.getValue(tp2.floatp);
-                            booleanResult = aOp.operateDoubleFloat(tp1.doublep, tp2.floatp);
-                            break;
-
-                        case ValueTag.XS_DOUBLE_TAG:
-                            tvp2.getValue(tp2.doublep);
-                            booleanResult = aOp.operateDoubleDouble(tp1.doublep, tp2.doublep);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_BOOLEAN_TAG:
-                    tvp1.getValue(tp1.boolp);
-                    switch (tid2) {
-                        case ValueTag.XS_BOOLEAN_TAG:
-                            tvp2.getValue(tp2.boolp);
-                            booleanResult = aOp.operateBooleanBoolean(tp1.boolp, tp2.boolp);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_STRING_TAG:
-                case ValueTag.XS_UNTYPED_ATOMIC_TAG:
-                    tvp1.getValue(tp1.utf8sp);
-                    switch (tid2) {
-                        case ValueTag.XS_STRING_TAG:
-                        case ValueTag.XS_UNTYPED_ATOMIC_TAG:
-                            tvp2.getValue(tp2.utf8sp);
-                            booleanResult = aOp.operateStringString(tp1.utf8sp, tp2.utf8sp);
-                            break;
-                    }
-                    break;
+            protected boolean transformThenCompareTaggedValues(AbstractValueComparisonOperation aOp,
+                    TaggedValuePointable tvp1, TaggedValuePointable tvp2, DynamicContext dCtx) throws SystemException {
+                TaggedValuePointable tvp1new = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+                TaggedValuePointable tvp2new = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
 
-                case ValueTag.XS_DATE_TAG:
-                    tvp1.getValue(tp1.datep);
-                    switch (tid2) {
-                        case ValueTag.XS_DATE_TAG:
-                            tvp2.getValue(tp2.datep);
-                            booleanResult = aOp.operateDateDate(tp1.datep, tp2.datep, dCtx);
-                            break;
-                        default:
-                            // Cross comparisons between DateTime, Date and Time are not supported.
-                            throw new SystemException(ErrorCode.XPTY0004);
-                    }
-                    break;
-
-                case ValueTag.XS_DATETIME_TAG:
-                    tvp1.getValue(tp1.datetimep);
-                    switch (tid2) {
-                        case ValueTag.XS_DATETIME_TAG:
-                            tvp2.getValue(tp2.datetimep);
-                            booleanResult = aOp.operateDatetimeDatetime(tp1.datetimep, tp2.datetimep, dCtx);
-                            break;
-                        default:
-                            // Cross comparisons between DateTime, Date and Time are not supported.
-                            throw new SystemException(ErrorCode.XPTY0004);
-                    }
-                    break;
-
-                case ValueTag.XS_TIME_TAG:
-                    tvp1.getValue(tp1.timep);
-                    switch (tid2) {
-                        case ValueTag.XS_TIME_TAG:
-                            tvp2.getValue(tp2.timep);
-                            booleanResult = aOp.operateTimeTime(tp1.timep, tp2.timep, dCtx);
-                            break;
-                        default:
-                            // Cross comparisons between DateTime, Date and Time are not supported.
-                            throw new SystemException(ErrorCode.XPTY0004);
-                    }
-                    break;
-
-                case ValueTag.XS_DURATION_TAG:
-                    tvp1.getValue(tp1.durationp);
-                    switch (tid2) {
-                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                            tvp2.getValue(tp2.longp);
-                            booleanResult = aOp.operateDurationDTDuration(tp1.durationp, tp2.longp);
-                            break;
-                        case ValueTag.XS_DURATION_TAG:
-                            tvp2.getValue(tp2.durationp);
-                            booleanResult = aOp.operateDurationDuration(tp1.durationp, tp2.durationp);
-                            break;
-                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                            tvp2.getValue(tp2.intp);
-                            booleanResult = aOp.operateDurationYMDuration(tp1.durationp, tp2.intp);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                    tvp1.getValue(tp1.longp);
-                    switch (tid2) {
-                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                            tvp2.getValue(tp2.longp);
-                            booleanResult = aOp.operateDTDurationDTDuration(tp1.longp, tp2.longp);
-                            break;
-                        case ValueTag.XS_DURATION_TAG:
-                            tvp2.getValue(tp2.durationp);
-                            booleanResult = aOp.operateDTDurationDuration(tp1.longp, tp2.durationp);
-                            break;
-                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                            tvp2.getValue(tp2.intp);
-                            booleanResult = aOp.operateDTDurationYMDuration(tp1.longp, tp2.intp);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                    tvp1.getValue(tp1.intp);
-                    switch (tid2) {
-                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                            tvp2.getValue(tp2.longp);
-                            booleanResult = aOp.operateYMDurationDTDuration(tp1.intp, tp2.longp);
-                            break;
-                        case ValueTag.XS_DURATION_TAG:
-                            tvp2.getValue(tp2.durationp);
-                            booleanResult = aOp.operateYMDurationDuration(tp1.intp, tp2.durationp);
-                            break;
-                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                            tvp2.getValue(tp2.intp);
-                            booleanResult = aOp.operateYMDurationYMDuration(tp1.intp, tp2.intp);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_G_DAY_TAG:
-                    tvp1.getValue(tp1.datep);
-                    switch (tid2) {
-                        case ValueTag.XS_G_DAY_TAG:
-                            tvp2.getValue(tp2.datep);
-                            booleanResult = aOp.operateGDayGDay(tp1.datep, tp2.datep, dCtx);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_G_MONTH_DAY_TAG:
-                    tvp1.getValue(tp1.datep);
-                    switch (tid2) {
-                        case ValueTag.XS_G_MONTH_DAY_TAG:
-                            tvp2.getValue(tp2.datep);
-                            booleanResult = aOp.operateGMonthDayGMonthDay(tp1.datep, tp2.datep, dCtx);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_G_MONTH_TAG:
-                    tvp1.getValue(tp1.datep);
-                    switch (tid2) {
-                        case ValueTag.XS_G_MONTH_TAG:
-                            tvp2.getValue(tp2.datep);
-                            booleanResult = aOp.operateGMonthGMonth(tp1.datep, tp2.datep, dCtx);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_G_YEAR_MONTH_TAG:
-                    tvp1.getValue(tp1.datep);
-                    switch (tid2) {
-                        case ValueTag.XS_G_YEAR_MONTH_TAG:
-                            tvp2.getValue(tp2.datep);
-                            booleanResult = aOp.operateGYearMonthGYearMonth(tp1.datep, tp2.datep, dCtx);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_G_YEAR_TAG:
-                    tvp1.getValue(tp1.datep);
-                    switch (tid2) {
-                        case ValueTag.XS_G_YEAR_TAG:
-                            tvp2.getValue(tp2.datep);
-                            booleanResult = aOp.operateGYearGYear(tp1.datep, tp2.datep, dCtx);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_HEX_BINARY_TAG:
-                    tvp1.getValue(tp1.binaryp);
-                    switch (tid2) {
-                        case ValueTag.XS_HEX_BINARY_TAG:
-                            tvp2.getValue(tp2.binaryp);
-                            booleanResult = aOp.operateHexBinaryHexBinary(tp1.binaryp, tp2.binaryp);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_BASE64_BINARY_TAG:
-                    tvp1.getValue(tp1.binaryp);
-                    switch (tid2) {
-                        case ValueTag.XS_BASE64_BINARY_TAG:
-                            tvp2.getValue(tp2.binaryp);
-                            booleanResult = aOp.operateBase64BinaryBase64Binary(tp1.binaryp, tp2.binaryp);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_ANY_URI_TAG:
-                    tvp1.getValue(tp1.utf8sp);
-                    switch (tid2) {
-                        case ValueTag.XS_ANY_URI_TAG:
-                            tvp2.getValue(tp2.utf8sp);
-                            booleanResult = aOp.operateAnyURIAnyURI(tp1.utf8sp, tp2.utf8sp);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_QNAME_TAG:
-                    tvp1.getValue(tp1.qnamep);
-                    switch (tid2) {
-                        case ValueTag.XS_QNAME_TAG:
-                            tvp2.getValue(tp2.qnamep);
-                            booleanResult = aOp.operateQNameQName(tp1.qnamep, tp2.qnamep);
-                            break;
-                    }
-                    break;
-
-                case ValueTag.XS_NOTATION_TAG:
-                    tvp1.getValue(tp1.utf8sp);
-                    switch (tid2) {
-                        case ValueTag.XS_NOTATION_TAG:
-                            tvp2.getValue(tp2.utf8sp);
-                            booleanResult = aOp.operateNotationNotation(tp1.utf8sp, tp2.utf8sp);
-                            break;
-                    }
-                    break;
+                try {
+                    if (FunctionHelper.isDerivedFromInteger(tvp1.getTag())) {
+                        abvsInteger1.reset();
+                        FunctionHelper.getIntegerPointable(tvp1, dOutInteger1);
+                        tvp1new.set(abvsInteger1.getByteArray(), abvsInteger1.getStartOffset(),
+                                LongPointable.TYPE_TRAITS.getFixedLength() + 1);
+                    } else {
+                        tvp1new = tvp1;
+                    }
+                    if (FunctionHelper.isDerivedFromInteger(tvp2.getTag())) {
+                        abvsInteger2.reset();
+                        FunctionHelper.getIntegerPointable(tvp2, dOutInteger2);
+                        tvp2new.set(abvsInteger2.getByteArray(), abvsInteger2.getStartOffset(),
+                                LongPointable.TYPE_TRAITS.getFixedLength() + 1);
+                    } else {
+                        tvp2new = tvp2;
+                    }
+
+                    return FunctionHelper.compareTaggedValues(aOp, tvp1new, tvp2new, dCtx);
+                } catch (SystemException se) {
+                    throw se;
+                } catch (Exception e) {
+                    throw new SystemException(ErrorCode.SYSE0001, e);
+                }
             }
-            return booleanResult;
-
-        } catch (SystemException se) {
-            throw se;
-        } catch (Exception e) {
-            throw new SystemException(ErrorCode.SYSE0001, e);
-        }
+        };
     }
 
     protected abstract AbstractValueComparisonOperation createValueComparisonOperation();

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java?rev=1387834&r1=1387833&r2=1387834&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java Thu Sep 20 01:04:42 2012
@@ -17,17 +17,10 @@
 package org.apache.vxquery.runtime.functions.comparison.general;
 
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.vxquery.context.DynamicContext;
+import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.datamodel.accessors.atomic.XSBinaryPointable;
-import org.apache.vxquery.datamodel.accessors.atomic.XSDatePointable;
-import org.apache.vxquery.datamodel.accessors.atomic.XSDateTimePointable;
-import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
-import org.apache.vxquery.datamodel.accessors.atomic.XSDurationPointable;
-import org.apache.vxquery.datamodel.accessors.atomic.XSQNamePointable;
-import org.apache.vxquery.datamodel.accessors.atomic.XSTimePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.exceptions.ErrorCode;
 import org.apache.vxquery.exceptions.SystemException;
@@ -69,21 +62,15 @@ import org.apache.vxquery.runtime.functi
 import org.apache.vxquery.runtime.functions.cast.CastToUntypedAtomicOperation;
 import org.apache.vxquery.runtime.functions.cast.CastToYMDurationOperation;
 import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonOperation;
-import org.apache.vxquery.types.BuiltinTypeRegistry;
+import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
 import edu.uci.ics.hyracks.data.std.api.IPointable;
-import edu.uci.ics.hyracks.data.std.primitive.BooleanPointable;
-import edu.uci.ics.hyracks.data.std.primitive.BytePointable;
 import edu.uci.ics.hyracks.data.std.primitive.DoublePointable;
-import edu.uci.ics.hyracks.data.std.primitive.FloatPointable;
-import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
-import edu.uci.ics.hyracks.data.std.primitive.LongPointable;
-import edu.uci.ics.hyracks.data.std.primitive.ShortPointable;
-import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
+import edu.uci.ics.hyracks.data.std.primitive.VoidPointable;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 
 public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
@@ -102,10 +89,16 @@ public abstract class AbstractGeneralCom
         final DataOutput dOutInner1 = abvsInner1.getDataOutput();
         final ArrayBackedValueStorage abvsInner2 = new ArrayBackedValueStorage();
         final DataOutput dOutInner2 = abvsInner2.getDataOutput();
-        final TypedPointables tp = new TypedPointables();
-        final TypedPointables tp1 = new TypedPointables();
-        final TypedPointables tp2 = new TypedPointables();
+
+        final FunctionHelper.TypedPointables tp1 = new FunctionHelper.TypedPointables();
+        final FunctionHelper.TypedPointables tp2 = new FunctionHelper.TypedPointables();
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
+        final SequencePointable seqp1 = (SequencePointable) SequencePointable.FACTORY.createPointable();
+        final SequencePointable seqp2 = (SequencePointable) SequencePointable.FACTORY.createPointable();
+        final VoidPointable p1 = (VoidPointable) VoidPointable.FACTORY.createPointable();
+        final VoidPointable p2 = (VoidPointable) VoidPointable.FACTORY.createPointable();
+        final TaggedValuePointable tvpSeq1 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+        final TaggedValuePointable tvpSeq2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
 
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             AbstractCastToOperation aCastToOp = new CastToStringOperation();
@@ -113,11 +106,86 @@ public abstract class AbstractGeneralCom
             @Override
             protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                 boolean booleanResult = false;
-                boolean tagTransformed1 = false, tagTransformed2 = false;
                 TaggedValuePointable tvpArg1 = args[0];
                 TaggedValuePointable tvpArg2 = args[1];
-                int tid1 = getBaseTypeForComparisons(tvpArg1.getTag());
-                int tid2 = getBaseTypeForComparisons(tvpArg2.getTag());
+                try {
+                    if (tvpArg1.getTag() == ValueTag.SEQUENCE_TAG) {
+                        tvpArg1.getValue(seqp1);
+                        int seqLen = seqp1.getEntryCount();
+                        for (int j = 0; j < seqLen; ++j) {
+                            seqp1.getEntry(j, p1);
+                            tvpSeq1.set(p1.getByteArray(), p1.getStartOffset(), p1.getLength());
+                            if (evaluateTaggedValueArgument2(aOp, tvpSeq1, tvpArg2, dCtx)) {
+                                booleanResult = true;
+                                break;
+                            }
+                        }
+                    } else {
+                        booleanResult = evaluateTaggedValueArgument2(aOp, tvpArg1, tvpArg2, dCtx);
+                    }
+
+                    byte[] byteResult = new byte[2];
+                    byteResult[0] = ValueTag.XS_BOOLEAN_TAG;
+                    byteResult[1] = (byte) (booleanResult ? 1 : 0);
+                    result.set(byteResult, 0, 2);
+                } catch (SystemException se) {
+                    throw se;
+                } catch (Exception e) {
+                    throw new SystemException(ErrorCode.SYSE0001, e);
+                }
+            }
+
+            /**
+             * Check the second argument for a sequence and loop if required.
+             * 
+             * @param aOp
+             * @param tvpArg1
+             * @param tvpArg2
+             * @param dCtx
+             * @return
+             * @throws SystemException
+             */
+            protected boolean evaluateTaggedValueArgument2(AbstractValueComparisonOperation aOp,
+                    TaggedValuePointable tvpArg1, TaggedValuePointable tvpArg2, DynamicContext dCtx)
+                    throws SystemException {
+                try {
+                    if (tvpArg2.getTag() == ValueTag.SEQUENCE_TAG) {
+                        tvpArg2.getValue(seqp2);
+                        int seqLen = seqp2.getEntryCount();
+                        for (int j = 0; j < seqLen; ++j) {
+                            seqp2.getEntry(j, p2);
+                            tvpSeq2.set(p2.getByteArray(), p2.getStartOffset(), p2.getLength());
+                            if (transformThenCompareTaggedValues(aOp, tvpArg1, tvpSeq2, dCtx)) {
+                                return true;
+                            }
+                        }
+                    } else {
+                        return transformThenCompareTaggedValues(aOp, tvpArg1, tvpArg2, dCtx);
+                    }
+                } catch (SystemException se) {
+                    throw se;
+                } catch (Exception e) {
+                    throw new SystemException(ErrorCode.SYSE0001, e);
+                }
+                return false;
+            }
+
+            /**
+             * Transform the values into values supported for general comparison.
+             * 
+             * @param aOp
+             * @param tvpArg1
+             * @param tvpArg2
+             * @param dCtx
+             * @return
+             * @throws SystemException
+             */
+            protected boolean transformThenCompareTaggedValues(AbstractValueComparisonOperation aOp,
+                    TaggedValuePointable tvpArg1, TaggedValuePointable tvpArg2, DynamicContext dCtx)
+                    throws SystemException {
+                boolean tagTransformed1 = false, tagTransformed2 = false;
+                int tid1 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpArg1.getTag());
+                int tid2 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpArg2.getTag());
                 abvsInner1.reset();
                 abvsInner2.reset();
                 // Converted tags
@@ -147,387 +215,28 @@ public abstract class AbstractGeneralCom
                     // Copy over the values not changed and upgrade numeric values to double.
                     if (!tagTransformed1) {
                         tvp1 = tvpArg1;
-                        switch (tvp1.getTag()) {
-                            case ValueTag.XS_DECIMAL_TAG:
-                            case ValueTag.XS_DOUBLE_TAG:
-                            case ValueTag.XS_FLOAT_TAG:
-                            case ValueTag.XS_INTEGER_TAG:
-                            case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                            case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                            case ValueTag.XS_LONG_TAG:
-                            case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                            case ValueTag.XS_UNSIGNED_LONG_TAG:
-                            case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                            case ValueTag.XS_INT_TAG:
-                            case ValueTag.XS_UNSIGNED_INT_TAG:
-                            case ValueTag.XS_SHORT_TAG:
-                            case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                            case ValueTag.XS_BYTE_TAG:
-                            case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                                getDoublePointable(tvpArg1, dOutInner1);
-                                tvp1.set(abvsInner1.getByteArray(), abvsInner1.getStartOffset(),
-                                        DoublePointable.TYPE_TRAITS.getFixedLength() + 1);
-                                tagTransformed1 = true;
+                        if (FunctionHelper.isDerivedFromDouble(tvp1.getTag())) {
+                            FunctionHelper.getDoublePointable(tvpArg1, dOutInner1);
+                            tvp1.set(abvsInner1.getByteArray(), abvsInner1.getStartOffset(),
+                                    DoublePointable.TYPE_TRAITS.getFixedLength() + 1);
+                            tagTransformed1 = true;
                         }
                     }
                     if (!tagTransformed2) {
                         tvp2 = tvpArg2;
-                        switch (tvp2.getTag()) {
-                            case ValueTag.XS_DECIMAL_TAG:
-                            case ValueTag.XS_DOUBLE_TAG:
-                            case ValueTag.XS_FLOAT_TAG:
-                            case ValueTag.XS_INTEGER_TAG:
-                            case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                            case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                            case ValueTag.XS_LONG_TAG:
-                            case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                            case ValueTag.XS_UNSIGNED_LONG_TAG:
-                            case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                            case ValueTag.XS_INT_TAG:
-                            case ValueTag.XS_UNSIGNED_INT_TAG:
-                            case ValueTag.XS_SHORT_TAG:
-                            case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                            case ValueTag.XS_BYTE_TAG:
-                            case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                                getDoublePointable(tvpArg1, dOutInner2);
-                                tvp2.set(abvsInner1.getByteArray(), abvsInner1.getStartOffset(),
-                                        DoublePointable.TYPE_TRAITS.getFixedLength() + 1);
-                                tagTransformed2 = true;
+                        if (FunctionHelper.isDerivedFromDouble(tvp2.getTag())) {
+                            FunctionHelper.getDoublePointable(tvpArg2, dOutInner2);
+                            tvp2.set(abvsInner2.getByteArray(), abvsInner2.getStartOffset(),
+                                    DoublePointable.TYPE_TRAITS.getFixedLength() + 1);
+                            tagTransformed2 = true;
                         }
                     }
-
-                    // Run the value comparison.
-                    switch (tid1) {
-
-                        case ValueTag.XS_DOUBLE_TAG:
-                            tvp1.getValue(tp1.doublep);
-                            switch (tid2) {
-                                case ValueTag.XS_DOUBLE_TAG:
-                                    tvp2.getValue(tp2.doublep);
-                                    booleanResult = aOp.operateDoubleDouble(tp1.doublep, tp2.doublep);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_BOOLEAN_TAG:
-                            tvp1.getValue(tp1.boolp);
-                            switch (tid2) {
-                                case ValueTag.XS_BOOLEAN_TAG:
-                                    tvp2.getValue(tp2.boolp);
-                                    booleanResult = aOp.operateBooleanBoolean(tp1.boolp, tp2.boolp);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_STRING_TAG:
-                            tvp1.getValue(tp1.utf8sp);
-                            switch (tid2) {
-                                case ValueTag.XS_STRING_TAG:
-                                    tvp2.getValue(tp2.utf8sp);
-                                    booleanResult = aOp.operateStringString(tp1.utf8sp, tp2.utf8sp);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_DATE_TAG:
-                            tvp1.getValue(tp1.datep);
-                            switch (tid2) {
-                                case ValueTag.XS_DATE_TAG:
-                                    tvp2.getValue(tp2.datep);
-                                    booleanResult = aOp.operateDateDate(tp1.datep, tp2.datep, dCtx);
-                                    break;
-                                default:
-                                    // Cross comparisons between DateTime, Date and Time are not supported.
-                                    throw new SystemException(ErrorCode.XPTY0004);
-                            }
-                            break;
-
-                        case ValueTag.XS_DATETIME_TAG:
-                            tvp1.getValue(tp1.datetimep);
-                            switch (tid2) {
-                                case ValueTag.XS_DATETIME_TAG:
-                                    tvp2.getValue(tp2.datetimep);
-                                    booleanResult = aOp.operateDatetimeDatetime(tp1.datetimep, tp2.datetimep, dCtx);
-                                    break;
-                                default:
-                                    // Cross comparisons between DateTime, Date and Time are not supported.
-                                    throw new SystemException(ErrorCode.XPTY0004);
-                            }
-                            break;
-
-                        case ValueTag.XS_TIME_TAG:
-                            tvp1.getValue(tp1.timep);
-                            switch (tid2) {
-                                case ValueTag.XS_TIME_TAG:
-                                    tvp2.getValue(tp2.timep);
-                                    booleanResult = aOp.operateTimeTime(tp1.timep, tp2.timep, dCtx);
-                                    break;
-                                default:
-                                    // Cross comparisons between DateTime, Date and Time are not supported.
-                                    throw new SystemException(ErrorCode.XPTY0004);
-                            }
-                            break;
-
-                        case ValueTag.XS_DURATION_TAG:
-                            tvp1.getValue(tp1.durationp);
-                            switch (tid2) {
-                                case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                                    tvp2.getValue(tp2.longp);
-                                    booleanResult = aOp.operateDurationDTDuration(tp1.durationp, tp2.longp);
-                                    break;
-                                case ValueTag.XS_DURATION_TAG:
-                                    tvp2.getValue(tp2.durationp);
-                                    booleanResult = aOp.operateDurationDuration(tp1.durationp, tp2.durationp);
-                                    break;
-                                case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                                    tvp2.getValue(tp2.intp);
-                                    booleanResult = aOp.operateDurationYMDuration(tp1.durationp, tp2.intp);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                            tvp1.getValue(tp1.longp);
-                            switch (tid2) {
-                                case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                                    tvp2.getValue(tp2.longp);
-                                    booleanResult = aOp.operateDTDurationDTDuration(tp1.longp, tp2.longp);
-                                    break;
-                                case ValueTag.XS_DURATION_TAG:
-                                    tvp2.getValue(tp2.durationp);
-                                    booleanResult = aOp.operateDTDurationDuration(tp1.longp, tp2.durationp);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                            tvp1.getValue(tp1.intp);
-                            switch (tid2) {
-                                case ValueTag.XS_DURATION_TAG:
-                                    tvp2.getValue(tp2.durationp);
-                                    booleanResult = aOp.operateYMDurationDuration(tp1.intp, tp2.durationp);
-                                    break;
-                                case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                                    tvp2.getValue(tp2.intp);
-                                    booleanResult = aOp.operateYMDurationYMDuration(tp1.intp, tp2.intp);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_G_DAY_TAG:
-                            tvp1.getValue(tp1.datep);
-                            switch (tid2) {
-                                case ValueTag.XS_G_DAY_TAG:
-                                    tvp2.getValue(tp2.datep);
-                                    booleanResult = aOp.operateGDayGDay(tp1.datep, tp2.datep, dCtx);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_G_MONTH_DAY_TAG:
-                            tvp1.getValue(tp1.datep);
-                            switch (tid2) {
-                                case ValueTag.XS_G_MONTH_DAY_TAG:
-                                    tvp2.getValue(tp2.datep);
-                                    booleanResult = aOp.operateGMonthDayGMonthDay(tp1.datep, tp2.datep, dCtx);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_G_MONTH_TAG:
-                            tvp1.getValue(tp1.datep);
-                            switch (tid2) {
-                                case ValueTag.XS_G_MONTH_TAG:
-                                    tvp2.getValue(tp2.datep);
-                                    booleanResult = aOp.operateGMonthGMonth(tp1.datep, tp2.datep, dCtx);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_G_YEAR_MONTH_TAG:
-                            tvp1.getValue(tp1.datep);
-                            switch (tid2) {
-                                case ValueTag.XS_G_YEAR_MONTH_TAG:
-                                    tvp2.getValue(tp2.datep);
-                                    booleanResult = aOp.operateGYearMonthGYearMonth(tp1.datep, tp2.datep, dCtx);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_G_YEAR_TAG:
-                            tvp1.getValue(tp1.datep);
-                            switch (tid2) {
-                                case ValueTag.XS_G_YEAR_TAG:
-                                    tvp2.getValue(tp2.datep);
-                                    booleanResult = aOp.operateGYearGYear(tp1.datep, tp2.datep, dCtx);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_HEX_BINARY_TAG:
-                            tvp1.getValue(tp1.binaryp);
-                            switch (tid2) {
-                                case ValueTag.XS_HEX_BINARY_TAG:
-                                    tvp2.getValue(tp2.binaryp);
-                                    booleanResult = aOp.operateHexBinaryHexBinary(tp1.binaryp, tp2.binaryp);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_BASE64_BINARY_TAG:
-                            tvp1.getValue(tp1.binaryp);
-                            switch (tid2) {
-                                case ValueTag.XS_BASE64_BINARY_TAG:
-                                    tvp2.getValue(tp2.binaryp);
-                                    booleanResult = aOp.operateBase64BinaryBase64Binary(tp1.binaryp, tp2.binaryp);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_ANY_URI_TAG:
-                            tvp1.getValue(tp1.utf8sp);
-                            switch (tid2) {
-                                case ValueTag.XS_ANY_URI_TAG:
-                                    tvp2.getValue(tp2.utf8sp);
-                                    booleanResult = aOp.operateAnyURIAnyURI(tp1.utf8sp, tp2.utf8sp);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_QNAME_TAG:
-                            tvp1.getValue(tp1.qnamep);
-                            switch (tid2) {
-                                case ValueTag.XS_QNAME_TAG:
-                                    tvp2.getValue(tp2.qnamep);
-                                    booleanResult = aOp.operateQNameQName(tp1.qnamep, tp2.qnamep);
-                                    break;
-                            }
-                            break;
-
-                        case ValueTag.XS_NOTATION_TAG:
-                            tvp1.getValue(tp1.utf8sp);
-                            switch (tid2) {
-                                case ValueTag.XS_NOTATION_TAG:
-                                    tvp2.getValue(tp2.utf8sp);
-                                    booleanResult = aOp.operateNotationNotation(tp1.utf8sp, tp2.utf8sp);
-                                    break;
-                            }
-                            break;
-                    }
-
-                    byte[] byteResult = new byte[2];
-                    byteResult[0] = ValueTag.XS_BOOLEAN_TAG;
-                    byteResult[1] = (byte) (booleanResult ? 1 : 0);
-                    result.set(byteResult, 0, 2);
                 } catch (SystemException se) {
                     throw se;
                 } catch (Exception e) {
                     throw new SystemException(ErrorCode.SYSE0001, e);
                 }
-            }
-
-            private void getDoublePointable(TaggedValuePointable tvp, DataOutput dOut) throws SystemException,
-                    IOException {
-                double value;
-                switch (tvp.getTag()) {
-                    case ValueTag.XS_DECIMAL_TAG:
-                        tvp.getValue(tp.decp);
-                        value = tp.decp.doubleValue();
-                        break;
-
-                    case ValueTag.XS_DOUBLE_TAG:
-                        tvp.getValue(tp.doublep);
-                        value = tp.doublep.doubleValue();
-                        break;
-
-                    case ValueTag.XS_FLOAT_TAG:
-                        tvp.getValue(tp.floatp);
-                        value = tp.floatp.doubleValue();
-                        break;
-
-                    case ValueTag.XS_INTEGER_TAG:
-                    case ValueTag.XS_LONG_TAG:
-                    case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                    case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                    case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                    case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                    case ValueTag.XS_UNSIGNED_INT_TAG:
-                    case ValueTag.XS_UNSIGNED_LONG_TAG:
-                        tvp.getValue(tp.longp);
-                        value = tp.longp.doubleValue();
-                        break;
-
-                    case ValueTag.XS_INT_TAG:
-                    case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                        tvp.getValue(tp.intp);
-                        value = tp.intp.doubleValue();
-                        break;
-
-                    case ValueTag.XS_SHORT_TAG:
-                    case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                        tvp.getValue(tp.shortp);
-                        value = tp.shortp.doubleValue();
-                        break;
-
-                    case ValueTag.XS_BYTE_TAG:
-                        tvp.getValue(tp.bytep);
-                        value = tp.bytep.doubleValue();
-                        break;
-
-                    default:
-                        value = 0;
-                }
-                dOut.write(ValueTag.XS_DOUBLE_TAG);
-                dOut.writeDouble(value);
-            }
-
-            private int getBaseTypeForComparisons(int tid) throws SystemException {
-                while (true) {
-                    switch (tid) {
-                        case ValueTag.XS_ANY_URI_TAG:
-                        case ValueTag.XS_BASE64_BINARY_TAG:
-                        case ValueTag.XS_BOOLEAN_TAG:
-                        case ValueTag.XS_DATE_TAG:
-                        case ValueTag.XS_DATETIME_TAG:
-                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                        case ValueTag.XS_DURATION_TAG:
-                        case ValueTag.XS_HEX_BINARY_TAG:
-                        case ValueTag.XS_G_DAY_TAG:
-                        case ValueTag.XS_G_MONTH_DAY_TAG:
-                        case ValueTag.XS_G_MONTH_TAG:
-                        case ValueTag.XS_G_YEAR_MONTH_TAG:
-                        case ValueTag.XS_G_YEAR_TAG:
-                        case ValueTag.XS_QNAME_TAG:
-                        case ValueTag.XS_STRING_TAG:
-                        case ValueTag.XS_TIME_TAG:
-                        case ValueTag.XS_UNTYPED_ATOMIC_TAG:
-                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                            return tid;
-                        case ValueTag.XS_DECIMAL_TAG:
-                        case ValueTag.XS_DOUBLE_TAG:
-                        case ValueTag.XS_FLOAT_TAG:
-                        case ValueTag.XS_INTEGER_TAG:
-                        case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                        case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                        case ValueTag.XS_LONG_TAG:
-                        case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                        case ValueTag.XS_UNSIGNED_LONG_TAG:
-                        case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                        case ValueTag.XS_INT_TAG:
-                        case ValueTag.XS_UNSIGNED_INT_TAG:
-                        case ValueTag.XS_SHORT_TAG:
-                        case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                        case ValueTag.XS_BYTE_TAG:
-                        case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                            return ValueTag.XS_DOUBLE_TAG;
-
-                        case ValueTag.XS_ANY_ATOMIC_TAG:
-                            throw new SystemException(ErrorCode.XPTY0004);
-
-                        default:
-                            tid = BuiltinTypeRegistry.INSTANCE.getSchemaTypeById(tid).getBaseType().getTypeId();
-                    }
-                }
+                return FunctionHelper.compareTaggedValues(aOp, tvp1, tvp2, dCtx);
             }
 
             private void getCastToOperator(int tid) {
@@ -642,23 +351,5 @@ public abstract class AbstractGeneralCom
         };
     }
 
-    private static class TypedPointables {
-        BooleanPointable boolp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
-        BytePointable bytep = (BytePointable) BytePointable.FACTORY.createPointable();
-        DoublePointable doublep = (DoublePointable) DoublePointable.FACTORY.createPointable();
-        FloatPointable floatp = (FloatPointable) FloatPointable.FACTORY.createPointable();
-        IntegerPointable intp = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
-        LongPointable longp = (LongPointable) LongPointable.FACTORY.createPointable();
-        ShortPointable shortp = (ShortPointable) ShortPointable.FACTORY.createPointable();
-        UTF8StringPointable utf8sp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
-        XSBinaryPointable binaryp = (XSBinaryPointable) XSBinaryPointable.FACTORY.createPointable();
-        XSDatePointable datep = (XSDatePointable) XSDatePointable.FACTORY.createPointable();
-        XSDateTimePointable datetimep = (XSDateTimePointable) XSDateTimePointable.FACTORY.createPointable();
-        XSDecimalPointable decp = (XSDecimalPointable) XSDecimalPointable.FACTORY.createPointable();
-        XSDurationPointable durationp = (XSDurationPointable) XSDurationPointable.FACTORY.createPointable();
-        XSTimePointable timep = (XSTimePointable) XSTimePointable.FACTORY.createPointable();
-        XSQNamePointable qnamep = (XSQNamePointable) XSQNamePointable.FACTORY.createPointable();
-    }
-
     protected abstract AbstractValueComparisonOperation createValueComparisonOperation();
 }
\ No newline at end of file

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnPrefixFromQNameScalarEvaluatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnPrefixFromQNameScalarEvaluatorFactory.java?rev=1387834&r1=1387833&r2=1387834&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnPrefixFromQNameScalarEvaluatorFactory.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnPrefixFromQNameScalarEvaluatorFactory.java Thu Sep 20 01:04:42 2012
@@ -52,6 +52,8 @@ public class FnPrefixFromQNameScalarEval
             protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
                 TaggedValuePointable tvp1 = args[0];
 
+                // TODO return empty sequence if argument is empty sequence.
+
                 // Only accept a strings.
                 if (tvp1.getTag() != ValueTag.XS_QNAME_TAG) {
                     throw new SystemException(ErrorCode.FORG0006);
@@ -59,6 +61,7 @@ public class FnPrefixFromQNameScalarEval
                 tvp1.getValue(qnamep);
 
                 try {
+                    // TODO return empty sequence if no prefix.
                     abvs.reset();
                     dOut.write(ValueTag.XS_NCNAME_TAG);
                     dOut.write(qnamep.getByteArray(), qnamep.getStartOffset() + qnamep.getUriLength(),

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnDistinctValuesScalarEvaluatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnDistinctValuesScalarEvaluatorFactory.java?rev=1387834&r1=1387833&r2=1387834&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnDistinctValuesScalarEvaluatorFactory.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnDistinctValuesScalarEvaluatorFactory.java Thu Sep 20 01:04:42 2012
@@ -28,8 +28,8 @@ import org.apache.vxquery.exceptions.Sys
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonOperation;
-import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.comparison.ValueEqComparisonOperation;
+import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -92,8 +92,7 @@ public class FnDistinctValuesScalarEvalu
                                 for (int k = j + 1; k < seqLen; ++k) {
                                     seq.getEntry(k, p);
                                     tvpCheck.set(p.getByteArray(), p.getStartOffset(), p.getLength());
-                                    if (AbstractValueComparisonScalarEvaluatorFactory.compareTaggedValues(aOp,
-                                            tvpDistinct, tvpCheck, dCtx)) {
+                                    if (FunctionHelper.compareTaggedValues(aOp, tvpDistinct, tvpCheck, dCtx)) {
                                         found = true;
                                         break;
                                     }

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnIndexOfScalarEvaluatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnIndexOfScalarEvaluatorFactory.java?rev=1387834&r1=1387833&r2=1387834&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnIndexOfScalarEvaluatorFactory.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnIndexOfScalarEvaluatorFactory.java Thu Sep 20 01:04:42 2012
@@ -29,8 +29,8 @@ import org.apache.vxquery.exceptions.Sys
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonOperation;
-import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.comparison.ValueEqComparisonOperation;
+import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -75,7 +75,7 @@ public class FnIndexOfScalarEvaluatorFac
                         for (int j = 0; j < seqLen; ++j) {
                             seq.getEntry(j, p);
                             tvp.set(p.getByteArray(), p.getStartOffset(), p.getLength());
-                            if (AbstractValueComparisonScalarEvaluatorFactory.compareTaggedValues(aOp, tvp, tvp2, dCtx)) {
+                            if (FunctionHelper.compareTaggedValues(aOp, tvp, tvp2, dCtx)) {
                                 abvsInner.reset();
                                 dOutInner.write(ValueTag.XS_INTEGER_TAG);
                                 dOutInner.writeLong(j + 1);
@@ -83,7 +83,7 @@ public class FnIndexOfScalarEvaluatorFac
                             }
                         }
                     } else {
-                        if (AbstractValueComparisonScalarEvaluatorFactory.compareTaggedValues(aOp, tvp1, tvp2, dCtx)) {
+                        if (FunctionHelper.compareTaggedValues(aOp, tvp1, tvp2, dCtx)) {
                             abvsInner.reset();
                             dOutInner.write(ValueTag.XS_INTEGER_TAG);
                             dOutInner.writeLong(1);

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java?rev=1387834&r1=1387833&r2=1387834&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java Thu Sep 20 01:04:42 2012
@@ -19,6 +19,7 @@ package org.apache.vxquery.runtime.funct
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSBinaryPointable;
@@ -33,6 +34,7 @@ import org.apache.vxquery.datamodel.util
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.exceptions.ErrorCode;
 import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonOperation;
 import org.apache.vxquery.types.BuiltinTypeConstants;
 import org.apache.vxquery.types.BuiltinTypeRegistry;
 
@@ -274,8 +276,9 @@ public class FunctionHelper {
         dOut.writeDouble(value);
     }
 
-    public static void getIntegerPointable(TypedPointables tp, TaggedValuePointable tvp, DataOutput dOut)
-            throws SystemException, IOException {
+    public static void getIntegerPointable(TaggedValuePointable tvp, DataOutput dOut) throws SystemException,
+            IOException {
+        TypedPointables tp = new TypedPointables();
         long value;
         switch (tvp.getTag()) {
             case ValueTag.XS_INTEGER_TAG:
@@ -365,4 +368,356 @@ public class FunctionHelper {
         }
         return false;
     }
+
+    public static boolean compareTaggedValues(AbstractValueComparisonOperation aOp, TaggedValuePointable tvp1,
+            TaggedValuePointable tvp2, DynamicContext dCtx) throws SystemException {
+        final TypedPointables tp1 = new TypedPointables();
+        final TypedPointables tp2 = new TypedPointables();
+
+        boolean booleanResult = false;
+        int tid1 = getBaseTypeForComparisons(tvp1.getTag());
+        int tid2 = getBaseTypeForComparisons(tvp2.getTag());
+        try {
+            switch (tid1) {
+                case ValueTag.XS_DECIMAL_TAG:
+                    tvp1.getValue(tp1.decp);
+                    switch (tid2) {
+                        case ValueTag.XS_DECIMAL_TAG:
+                            tvp2.getValue(tp2.decp);
+                            booleanResult = aOp.operateDecimalDecimal(tp1.decp, tp2.decp);
+                            break;
+
+                        case ValueTag.XS_INTEGER_TAG:
+                            tvp2.getValue(tp2.longp);
+                            booleanResult = aOp.operateDecimalInteger(tp1.decp, tp2.longp);
+                            break;
+
+                        case ValueTag.XS_FLOAT_TAG:
+                            tvp2.getValue(tp2.floatp);
+                            booleanResult = aOp.operateDecimalFloat(tp1.decp, tp2.floatp);
+                            break;
+
+                        case ValueTag.XS_DOUBLE_TAG:
+                            tvp2.getValue(tp2.doublep);
+                            booleanResult = aOp.operateDecimalDouble(tp1.decp, tp2.doublep);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_INTEGER_TAG:
+                    tvp1.getValue(tp1.longp);
+                    switch (tid2) {
+                        case ValueTag.XS_DECIMAL_TAG:
+                            tvp2.getValue(tp2.decp);
+                            booleanResult = aOp.operateIntegerDecimal(tp1.longp, tp2.decp);
+                            break;
+
+                        case ValueTag.XS_INTEGER_TAG:
+                            tvp2.getValue(tp2.longp);
+                            booleanResult = aOp.operateIntegerInteger(tp1.longp, tp2.longp);
+                            break;
+
+                        case ValueTag.XS_FLOAT_TAG:
+                            tvp2.getValue(tp2.floatp);
+                            booleanResult = aOp.operateIntegerFloat(tp1.longp, tp2.floatp);
+                            break;
+
+                        case ValueTag.XS_DOUBLE_TAG:
+                            tvp2.getValue(tp2.doublep);
+                            booleanResult = aOp.operateIntegerDouble(tp1.longp, tp2.doublep);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_FLOAT_TAG:
+                    tvp1.getValue(tp1.floatp);
+                    switch (tid2) {
+                        case ValueTag.XS_DECIMAL_TAG:
+                            tvp2.getValue(tp2.decp);
+                            booleanResult = aOp.operateFloatDecimal(tp1.floatp, tp2.decp);
+                            break;
+
+                        case ValueTag.XS_INTEGER_TAG:
+                            tvp2.getValue(tp2.longp);
+                            booleanResult = aOp.operateFloatInteger(tp1.floatp, tp2.longp);
+                            break;
+
+                        case ValueTag.XS_FLOAT_TAG:
+                            tvp2.getValue(tp2.floatp);
+                            booleanResult = aOp.operateFloatFloat(tp1.floatp, tp2.floatp);
+                            break;
+
+                        case ValueTag.XS_DOUBLE_TAG:
+                            tvp2.getValue(tp2.doublep);
+                            booleanResult = aOp.operateFloatDouble(tp1.floatp, tp2.doublep);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_DOUBLE_TAG:
+                    tvp1.getValue(tp1.doublep);
+                    switch (tid2) {
+                        case ValueTag.XS_DECIMAL_TAG:
+                            tvp2.getValue(tp2.decp);
+                            booleanResult = aOp.operateDoubleDecimal(tp1.doublep, tp2.decp);
+                            break;
+
+                        case ValueTag.XS_INTEGER_TAG:
+                            tvp2.getValue(tp2.longp);
+                            booleanResult = aOp.operateDoubleInteger(tp1.doublep, tp2.longp);
+                            break;
+
+                        case ValueTag.XS_FLOAT_TAG:
+                            tvp2.getValue(tp2.floatp);
+                            booleanResult = aOp.operateDoubleFloat(tp1.doublep, tp2.floatp);
+                            break;
+
+                        case ValueTag.XS_DOUBLE_TAG:
+                            tvp2.getValue(tp2.doublep);
+                            booleanResult = aOp.operateDoubleDouble(tp1.doublep, tp2.doublep);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_BOOLEAN_TAG:
+                    tvp1.getValue(tp1.boolp);
+                    switch (tid2) {
+                        case ValueTag.XS_BOOLEAN_TAG:
+                            tvp2.getValue(tp2.boolp);
+                            booleanResult = aOp.operateBooleanBoolean(tp1.boolp, tp2.boolp);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_STRING_TAG:
+                case ValueTag.XS_NORMALIZED_STRING_TAG:
+                case ValueTag.XS_TOKEN_TAG:
+                case ValueTag.XS_LANGUAGE_TAG:
+                case ValueTag.XS_NMTOKEN_TAG:
+                case ValueTag.XS_NAME_TAG:
+                case ValueTag.XS_NCNAME_TAG:
+                case ValueTag.XS_ID_TAG:
+                case ValueTag.XS_IDREF_TAG:
+                case ValueTag.XS_ENTITY_TAG:
+                case ValueTag.XS_UNTYPED_ATOMIC_TAG:
+                    tvp1.getValue(tp1.utf8sp);
+                    switch (tid2) {
+                        case ValueTag.XS_STRING_TAG:
+                        case ValueTag.XS_NORMALIZED_STRING_TAG:
+                        case ValueTag.XS_TOKEN_TAG:
+                        case ValueTag.XS_LANGUAGE_TAG:
+                        case ValueTag.XS_NMTOKEN_TAG:
+                        case ValueTag.XS_NAME_TAG:
+                        case ValueTag.XS_NCNAME_TAG:
+                        case ValueTag.XS_ID_TAG:
+                        case ValueTag.XS_IDREF_TAG:
+                        case ValueTag.XS_ENTITY_TAG:
+                        case ValueTag.XS_UNTYPED_ATOMIC_TAG:
+                            tvp2.getValue(tp2.utf8sp);
+                            booleanResult = aOp.operateStringString(tp1.utf8sp, tp2.utf8sp);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_DATE_TAG:
+                    tvp1.getValue(tp1.datep);
+                    switch (tid2) {
+                        case ValueTag.XS_DATE_TAG:
+                            tvp2.getValue(tp2.datep);
+                            booleanResult = aOp.operateDateDate(tp1.datep, tp2.datep, dCtx);
+                            break;
+                        default:
+                            // Cross comparisons between DateTime, Date and Time are not supported.
+                            throw new SystemException(ErrorCode.XPTY0004);
+                    }
+                    break;
+
+                case ValueTag.XS_DATETIME_TAG:
+                    tvp1.getValue(tp1.datetimep);
+                    switch (tid2) {
+                        case ValueTag.XS_DATETIME_TAG:
+                            tvp2.getValue(tp2.datetimep);
+                            booleanResult = aOp.operateDatetimeDatetime(tp1.datetimep, tp2.datetimep, dCtx);
+                            break;
+                        default:
+                            // Cross comparisons between DateTime, Date and Time are not supported.
+                            throw new SystemException(ErrorCode.XPTY0004);
+                    }
+                    break;
+
+                case ValueTag.XS_TIME_TAG:
+                    tvp1.getValue(tp1.timep);
+                    switch (tid2) {
+                        case ValueTag.XS_TIME_TAG:
+                            tvp2.getValue(tp2.timep);
+                            booleanResult = aOp.operateTimeTime(tp1.timep, tp2.timep, dCtx);
+                            break;
+                        default:
+                            // Cross comparisons between DateTime, Date and Time are not supported.
+                            throw new SystemException(ErrorCode.XPTY0004);
+                    }
+                    break;
+
+                case ValueTag.XS_DURATION_TAG:
+                    tvp1.getValue(tp1.durationp);
+                    switch (tid2) {
+                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
+                            tvp2.getValue(tp2.longp);
+                            booleanResult = aOp.operateDurationDTDuration(tp1.durationp, tp2.longp);
+                            break;
+                        case ValueTag.XS_DURATION_TAG:
+                            tvp2.getValue(tp2.durationp);
+                            booleanResult = aOp.operateDurationDuration(tp1.durationp, tp2.durationp);
+                            break;
+                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
+                            tvp2.getValue(tp2.intp);
+                            booleanResult = aOp.operateDurationYMDuration(tp1.durationp, tp2.intp);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_DAY_TIME_DURATION_TAG:
+                    tvp1.getValue(tp1.longp);
+                    switch (tid2) {
+                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
+                            tvp2.getValue(tp2.longp);
+                            booleanResult = aOp.operateDTDurationDTDuration(tp1.longp, tp2.longp);
+                            break;
+                        case ValueTag.XS_DURATION_TAG:
+                            tvp2.getValue(tp2.durationp);
+                            booleanResult = aOp.operateDTDurationDuration(tp1.longp, tp2.durationp);
+                            break;
+                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
+                            tvp2.getValue(tp2.intp);
+                            booleanResult = aOp.operateDTDurationYMDuration(tp1.longp, tp2.intp);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
+                    tvp1.getValue(tp1.intp);
+                    switch (tid2) {
+                        case ValueTag.XS_DAY_TIME_DURATION_TAG:
+                            tvp2.getValue(tp2.longp);
+                            booleanResult = aOp.operateYMDurationDTDuration(tp1.intp, tp2.longp);
+                            break;
+                        case ValueTag.XS_DURATION_TAG:
+                            tvp2.getValue(tp2.durationp);
+                            booleanResult = aOp.operateYMDurationDuration(tp1.intp, tp2.durationp);
+                            break;
+                        case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
+                            tvp2.getValue(tp2.intp);
+                            booleanResult = aOp.operateYMDurationYMDuration(tp1.intp, tp2.intp);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_G_DAY_TAG:
+                    tvp1.getValue(tp1.datep);
+                    switch (tid2) {
+                        case ValueTag.XS_G_DAY_TAG:
+                            tvp2.getValue(tp2.datep);
+                            booleanResult = aOp.operateGDayGDay(tp1.datep, tp2.datep, dCtx);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_G_MONTH_DAY_TAG:
+                    tvp1.getValue(tp1.datep);
+                    switch (tid2) {
+                        case ValueTag.XS_G_MONTH_DAY_TAG:
+                            tvp2.getValue(tp2.datep);
+                            booleanResult = aOp.operateGMonthDayGMonthDay(tp1.datep, tp2.datep, dCtx);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_G_MONTH_TAG:
+                    tvp1.getValue(tp1.datep);
+                    switch (tid2) {
+                        case ValueTag.XS_G_MONTH_TAG:
+                            tvp2.getValue(tp2.datep);
+                            booleanResult = aOp.operateGMonthGMonth(tp1.datep, tp2.datep, dCtx);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_G_YEAR_MONTH_TAG:
+                    tvp1.getValue(tp1.datep);
+                    switch (tid2) {
+                        case ValueTag.XS_G_YEAR_MONTH_TAG:
+                            tvp2.getValue(tp2.datep);
+                            booleanResult = aOp.operateGYearMonthGYearMonth(tp1.datep, tp2.datep, dCtx);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_G_YEAR_TAG:
+                    tvp1.getValue(tp1.datep);
+                    switch (tid2) {
+                        case ValueTag.XS_G_YEAR_TAG:
+                            tvp2.getValue(tp2.datep);
+                            booleanResult = aOp.operateGYearGYear(tp1.datep, tp2.datep, dCtx);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_HEX_BINARY_TAG:
+                    tvp1.getValue(tp1.binaryp);
+                    switch (tid2) {
+                        case ValueTag.XS_HEX_BINARY_TAG:
+                            tvp2.getValue(tp2.binaryp);
+                            booleanResult = aOp.operateHexBinaryHexBinary(tp1.binaryp, tp2.binaryp);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_BASE64_BINARY_TAG:
+                    tvp1.getValue(tp1.binaryp);
+                    switch (tid2) {
+                        case ValueTag.XS_BASE64_BINARY_TAG:
+                            tvp2.getValue(tp2.binaryp);
+                            booleanResult = aOp.operateBase64BinaryBase64Binary(tp1.binaryp, tp2.binaryp);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_ANY_URI_TAG:
+                    tvp1.getValue(tp1.utf8sp);
+                    switch (tid2) {
+                        case ValueTag.XS_ANY_URI_TAG:
+                            tvp2.getValue(tp2.utf8sp);
+                            booleanResult = aOp.operateAnyURIAnyURI(tp1.utf8sp, tp2.utf8sp);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_QNAME_TAG:
+                    tvp1.getValue(tp1.qnamep);
+                    switch (tid2) {
+                        case ValueTag.XS_QNAME_TAG:
+                            tvp2.getValue(tp2.qnamep);
+                            booleanResult = aOp.operateQNameQName(tp1.qnamep, tp2.qnamep);
+                            break;
+                    }
+                    break;
+
+                case ValueTag.XS_NOTATION_TAG:
+                    tvp1.getValue(tp1.utf8sp);
+                    switch (tid2) {
+                        case ValueTag.XS_NOTATION_TAG:
+                            tvp2.getValue(tp2.utf8sp);
+                            booleanResult = aOp.operateNotationNotation(tp1.utf8sp, tp2.utf8sp);
+                            break;
+                    }
+                    break;
+            }
+            return booleanResult;
+
+        } catch (SystemException se) {
+            throw se;
+        } catch (Exception e) {
+            throw new SystemException(ErrorCode.SYSE0001, e);
+        }
+    }
 }



Mime
View raw message