Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 146320 Details for
Bug 280555
[xpath2] fn:compare returns XPST0017
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Finished patch
compare-collation-patch-3.txt (text/plain), 93.98 KB, created by
Jesper Moller
on 2009-09-02 16:16:44 EDT
(
hide
)
Description:
Finished patch
Filename:
MIME Type:
Creator:
Jesper Moller
Created:
2009-09-02 16:16:44 EDT
Size:
93.98 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.xml.xpath2.processor.tests >Index: src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java,v >retrieving revision 1.30 >diff -u -r1.30 AbstractPsychoPathTest.java >--- src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java 20 Aug 2009 21:48:25 -0000 1.30 >+++ src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java 2 Sep 2009 20:17:11 -0000 >@@ -13,7 +13,8 @@ > * Jesper S Moller - bug 283404 - fixed locale > * Jesper S Moller - bug 281159 - fix document URIs and also filter XML namespace > * Jesper S Moller - bug 275610 - Avoid big time and memory overhead for externals >- * Jesper Steen Moeller - bug 282096 - make test harness handle all string encoding translate function surrogate aware >+ * Jesper Steen Moeller - bug 282096 - make test harness handle all string encoding >+ * Jesper Steen Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > package org.eclipse.wst.xml.xpath2.processor.test; > >@@ -173,8 +174,10 @@ > return xsGrammars[0].toXSModel(xsGrammars); > } > >- protected DynamicContext setupDynamicContext(XSModel schema) { >- DynamicContext dc = dynamicContext = new DefaultDynamicContext(schema, domDoc); >+ protected DefaultDynamicContext setupDynamicContext(XSModel schema) { >+ DefaultDynamicContext dc = new DefaultDynamicContext(schema, domDoc); >+ dynamicContext = dc; >+ > dc.add_namespace("xs", "http://www.w3.org/2001/XMLSchema"); > dc.add_namespace("xsd", "http://www.w3.org/2001/XMLSchema"); > dc.add_namespace("fn", "http://www.w3.org/2005/xpath-functions"); >@@ -352,16 +355,18 @@ > protected DynamicContext setupVariables(DynamicContext dc) { > dc.add_variable(new QName("x")); > dc.add_variable(new QName("var")); >- AnyType docType = new DocType(domDoc); >- ElementType elementType = new ElementType(domDoc.getDocumentElement()); >- dc.set_variable(new QName("input-context1"), docType); >- dc.set_variable(new QName("input-context"), docType); >- if (domDoc2 == null) { >- dc.set_variable(new QName("input-context2"), docType); >- } else { >- dc.set_variable(new QName("input-context2"), (AnyType) new DocType(domDoc2)); >+ >+ if (domDoc != null) { >+ AnyType docType = new DocType(domDoc); >+ ElementType elementType = new ElementType(domDoc.getDocumentElement()); >+ dc.set_variable(new QName("input-context1"), docType); >+ dc.set_variable(new QName("input-context"), docType); >+ if (domDoc2 == null) { >+ dc.set_variable(new QName("input-context2"), docType); >+ } else { >+ dc.set_variable(new QName("input-context2"), (AnyType) new DocType(domDoc2)); >+ } > } >- > return dc; > } > >Index: src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java,v >retrieving revision 1.34 >diff -u -r1.34 TestBugs.java >--- src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java 22 Aug 2009 01:14:10 -0000 1.34 >+++ src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java 2 Sep 2009 20:17:11 -0000 >@@ -31,15 +31,19 @@ > * bug 279376 improvements to xs:yearMonthDuration division operation > * bug 281046 implementation of xs:base64Binary data type > * Jesper S Moller - bug 286061 correct handling of quoted string >+ * Jesper S Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > package org.eclipse.wst.xml.xpath2.processor.test; > > import java.net.URL; >+import java.util.Comparator; > > import javax.xml.parsers.DocumentBuilder; > import javax.xml.parsers.DocumentBuilderFactory; > > import org.apache.xerces.xs.XSModel; >+import org.eclipse.wst.xml.xpath2.processor.CollationProvider; >+import org.eclipse.wst.xml.xpath2.processor.DefaultDynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator; > import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.Evaluator; >@@ -53,6 +57,8 @@ > > public class TestBugs extends AbstractPsychoPathTest { > >+ private static final String URN_X_ECLIPSE_XPATH20_FUNKY_COLLATOR = "urn:x-eclipse:xpath20:funky-collator"; >+ > public void testStringLengthWithElementArg() throws Exception { > // Bug 273719 > URL fileURL = bundle.getEntry("/bugTestFiles/bug273719.xml"); >@@ -980,4 +986,38 @@ > assertEquals("Don't try this at \"home\", she said", resultValue); > } > >+ public void testBug280555_collations() throws Exception { >+ // Setup context >+ DefaultDynamicContext dc = setupDynamicContext(null); >+ dc.set_collation_provider(createLengthCollatorProvider()); >+ Evaluator eval = new DefaultEvaluator(dc, domDoc); >+ >+ // Parse expression >+ XPath path = compileXPath(dc, " 'abc' < 'de' "); >+ >+ // Evaluate once >+ XSBoolean bval = (XSBoolean) eval.evaluate(path).first(); >+ assertTrue("'abc' < 'def' for normal collations", bval.value()); >+ >+ // Evaluate again with the funny collator >+ dc.set_default_collation(URN_X_ECLIPSE_XPATH20_FUNKY_COLLATOR); >+ XSBoolean bval2 = (XSBoolean) eval.evaluate(path).first(); >+ assertFalse("'abc' < 'def' for normal collations", bval2.value()); >+} >+ >+ private CollationProvider createLengthCollatorProvider() { >+ return new CollationProvider() { >+ public Comparator get_collation(String name) { >+ if (name.equals(URN_X_ECLIPSE_XPATH20_FUNKY_COLLATOR)) { >+ return new Comparator<String>() { >+ public int compare(String o1, String o2) { >+ return o1.length() - o2.length(); >+ } >+ }; >+ } >+ return null; >+ } >+ }; >+ } >+ > } >#P org.eclipse.wst.xml.xpath2.processor >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBase64Binary.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBase64Binary.java,v >retrieving revision 1.3 >diff -u -r1.3 XSBase64Binary.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBase64Binary.java 10 Jul 2009 03:43:59 -0000 1.3 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBase64Binary.java 2 Sep 2009 20:17:14 -0000 >@@ -13,6 +13,7 @@ > > import org.apache.xerces.impl.dv.util.Base64; > import org.apache.xerces.impl.dv.util.HexBin; >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -147,7 +148,7 @@ > * > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > String valToCompare = arg.string_value(); > > byte[] value1 = Base64.decode(_value); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGYearMonth.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGYearMonth.java,v >retrieving revision 1.4 >diff -u -r1.4 XSGYearMonth.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGYearMonth.java 8 Jul 2009 02:21:45 -0000 1.4 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGYearMonth.java 2 Sep 2009 20:17:14 -0000 >@@ -12,6 +12,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -282,7 +283,7 @@ > * False otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSGYearMonth val = (XSGYearMonth) NumericType.get_single_type(arg, > XSGYearMonth.class); > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDuration.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDuration.java,v >retrieving revision 1.6 >diff -u -r1.6 XSDuration.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDuration.java 16 Jul 2009 17:22:37 -0000 1.6 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDuration.java 2 Sep 2009 20:17:14 -0000 >@@ -14,6 +14,7 @@ > > import java.math.BigInteger; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -229,7 +230,7 @@ > * @return True if they both represent the duration of time. False otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSDuration val = (XSDuration) NumericType.get_single_type(arg, > XSDuration.class); > >@@ -245,7 +246,7 @@ > * stored. False otherwise > * @throws DynamicError > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > XSDuration val = (XSDuration) NumericType.get_single_type(arg, > XSDayTimeDuration.class); > >@@ -261,7 +262,7 @@ > * stored. False otherwise > * @throws DynamicError > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > XSDuration val = (XSDuration) NumericType.get_single_type(arg, > XSDayTimeDuration.class); > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGMonth.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGMonth.java,v >retrieving revision 1.5 >diff -u -r1.5 XSGMonth.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGMonth.java 8 Jul 2009 02:21:45 -0000 1.5 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGMonth.java 2 Sep 2009 20:17:14 -0000 >@@ -12,6 +12,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -279,7 +280,7 @@ > * otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSGMonth val = (XSGMonth) NumericType.get_single_type(arg, > XSGMonth.class); > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSFloat.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSFloat.java,v >retrieving revision 1.17 >diff -u -r1.17 XSFloat.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSFloat.java 14 Aug 2009 04:25:31 -0000 1.17 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSFloat.java 2 Sep 2009 20:17:14 -0000 >@@ -22,6 +22,7 @@ > import java.text.DecimalFormat; > import java.util.Iterator; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -194,14 +195,14 @@ > > /** > * Equality comparison between this number and the supplied representation. >- * > * @param aa > * The datatype to compare with >+ * > * @return True if the two representations are of the same number. False > * otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType aa) throws DynamicError { >+ public boolean eq(AnyType aa, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(aa); > if (!(carg instanceof XSFloat)) > DynamicError.throw_type_error(); >@@ -220,7 +221,7 @@ > * one stored. False otherwise > * @throws DynamicError > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(arg); > XSFloat val = (XSFloat) get_single_type(carg, XSFloat.class); > return float_value() > val.float_value(); >@@ -235,7 +236,7 @@ > * one stored. False otherwise > * @throws DynamicError > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(arg); > XSFloat val = (XSFloat) get_single_type(carg, XSFloat.class); > return float_value() < val.float_value(); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/QName.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/QName.java,v >retrieving revision 1.3 >diff -u -r1.3 QName.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/QName.java 5 Aug 2009 01:58:39 -0000 1.3 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/QName.java 2 Sep 2009 20:17:13 -0000 >@@ -12,6 +12,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -321,7 +322,7 @@ > * @return True if the two represent the same node. False otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > QName val = (QName) NumericType.get_single_type(arg, QName.class); > return equals(val); > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDouble.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDouble.java,v >retrieving revision 1.19 >diff -u -r1.19 XSDouble.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDouble.java 14 Aug 2009 04:25:31 -0000 1.19 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDouble.java 2 Sep 2009 20:17:14 -0000 >@@ -22,6 +22,7 @@ > import java.math.RoundingMode; > import java.util.Iterator; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -241,15 +242,15 @@ > > /** > * Equality comparison between this number and the supplied representation. >- * > * @param aa > * Representation to be compared with (must currently be of type > * XSDouble) >+ * > * @return True if the 2 representations represent the same number. False > * otherwise > * @since 1.1 > */ >- public boolean eq(AnyType aa) throws DynamicError { >+ public boolean eq(AnyType aa, DynamicContext context) throws DynamicError { > ResultSequence rs = ResultSequenceFactory.create_new(aa); > ResultSequence crs = constructor(rs); > >@@ -272,7 +273,7 @@ > * @return True if the supplied type represents a number smaller than this > * one stored. False otherwise > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(arg); > > XSDouble val = (XSDouble) get_single_type(carg, XSDouble.class); >@@ -297,7 +298,7 @@ > * @return True if the supplied type represents a number greater than this > * one stored. False otherwise > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(arg); > > XSDouble val = (XSDouble) get_single_type(carg, XSDouble.class); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDate.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDate.java,v >retrieving revision 1.9 >diff -u -r1.9 XSDate.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDate.java 10 Jul 2009 03:43:59 -0000 1.9 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDate.java 2 Sep 2009 20:17:14 -0000 >@@ -15,6 +15,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -343,7 +344,7 @@ > * @return True if the two dates are represent the same exact point in time. > * False otherwise. > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSDate val = (XSDate) NumericType.get_single_type(arg, XSDate.class); > > return calendar().equals(val.calendar()); >@@ -358,7 +359,7 @@ > * @return True if in time, this date lies before the date supplied. False > * otherwise. > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > XSDate val = (XSDate) NumericType.get_single_type(arg, XSDate.class); > > return calendar().before(val.calendar()); >@@ -373,7 +374,7 @@ > * @return True if in time, this date lies after the date supplied. False > * otherwise. > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > XSDate val = (XSDate) NumericType.get_single_type(arg, XSDate.class); > > return calendar().after(val.calendar()); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGDay.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGDay.java,v >retrieving revision 1.7 >diff -u -r1.7 XSGDay.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGDay.java 10 Jul 2009 03:43:59 -0000 1.7 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGDay.java 2 Sep 2009 20:17:14 -0000 >@@ -13,6 +13,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -298,7 +299,7 @@ > * otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSGDay val = (XSGDay) NumericType.get_single_type(arg, XSGDay.class); > > return calendar().equals(val.calendar()); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSHexBinary.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSHexBinary.java,v >retrieving revision 1.5 >diff -u -r1.5 XSHexBinary.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSHexBinary.java 10 Jul 2009 03:43:59 -0000 1.5 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSHexBinary.java 2 Sep 2009 20:17:14 -0000 >@@ -14,6 +14,7 @@ > > import org.apache.xerces.impl.dv.util.Base64; > import org.apache.xerces.impl.dv.util.HexBin; >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -163,7 +164,7 @@ > * > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > String valToCompare = arg.string_value(); > > byte[] value1 = HexBin.decode(_value); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSAnyURI.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSAnyURI.java,v >retrieving revision 1.5 >diff -u -r1.5 XSAnyURI.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSAnyURI.java 5 Aug 2009 01:58:39 -0000 1.5 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSAnyURI.java 2 Sep 2009 20:17:14 -0000 >@@ -19,6 +19,7 @@ > import java.util.ArrayList; > import java.util.Collection; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -122,7 +123,7 @@ > * otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > if (arg instanceof XSAnyURI || arg instanceof XSString) { > if (this.string_value().equals(arg.string_value())) { > return true; >@@ -139,7 +140,7 @@ > * must be of type xs:anyURI (or, by promotion of this, xs:string) > * @since 1.1 > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > if (!(arg instanceof XSAnyURI || arg instanceof XSString)) { > throw DynamicError.throw_type_error(); > } >@@ -159,7 +160,7 @@ > * > * @since 1.1 > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > if (!(arg instanceof XSAnyURI || arg instanceof XSString)) { > throw DynamicError.throw_type_error(); > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBoolean.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBoolean.java,v >retrieving revision 1.3 >diff -u -r1.3 XSBoolean.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBoolean.java 2 Jul 2009 23:24:03 -0000 1.3 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBoolean.java 2 Sep 2009 20:17:14 -0000 >@@ -13,6 +13,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -144,7 +145,7 @@ > * @return New XSBoolean representation of true/false result of the equality > * comparison > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSBoolean barg = (XSBoolean) NumericType.get_single_type(arg, > XSBoolean.class); > >@@ -163,7 +164,7 @@ > * @return New XSBoolean representation of true/false result of the > * comparison > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > XSBoolean barg = (XSBoolean) NumericType.get_single_type(arg, > XSBoolean.class); > >@@ -186,7 +187,7 @@ > * @return New XSBoolean representation of true/false result of the > * comparison > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > XSBoolean barg = (XSBoolean) NumericType.get_single_type(arg, > XSBoolean.class); > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSInteger.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSInteger.java,v >retrieving revision 1.12 >diff -u -r1.12 XSInteger.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSInteger.java 31 Jul 2009 21:43:32 -0000 1.12 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSInteger.java 2 Sep 2009 20:17:14 -0000 >@@ -20,6 +20,7 @@ > import java.math.RoundingMode; > import java.util.Iterator; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -292,7 +293,7 @@ > * (non-Javadoc) > * @see org.eclipse.wst.xml.xpath2.processor.internal.types.XSDecimal#gt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(arg); > XSInteger val = (XSInteger) get_single_type(carg, XSInteger.class); > >@@ -312,7 +313,7 @@ > * (non-Javadoc) > * @see org.eclipse.wst.xml.xpath2.processor.internal.types.XSDecimal#lt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(arg); > XSInteger val = (XSInteger) get_single_type(carg, XSInteger.class); > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDecimal.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDecimal.java,v >retrieving revision 1.17 >diff -u -r1.17 XSDecimal.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDecimal.java 31 Jul 2009 15:39:38 -0000 1.17 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDecimal.java 2 Sep 2009 20:17:14 -0000 >@@ -20,6 +20,7 @@ > import java.math.RoundingMode; > import java.util.Iterator; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -189,15 +190,15 @@ > // comparisons > /** > * Equality comparison between this number and the supplied representation. >- * >- * > * @param at > * Representation to be compared with (must currently be of type > * XSDecimal) >+ * >+ * > * @return True if the 2 representation represent the same number. False > * otherwise > */ >- public boolean eq(AnyType at) throws DynamicError { >+ public boolean eq(AnyType at, DynamicContext context) throws DynamicError { > > ResultSequence rs = ResultSequenceFactory.create_new(at); > >@@ -221,7 +222,7 @@ > * @return True if the supplied type represents a number smaller than this > * one stored. False otherwise > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(arg); > > XSDecimal val = (XSDecimal) get_single_type(carg, XSDecimal.class); >@@ -244,7 +245,7 @@ > * @return True if the supplied type represents a number greater than this > * one stored. False otherwise > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > AnyType carg = convertArg(arg); > XSDecimal val = (XSDecimal) get_single_type(carg, XSDecimal.class); > return (_value.compareTo(val.getValue()) == -1); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSString.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSString.java,v >retrieving revision 1.8 >diff -u -r1.8 XSString.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSString.java 23 Aug 2009 20:55:54 -0000 1.8 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSString.java 2 Sep 2009 20:17:14 -0000 >@@ -9,16 +9,21 @@ > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 > * Mukul Gandhi - improved comparison of xs:string with other XDM types > * Jesper S Moller - bug 286061 correct handling of quoted string >+ * Jesper S Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import java.math.BigInteger; >+ >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >-import org.eclipse.wst.xml.xpath2.processor.internal.function.*; >- >-import java.util.*; >+import org.eclipse.wst.xml.xpath2.processor.internal.function.CmpEq; >+import org.eclipse.wst.xml.xpath2.processor.internal.function.CmpGt; >+import org.eclipse.wst.xml.xpath2.processor.internal.function.CmpLt; >+import org.eclipse.wst.xml.xpath2.processor.internal.function.FnCompare; > > /** > * A representation of the String datatype >@@ -112,21 +117,17 @@ > // comparisons > > // 666 indicates death [compare returned empty seq] >- private int do_compare(AnyType arg) throws DynamicError { >- Collection args = new ArrayList(); >+ private int do_compare(AnyType arg, DynamicContext dc) throws DynamicError { > >- ResultSequence rs = ResultSequenceFactory.create_new(this); >- args.add(rs); >- args.add(ResultSequenceFactory.create_new(new >- XSString(arg.string_value()))); >- rs = FnCompare.compare(args); >- >- if (rs.empty()) >- return 666; >+ ResultSequence rs = ResultSequenceFactory.create_new(); >+ // XXX: This can't happen, I guess >+ if (arg == null) return 666; > >- XSInteger i = (XSInteger) rs.first(); >+ XSString comparand = arg instanceof XSString ? (XSString)arg : new XSString(arg.string_value()); >+ >+ BigInteger result = FnCompare.compare_string(dc.default_collation_name(), this, comparand, dc); > >- return i.int_value().intValue(); >+ return result.intValue(); > } > > /** >@@ -139,8 +140,8 @@ > * otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >- int cmp = do_compare(arg); >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { >+ int cmp = do_compare(arg, context); > > // XXX im not sure what to do here!!! because eq has to return > // something i fink.... >@@ -160,8 +161,8 @@ > * supplied. False otherwise > * @throws DynamicError > */ >- public boolean gt(AnyType arg) throws DynamicError { >- int cmp = do_compare(arg); >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { >+ int cmp = do_compare(arg, context); > > assert cmp != 666; > >@@ -178,8 +179,8 @@ > * False otherwise > * @throws DynamicError > */ >- public boolean lt(AnyType arg) throws DynamicError { >- int cmp = do_compare(arg); >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { >+ int cmp = do_compare(arg, context); > > assert cmp != 666; > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSTime.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSTime.java,v >retrieving revision 1.6 >diff -u -r1.6 XSTime.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSTime.java 7 Jul 2009 04:32:12 -0000 1.6 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSTime.java 2 Sep 2009 20:17:14 -0000 >@@ -14,6 +14,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -335,7 +336,7 @@ > * @return True if both XSTime's represent the same time. False otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSTime val = (XSTime) NumericType.get_single_type(arg, XSTime.class); > > return calendar().equals(val.calendar()); >@@ -349,7 +350,7 @@ > * @return True if the supplied time represnts a point in time after that > * represented by the time stored. False otherwise > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > XSTime val = (XSTime) NumericType.get_single_type(arg, XSTime.class); > > return calendar().before(val.calendar()); >@@ -364,7 +365,7 @@ > * represented by the time stored. False otherwise > * @throws DynamicError > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > XSTime val = (XSTime) NumericType.get_single_type(arg, XSTime.class); > > return calendar().after(val.calendar()); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGYear.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGYear.java,v >retrieving revision 1.5 >diff -u -r1.5 XSGYear.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGYear.java 8 Jul 2009 02:21:45 -0000 1.5 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGYear.java 2 Sep 2009 20:17:14 -0000 >@@ -12,6 +12,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -264,7 +265,7 @@ > * otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSGYear val = (XSGYear) NumericType.get_single_type(arg, XSGYear.class); > > return calendar().equals(val.calendar()); >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSYearMonthDuration.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSYearMonthDuration.java,v >retrieving revision 1.7 >diff -u -r1.7 XSYearMonthDuration.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSYearMonthDuration.java 16 Jul 2009 17:22:37 -0000 1.7 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSYearMonthDuration.java 2 Sep 2009 20:17:14 -0000 >@@ -17,6 +17,7 @@ > > import java.math.BigDecimal; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -277,7 +278,7 @@ > * @return True if they both represent the duration of time. False otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > if (arg instanceof XSDayTimeDuration) { > XSDayTimeDuration dayTimeDuration = (XSDayTimeDuration)arg; > return (monthValue() == 0 && dayTimeDuration.value() == 0.0); >@@ -287,7 +288,7 @@ > } > XSDuration val = (XSDuration) NumericType > .get_single_type(arg, XSDuration.class); >- return super.eq(val); >+ return super.eq(val, context); > } > > /** >@@ -299,7 +300,7 @@ > * stored. False otherwise > * @throws DynamicError > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > XSYearMonthDuration val = (XSYearMonthDuration) NumericType > .get_single_type(arg, XSYearMonthDuration.class); > >@@ -315,7 +316,7 @@ > * stored. False otherwise > * @throws DynamicError > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > XSYearMonthDuration val = (XSYearMonthDuration) NumericType > .get_single_type(arg, XSYearMonthDuration.class); > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDateTime.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDateTime.java,v >retrieving revision 1.9 >diff -u -r1.9 XSDateTime.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDateTime.java 23 Aug 2009 19:57:00 -0000 1.9 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSDateTime.java 2 Sep 2009 20:17:14 -0000 >@@ -15,6 +15,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -759,7 +760,7 @@ > * @return True if the two dates and times are represent the same exact > * point in time. False otherwise. > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSDateTime val = (XSDateTime) NumericType.get_single_type(arg, > XSDateTime.class); > >@@ -776,7 +777,7 @@ > * @return True if in time, this date and time lies before the date and time > * supplied. False otherwise. > */ >- public boolean lt(AnyType arg) throws DynamicError { >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError { > XSDateTime val = (XSDateTime) NumericType.get_single_type(arg, > XSDateTime.class); > >@@ -793,7 +794,7 @@ > * @return True if in time, this date and time lies after the date and time > * supplied. False otherwise. > */ >- public boolean gt(AnyType arg) throws DynamicError { >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError { > XSDateTime val = (XSDateTime) NumericType.get_single_type(arg, > XSDateTime.class); > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGMonthDay.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGMonthDay.java,v >retrieving revision 1.7 >diff -u -r1.7 XSGMonthDay.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGMonthDay.java 10 Jul 2009 03:43:59 -0000 1.7 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSGMonthDay.java 2 Sep 2009 20:17:14 -0000 >@@ -14,6 +14,7 @@ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -313,7 +314,7 @@ > * False otherwise > * @throws DynamicError > */ >- public boolean eq(AnyType arg) throws DynamicError { >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError { > XSGMonthDay val = (XSGMonthDay) NumericType.get_single_type(arg, > XSGMonthDay.class); > >Index: src/org/eclipse/wst/xml/xpath2/processor/DynamicError.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/DynamicError.java,v >retrieving revision 1.22 >diff -u -r1.22 DynamicError.java >--- src/org/eclipse/wst/xml/xpath2/processor/DynamicError.java 14 Aug 2009 04:44:10 -0000 1.22 >+++ src/org/eclipse/wst/xml/xpath2/processor/DynamicError.java 2 Sep 2009 20:17:13 -0000 >@@ -12,6 +12,7 @@ > * Jesper Steen Moeller - bug 28149 - add more fn:error info > * Jesper Steen Moller - bug 281159 - fix document loading and resolving URIs > * Jesper Steen Moller - Bug 286062 - Add FOAR0002 >+ * Jesper Steen Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor; >@@ -199,7 +200,25 @@ > > return new DynamicError("FOCH0001", error); > } >- >+ >+ /** >+ * Returns the dynamic error for an unsupported normalization form >+ * >+ * @param collationName >+ * is the error >+ * @return the DynamicError. >+ * @since 1.1 >+ * >+ */ >+ public static DynamicError unsupported_collation(String collationName) { >+ String error = "Unsupported collation URI. "; >+ >+ if (collationName != null) >+ error += " " + collationName; >+ >+ return new DynamicError("FOCH0002", error); >+ } >+ > /** > * Returns the dynamic error for an unsupported normalization form > * >Index: src/org/eclipse/wst/xml/xpath2/processor/DynamicContext.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/DynamicContext.java,v >retrieving revision 1.11 >diff -u -r1.11 DynamicContext.java >--- src/org/eclipse/wst/xml/xpath2/processor/DynamicContext.java 20 Aug 2009 21:48:28 -0000 1.11 >+++ src/org/eclipse/wst/xml/xpath2/processor/DynamicContext.java 2 Sep 2009 20:17:13 -0000 >@@ -12,16 +12,20 @@ > * Jesper Moller- bug 281159 - fix document loading and resolving URIs > * Jesper Moller- bug 286452 - always return the stable date/time from dynamic context > * Jesper Moller- bug 275610 - Avoid big time and memory overhead for externals >+ * Jesper Moller- bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor; > >-import org.eclipse.wst.xml.xpath2.processor.internal.Focus; >-import org.eclipse.wst.xml.xpath2.processor.internal.types.*; >- > import java.net.URI; >-import java.util.*; >-import org.w3c.dom.*; >+import java.util.Collection; >+import java.util.Comparator; >+import java.util.GregorianCalendar; >+ >+import org.eclipse.wst.xml.xpath2.processor.internal.Focus; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.QName; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration; > > /** > * Interface for dynamic context. >@@ -29,6 +33,11 @@ > public interface DynamicContext extends StaticContext { > > /** >+ * The default collation which is guaranteed to always be implemented >+ */ >+ public static final String CODEPOINT_COLLATION = "http://www.w3.org/2005/xpath-functions/collation/codepoint"; >+ >+ /** > * Get context item. > * > * @return the context item. >@@ -138,6 +147,20 @@ > * @return Focus > */ > public Focus focus(); >- >+ >+ /** >+ * Return a useful collator for the specified URI >+ * >+ * @param uri >+ * @return A Jaa collator, or null, if no such Collator exists >+ */ >+ public Comparator<Object> get_collation(String uri); >+ >+ /** >+ * Returns the current default collator >+ * >+ * @return The default name to use as the collator >+ */ >+ public String default_collation_name(); > > } >Index: src/org/eclipse/wst/xml/xpath2/processor/DefaultEvaluator.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/DefaultEvaluator.java,v >retrieving revision 1.11 >diff -u -r1.11 DefaultEvaluator.java >--- src/org/eclipse/wst/xml/xpath2/processor/DefaultEvaluator.java 20 Aug 2009 21:48:28 -0000 1.11 >+++ src/org/eclipse/wst/xml/xpath2/processor/DefaultEvaluator.java 2 Sep 2009 20:17:13 -0000 >@@ -11,6 +11,7 @@ > * Jesper Steen Moeller - bug 285145 - check arguments to op:to > * Jesper Steen Moeller - bug 262765 - fixed node state iteration > * Jesper Steen Moller - bug 275610 - Avoid big time and memory overhead for externals >+ * Jesper Steen Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor; >@@ -465,40 +466,40 @@ > > switch (cmpex.type()) { > case CmpExpr.EQ: >- return FsEq.fs_eq_value(args); >+ return FsEq.fs_eq_value(args, _dc); > > case CmpExpr.NE: >- return FsNe.fs_ne_value(args); >+ return FsNe.fs_ne_value(args, _dc); > > case CmpExpr.GT: >- return FsGt.fs_gt_value(args); >+ return FsGt.fs_gt_value(args, _dc); > > case CmpExpr.LT: >- return FsLt.fs_lt_value(args); >+ return FsLt.fs_lt_value(args, _dc); > > case CmpExpr.GE: >- return FsGe.fs_ge_value(args); >+ return FsGe.fs_ge_value(args, _dc); > > case CmpExpr.LE: >- return FsLe.fs_le_value(args); >+ return FsLe.fs_le_value(args, _dc); > > case CmpExpr.EQUALS: >- return FsEq.fs_eq_general(args); >+ return FsEq.fs_eq_general(args, _dc); > > case CmpExpr.NOTEQUALS: >- return FsNe.fs_ne_general(args); >+ return FsNe.fs_ne_general(args, _dc); > > case CmpExpr.GREATER: >- return FsGt.fs_gt_general(args); >+ return FsGt.fs_gt_general(args, _dc); > > case CmpExpr.LESSTHAN: >- return FsLt.fs_lt_general(args); >+ return FsLt.fs_lt_general(args, _dc); > > case CmpExpr.GREATEREQUAL: >- return FsGe.fs_ge_general(args); >+ return FsGe.fs_ge_general(args, _dc); > > case CmpExpr.LESSEQUAL: >- return FsLe.fs_le_general(args); >+ return FsLe.fs_le_general(args, _dc); > > case CmpExpr.IS: > case CmpExpr.LESS_LESS: >@@ -1775,7 +1776,7 @@ > if (at instanceof NumericType) { > try { > _g_xsint.set_int(BigInteger.valueOf(_dc.context_position())); >- return FsEq.fs_eq_fast(at, _g_xsint); >+ return FsEq.fs_eq_fast(at, _g_xsint, _dc); > } catch (DynamicError err) { > report_error(err); > >Index: src/org/eclipse/wst/xml/xpath2/processor/DefaultDynamicContext.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/DefaultDynamicContext.java,v >retrieving revision 1.13 >diff -u -r1.13 DefaultDynamicContext.java >--- src/org/eclipse/wst/xml/xpath2/processor/DefaultDynamicContext.java 20 Aug 2009 21:48:28 -0000 1.13 >+++ src/org/eclipse/wst/xml/xpath2/processor/DefaultDynamicContext.java 2 Sep 2009 20:17:13 -0000 >@@ -13,6 +13,7 @@ > * Jesper Moller- bug 281159 - fix document loading and resolving URIs > * Jesper Moller- bug 286452 - always return the stable date/time from dynamic context > * Jesper Moller- bug 275610 - Avoid big time and memory overhead for externals >+ * Jesper Moller- bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor; >@@ -23,6 +24,7 @@ > import org.eclipse.wst.xml.xpath2.processor.internal.function.*; > import org.eclipse.wst.xml.xpath2.processor.internal.types.*; > >+import java.text.Collator; > import java.util.*; > > import org.w3c.dom.*; >@@ -44,6 +46,8 @@ > private XSDuration _tz; > private Map _loaded_documents; > private GregorianCalendar _current_date_time; >+ private String _default_collation_name = CODEPOINT_COLLATION; >+ private CollationProvider _collation_provider; > > /** > * Constructor. >@@ -242,4 +246,30 @@ > super.set_variable(var, val); > } > >+ public void set_default_collation(String _default_collation) { >+ this._default_collation_name = _default_collation; >+ } >+ >+ public String default_collation_name() { >+ return _default_collation_name; >+ } >+ >+ // We are explicitly NOT using generics here, in anticipation of JDK1.4 compatibility >+ private static Comparator CODEPOINT_COMPARATOR = new Comparator() { >+ >+ public int compare(Object o1, Object o2) { >+ return ((String)o1).compareTo((String)o2); >+ } >+ }; >+ >+ public Comparator<Object> get_collation(String uri) { >+ if (CODEPOINT_COLLATION.equals(uri)) return CODEPOINT_COMPARATOR; >+ >+ return _collation_provider != null ? _collation_provider.get_collation(uri) : null; >+ } >+ >+ public void set_collation_provider(CollationProvider provider) { >+ this._collation_provider = provider; >+ } >+ > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsEq.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsEq.java,v >retrieving revision 1.7 >diff -u -r1.7 FsEq.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsEq.java 30 Jul 2009 23:09:23 -0000 1.7 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsEq.java 2 Sep 2009 20:17:13 -0000 >@@ -12,10 +12,12 @@ > * David Carver - bug 262765 - fixed comparison on sequence range values. > * Jesper S Moller - bug 283214 - fix eq for untyped atomic values > * Jesper Steen Moeller - bug 285145 - implement full arity checking >+ * Jesper Steen Moeller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -49,7 +51,7 @@ > public ResultSequence evaluate(Collection args) throws DynamicError { > assert args.size() >= min_arity() && args.size() <= max_arity(); > >- return fs_eq_value(args); >+ return fs_eq_value(args, dynamic_context()); > } > > /** >@@ -100,9 +102,9 @@ > * Dynamic error. > * @return Result of conversion. > */ >- public static ResultSequence fs_eq_value(Collection args) >+ public static ResultSequence fs_eq_value(Collection args, DynamicContext dynamicContext) > throws DynamicError { >- return do_cmp_value_op(args, CmpEq.class, "eq"); >+ return do_cmp_value_op(args, CmpEq.class, "eq", dynamicContext); > } > > /** >@@ -116,7 +118,7 @@ > * Dynamic error. > * @return Result of Equality operation. > */ >- public static boolean fs_eq_fast(AnyType one, AnyType two) >+ public static boolean fs_eq_fast(AnyType one, AnyType two, DynamicContext dynamicContext) > throws DynamicError { > > one = FnData.atomize(one); >@@ -133,7 +135,7 @@ > > CmpEq cmpone = (CmpEq) one; > >- return cmpone.eq(two); >+ return cmpone.eq(two, dynamicContext); > } > > /** >@@ -143,12 +145,14 @@ > * input1 of any type. > * @param b > * input2 of any type. >+ * @param dc >+ * Dynamic Context > * @throws DynamicError > * Dynamic error. > * @return Result of Equality operation. > */ > private static boolean do_general_pair(AnyType a, AnyType b, >- Method comparator) throws DynamicError { >+ Method comparator, DynamicContext dc) throws DynamicError { > > // section 3.5.2 > >@@ -201,7 +205,7 @@ > args.add(one); > args.add(two); > >- Object margs[] = { args }; >+ Object margs[] = { args, dc }; > > ResultSequence result = null; > try { >@@ -229,13 +233,15 @@ > * > * @param args > * input arguments. >+ * @param dc >+ * Dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of general equality operation. > */ >- public static ResultSequence fs_eq_general(Collection args) >+ public static ResultSequence fs_eq_general(Collection args, DynamicContext dc) > throws DynamicError { >- return do_cmp_general_op(args, FsEq.class, "fs_eq_value"); >+ return do_cmp_general_op(args, FsEq.class, "fs_eq_value", dc); > } > > // voodoo 3 >@@ -253,18 +259,18 @@ > * @return Result of the operation. > */ > public static ResultSequence do_cmp_general_op(Collection args, Class type, >- String mname) throws DynamicError { >+ String mname, DynamicContext dc) throws DynamicError { > > // do the voodoo > Method comparator = null; > > try { >- Class margsdef[] = { Collection.class }; >+ Class margsdef[] = { Collection.class, DynamicContext.class }; > > comparator = type.getMethod(mname, margsdef); > > } catch (NoSuchMethodException err) { >- assert false; >+ throw new RuntimeException("Can¿'t find method : " + mname, err); > } > > // sanity check args and get them >@@ -290,7 +296,7 @@ > for (Iterator j = two.iterator(); j.hasNext();) { > AnyType b = (AnyType) j.next(); > >- if (do_general_pair(a, b, comparator)) >+ if (do_general_pair(a, b, comparator, dc)) > return ResultSequenceFactory > .create_new(new XSBoolean(true)); > } >@@ -309,12 +315,14 @@ > * type of the arguments. > * @param mname > * Method name for template simulation. >+ * @param dynamicContext >+ * Dynamic error. > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ > public static ResultSequence do_cmp_value_op(Collection args, Class type, >- String mname) throws DynamicError { >+ String mname, DynamicContext dynamicContext) throws DynamicError { > > // sanity check args + convert em > if (args.size() != 2) >@@ -339,29 +347,29 @@ > DynamicError.throw_type_error(); > > try { >- Class margsdef[] = { AnyType.class }; >+ Class margsdef[] = { AnyType.class, DynamicContext.class }; > Method method = null; > > method = type.getMethod(mname, margsdef); > >- Object margs[] = { arg2.first() }; >+ Object margs[] = { arg2.first(), dynamicContext }; > Boolean cmpres = (Boolean) method.invoke(arg, margs); > > return ResultSequenceFactory.create_new(new XSBoolean(cmpres > .booleanValue())); > } catch (NoSuchMethodException err) { > assert false; >+ throw new RuntimeException("cannot compare using method " + mname, err); > } catch (IllegalAccessException err) { > assert false; >+ throw new RuntimeException("cannot compare using method " + mname, err); > } catch (InvocationTargetException err) { > Throwable ex = err.getTargetException(); > > if (ex instanceof DynamicError) > throw (DynamicError) ex; > >- ex.printStackTrace(); >- System.exit(1); >+ throw new RuntimeException("cannot compare using method " + mname, ex); > } >- return null; // unreach! > } > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnIndexOf.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnIndexOf.java,v >retrieving revision 1.2 >diff -u -r1.2 FnIndexOf.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnIndexOf.java 23 May 2009 02:10:28 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnIndexOf.java 2 Sep 2009 20:17:13 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; >@@ -15,6 +16,7 @@ > import java.util.Collection; > import java.util.Iterator; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -46,7 +48,7 @@ > */ > @Override > public ResultSequence evaluate(Collection args) throws DynamicError { >- return index_of(args); >+ return index_of(args, dynamic_context()); > } > > /** >@@ -73,11 +75,12 @@ > * > * @param args > * Result from the expressions evaluation. >+ * @param dynamicContext > * @throws DynamicError > * Dynamic error. > * @return Result of fn:index-of operation. > */ >- public static ResultSequence index_of(Collection args) throws DynamicError { >+ public static ResultSequence index_of(Collection args, DynamicContext dynamicContext) throws DynamicError { > > assert args.size() == 2; > >@@ -101,7 +104,7 @@ > for (Iterator i = arg1.iterator(); i.hasNext();) { > CmpEq candidate = get_comparable((AnyType) i.next()); > >- if (candidate.eq(at)) >+ if (candidate.eq(at, dynamicContext)) > rs.add(new XSInteger(BigInteger.valueOf(index))); > > index++; >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnCompare.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnCompare.java,v >retrieving revision 1.3 >diff -u -r1.3 FnCompare.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnCompare.java 30 Jul 2009 23:09:22 -0000 1.3 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnCompare.java 2 Sep 2009 20:17:13 -0000 >@@ -8,10 +8,12 @@ > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 > * Jesper Steen Moeller - bug 285145 - implement full arity checking >+ * Jesper Steen Moeller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -58,8 +60,7 @@ > * Constructor of FnCompare. > */ > public FnCompare() { >- // XXX: This should be 2-3 when compare learns how to deal with collations >- super(new QName("compare"), 2); >+ super(new QName("compare"), 2, 3); > } > > /** >@@ -73,45 +74,59 @@ > */ > @Override > public ResultSequence evaluate(Collection args) throws DynamicError { >- return compare(args); >+ return compare(args, dynamic_context()); > } > > /** > * Compare the arguments. > * > * @param args >- * are compared. >+ * are compared (optional 3rd argument is the collation) >+ * @param dynamicContext >+ * Current dynamic context > * @throws DynamicError > * Dynamic error. > * @return The result of the comparison of the arguments. > */ >- public static ResultSequence compare(Collection args) throws DynamicError { >+ public static ResultSequence compare(Collection args, DynamicContext dynamicContext) throws DynamicError { > Collection cargs = Function.convert_arguments(args, expected_args()); > >- ResultSequence rs = ResultSequenceFactory.create_new(); >- > Iterator argiter = cargs.iterator(); > ResultSequence arg1 = (ResultSequence) argiter.next(); >- if (arg1.empty()) >- return rs; > ResultSequence arg2 = (ResultSequence) argiter.next(); >- if (arg2.empty()) >- return rs; > >- XSString xstr1 = (XSString) arg1.first(); >- XSString xstr2 = (XSString) arg2.first(); >+ String collationUri = dynamicContext.default_collation_name(); >+ if (argiter.hasNext()) { >+ ResultSequence collArg = (ResultSequence) argiter.next(); >+ collationUri = collArg.first().string_value(); >+ } > >- // XXX collations!!! >- int ret = xstr1.value().compareTo(xstr2.value()); >+ XSString xstr1 = arg1.empty() ? null : (XSString) arg1.first(); >+ XSString xstr2 = arg2.empty() ? null : (XSString) arg2.first(); >+ >+ BigInteger result = compare_string(collationUri, xstr1, xstr2, dynamicContext); >+ if (result != null) { >+ return ResultSequenceFactory.create_new(new XSInteger(result)); >+ } else { >+ return ResultSequenceFactory.create_new(); >+ } >+ } >+ >+ public static BigInteger compare_string(String collationUri, XSString xstr1, >+ XSString xstr2, DynamicContext dynamicContext) throws DynamicError { >+ Comparator collator = dynamicContext.get_collation(collationUri); >+ if (collator == null) throw DynamicError.unsupported_collation(collationUri); >+ >+ if (xstr1 == null || xstr2 == null) return null; >+ >+ int ret = collator.compare(xstr1.value(), xstr2.value()); > > if (ret == 0) >- rs.add(new XSInteger(BigInteger.valueOf(0))); >+ return BigInteger.ZERO; > else if (ret < 0) >- rs.add(new XSInteger(BigInteger.valueOf(-1))); >+ return BigInteger.valueOf(-1); > else >- rs.add(new XSInteger(BigInteger.valueOf(1))); >- >- return rs; >+ return BigInteger.ONE; > } > > /** >@@ -125,6 +140,7 @@ > SeqType arg = new SeqType(new XSString(), SeqType.OCC_QMARK); > _expected_args.add(arg); > _expected_args.add(arg); >+ _expected_args.add(new SeqType(new XSString(), SeqType.OCC_NONE)); > } > > return _expected_args; >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpGt.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpGt.java,v >retrieving revision 1.1 >diff -u -r1.1 CmpGt.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpGt.java 27 Apr 2009 15:06:57 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpGt.java 2 Sep 2009 20:17:13 -0000 >@@ -7,10 +7,12 @@ > * > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.internal.*; > import org.eclipse.wst.xml.xpath2.processor.internal.types.*; >@@ -24,9 +26,10 @@ > * > * @param arg > * argument of any type. >+ * @param context TODO > * @throws DynamicError > * Dynamic error. > * @return Result of operation, true/false. > */ >- public boolean gt(AnyType arg) throws DynamicError; >+ public boolean gt(AnyType arg, DynamicContext context) throws DynamicError; > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpEq.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpEq.java,v >retrieving revision 1.1 >diff -u -r1.1 CmpEq.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpEq.java 27 Apr 2009 15:06:58 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpEq.java 2 Sep 2009 20:17:13 -0000 >@@ -7,10 +7,12 @@ > * > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.internal.*; > import org.eclipse.wst.xml.xpath2.processor.internal.types.*; >@@ -24,9 +26,10 @@ > * > * @param arg > * argument of any type. >+ * @param context TODO > * @throws DynamicError > * Dynamic error. > * @return Result of operation, true/false. > */ >- public boolean eq(AnyType arg) throws DynamicError; >+ public boolean eq(AnyType arg, DynamicContext context) throws DynamicError; > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnMax.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnMax.java,v >retrieving revision 1.1 >diff -u -r1.1 FnMax.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnMax.java 27 Apr 2009 15:06:57 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnMax.java 2 Sep 2009 20:17:13 -0000 >@@ -7,10 +7,12 @@ > * > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -44,7 +46,7 @@ > */ > @Override > public ResultSequence evaluate(Collection args) throws DynamicError { >- return max(args); >+ return max(args, dynamic_context()); > } > > /** >@@ -52,11 +54,13 @@ > * > * @param args > * Result from the expressions evaluation. >+ * @param context >+ * Relevant dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of fn:max operation. > */ >- public static ResultSequence max(Collection args) throws DynamicError { >+ public static ResultSequence max(Collection args, DynamicContext context) throws DynamicError { > > // XXX fix this > ResultSequence arg = get_arg(args, CmpGt.class); >@@ -76,7 +80,7 @@ > if (max == null) > max = item; > else { >- boolean res = item.gt((AnyType) max); >+ boolean res = item.gt((AnyType) max, context); > > if (res) > max = item; >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDistinctValues.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDistinctValues.java,v >retrieving revision 1.2 >diff -u -r1.2 FnDistinctValues.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDistinctValues.java 23 May 2009 02:10:28 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDistinctValues.java 2 Sep 2009 20:17:13 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; >@@ -14,6 +15,7 @@ > import java.util.Collection; > import java.util.Iterator; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -48,7 +50,7 @@ > */ > @Override > public ResultSequence evaluate(Collection args) throws DynamicError { >- return distinct_values(args); >+ return distinct_values(args, dynamic_context()); > } > > /** >@@ -62,7 +64,7 @@ > * Dynamic error. > * @return Result of operation. > */ >- private static boolean contains(ResultSequence rs, AnyAtomicType item) >+ private static boolean contains(ResultSequence rs, AnyAtomicType item, DynamicContext context) > throws DynamicError { > if (!(item instanceof CmpEq)) > return false; >@@ -75,7 +77,7 @@ > > CmpEq cmp = (CmpEq) at; > >- if (cmp.eq(item)) >+ if (cmp.eq(item, context)) > return true; > > } >@@ -91,7 +93,7 @@ > * Dynamic error. > * @return Result of fn:distinct-values operation. > */ >- public static ResultSequence distinct_values(Collection args) >+ public static ResultSequence distinct_values(Collection args, DynamicContext context) > throws DynamicError { > > assert args.size() == 1; >@@ -109,7 +111,7 @@ > if (!(at instanceof AnyAtomicType)) > DynamicError.throw_type_error(); > >- if (!contains(rs, (AnyAtomicType) at)) >+ if (!contains(rs, (AnyAtomicType) at, context)) > rs.add(at); > } > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpLt.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpLt.java,v >retrieving revision 1.1 >diff -u -r1.1 CmpLt.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpLt.java 27 Apr 2009 15:06:58 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/CmpLt.java 2 Sep 2009 20:17:13 -0000 >@@ -7,10 +7,12 @@ > * > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.internal.*; > import org.eclipse.wst.xml.xpath2.processor.internal.types.*; >@@ -24,9 +26,10 @@ > * > * @param arg > * argument of any type. >+ * @param context TODO > * @throws DynamicError > * Dynamic error. > * @return Result of operation, true/false. > */ >- public boolean lt(AnyType arg) throws DynamicError; >+ public boolean lt(AnyType arg, DynamicContext context) throws DynamicError; > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsNe.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsNe.java,v >retrieving revision 1.2 >diff -u -r1.2 FsNe.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsNe.java 30 Jul 2009 23:09:23 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsNe.java 2 Sep 2009 20:17:13 -0000 >@@ -8,10 +8,12 @@ > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 > * Jesper Steen Moeller - bug 285145 - implement full arity checking >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.internal.*; >@@ -43,7 +45,7 @@ > public ResultSequence evaluate(Collection args) throws DynamicError { > assert args.size() >= min_arity() && args.size() <= max_arity(); > >- return fs_ne_value(args); >+ return fs_ne_value(args, dynamic_context()); > } > > /** >@@ -51,13 +53,15 @@ > * > * @param args > * input arguments. >+ * @param context >+ * The dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_ne_value(Collection args) >+ public static ResultSequence fs_ne_value(Collection args, DynamicContext context) > throws DynamicError { >- return FnNot.fn_not(FsEq.fs_eq_value(args)); >+ return FnNot.fn_not(FsEq.fs_eq_value(args, context)); > } > > /** >@@ -65,13 +69,15 @@ > * > * @param args > * input arguments. >+ * @param dc >+ * The dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_ne_general(Collection args) >+ public static ResultSequence fs_ne_general(Collection args, DynamicContext dc) > throws DynamicError { >- return FsEq.do_cmp_general_op(args, FsNe.class, "fs_ne_value"); >+ return FsEq.do_cmp_general_op(args, FsNe.class, "fs_ne_value", dc); > } > > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsGe.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsGe.java,v >retrieving revision 1.2 >diff -u -r1.2 FsGe.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsGe.java 30 Jul 2009 23:09:23 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsGe.java 2 Sep 2009 20:17:13 -0000 >@@ -8,10 +8,12 @@ > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 > * Jesper Steen Moeller - bug 285145 - implement full arity checking >+ * Jesper Steen Mooller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -44,7 +46,7 @@ > public ResultSequence evaluate(Collection args) throws DynamicError { > assert args.size() >= min_arity() && args.size() <= max_arity(); > >- return fs_ge_value(args); >+ return fs_ge_value(args, dynamic_context()); > } > > /** >@@ -52,18 +54,19 @@ > * > * @param args > * input arguments. >+ * @param dc > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_ge_value(Collection args) >+ public static ResultSequence fs_ge_value(Collection args, DynamicContext dc) > throws DynamicError { >- ResultSequence greater = FsGt.fs_gt_value(args); >+ ResultSequence greater = FsGt.fs_gt_value(args, dc); > > if (((XSBoolean) greater.first()).value()) > return greater; > >- ResultSequence equal = FsEq.fs_eq_value(args); >+ ResultSequence equal = FsEq.fs_eq_value(args, dc); > > if (((XSBoolean) equal.first()).value()) > return equal; >@@ -76,12 +79,14 @@ > * > * @param args > * input arguments. >+ * @param dc >+ * The dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_ge_general(Collection args) >+ public static ResultSequence fs_ge_general(Collection args, DynamicContext dc) > throws DynamicError { >- return FsEq.do_cmp_general_op(args, FsGe.class, "fs_ge_value"); >+ return FsEq.do_cmp_general_op(args, FsGe.class, "fs_ge_value", dc); > } > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnMin.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnMin.java,v >retrieving revision 1.1 >diff -u -r1.1 FnMin.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnMin.java 27 Apr 2009 15:06:57 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnMin.java 2 Sep 2009 20:17:13 -0000 >@@ -7,10 +7,12 @@ > * > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -44,7 +46,7 @@ > */ > @Override > public ResultSequence evaluate(Collection args) throws DynamicError { >- return min(args); >+ return min(args, dynamic_context()); > } > > /** >@@ -52,11 +54,13 @@ > * > * @param args > * Result from the expressions evaluation. >+ * @param dynamic >+ * Dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of fn:min operation. > */ >- public static ResultSequence min(Collection args) throws DynamicError { >+ public static ResultSequence min(Collection args, DynamicContext dynamic) throws DynamicError { > > // XXX fix this > ResultSequence arg = FnMax.get_arg(args, CmpLt.class); >@@ -76,7 +80,7 @@ > if (min == null) > min = item; > else { >- boolean res = item.lt((AnyType) min); >+ boolean res = item.lt((AnyType) min, dynamic); > > if (res) > min = item; >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsLt.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsLt.java,v >retrieving revision 1.2 >diff -u -r1.2 FsLt.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsLt.java 30 Jul 2009 23:09:22 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsLt.java 2 Sep 2009 20:17:13 -0000 >@@ -8,10 +8,12 @@ > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 > * Jesper Steen Moeller - bug 285145 - implement full arity checking >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.internal.*; >@@ -43,7 +45,7 @@ > public ResultSequence evaluate(Collection args) throws DynamicError { > assert args.size() >= min_arity() && args.size() <= max_arity(); > >- return fs_lt_value(args); >+ return fs_lt_value(args, dynamic_context()); > } > > /** >@@ -51,13 +53,15 @@ > * > * @param args > * input arguments. >+ * @param context >+ * Dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_lt_value(Collection args) >+ public static ResultSequence fs_lt_value(Collection args, DynamicContext context) > throws DynamicError { >- return FsEq.do_cmp_value_op(args, CmpLt.class, "lt"); >+ return FsEq.do_cmp_value_op(args, CmpLt.class, "lt", context); > } > > /** >@@ -65,12 +69,14 @@ > * > * @param args > * input arguments. >+ * @param dc >+ * The dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_lt_general(Collection args) >+ public static ResultSequence fs_lt_general(Collection args, DynamicContext dc) > throws DynamicError { >- return FsEq.do_cmp_general_op(args, FsLt.class, "fs_lt_value"); >+ return FsEq.do_cmp_general_op(args, FsLt.class, "fs_lt_value", dc); > } > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDeepEqual.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDeepEqual.java,v >retrieving revision 1.1 >diff -u -r1.1 FnDeepEqual.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDeepEqual.java 27 Apr 2009 15:06:58 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDeepEqual.java 2 Sep 2009 20:17:13 -0000 >@@ -7,10 +7,12 @@ > * > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -49,7 +51,7 @@ > */ > @Override > public ResultSequence evaluate(Collection args) throws DynamicError { >- return deep_equal(args); >+ return deep_equal(args, dynamic_context()); > } > > /** >@@ -57,11 +59,13 @@ > * > * @param args > * Result from the expressions evaluation. >+ * @param context >+ * Dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of fn:deep-equal operation. > */ >- public static ResultSequence deep_equal(Collection args) >+ public static ResultSequence deep_equal(Collection args, DynamicContext context) > throws DynamicError { > > assert args.size() == 2; >@@ -71,7 +75,7 @@ > ResultSequence arg1 = (ResultSequence) citer.next(); > ResultSequence arg2 = (ResultSequence) citer.next(); > >- boolean result = deep_equal(arg1, arg2); >+ boolean result = deep_equal(arg1, arg2, context); > > return ResultSequenceFactory.create_new(new XSBoolean(result)); > } >@@ -83,9 +87,11 @@ > * input1 xpath expression/variable. > * @param two > * input2 xpath expression/variable. >+ * @param context >+ * Current dynamic context > * @return Result of fn:deep-equal operation. > */ >- public static boolean deep_equal(ResultSequence one, ResultSequence two) { >+ public static boolean deep_equal(ResultSequence one, ResultSequence two, DynamicContext context) { > if (one.empty() && two.empty()) > return true; > >@@ -99,7 +105,7 @@ > AnyType a = (AnyType) onei.next(); > AnyType b = (AnyType) twoi.next(); > >- if (!deep_equal(a, b)) >+ if (!deep_equal(a, b, context)) > return false; > } > return true; >@@ -112,17 +118,18 @@ > * input1 xpath expression/variable. > * @param two > * input2 xpath expression/variable. >+ * @param context > * @return Result of fn:deep-equal operation. > */ >- public static boolean deep_equal(AnyType one, AnyType two) { >+ public static boolean deep_equal(AnyType one, AnyType two, DynamicContext context) { > if ((one instanceof AnyAtomicType) && (two instanceof AnyAtomicType)) >- return deep_equal((AnyAtomicType) one, (AnyAtomicType) two); >+ return deep_equal((AnyAtomicType) one, (AnyAtomicType) two, context); > > else if (((one instanceof AnyAtomicType) && (two instanceof NodeType)) > || ((one instanceof NodeType) && (two instanceof AnyAtomicType))) > return false; > else if ((one instanceof NodeType) && (two instanceof NodeType)) >- return deep_equal((NodeType) one, (NodeType) two); >+ return deep_equal((NodeType) one, (NodeType) two, context); > else { > assert false; > return false; >@@ -138,7 +145,7 @@ > * input2 xpath expression/variable. > * @return Result of fn:deep-equal operation. > */ >- public static boolean deep_equal(AnyAtomicType one, AnyAtomicType two) { >+ public static boolean deep_equal(AnyAtomicType one, AnyAtomicType two, DynamicContext context) { > if (!(one instanceof CmpEq)) > return false; > if (!(two instanceof CmpEq)) >@@ -147,7 +154,7 @@ > CmpEq a = (CmpEq) one; > > try { >- if (a.eq(two)) >+ if (a.eq(two, context)) > return true; > return false; > } catch (DynamicError err) { >@@ -164,7 +171,7 @@ > * input2 xpath expression/variable. > * @return Result of fn:deep-equal operation. > */ >- public static boolean deep_equal(NodeType one, NodeType two) { >+ public static boolean deep_equal(NodeType one, NodeType two, DynamicContext context) { > Node a = one.node_value(); > Node b = two.node_value(); > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsLe.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsLe.java,v >retrieving revision 1.2 >diff -u -r1.2 FsLe.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsLe.java 30 Jul 2009 23:09:23 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsLe.java 2 Sep 2009 20:17:13 -0000 >@@ -8,10 +8,12 @@ > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 > * Jesper Steen Moeller - bug 285145 - implement full arity checking >+ * Jesper Moller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >@@ -44,7 +46,7 @@ > public ResultSequence evaluate(Collection args) throws DynamicError { > assert args.size() >= min_arity() && args.size() <= max_arity(); > >- return fs_le_value(args); >+ return fs_le_value(args, dynamic_context()); > } > > /** >@@ -52,18 +54,20 @@ > * > * @param args > * input arguments. >+ * @param >+ * DynamicContext > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_le_value(Collection args) >+ public static ResultSequence fs_le_value(Collection args, DynamicContext dc) > throws DynamicError { >- ResultSequence less = FsLt.fs_lt_value(args); >+ ResultSequence less = FsLt.fs_lt_value(args, dc); > > if (((XSBoolean) less.first()).value()) > return less; > >- ResultSequence equal = FsEq.fs_eq_value(args); >+ ResultSequence equal = FsEq.fs_eq_value(args, dc); > > if (((XSBoolean) equal.first()).value()) > return equal; >@@ -76,12 +80,14 @@ > * > * @param args > * input arguments. >+ * @param dc >+ * The dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_le_general(Collection args) >+ public static ResultSequence fs_le_general(Collection args, DynamicContext dc) > throws DynamicError { >- return FsEq.do_cmp_general_op(args, FsLe.class, "fs_le_value"); >+ return FsEq.do_cmp_general_op(args, FsLe.class, "fs_le_value", dc); > } > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsGt.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsGt.java,v >retrieving revision 1.2 >diff -u -r1.2 FsGt.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsGt.java 30 Jul 2009 23:09:22 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsGt.java 2 Sep 2009 20:17:13 -0000 >@@ -8,10 +8,12 @@ > * Contributors: > * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 > * Jesper Steen Moeller - bug 285145 - implement full arity checking >+ * Jesper Steen Moeller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import org.eclipse.wst.xml.xpath2.processor.DynamicContext; > import org.eclipse.wst.xml.xpath2.processor.DynamicError; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.internal.*; >@@ -43,7 +45,7 @@ > public ResultSequence evaluate(Collection args) throws DynamicError { > assert args.size() >= min_arity() && args.size() <= max_arity(); > >- return fs_gt_value(args); >+ return fs_gt_value(args, dynamic_context()); > } > > /** >@@ -51,13 +53,15 @@ > * > * @param args > * input arguments. >+ * @param dynamic >+ * Dynamic contexet > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_gt_value(Collection args) >+ public static ResultSequence fs_gt_value(Collection args, DynamicContext dynamic) > throws DynamicError { >- return FsEq.do_cmp_value_op(args, CmpGt.class, "gt"); >+ return FsEq.do_cmp_value_op(args, CmpGt.class, "gt", dynamic); > } > > /** >@@ -65,13 +69,15 @@ > * > * @param args > * input arguments. >+ * @param dc >+ * The dynamic context > * @throws DynamicError > * Dynamic error. > * @return Result of the operation. > */ >- public static ResultSequence fs_gt_general(Collection args) >+ public static ResultSequence fs_gt_general(Collection args, DynamicContext dc) > throws DynamicError { >- return FsEq.do_cmp_general_op(args, FsGt.class, "fs_gt_value"); >+ return FsEq.do_cmp_general_op(args, FsGt.class, "fs_gt_value", dc); > } > > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDefaultCollation.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDefaultCollation.java,v >retrieving revision 1.2 >diff -u -r1.2 FnDefaultCollation.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDefaultCollation.java 30 Jul 2009 23:09:23 -0000 1.2 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnDefaultCollation.java 2 Sep 2009 20:17:13 -0000 >@@ -8,6 +8,7 @@ > * Contributors: > * David Carver (STAR) - initial API and implementation > * Jesper Steen Moeller - bug 285145 - implement full arity checking >+ * Jesper Steen Moeller - bug 280555 - Add pluggable collation support > *******************************************************************************/ > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >@@ -17,7 +18,6 @@ > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; > import org.eclipse.wst.xml.xpath2.processor.internal.types.QName; >-import org.eclipse.wst.xml.xpath2.processor.internal.types.XSBoolean; > import org.eclipse.wst.xml.xpath2.processor.internal.types.XSString; > > /** >@@ -43,8 +43,6 @@ > */ > public class FnDefaultCollation extends Function { > >- private static final String DEFAULT_COLLATION = "http://www.w3.org/2005/xpath-functions/collation/codepoint"; >- > public FnDefaultCollation() { > super(new QName("default-collation"), 0); > } >@@ -53,7 +51,7 @@ > public ResultSequence evaluate(Collection args) throws DynamicError { > assert args.size() >= min_arity() && args.size() <= max_arity(); > ResultSequence rs = ResultSequenceFactory.create_new(); >- rs.add(new XSString(DEFAULT_COLLATION)); >+ rs.add(new XSString(dynamic_context().default_collation_name())); > return rs; > } > >Index: src/org/eclipse/wst/xml/xpath2/processor/CollationProvider.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/xpath2/processor/CollationProvider.java >diff -N src/org/eclipse/wst/xml/xpath2/processor/CollationProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/xpath2/processor/CollationProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 Jesper Moller, and others >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Jesper Moller - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.wst.xml.xpath2.processor; >+ >+import java.util.Comparator; >+ >+/** >+ * Service provider interface for looking up collations from within the dynamic context. >+ */ >+public interface CollationProvider { >+ /** >+ * Gets the named collator. W3C does not define collation names (yet?) so we are constrained to using an >+ * implementation-defined naming scheme. >+ * >+ * @param name A URI designating the collation to use >+ * @return The collation to use, or null if no such collation exists by this provider >+ */ >+ Comparator get_collation(String name); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 280555
:
145487
| 146320