You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(57) |
Apr
(103) |
May
(164) |
Jun
(139) |
Jul
(173) |
Aug
(196) |
Sep
(221) |
Oct
(333) |
Nov
(214) |
Dec
(88) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(163) |
Feb
(165) |
Mar
(98) |
Apr
(93) |
May
(199) |
Jun
(118) |
Jul
(200) |
Aug
(212) |
Sep
(185) |
Oct
(297) |
Nov
(437) |
Dec
(272) |
2006 |
Jan
(542) |
Feb
(329) |
Mar
(267) |
Apr
(332) |
May
(267) |
Jun
(130) |
Jul
(161) |
Aug
(348) |
Sep
(166) |
Oct
(305) |
Nov
(173) |
Dec
(173) |
2007 |
Jan
(199) |
Feb
(118) |
Mar
(133) |
Apr
(200) |
May
(208) |
Jun
(146) |
Jul
(198) |
Aug
(146) |
Sep
(187) |
Oct
(182) |
Nov
(181) |
Dec
(83) |
2008 |
Jan
(252) |
Feb
(124) |
Mar
(124) |
Apr
(101) |
May
(143) |
Jun
(122) |
Jul
(129) |
Aug
(60) |
Sep
(80) |
Oct
(89) |
Nov
(54) |
Dec
(112) |
2009 |
Jan
(88) |
Feb
(145) |
Mar
(105) |
Apr
(164) |
May
(123) |
Jun
(154) |
Jul
(374) |
Aug
(341) |
Sep
(219) |
Oct
(137) |
Nov
(373) |
Dec
(240) |
2010 |
Jan
(197) |
Feb
(270) |
Mar
(253) |
Apr
(150) |
May
(102) |
Jun
(51) |
Jul
(300) |
Aug
(512) |
Sep
(254) |
Oct
(258) |
Nov
(288) |
Dec
(143) |
2011 |
Jan
(238) |
Feb
(179) |
Mar
(253) |
Apr
(332) |
May
(248) |
Jun
(255) |
Jul
(216) |
Aug
(282) |
Sep
(146) |
Oct
(77) |
Nov
(86) |
Dec
(69) |
2012 |
Jan
(172) |
Feb
(234) |
Mar
(229) |
Apr
(101) |
May
(212) |
Jun
(267) |
Jul
(129) |
Aug
(210) |
Sep
(239) |
Oct
(271) |
Nov
(368) |
Dec
(220) |
2013 |
Jan
(179) |
Feb
(155) |
Mar
(59) |
Apr
(47) |
May
(99) |
Jun
(158) |
Jul
(185) |
Aug
(16) |
Sep
(16) |
Oct
(7) |
Nov
(20) |
Dec
(12) |
2014 |
Jan
(21) |
Feb
(17) |
Mar
(18) |
Apr
(13) |
May
(27) |
Jun
(15) |
Jul
(19) |
Aug
(22) |
Sep
(30) |
Oct
(16) |
Nov
(19) |
Dec
(16) |
2015 |
Jan
(14) |
Feb
(24) |
Mar
(33) |
Apr
(41) |
May
(14) |
Jun
(80) |
Jul
(53) |
Aug
(8) |
Sep
(7) |
Oct
(15) |
Nov
(13) |
Dec
(2) |
2016 |
Jan
(22) |
Feb
(12) |
Mar
(30) |
Apr
(6) |
May
(33) |
Jun
(16) |
Jul
(8) |
Aug
(20) |
Sep
(12) |
Oct
(18) |
Nov
(12) |
Dec
(11) |
2017 |
Jan
(24) |
Feb
(26) |
Mar
(47) |
Apr
(23) |
May
(19) |
Jun
(14) |
Jul
(28) |
Aug
(30) |
Sep
(17) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
(1) |
Feb
(73) |
Mar
(90) |
Apr
(42) |
May
(116) |
Jun
(90) |
Jul
(127) |
Aug
(103) |
Sep
(56) |
Oct
(42) |
Nov
(95) |
Dec
(58) |
2020 |
Jan
(102) |
Feb
(31) |
Mar
(93) |
Apr
(60) |
May
(57) |
Jun
(45) |
Jul
(29) |
Aug
(32) |
Sep
(44) |
Oct
(86) |
Nov
(51) |
Dec
(71) |
2021 |
Jan
(44) |
Feb
(25) |
Mar
(78) |
Apr
(130) |
May
(64) |
Jun
(74) |
Jul
(21) |
Aug
(64) |
Sep
(40) |
Oct
(43) |
Nov
(21) |
Dec
(99) |
2022 |
Jan
(154) |
Feb
(64) |
Mar
(45) |
Apr
(95) |
May
(62) |
Jun
(48) |
Jul
(73) |
Aug
(37) |
Sep
(71) |
Oct
(27) |
Nov
(40) |
Dec
(65) |
2023 |
Jan
(89) |
Feb
(130) |
Mar
(124) |
Apr
(50) |
May
(93) |
Jun
(46) |
Jul
(45) |
Aug
(68) |
Sep
(62) |
Oct
(71) |
Nov
(108) |
Dec
(82) |
2024 |
Jan
(53) |
Feb
(76) |
Mar
(64) |
Apr
(75) |
May
(36) |
Jun
(54) |
Jul
(98) |
Aug
(137) |
Sep
(58) |
Oct
(177) |
Nov
(84) |
Dec
(52) |
2025 |
Jan
(70) |
Feb
(53) |
Mar
(72) |
Apr
(47) |
May
(88) |
Jun
(49) |
Jul
(86) |
Aug
(41) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Wolfgang M. M. <wol...@us...> - 2004-09-23 19:44:35
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28793/src/org/exist/xupdate/test Modified Files: AllTests.java XUpdateTestCases.java Log Message: 1) Added XUpdate extension: xupdate:replace. Replaces the selected nodes with a new node as specified in the content. 2) Declared variables are now passed to all select statements, including value-of and other xupdate:variable declarations. 3) Added test cases for xupdate:replace and xupdate:variable Index: XUpdateTestCases.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/test/XUpdateTestCases.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XUpdateTestCases.java 21 Sep 2004 14:42:05 -0000 1.4 --- XUpdateTestCases.java 23 Sep 2004 19:44:24 -0000 1.5 *************** *** 21,35 **** // TestCases Start ! public void append() throws Exception { test.doTest("append", "address.xml"); }; ! public void insertafter() throws Exception { test.doTest("insertafter", "address.xml"); }; ! public void insertbefore() throws Exception { test.doTest("insertbefore", "address.xml"); }; ! public void remove() throws Exception { test.doTest("remove", "address.xml"); }; ! public void update() throws Exception { test.doTest("update", "address.xml"); }; ! public void appendAttribute() throws Exception { test.doTest("append_attribute", "address.xml"); }; ! public void appendChild() throws Exception { test.doTest("append_child", "address.xml"); }; ! public void insertafter_big() throws Exception { test.doTest("insertafter_big", "address_big.xml"); }; ! public void conditional() throws Exception { test.doTest("conditional", "address.xml"); ! ! } // <add a new TestCase Method here> --- 21,35 ---- // TestCases Start ! public void append() throws Exception { test.doTest("append", "address.xml"); } ! public void insertafter() throws Exception { test.doTest("insertafter", "address.xml"); } ! public void insertbefore() throws Exception { test.doTest("insertbefore", "address.xml"); } ! public void remove() throws Exception { test.doTest("remove", "address.xml"); } ! public void update() throws Exception { test.doTest("update", "address.xml"); } ! public void appendAttribute() throws Exception { test.doTest("append_attribute", "address.xml"); } ! public void appendChild() throws Exception { test.doTest("append_child", "address.xml"); } ! public void insertafter_big() throws Exception { test.doTest("insertafter_big", "address_big.xml"); } ! public void conditional() throws Exception { test.doTest("conditional", "address.xml"); } ! public void variables() throws Exception { test.doTest("variables", "address.xml"); } ! public void replace() throws Exception { test.doTest("replace", "address.xml"); } // <add a new TestCase Method here> Index: AllTests.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/test/AllTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AllTests.java 21 Sep 2004 14:42:05 -0000 1.3 --- AllTests.java 23 Sep 2004 19:44:24 -0000 1.4 *************** *** 29,32 **** --- 29,34 ---- suite.addTest(new XUpdateTestCases("insertafter_big", test)); suite.addTest(new XUpdateTestCases("conditional", test)); + suite.addTest(new XUpdateTestCases("variables", test)); + suite.addTest(new XUpdateTestCases("replace", test)); /* |
From: Wolfgang M. M. <wol...@us...> - 2004-09-23 19:44:34
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/test/results In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28793/src/org/exist/xupdate/test/results Added Files: replace.xml variables.xml Log Message: 1) Added XUpdate extension: xupdate:replace. Replaces the selected nodes with a new node as specified in the content. 2) Declared variables are now passed to all select statements, including value-of and other xupdate:variable declarations. 3) Added test cases for xupdate:replace and xupdate:variable --- NEW FILE: replace.xml --- <?xml version="1.0" encoding="UTF-8"?> <addressbook> <address> <fname>John</fname> <lname>Jekyll</lname> <company>Johnny's Car Wash</company> <city>Bloomington</city> <email type="work">jo...@ca...</email> </address> <address> <fname>Boris</fname> <lname>Becker</lname> <company>BB-Inc.</company> <city>Leimen</city> </address> </addressbook> --- NEW FILE: variables.xml --- <?xml version="1.0" encoding="UTF-8"?> <addressbook> <address> <fname>John</fname> <lname>Jekyll</lname> <company>Johnny's Car Wash</company> <city>Bloomington</city> <email type="work">jo...@ca...</email> </address> <address> <fname>Boris</fname> <lname>Becker</lname> <company>BB-Inc.</company> <city>Leimen</city> </address> </addressbook> |
From: Wolfgang M. M. <wol...@us...> - 2004-09-23 19:44:33
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/test/modifications In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28793/src/org/exist/xupdate/test/modifications Added Files: variables.xml replace.xml Log Message: 1) Added XUpdate extension: xupdate:replace. Replaces the selected nodes with a new node as specified in the content. 2) Declared variables are now passed to all select statements, including value-of and other xupdate:variable declarations. 3) Added test cases for xupdate:replace and xupdate:variable --- NEW FILE: replace.xml --- <?xml version="1.0" encoding="UTF-8"?> <xu:modifications version="1.0" xmlns:xu="http://www.xmldb.org/xupdate"> <xu:replace select="//address[lname = 'Hyde']"> <address> <fname>Boris</fname> <lname>Becker</lname> <company>BB-Inc.</company> <city>Leimen</city> </address> </xu:replace> </xu:modifications> --- NEW FILE: variables.xml --- <?xml version="1.0" encoding="UTF-8"?> <xu:modifications version="1.0" xmlns:xu="http://www.xmldb.org/xupdate"> <xu:variable name="address" select="//address[lname = 'Hyde']"/> <xu:variable name="root" select="$address/.."/> <xu:remove select="$address"/> <xu:append select="$root"> <address> <fname>Boris</fname> <lname>Becker</lname> <company>BB-Inc.</company> <city>Leimen</city> </address> </xu:append> </xu:modifications> |
From: Thomas J. <zal...@us...> - 2004-09-23 14:59:45
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26796/src/org/exist/dom Modified Files: NamedNode.java Log Message: cleanup imports Index: NamedNode.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/NamedNode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NamedNode.java 1 Sep 2004 17:41:30 -0000 1.3 --- NamedNode.java 23 Sep 2004 14:59:35 -0000 1.4 *************** *** 23,29 **** package org.exist.dom; - import org.w3c.dom.DOMException; - import org.w3c.dom.Node; - /** * A node with a QName, i.e. an element or attribute. --- 23,26 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-09-23 12:42:00
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25842/src/org/exist/xquery/functions Modified Files: FunNot.java FunFalse.java Log Message: Fixes for fn:not(). The function did not work for expressions like not(//abc) where abc is a non-existent node, or expressions like //test[not(false())]. Index: FunNot.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunNot.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FunNot.java 21 Sep 2004 11:49:21 -0000 1.6 --- FunNot.java 23 Sep 2004 12:41:19 -0000 1.7 *************** *** 70,96 **** Item contextItem) throws XPathException { Expression arg = getArgument(0); // case 1: if the argument expression returns a node set, // subtract the set from the context node set and return // the remaining set ! if (Type.subTypeOf(arg.returnsType(), Type.NODE)) { NodeSet result = new ExtArrayNodeSet(); if(contextSequence.getLength() > 0) result.addAll(contextSequence); NodeProxy current; ! if (inPredicate) for (SequenceIterator i = result.iterate(); i.hasNext();) { current = (NodeProxy) i.nextItem(); current.addContextNode(current); } // evaluate argument expression Sequence argSeq = arg.eval(contextSequence, contextItem); NodeSet argSet = argSeq.toNodeSet().getContextNodes(true); ! result = result.except(argSet); ! if (result.getLength() == 0) ! return BooleanValue.TRUE; ! else ! return result; // case 2: simply invert the boolean value } else { --- 70,100 ---- Item contextItem) throws XPathException { + if(contextItem != null) + contextSequence = contextItem.toSequence(); + Expression arg = getArgument(0); + // case 1: if the argument expression returns a node set, // subtract the set from the context node set and return // the remaining set ! if (Type.subTypeOf(arg.returnsType(), Type.NODE) && ! (arg.getDependencies() & Dependency.CONTEXT_ITEM) == 0 && ! contextSequence.getLength() > 0) { NodeSet result = new ExtArrayNodeSet(); if(contextSequence.getLength() > 0) result.addAll(contextSequence); NodeProxy current; ! if (inPredicate) { for (SequenceIterator i = result.iterate(); i.hasNext();) { current = (NodeProxy) i.nextItem(); current.addContextNode(current); } + } // evaluate argument expression Sequence argSeq = arg.eval(contextSequence, contextItem); NodeSet argSet = argSeq.toNodeSet().getContextNodes(true); ! return result.except(argSet); ! // case 2: simply invert the boolean value } else { Index: FunFalse.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunFalse.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FunFalse.java 12 Sep 2004 09:25:14 -0000 1.3 --- FunFalse.java 23 Sep 2004 12:41:19 -0000 1.4 *************** *** 22,32 **** import org.exist.dom.QName; - import org.exist.xquery.Cardinality; import org.exist.xquery.BasicFunction; import org.exist.xquery.FunctionSignature; import org.exist.xquery.Module; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.BooleanValue; - import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; --- 22,31 ---- import org.exist.dom.QName; import org.exist.xquery.BasicFunction; + import org.exist.xquery.Cardinality; import org.exist.xquery.FunctionSignature; import org.exist.xquery.Module; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.BooleanValue; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; *************** *** 54,58 **** return Type.BOOLEAN; } ! /** * Always returns false. --- 53,57 ---- return Type.BOOLEAN; } ! /** * Always returns false. |
From: Wolfgang M. M. <wol...@us...> - 2004-09-23 12:41:57
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25842/src/org/exist/xquery/test Modified Files: AllTests.java XPathQueryTest.java Log Message: Fixes for fn:not(). The function did not work for expressions like not(//abc) where abc is a non-existent node, or expressions like //test[not(false())]. Index: XPathQueryTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/test/XPathQueryTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XPathQueryTest.java 13 Aug 2004 15:33:44 -0000 1.5 --- XPathQueryTest.java 23 Sep 2004 12:41:18 -0000 1.6 *************** *** 109,113 **** System.out.println("testStarAxis 4: ========" ); printResult(result); ! assertEquals( "XPath: /*/*", 4, result.getSize() ); } catch (XMLDBException e) { --- 109,114 ---- System.out.println("testStarAxis 4: ========" ); printResult(result); ! // TODO: needs to be fixed: ! assertEquals( "XPath: /*/*", 12, result.getSize() ); } catch (XMLDBException e) { *************** *** 184,187 **** --- 185,220 ---- } + public void testNot() { + try { + XPathQueryService service = + storeXMLStringAndGetQueryService("strings.xml", strings); + + ResourceSet result = + service.queryResource( + "strings.xml", + "/test/string[not(@value)]"); + assertEquals(2, result.getSize()); + + result = + service.queryResource( + "strings.xml", + "not(/test/abcd)"); + assertEquals(1, result.getSize()); + Resource r = result.getResource(0); + assertEquals("false", r.getContent().toString()); + + result = + service.queryResource( + "strings.xml", + "/test/string[not(@id)]"); + assertEquals(1, result.getSize()); + r = result.getResource(0); + assertEquals("false", r.getContent().toString()); + } catch (XMLDBException e) { + System.out.println("testStrings(): XMLDBException: "+e); + fail(e.getMessage()); + } + } + /** * @return Index: AllTests.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/test/AllTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AllTests.java 9 Jul 2004 14:43:55 -0000 1.3 --- AllTests.java 23 Sep 2004 12:41:18 -0000 1.4 *************** *** 40,44 **** suite.addTestSuite(XPathQueryTest.class); suite.addTestSuite(LexerTest.class); // jmv: Note: LexerTest needs /db/test created by XPathQueryTest ! suite.addTestSuite(XQueryUseCasesTest.class); //$JUnit-END$ return suite; --- 40,44 ---- suite.addTestSuite(XPathQueryTest.class); suite.addTestSuite(LexerTest.class); // jmv: Note: LexerTest needs /db/test created by XPathQueryTest ! // suite.addTestSuite(XQueryUseCasesTest.class); //$JUnit-END$ return suite; |
From: Wolfgang M. M. <wol...@us...> - 2004-09-23 12:41:57
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25842/src/org/exist/dom Modified Files: AbstractNodeSet.java Log Message: Fixes for fn:not(). The function did not work for expressions like not(//abc) where abc is a non-existent node, or expressions like //test[not(false())]. Index: AbstractNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/AbstractNodeSet.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** AbstractNodeSet.java 12 Sep 2004 09:25:20 -0000 1.25 --- AbstractNodeSet.java 23 Sep 2004 12:41:19 -0000 1.26 *************** *** 1041,1048 **** --- 1041,1050 ---- for (Iterator i = iterator(); i.hasNext();) { current = (NodeProxy) i.next(); + System.out.println(current.gid); contextNode = current.getContext(); while (contextNode != null) { context = contextNode.getNode(); context.addMatches(current); + System.out.println("context: " + context.gid); if (!result.contains(context)) { if (rememberContext) |
From: Wolfgang M. M. <wol...@us...> - 2004-09-23 12:41:34
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25842/src/org/exist/xquery Modified Files: Predicate.java PathExpr.java Log Message: Fixes for fn:not(). The function did not work for expressions like not(//abc) where abc is a non-existent node, or expressions like //test[not(false())]. Index: Predicate.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/Predicate.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Predicate.java 12 Sep 2004 09:25:14 -0000 1.4 --- Predicate.java 23 Sep 2004 12:41:25 -0000 1.5 *************** *** 76,80 **** return Sequence.EMPTY_SEQUENCE; int type = inner.returnsType(); - //LOG.debug("inner expr " + inner.pprint() + " returns " + Type.getTypeName(type)); // Case 1: predicate expression returns a node set. Check the returned node set --- 76,79 ---- *************** *** 126,129 **** --- 125,129 ---- context.setContextPosition(p); Sequence innerSeq = inner.eval(contextSequence, item); + LOG.debug("innerSeq = " + innerSeq.effectiveBooleanValue()); if(innerSeq.effectiveBooleanValue()) result.add(item); Index: PathExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/PathExpr.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PathExpr.java 2 Jun 2004 11:34:36 -0000 1.7 --- PathExpr.java 23 Sep 2004 12:41:26 -0000 1.8 *************** *** 126,130 **** if (contextDocs != null) expr.setContextDocSet(contextDocs); if ((expr.getDependencies() & Dependency.CONTEXT_ITEM) != 0) { - //LOG.debug("single step mode: " + expr.pprint()); if (r.getLength() == 0) { r = expr.eval(null, null); --- 126,129 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-09-23 12:41:33
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25842/src/org/exist/util/hashtable/test Modified Files: HashtableTest.java Log Message: Fixes for fn:not(). The function did not work for expressions like not(//abc) where abc is a non-existent node, or expressions like //test[not(false())]. Index: HashtableTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable/test/HashtableTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HashtableTest.java 22 Sep 2004 10:46:00 -0000 1.6 --- HashtableTest.java 23 Sep 2004 12:41:21 -0000 1.7 *************** *** 36,40 **** public class HashtableTest extends TestCase { ! private int tabSize = 1000000; private Object values[] = new Object[tabSize]; --- 36,40 ---- public class HashtableTest extends TestCase { ! private int tabSize = 100000; private Object values[] = new Object[tabSize]; |
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13794/src/org/exist/xquery/value Modified Files: AtomicValue.java NumericValue.java DurationValue.java AbstractDateTimeValue.java AnyURIValue.java TimeValue.java UntypedAtomicValue.java ComputableValue.java DateValue.java OrderedValueSequence.java StringValue.java QNameValue.java DateTimeValue.java YearMonthDurationValue.java JavaObjectValue.java DayTimeDurationValue.java PreorderedValueSequence.java BooleanValue.java Log Message: Added collation support to XQuery. This is work in progress. Currently, it works for sorting and comparisons. Index: UntypedAtomicValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/UntypedAtomicValue.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UntypedAtomicValue.java 28 May 2004 10:54:10 -0000 1.3 --- UntypedAtomicValue.java 22 Sep 2004 21:50:06 -0000 1.4 *************** *** 23,26 **** --- 23,29 ---- package org.exist.xquery.value; + import java.text.Collator; + + import org.exist.util.Collations; import org.exist.xquery.Constants; import org.exist.xquery.XPathException; *************** *** 112,118 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (Type.subTypeOf(other.getType(), Type.STRING)) { ! int cmp = value.compareTo(other.getStringValue()); switch (operator) { case Constants.EQ : --- 115,121 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (Type.subTypeOf(other.getType(), Type.STRING)) { ! int cmp = Collations.compare(collator, value, other.getStringValue()); switch (operator) { case Constants.EQ : *************** *** 140,145 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { ! return value.compareTo(other.getStringValue()); } --- 143,151 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { ! if(collator == null) ! return value.compareTo(other.getStringValue()); ! else ! return collator.compare(value, other.getStringValue()); } Index: NumericValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/NumericValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NumericValue.java 28 May 2004 10:54:10 -0000 1.2 --- NumericValue.java 22 Sep 2004 21:50:06 -0000 1.3 *************** *** 1,4 **** --- 1,6 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.xquery.Constants; import org.exist.xquery.XPathException; *************** *** 29,33 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if(Type.subTypeOf(other.getType(), Type.NUMBER)) { --- 31,35 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if(Type.subTypeOf(other.getType(), Type.NUMBER)) { *************** *** 59,63 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { if(Type.subTypeOf(other.getType(), Type.NUMBER)) { double otherVal = ((NumericValue)other).getDouble(); --- 61,65 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if(Type.subTypeOf(other.getType(), Type.NUMBER)) { double otherVal = ((NumericValue)other).getDouble(); Index: PreorderedValueSequence.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/PreorderedValueSequence.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PreorderedValueSequence.java 12 Sep 2004 09:25:15 -0000 1.1 --- PreorderedValueSequence.java 22 Sep 2004 21:50:07 -0000 1.2 *************** *** 160,164 **** cmp = -1; } else ! cmp = a.compareTo(b); if((orderSpecs[i].getModifiers() & OrderSpec.DESCENDING_ORDER) != 0) cmp = cmp * -1; --- 160,164 ---- cmp = -1; } else ! cmp = a.compareTo(orderSpecs[i].getCollator(), b); if((orderSpecs[i].getModifiers() & OrderSpec.DESCENDING_ORDER) != 0) cmp = cmp * -1; Index: ComputableValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/ComputableValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ComputableValue.java 28 May 2004 10:54:10 -0000 1.2 --- ComputableValue.java 22 Sep 2004 21:50:06 -0000 1.3 *************** *** 23,26 **** --- 23,28 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.xquery.XPathException; *************** *** 43,52 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public abstract boolean compareTo(int operator, AtomicValue other) throws XPathException; /* (non-Javadoc) * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public abstract int compareTo(AtomicValue other) throws XPathException; /* (non-Javadoc) --- 45,54 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public abstract boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException; /* (non-Javadoc) * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public abstract int compareTo(Collator collator, AtomicValue other) throws XPathException; /* (non-Javadoc) Index: YearMonthDurationValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/YearMonthDurationValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** YearMonthDurationValue.java 28 May 2004 10:54:10 -0000 1.2 --- YearMonthDurationValue.java 22 Sep 2004 21:50:07 -0000 1.3 *************** *** 24,27 **** --- 24,29 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.xquery.Constants; import org.exist.xquery.XPathException; *************** *** 189,193 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.YEAR_MONTH_DURATION) { int v1 = getValue(); --- 191,195 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.YEAR_MONTH_DURATION) { int v1 = getValue(); *************** *** 218,222 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { if (other.getType() == Type.YEAR_MONTH_DURATION) { int v1 = getValue(); --- 220,224 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if (other.getType() == Type.YEAR_MONTH_DURATION) { int v1 = getValue(); *************** *** 239,245 **** public AtomicValue max(AtomicValue other) throws XPathException { if (other.getType() == Type.YEAR_MONTH_DURATION) ! return compareTo(other) > 0 ? this : other; else ! return compareTo(other.convertTo(Type.YEAR_MONTH_DURATION)) > 0 ? this : other; --- 241,247 ---- public AtomicValue max(AtomicValue other) throws XPathException { if (other.getType() == Type.YEAR_MONTH_DURATION) ! return compareTo(null, other) > 0 ? this : other; else ! return compareTo(null, other.convertTo(Type.YEAR_MONTH_DURATION)) > 0 ? this : other; *************** *** 251,257 **** public AtomicValue min(AtomicValue other) throws XPathException { if (other.getType() == Type.YEAR_MONTH_DURATION) ! return compareTo(other) < 0 ? this : other; else ! return compareTo(other.convertTo(Type.YEAR_MONTH_DURATION)) < 0 ? this : other; --- 253,259 ---- public AtomicValue min(AtomicValue other) throws XPathException { if (other.getType() == Type.YEAR_MONTH_DURATION) ! return compareTo(null, other) < 0 ? this : other; else ! return compareTo(null, other.convertTo(Type.YEAR_MONTH_DURATION)) < 0 ? this : other; Index: JavaObjectValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/JavaObjectValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JavaObjectValue.java 28 May 2004 10:54:10 -0000 1.2 --- JavaObjectValue.java 22 Sep 2004 21:50:07 -0000 1.3 *************** *** 23,26 **** --- 23,28 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.xquery.XPathException; *************** *** 67,71 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { throw new XPathException( "cannot compare Java object to " + Type.getTypeName(other.getType())); --- 69,73 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { throw new XPathException( "cannot compare Java object to " + Type.getTypeName(other.getType())); *************** *** 75,79 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { throw new XPathException( "cannot compare Java object to " + Type.getTypeName(other.getType())); --- 77,81 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { throw new XPathException( "cannot compare Java object to " + Type.getTypeName(other.getType())); Index: AnyURIValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/AnyURIValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AnyURIValue.java 28 May 2004 10:54:10 -0000 1.2 --- AnyURIValue.java 22 Sep 2004 21:50:06 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- import java.net.URISyntaxException; import java.net.URL; + import java.text.Collator; import org.exist.xquery.Constants; *************** *** 82,86 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.ANY_URI) { String otherURI = other.getStringValue(); --- 83,87 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.ANY_URI) { String otherURI = other.getStringValue(); *************** *** 98,102 **** } } else ! return compareTo(operator, other.convertTo(Type.ANY_URI)); } --- 99,103 ---- } } else ! return compareTo(collator, operator, other.convertTo(Type.ANY_URI)); } *************** *** 104,113 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { if (other.getType() == Type.ANY_URI) { String otherURI = other.getStringValue(); return uri.compareTo(otherURI); } else { ! return compareTo(other.convertTo(Type.ANY_URI)); } } --- 105,114 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if (other.getType() == Type.ANY_URI) { String otherURI = other.getStringValue(); return uri.compareTo(otherURI); } else { ! return compareTo(collator, other.convertTo(Type.ANY_URI)); } } Index: StringValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/StringValue.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StringValue.java 18 Aug 2004 20:08:55 -0000 1.6 --- StringValue.java 22 Sep 2004 21:50:06 -0000 1.7 *************** *** 21,26 **** --- 21,29 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.apache.oro.text.perl.Perl5Util; import org.exist.dom.QName; + import org.exist.util.Collations; import org.exist.util.XMLChar; import org.exist.xquery.Constants; *************** *** 232,236 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (Type.subTypeOf(other.getType(), Type.STRING)) { boolean substringCompare = false; --- 235,239 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (Type.subTypeOf(other.getType(), Type.STRING)) { boolean substringCompare = false; *************** *** 258,265 **** return value.endsWith(otherVal); case Constants.TRUNC_NONE : ! return value.equals(otherVal); } } ! int cmp = value.compareTo(other.getStringValue()); switch (operator) { case Constants.EQ : --- 261,268 ---- return value.endsWith(otherVal); case Constants.TRUNC_NONE : ! return Collations.equals(collator, value, otherVal); } } ! int cmp = Collations.compare(collator, value, other.getStringValue()); switch (operator) { case Constants.EQ : *************** *** 287,292 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { ! return value.compareTo(other.getStringValue()); } --- 290,298 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { ! if(collator == null) ! return value.compareTo(other.getStringValue()); ! else ! return collator.compare(value, other.getStringValue()); } Index: BooleanValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/BooleanValue.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BooleanValue.java 12 Sep 2004 09:25:15 -0000 1.4 --- BooleanValue.java 22 Sep 2004 21:50:07 -0000 1.5 *************** *** 21,24 **** --- 21,26 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.xquery.Constants; import org.exist.xquery.XPathException; *************** *** 83,87 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (Type.subTypeOf(other.getType(), Type.BOOLEAN)) { boolean otherVal = ((BooleanValue) other).getValue(); --- 85,89 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (Type.subTypeOf(other.getType(), Type.BOOLEAN)) { boolean otherVal = ((BooleanValue) other).getValue(); *************** *** 102,106 **** } ! public int compareTo(AtomicValue other) throws XPathException { boolean otherVal = other.effectiveBooleanValue(); if (otherVal == value) --- 104,108 ---- } ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { boolean otherVal = other.effectiveBooleanValue(); if (otherVal == value) Index: DateTimeValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/DateTimeValue.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DateTimeValue.java 22 Jun 2004 11:05:21 -0000 1.3 --- DateTimeValue.java 22 Sep 2004 21:50:07 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xquery.value; + import java.text.Collator; import java.util.Calendar; import java.util.GregorianCalendar; *************** *** 228,232 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.DATE_TIME) { int cmp = date.compareTo(((DateTimeValue) other).date); --- 229,233 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.DATE_TIME) { int cmp = date.compareTo(((DateTimeValue) other).date); *************** *** 256,260 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { if (other.getType() == Type.DATE_TIME) return date.compareTo(((DateTimeValue) other).date); --- 257,261 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if (other.getType() == Type.DATE_TIME) return date.compareTo(((DateTimeValue) other).date); Index: AbstractDateTimeValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/AbstractDateTimeValue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractDateTimeValue.java 29 Jan 2004 15:06:42 -0000 1.1 --- AbstractDateTimeValue.java 22 Sep 2004 21:50:06 -0000 1.2 *************** *** 24,27 **** --- 24,28 ---- package org.exist.xquery.value; + import java.text.Collator; import java.util.Calendar; import java.util.Date; *************** *** 55,59 **** public abstract AtomicValue convertTo(int requiredType) throws XPathException; ! public abstract boolean compareTo(int operator, AtomicValue other) throws XPathException; --- 56,60 ---- public abstract AtomicValue convertTo(int requiredType) throws XPathException; ! public abstract boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException; Index: DateValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/DateValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DateValue.java 28 May 2004 10:54:10 -0000 1.2 --- DateValue.java 22 Sep 2004 21:50:06 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xquery.value; + import java.text.Collator; import java.util.Calendar; import java.util.Date; *************** *** 181,185 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.DATE) { int cmp = date.compareTo(((DateValue) other).date); --- 182,186 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.DATE) { int cmp = date.compareTo(((DateValue) other).date); *************** *** 209,213 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { if (other.getType() == Type.DATE) { return date.compareTo(((DateValue) other).date); --- 210,214 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if (other.getType() == Type.DATE) { return date.compareTo(((DateValue) other).date); Index: TimeValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/TimeValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TimeValue.java 28 May 2004 10:54:10 -0000 1.2 --- TimeValue.java 22 Sep 2004 21:50:06 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xquery.value; + import java.text.Collator; import java.util.Calendar; import java.util.Date; *************** *** 207,211 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.TIME) { System.out.println( --- 208,212 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.TIME) { System.out.println( *************** *** 237,241 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { if (other.getType() == Type.TIME) { return date.compareTo(((TimeValue) other).date); --- 238,242 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if (other.getType() == Type.TIME) { return date.compareTo(((TimeValue) other).date); Index: QNameValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/QNameValue.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QNameValue.java 12 Sep 2004 12:56:28 -0000 1.4 --- QNameValue.java 22 Sep 2004 21:50:06 -0000 1.5 *************** *** 23,26 **** --- 23,28 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.dom.QName; import org.exist.xquery.Constants; *************** *** 80,84 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.QNAME) { int cmp = qname.compareTo(((QNameValue) other).qname); --- 82,86 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.QNAME) { int cmp = qname.compareTo(((QNameValue) other).qname); *************** *** 108,112 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { if (other.getType() == Type.QNAME) { return qname.compareTo(((QNameValue) other).qname); --- 110,114 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if (other.getType() == Type.QNAME) { return qname.compareTo(((QNameValue) other).qname); Index: DayTimeDurationValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/DayTimeDurationValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DayTimeDurationValue.java 28 May 2004 10:54:10 -0000 1.2 --- DayTimeDurationValue.java 22 Sep 2004 21:50:07 -0000 1.3 *************** *** 24,27 **** --- 24,29 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.xquery.Constants; import org.exist.xquery.XPathException; *************** *** 232,236 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.DAY_TIME_DURATION) { double v1 = getValue(); --- 234,238 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { if (other.getType() == Type.DAY_TIME_DURATION) { double v1 = getValue(); *************** *** 261,265 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { if (other.getType() == Type.DAY_TIME_DURATION) { double v1 = getValue(); --- 263,267 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if (other.getType() == Type.DAY_TIME_DURATION) { double v1 = getValue(); *************** *** 282,288 **** public AtomicValue max(AtomicValue other) throws XPathException { if (other.getType() == Type.DAY_TIME_DURATION) ! return compareTo(other) > 0 ? this : other; else ! return compareTo(other.convertTo(Type.DAY_TIME_DURATION)) > 0 ? this : other; --- 284,290 ---- public AtomicValue max(AtomicValue other) throws XPathException { if (other.getType() == Type.DAY_TIME_DURATION) ! return compareTo(null, other) > 0 ? this : other; else ! return compareTo(null, other.convertTo(Type.DAY_TIME_DURATION)) > 0 ? this : other; *************** *** 294,300 **** public AtomicValue min(AtomicValue other) throws XPathException { if (other.getType() == Type.DAY_TIME_DURATION) ! return compareTo(other) < 0 ? this : other; else ! return compareTo(other.convertTo(Type.DAY_TIME_DURATION)) < 0 ? this : other; --- 296,302 ---- public AtomicValue min(AtomicValue other) throws XPathException { if (other.getType() == Type.DAY_TIME_DURATION) ! return compareTo(null, other) < 0 ? this : other; else ! return compareTo(null, other.convertTo(Type.DAY_TIME_DURATION)) < 0 ? this : other; Index: DurationValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/DurationValue.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DurationValue.java 28 May 2004 10:54:10 -0000 1.2 --- DurationValue.java 22 Sep 2004 21:50:06 -0000 1.3 *************** *** 24,27 **** --- 24,29 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.xquery.XPathException; *************** *** 242,246 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { throw new XPathException("xs:duration values cannot be compared. Use xdt:yearMonthDuration or xdt:dayTimeDuration instead"); --- 244,248 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { throw new XPathException("xs:duration values cannot be compared. Use xdt:yearMonthDuration or xdt:dayTimeDuration instead"); *************** *** 250,254 **** * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(AtomicValue other) throws XPathException { throw new XPathException("xs:duration values cannot be compared. Use xdt:yearMonthDuration or xdt:dayTimeDuration instead"); } --- 252,256 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(org.exist.xquery.value.AtomicValue) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { throw new XPathException("xs:duration values cannot be compared. Use xdt:yearMonthDuration or xdt:dayTimeDuration instead"); } Index: AtomicValue.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/AtomicValue.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AtomicValue.java 12 Sep 2004 09:25:15 -0000 1.5 --- AtomicValue.java 22 Sep 2004 21:50:06 -0000 1.6 *************** *** 21,24 **** --- 21,26 ---- package org.exist.xquery.value; + import java.text.Collator; + import org.exist.dom.DocumentSet; import org.exist.dom.NodeSet; *************** *** 48,55 **** public abstract AtomicValue convertTo(int requiredType) throws XPathException; ! public abstract boolean compareTo(int operator, AtomicValue other) throws XPathException; ! public abstract int compareTo(AtomicValue other) throws XPathException; public abstract AtomicValue max(AtomicValue other) throws XPathException; --- 50,57 ---- public abstract AtomicValue convertTo(int requiredType) throws XPathException; ! public abstract boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException; ! public abstract int compareTo(Collator collator, AtomicValue other) throws XPathException; public abstract AtomicValue max(AtomicValue other) throws XPathException; *************** *** 251,255 **** * @see org.exist.xquery.value.AtomicValue#compareTo(java.lang.Object) */ ! public int compareTo(AtomicValue other) throws XPathException { if (other instanceof EmptyValue) return 0; --- 253,257 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(java.lang.Object) */ ! public int compareTo(Collator collator, AtomicValue other) throws XPathException { if (other instanceof EmptyValue) return 0; *************** *** 288,292 **** * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(int operator, AtomicValue other) throws XPathException { throw new XPathException("Cannot compare operand to empty value"); } --- 290,294 ---- * @see org.exist.xquery.value.AtomicValue#compareTo(int, org.exist.xquery.value.AtomicValue) */ ! public boolean compareTo(Collator collator, int operator, AtomicValue other) throws XPathException { throw new XPathException("Cannot compare operand to empty value"); } Index: OrderedValueSequence.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/value/OrderedValueSequence.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OrderedValueSequence.java 12 Sep 2004 09:25:15 -0000 1.3 --- OrderedValueSequence.java 22 Sep 2004 21:50:06 -0000 1.4 *************** *** 76,79 **** --- 76,80 ---- */ public int getLength() { + System.out.println("Length: " + count); return (items == null) ? 0 : count; } *************** *** 171,175 **** cmp = -1; } else ! cmp = a.compareTo(b); if((orderSpecs[i].getModifiers() & OrderSpec.DESCENDING_ORDER) != 0) cmp = cmp * -1; --- 172,176 ---- cmp = -1; } else ! cmp = a.compareTo(orderSpecs[i].getCollator(), b); if((orderSpecs[i].getModifiers() & OrderSpec.DESCENDING_ORDER) != 0) cmp = cmp * -1; *************** *** 198,203 **** */ public Item nextItem() { ! if(pos < count) return items[pos++].item; return null; } --- 199,205 ---- */ public Item nextItem() { ! if(pos < count) { return items[pos++].item; + } return null; } |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 21:50:17
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13794/src/org/exist/xquery/parser Modified Files: XQuery.g Log Message: Added collation support to XQuery. This is work in progress. Currently, it works for sorting and comparisons. Index: XQuery.g =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQuery.g,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** XQuery.g 21 Sep 2004 19:46:16 -0000 1.27 --- XQuery.g 22 Sep 2004 21:50:08 -0000 1.28 *************** *** 92,96 **** QNAME PREDICATE FLWOR PARENTHESIZED ABSOLUTE_SLASH ABSOLUTE_DSLASH WILDCARD PREFIX_WILDCARD FUNCTION UNARY_MINUS UNARY_PLUS XPOINTER XPOINTER_ID VARIABLE_REF ! VARIABLE_BINDING ELEMENT ATTRIBUTE TEXT VERSION_DECL NAMESPACE_DECL DEF_NAMESPACE_DECL DEF_FUNCTION_NS_DECL GLOBAL_VAR FUNCTION_DECL PROLOG ATOMIC_TYPE MODULE ORDER_BY POSITIONAL_VAR BEFORE AFTER MODULE_DECL ATTRIBUTE_TEST COMP_ELEM_CONSTRUCTOR --- 92,97 ---- QNAME PREDICATE FLWOR PARENTHESIZED ABSOLUTE_SLASH ABSOLUTE_DSLASH WILDCARD PREFIX_WILDCARD FUNCTION UNARY_MINUS UNARY_PLUS XPOINTER XPOINTER_ID VARIABLE_REF ! VARIABLE_BINDING ELEMENT ATTRIBUTE TEXT VERSION_DECL NAMESPACE_DECL ! DEF_NAMESPACE_DECL DEF_COLLATION_DECL DEF_FUNCTION_NS_DECL GLOBAL_VAR FUNCTION_DECL PROLOG ATOMIC_TYPE MODULE ORDER_BY POSITIONAL_VAR BEFORE AFTER MODULE_DECL ATTRIBUTE_TEST COMP_ELEM_CONSTRUCTOR *************** *** 137,141 **** | ( "declare" "default" ) ! => dnd:defaultNamespaceDecl | ( "declare" "function" ) --- 138,142 ---- | ( "declare" "default" ) ! => dnd:defaultsDecl | ( "declare" "function" ) *************** *** 162,174 **** ; ! defaultNamespaceDecl : "declare" "default" ( "element" "namespace" defu:STRING_LITERAL ! { #defaultNamespaceDecl= #(#[DEF_NAMESPACE_DECL, "defaultNamespaceDecl"], defu); } | "function" "namespace" deff:STRING_LITERAL ! { #defaultNamespaceDecl= #(#[DEF_FUNCTION_NS_DECL, "defaultFunctionNSDecl"], deff); } ) ; --- 163,178 ---- ; ! defaultsDecl : "declare" "default" ( "element" "namespace" defu:STRING_LITERAL ! { #defaultsDecl= #(#[DEF_NAMESPACE_DECL, "defaultNamespaceDecl"], defu); } | "function" "namespace" deff:STRING_LITERAL ! { #defaultsDecl= #(#[DEF_FUNCTION_NS_DECL, "defaultFunctionNSDecl"], deff); } ! | ! "collation" defc:STRING_LITERAL ! { #defaultsDecl = #(#[DEF_COLLATION_DECL, "defaultCollationDecl"], defc); } ) ; *************** *** 313,317 **** orderModifier : ! ( "ascending" | "descending" )? ( "empty" ( "greatest" | "least" ) )? ; --- 317,321 ---- orderModifier : ! ( "ascending" | "descending" )? ( "empty" ( "greatest" | "least" ) )? ( "collation" STRING_LITERAL )? ; *************** *** 1046,1049 **** --- 1050,1055 ---- | "declare" { name = "declare"; } + | + "collation" { name = "collation"; } ; *************** *** 1200,1203 **** --- 1206,1214 ---- | #( + DEF_COLLATION_DECL defc:STRING_LITERAL + { context.setDefaultCollation(defc.getText()); } + ) + | + #( qname:GLOBAL_VAR { *************** *** 1608,1612 **** step=expr [orderSpecExpr] { ! OrderSpec orderSpec= new OrderSpec(orderSpecExpr); int modifiers= 0; orderBy.add(orderSpec); --- 1619,1623 ---- step=expr [orderSpecExpr] { ! OrderSpec orderSpec= new OrderSpec(context, orderSpecExpr); int modifiers= 0; orderBy.add(orderSpec); *************** *** 1635,1638 **** --- 1646,1655 ---- ) )? + ( + "collation" collURI:STRING_LITERAL + { + orderSpec.setCollation(collURI.getText()); + } + )? )+ ) |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 21:50:16
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13794/src/org/exist/xquery/functions Modified Files: FunDistinctValues.java Log Message: Added collation support to XQuery. This is work in progress. Currently, it works for sorting and comparisons. Index: FunDistinctValues.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunDistinctValues.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FunDistinctValues.java 12 Sep 2004 09:25:14 -0000 1.5 --- FunDistinctValues.java 22 Sep 2004 21:50:07 -0000 1.6 *************** *** 23,26 **** --- 23,27 ---- package org.exist.xquery.functions; + import java.text.Collator; import java.util.Comparator; import java.util.TreeSet; *************** *** 85,89 **** long start = System.currentTimeMillis(); Sequence values = getArgument(0).eval(contextSequence); ! TreeSet set = new TreeSet(new ValueComparator()); ValueSequence result = new ValueSequence(); AtomicValue value; --- 86,90 ---- long start = System.currentTimeMillis(); Sequence values = getArgument(0).eval(contextSequence); ! TreeSet set = new TreeSet(new ValueComparator(context.getCollator(null))); ValueSequence result = new ValueSequence(); AtomicValue value; *************** *** 104,107 **** --- 105,115 ---- private final static class ValueComparator implements Comparator { + + Collator collator; + + public ValueComparator(Collator collator) { + this.collator = collator; + } + /* (non-Javadoc) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) *************** *** 109,113 **** public int compare(Object o1, Object o2) { try { ! return ((AtomicValue) o1).compareTo((AtomicValue) o2); } catch (XPathException e) { throw new IllegalArgumentException("cannot compare values"); --- 117,121 ---- public int compare(Object o1, Object o2) { try { ! return ((AtomicValue) o1).compareTo(collator, (AtomicValue) o2); } catch (XPathException e) { throw new IllegalArgumentException("cannot compare values"); |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 21:50:16
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13794/src/org/exist/xquery Modified Files: OrderSpec.java GeneralComparison.java XQueryContext.java Log Message: Added collation support to XQuery. This is work in progress. Currently, it works for sorting and comparisons. Index: OrderSpec.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/OrderSpec.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OrderSpec.java 30 Jun 2004 15:56:59 -0000 1.2 --- OrderSpec.java 22 Sep 2004 21:50:07 -0000 1.3 *************** *** 23,26 **** --- 23,28 ---- package org.exist.xquery; + import java.text.Collator; + /** * An XQuery order specifier as specified in an "order by" clause. *************** *** 36,47 **** public static final int EMPTY_LEAST = 4; private Expression expression; private int modifiers = 0; /** * */ ! public OrderSpec(Expression sortExpr) { this.expression = sortExpr; } --- 38,52 ---- public static final int EMPTY_LEAST = 4; + private XQueryContext context; private Expression expression; private int modifiers = 0; + private Collator collator = null; /** * */ ! public OrderSpec(XQueryContext context, Expression sortExpr) { this.expression = sortExpr; + this.context = context; } *************** *** 50,53 **** --- 55,62 ---- } + public void setCollation(String collationURI) throws XPathException { + this.collator = context.getCollator(collationURI); + } + public Expression getSortExpression() { return expression; *************** *** 58,61 **** --- 67,74 ---- } + public Collator getCollator() { + return collator == null ? context.getDefaultCollator() : collator; + } + public String toString() { StringBuffer buf = new StringBuffer(); Index: GeneralComparison.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/GeneralComparison.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GeneralComparison.java 20 Sep 2004 20:31:38 -0000 1.8 --- GeneralComparison.java 22 Sep 2004 21:50:07 -0000 1.9 *************** *** 339,343 **** return lv.contains(rv); default: ! return lv.compareTo(relation, rv); } } catch (XPathException e) { --- 339,343 ---- return lv.contains(rv); default: ! return lv.compareTo(context.getDefaultCollator(), relation, rv); } } catch (XPathException e) { Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** XQueryContext.java 12 Sep 2004 13:12:23 -0000 1.24 --- XQueryContext.java 22 Sep 2004 21:50:07 -0000 1.25 *************** *** 28,33 **** import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; - import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; --- 28,33 ---- import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; + import java.text.Collator; import java.util.ArrayList; import java.util.HashMap; *************** *** 45,48 **** --- 45,49 ---- import org.exist.security.User; import org.exist.storage.DBBroker; + import org.exist.util.Collations; import org.exist.xquery.parser.XQueryLexer; import org.exist.xquery.parser.XQueryParser; *************** *** 129,132 **** --- 130,136 ---- private String defaultFunctionNamespace = Module.BUILTIN_FUNCTION_NS; + private String defaultCollation = Collations.CODEPOINT; + private Collator defaultCollator = null; + /** * Set to true to enable XPath 1.0 *************** *** 267,270 **** --- 271,297 ---- } + public void setDefaultCollation(String uri) throws XPathException { + if(uri.equals(Collations.CODEPOINT) || uri.equals(Collations.CODEPOINT_SHORT)) { + defaultCollation = Collations.CODEPOINT; + defaultCollator = null; + } + defaultCollator = Collations.getCollationFromURI(uri); + defaultCollation = uri; + } + + public String getDefaultCollation() { + return defaultCollation; + } + + public Collator getCollator(String uri) throws XPathException { + if(uri == null) + return defaultCollator; + return Collations.getCollationFromURI(uri); + } + + public Collator getDefaultCollator() { + return defaultCollator; + } + /** * Return the namespace URI mapped to the registered prefix |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 21:50:16
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13794/src/org/exist/util Added Files: Collations.java Removed Files: CharTest.java Log Message: Added collation support to XQuery. This is work in progress. Currently, it works for sorting and comparisons. --- NEW FILE: Collations.java --- /* * Created on Sep 23, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package org.exist.util; import java.net.URI; import java.net.URISyntaxException; import java.text.Collator; import java.util.Locale; import java.util.StringTokenizer; import org.apache.log4j.Logger; import org.exist.xquery.XPathException; /** * Utility methods dealing with collations. * * @author wolf */ public class Collations { private final static Logger LOG = Logger.getLogger(Collations.class); /** * The default unicode codepoint collation URI as defined by the XQuery spec. */ public final static String CODEPOINT = "http://www.w3.org/2004/07/xpath-functions/collation/codepoint"; /** * Short string to select the default codepoint collation */ public final static String CODEPOINT_SHORT = "codepoint"; /** * The URI used to select collations in eXist. */ public final static String EXIST_COLLATION_URI = "http://exist-db.org/collation"; /** * Get a {@link Comparator} from the specified URI. * * The original code is from saxon (@linkplain http://saxon.sf.net). * * @param uri * @return * @throws XPathException */ public final static Collator getCollationFromURI(String uri) throws XPathException { if(uri.startsWith(EXIST_COLLATION_URI) || uri.startsWith("?")) { URI u = null; try { u = new URI(uri); } catch (URISyntaxException e) { return null; } String query = u.getQuery(); if(query == null) return getCollationFromParams(null, null, null); String lang = null; String strength = null; String decomposition = null; StringTokenizer queryTokenizer = new StringTokenizer(query, ";&"); while (queryTokenizer.hasMoreElements()) { String param = queryTokenizer.nextToken(); int eq = param.indexOf('='); if (eq > 0 && eq < param.length()-1) { String kw = param.substring(0, eq); String val = param.substring(eq + 1); if (kw.equals("lang")) { lang = val; } else if (kw.equals("strength")) { strength = val; } else if (kw.equals("decomposition")) { decomposition = val; } } } return getCollationFromParams(lang, strength, decomposition); } else // unknown collation return null; } public final static boolean equals(Collator collator, String s1, String s2) { if(collator == null) return s1.equals(s2); else return collator.equals(s1, s2); } public final static int compare(Collator collator, String s1, String s2) { if(collator == null) return s1.compareTo(s2); else return collator.compare(s1, s2); } /** * @param lang * @param strength * @param decomposition * @return */ private static Collator getCollationFromParams(String lang, String strength, String decomposition) throws XPathException { Collator collator = null; if(lang == null) { collator = Collator.getInstance(); } else { Locale locale = getLocale(lang); LOG.debug("Using locale: " + locale.toString()); collator = Collator.getInstance(locale); } if(strength != null) { if("primary".equals(strength)) collator.setStrength(Collator.PRIMARY); else if("secondary".equals(strength)) collator.setStrength(Collator.SECONDARY); else if("tertiary".equals(strength)) collator.setStrength(Collator.TERTIARY); else if("identical".equals(strength)) collator.setStrength(Collator.IDENTICAL); else throw new XPathException("Collation strength should be either 'primary', 'secondary', 'tertiary' or 'identical"); } if(decomposition != null) { if("none".equals(decomposition)) collator.setDecomposition(Collator.NO_DECOMPOSITION); else if("full".equals(decomposition)) collator.setDecomposition(Collator.FULL_DECOMPOSITION); else if("standard".equals(decomposition)) collator.setDecomposition(Collator.CANONICAL_DECOMPOSITION); else throw new XPathException("Collation decomposition should be either 'none', 'full' or 'standard"); } return collator; } /** * @param lang * @return */ private static Locale getLocale(String lang) { int dash = lang.indexOf('-'); if(dash < 0) return new Locale(lang); else return new Locale(lang.substring(0, dash), lang.substring(dash + 1)); } } --- CharTest.java DELETED --- |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 15:21:49
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/collections In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25015/src/org/exist/collections Modified Files: Collection.java Log Message: Document and collection permissions were stored as a single byte, though 9 bits are used. As a result, the user:read permission bit was reset to 1 whenever the db got restarted. Index: Collection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/collections/Collection.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Collection.java 14 Sep 2004 17:05:35 -0000 1.52 --- Collection.java 22 Sep 2004 15:21:02 -0000 1.53 *************** *** 628,632 **** final int uid = istream.readInt(); final int gid = istream.readInt(); ! final int perm = (istream.readByte() & 0777); if (secman == null) { permissions.setOwner(SecurityManager.DBA_USER); --- 628,632 ---- final int uid = istream.readInt(); final int gid = istream.readInt(); ! final int perm = (istream.readInt() & 0777); if (secman == null) { permissions.setOwner(SecurityManager.DBA_USER); *************** *** 1580,1584 **** ostream.writeInt(group.getId()); } ! ostream.writeByte((byte) permissions.getPermissions()); ostream.writeLong(created); if(reloadRequired) { --- 1580,1584 ---- ostream.writeInt(group.getId()); } ! ostream.writeInt(permissions.getPermissions()); ostream.writeLong(created); if(reloadRequired) { |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 15:21:19
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25015/src/org/exist/dom Modified Files: DocumentImpl.java Log Message: Document and collection permissions were stored as a single byte, though 9 bits are used. As a result, the user:read permission bit was reset to 1 whenever the db got restarted. Index: DocumentImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/DocumentImpl.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** DocumentImpl.java 18 Sep 2004 15:19:47 -0000 1.54 --- DocumentImpl.java 22 Sep 2004 15:21:03 -0000 1.55 *************** *** 564,568 **** final int uid = istream.readInt(); final int gid = istream.readInt(); ! final int perm = (istream.readByte() & 0777); if (secman == null) { permissions.setOwner(SecurityManager.DBA_USER); --- 564,568 ---- final int uid = istream.readInt(); final int gid = istream.readInt(); ! final int perm = (istream.readInt() & 0777); if (secman == null) { permissions.setOwner(SecurityManager.DBA_USER); *************** *** 687,691 **** ostream.writeInt(group.getId()); } ! ostream.writeByte((byte) permissions.getPermissions()); if(lockOwnerId > 0) ostream.writeInt(lockOwnerId); --- 687,691 ---- ostream.writeInt(group.getId()); } ! ostream.writeInt(permissions.getPermissions()); if(lockOwnerId > 0) ostream.writeInt(lockOwnerId); |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 12:39:36
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23431/src/org/exist/xupdate Modified Files: Conditional.java Modification.java Log Message: XUpdate now pools compiled xpath statements. Index: Modification.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Modification.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Modification.java 21 Sep 2004 14:42:04 -0000 1.32 --- Modification.java 22 Sep 2004 12:39:21 -0000 1.33 *************** *** 23,27 **** package org.exist.xupdate; ! import java.io.StringReader; import java.util.Comparator; import java.util.HashMap; --- 23,27 ---- package org.exist.xupdate; ! import java.io.IOException; import java.util.Comparator; import java.util.HashMap; *************** *** 37,58 **** import org.exist.dom.NodeSet; import org.exist.security.PermissionDeniedException; import org.exist.storage.DBBroker; import org.exist.storage.store.StorageAddress; import org.exist.util.Lock; import org.exist.util.LockException; ! import org.exist.xquery.PathExpr; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; - import org.exist.xquery.parser.XQueryLexer; - import org.exist.xquery.parser.XQueryParser; - import org.exist.xquery.parser.XQueryTreeParser; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.Type; import org.w3c.dom.NodeList; - import antlr.RecognitionException; - import antlr.TokenStreamException; - import antlr.collections.AST; - /** * Base class for all XUpdate modifications. --- 37,55 ---- import org.exist.dom.NodeSet; import org.exist.security.PermissionDeniedException; + import org.exist.source.Source; + import org.exist.source.StringSource; import org.exist.storage.DBBroker; + import org.exist.storage.XQueryPool; import org.exist.storage.store.StorageAddress; import org.exist.util.Lock; import org.exist.util.LockException; ! import org.exist.xquery.CompiledXQuery; import org.exist.xquery.XPathException; + import org.exist.xquery.XQuery; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.Type; import org.w3c.dom.NodeList; /** * Base class for all XUpdate modifications. *************** *** 112,150 **** protected NodeList select(DocumentSet docs) throws PermissionDeniedException, EXistException, XPathException { ! try { ! XQueryContext context = new XQueryContext(broker); ! context.setExclusiveMode(true); ! context.setStaticallyKnownDocuments(docs); ! declareNamespaces(context); ! XQueryLexer lexer = new XQueryLexer(context, new StringReader(selectStmt)); ! XQueryParser parser = new XQueryParser(lexer); ! XQueryTreeParser treeParser = new XQueryTreeParser(context); ! parser.xpath(); ! if (parser.foundErrors()) { ! throw new RuntimeException(parser.getErrorMessage()); ! } ! ! AST ast = parser.getAST(); ! PathExpr expr = new PathExpr(context); ! treeParser.xpath(ast, expr); ! if (treeParser.foundErrors()) { ! throw new RuntimeException(treeParser.getErrorMessage()); } ! long start = System.currentTimeMillis(); ! ! Sequence resultSeq = expr.eval(null, null); ! if (!(resultSeq.getLength() == 0 || Type.subTypeOf(resultSeq.getItemType(), Type.NODE))) ! throw new EXistException("select expression should evaluate to a node-set; got " + ! Type.getTypeName(resultSeq.getItemType())); ! LOG.debug("found " + resultSeq.getLength() + " for select: " + selectStmt); ! return (NodeList)resultSeq.toNodeSet(); ! } catch (RecognitionException e) { ! LOG.warn("error while parsing select expression", e); ! throw new EXistException(e); ! } catch (TokenStreamException e) { ! LOG.warn("error while parsing select expression", e); ! throw new EXistException(e); } } --- 109,145 ---- protected NodeList select(DocumentSet docs) throws PermissionDeniedException, EXistException, XPathException { ! XQuery xquery = broker.getXQueryService(); ! XQueryPool pool = xquery.getXQueryPool(); ! Source source = new StringSource(selectStmt); ! CompiledXQuery compiled = pool.borrowCompiledXQuery(source); ! XQueryContext context; ! if(compiled == null) ! context = xquery.newContext(); ! else ! context = compiled.getContext(); ! context.setExclusiveMode(true); ! context.setStaticallyKnownDocuments(docs); ! declareNamespaces(context); ! ! if(compiled == null) ! try { ! compiled = xquery.compile(context, source); ! } catch (IOException e) { ! throw new EXistException("An exception occurred while compiling the query: " + e.getMessage()); } ! ! Sequence resultSeq = null; ! try { ! resultSeq = xquery.execute(compiled, null); ! } finally { ! pool.returnCompiledXQuery(source, compiled); } + + if (!(resultSeq.getLength() == 0 || Type.subTypeOf(resultSeq.getItemType(), Type.NODE))) + throw new EXistException("select expression should evaluate to a node-set; got " + + Type.getTypeName(resultSeq.getItemType())); + LOG.debug("found " + resultSeq.getLength() + " for select: " + selectStmt); + return (NodeList)resultSeq.toNodeSet(); } Index: Conditional.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Conditional.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Conditional.java 21 Sep 2004 14:42:04 -0000 1.1 --- Conditional.java 22 Sep 2004 12:39:21 -0000 1.2 *************** *** 22,26 **** package org.exist.xupdate; ! import java.io.StringReader; import java.util.ArrayList; import java.util.List; --- 22,26 ---- package org.exist.xupdate; ! import java.io.IOException; import java.util.ArrayList; import java.util.List; *************** *** 30,34 **** --- 30,37 ---- import org.exist.dom.DocumentSet; import org.exist.security.PermissionDeniedException; + import org.exist.source.Source; + import org.exist.source.StringSource; import org.exist.storage.DBBroker; + import org.exist.storage.XQueryPool; import org.exist.util.LockException; import org.exist.xquery.CompiledXQuery; *************** *** 67,76 **** LOG.debug("Processing xupdate:if ..."); XQuery xquery = broker.getXQueryService(); ! XQueryContext context = xquery.newContext(); context.setBackwardsCompatibility(true); context.setStaticallyKnownDocuments(docs); declareNamespaces(context); ! CompiledXQuery compiled = xquery.compile(context, new StringReader(selectStmt)); ! Sequence seq = xquery.execute(compiled, null); if(seq.effectiveBooleanValue()) { long mods = 0; --- 70,98 ---- LOG.debug("Processing xupdate:if ..."); XQuery xquery = broker.getXQueryService(); ! XQueryPool pool = xquery.getXQueryPool(); ! Source source = new StringSource(selectStmt); ! CompiledXQuery compiled = pool.borrowCompiledXQuery(source); ! XQueryContext context; ! if(compiled == null) ! context = xquery.newContext(); ! else ! context = compiled.getContext(); ! context.setBackwardsCompatibility(true); context.setStaticallyKnownDocuments(docs); declareNamespaces(context); ! if(compiled == null) ! try { ! compiled = xquery.compile(context, source); ! } catch (IOException e) { ! throw new EXistException("An exception occurred while compiling the query: " + e.getMessage()); ! } ! ! Sequence seq = null; ! try { ! seq = xquery.execute(compiled, null); ! } finally { ! pool.returnCompiledXQuery(source, compiled); ! } if(seq.effectiveBooleanValue()) { long mods = 0; |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 10:46:13
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28966/src/org/exist/util/hashtable Modified Files: SequencedLongHashMap.java Long2ObjectHashMap.java Int2ObjectHashMap.java Log Message: Improved SequencedLongHashMap (which is used for the LRU cache) to create less temporary objects. Index: SequencedLongHashMap.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable/SequencedLongHashMap.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SequencedLongHashMap.java 15 Aug 2004 20:53:28 -0000 1.3 --- SequencedLongHashMap.java 22 Sep 2004 10:46:00 -0000 1.4 *************** *** 30,34 **** import java.util.Iterator; ! public class SequencedLongHashMap extends Long2ObjectHashMap { public final static class Entry { --- 30,36 ---- import java.util.Iterator; ! import org.exist.util.hashtable.Long2ObjectHashMap.Long2ObjectIterator; ! ! public class SequencedLongHashMap extends AbstractHashtable { public final static class Entry { *************** *** 57,60 **** --- 59,67 ---- } } + + private final static Entry REMOVED_ENTRY = new Entry(0, null); + + protected long[] keys; + protected Entry[] values; private Entry first = null; *************** *** 63,100 **** public SequencedLongHashMap() { super(); } public SequencedLongHashMap(int iSize) { super(iSize); } public void put(long key, Object value) { ! Entry entry = new Entry(key, value); ! Entry duplicate = null; try { ! Object old = insert(key, entry); ! if(old != null && !(old instanceof Entry)) ! throw new RuntimeException("Found old object: " + old.getClass().getName()); ! duplicate = (Entry)old; } catch (HashtableOverflowException e) { ! long[] copyKeys = keys; ! Object[] copyValues = values; // enlarge the table with a prime value tabSize = (int) nextPrime(tabSize + tabSize / 2); keys = new long[tabSize]; ! values = new Object[tabSize]; items = 0; try { for (int k = 0; k < copyValues.length; k++) { ! if (copyValues[k] != null && copyValues[k] != REMOVED) ! insert(copyKeys[k], copyValues[k]); } ! duplicate = (Entry)insert(key, entry); } catch (HashtableOverflowException e1) { } } ! if(duplicate != null) ! removeEntry(duplicate); if(first == null) { first = entry; --- 70,105 ---- public SequencedLongHashMap() { super(); + keys = new long[tabSize]; + values = new Entry[tabSize]; } public SequencedLongHashMap(int iSize) { super(iSize); + keys = new long[tabSize]; + values = new Entry[tabSize]; } public void put(long key, Object value) { ! Entry entry = null; try { ! entry = insert(key, value); } catch (HashtableOverflowException e) { ! Entry[] copyValues = values; // enlarge the table with a prime value tabSize = (int) nextPrime(tabSize + tabSize / 2); keys = new long[tabSize]; ! values = new Entry[tabSize]; items = 0; try { for (int k = 0; k < copyValues.length; k++) { ! if (copyValues[k] != null && copyValues[k] != REMOVED_ENTRY) ! insert(copyValues[k].key, copyValues[k].value); } ! entry = (Entry)insert(key, value); } catch (HashtableOverflowException e1) { } } ! if(first == null) { first = entry; *************** *** 107,113 **** } public Object get(long key) { ! Entry entry = (Entry) super.get(key); ! return entry == null ? null : entry.value; } --- 112,197 ---- } + protected Entry insert(long key, Object value) throws HashtableOverflowException { + if (value == null) + throw new IllegalArgumentException("Illegal value: null"); + int idx = hash(key) % tabSize; + if(idx < 0) + idx *= -1; + int bucket = -1; + // look for an empty bucket + if (values[idx] == null) { + keys[idx] = key; + values[idx] = new Entry(key, value); + ++items; + return values[idx]; + } else if (values[idx] == REMOVED_ENTRY) { + // remember the bucket, but continue to check + // for duplicate keys + bucket = idx; + } else if (keys[idx] == key) { + // duplicate value + Entry dup = values[idx]; + dup.value = value; + removeEntry(dup); + return dup; + } + int rehashVal = rehash(idx); + int rehashCnt = 1; + for (int i = 0; i < tabSize; i++) { + idx = (idx + rehashVal) % tabSize; + if(values[idx] == REMOVED_ENTRY) { + if(bucket == -1) + bucket = idx; + } else if (values[idx] == null) { + if(bucket > -1) { + // store key into the empty bucket first found + idx = bucket; + } + keys[idx] = key; + values[idx] = new Entry(key, value); + ++items; + return values[idx]; + } else if(keys[idx] == key) { + // duplicate value + Entry dup = values[idx]; + dup.value = value; + removeEntry(dup); + return dup; + } + ++rehashCnt; + } + // if the key has not been inserted yet, do it now + if(bucket > -1) { + keys[bucket] = key; + values[bucket] = new Entry(key, value); + ++items; + return values[bucket]; + } + throw new HashtableOverflowException(); + } + public Object get(long key) { ! int idx = hash(key) % tabSize; ! if(idx < 0) ! idx *= -1; ! if (values[idx] == null) ! return null; // key does not exist ! else if (keys[idx] == key) { ! if(values[idx] == REMOVED) ! return null; ! return values[idx].value; ! } ! int rehashVal = rehash(idx); ! for (int i = 0; i < tabSize; i++) { ! idx = (idx + rehashVal) % tabSize; ! if (values[idx] == null) { ! return null; // key not found ! } else if (keys[idx] == key) { ! if(values[idx] == REMOVED) ! return null; ! return values[idx].value; ! } ! } ! return null; } *************** *** 117,121 **** public Object remove(long key) { ! Entry entry = (Entry) super.remove(key); if(entry != null) { removeEntry(entry); --- 201,205 ---- public Object remove(long key) { ! Entry entry = removeFromHashtable(key); if(entry != null) { removeEntry(entry); *************** *** 125,128 **** --- 209,243 ---- } + private Entry removeFromHashtable(long key) { + int idx = hash(key) % tabSize; + if(idx < 0) + idx *= -1; + if (values[idx] == null) { + return null; // key does not exist + } else if (keys[idx] == key) { + if(values[idx] == REMOVED_ENTRY) + return null; // key has already been removed + Entry o = values[idx]; + values[idx] = REMOVED_ENTRY; + --items; + return o; + } + int rehashVal = rehash(idx); + for (int i = 0; i < tabSize; i++) { + idx = (idx + rehashVal) % tabSize; + if (values[idx] == null) { + return null; // key not found + } else if (keys[idx] == key) { + if(values[idx] == REMOVED_ENTRY) + return null; // key has already been removed + Entry o = values[idx]; + values[idx] = REMOVED_ENTRY; + --items; + return o; + } + } + return null; + } + /** * Remove the first entry added to the map. *************** *** 133,142 **** if(first == null) return null; ! super.remove(first.key); ! Entry head = first; ! first = head.next; ! if(head != null) ! head.prev = null; ! return head.value; } --- 248,255 ---- if(first == null) return null; ! final Entry head = first; ! removeFromHashtable(first.key); ! removeEntry(first); ! return head; } *************** *** 157,160 **** --- 270,286 ---- entry.next.prev = entry.prev; } + entry.prev = null; + entry.next = null; + } + + protected int rehash(int iVal) { + int retVal = (iVal + iVal / 2) % tabSize; + if (retVal == 0) + retVal = 1; + return retVal; + } + + protected final static int hash(long l) { + return (int) (l ^ (l >>> 32)); } Index: Int2ObjectHashMap.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable/Int2ObjectHashMap.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Int2ObjectHashMap.java 25 May 2004 09:26:14 -0000 1.5 --- Int2ObjectHashMap.java 22 Sep 2004 10:46:00 -0000 1.6 *************** *** 244,248 **** return retVal; } ! protected static int hash(int i) { return i; --- 244,248 ---- return retVal; } ! protected static int hash(int i) { return i; Index: Long2ObjectHashMap.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable/Long2ObjectHashMap.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Long2ObjectHashMap.java 15 Aug 2004 20:29:10 -0000 1.5 --- Long2ObjectHashMap.java 22 Sep 2004 10:46:00 -0000 1.6 *************** *** 32,36 **** */ public class Long2ObjectHashMap extends AbstractHashtable { ! protected long[] keys; protected Object[] values; --- 32,36 ---- */ public class Long2ObjectHashMap extends AbstractHashtable { ! protected long[] keys; protected Object[] values; |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 10:46:13
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28966/src/org/exist/util/hashtable/test Modified Files: HashtableTest.java Log Message: Improved SequencedLongHashMap (which is used for the LRU cache) to create less temporary objects. Index: HashtableTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/hashtable/test/HashtableTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HashtableTest.java 12 Aug 2004 18:54:21 -0000 1.5 --- HashtableTest.java 22 Sep 2004 10:46:00 -0000 1.6 *************** *** 36,40 **** public class HashtableTest extends TestCase { ! private int tabSize = 100000; private Object values[] = new Object[tabSize]; --- 36,40 ---- public class HashtableTest extends TestCase { ! private int tabSize = 1000000; private Object values[] = new Object[tabSize]; *************** *** 51,65 **** Int2ObjectHashMap table = new Int2ObjectHashMap(tabSize); Random rand = new Random(System.currentTimeMillis()); for(int i = 0; i < tabSize; i++) { ! keys[i] = rand.nextInt(Integer.MAX_VALUE); values[i] = new String("a" + keys[i]); table.put(keys[i], values[i]); } for(int i = 0; i < tabSize; i++) { Object v = table.get(keys[i]); ! assertEquals( values[i], v); } int r; - long p; for(int i = 0; i < tabSize / 10; i++) { do { --- 51,69 ---- Int2ObjectHashMap table = new Int2ObjectHashMap(tabSize); Random rand = new Random(System.currentTimeMillis()); + System.out.println("Generating " + tabSize + " random keys..."); for(int i = 0; i < tabSize; i++) { ! do { ! keys[i] = rand.nextInt(Integer.MAX_VALUE); ! } while(table.get(keys[i]) != null); values[i] = new String("a" + keys[i]); table.put(keys[i], values[i]); } + System.out.println("Testing get(key) ..."); for(int i = 0; i < tabSize; i++) { Object v = table.get(keys[i]); ! assertEquals( values[i], v ); } + System.out.println("Testing remove(key) ..."); int r; for(int i = 0; i < tabSize / 10; i++) { do { *************** *** 67,82 **** } while(values[r] == null); table.remove(keys[r]); - //assertTrue(p > -1); values[r] = null; } for(int i = 0; i <tabSize; i++) { ! if(values[i] == null) { ! continue; ! } String v = (String)table.get(keys[i]); ! if(v == null) ! System.out.println("key " + keys[i] + " already removed?"); ! else ! assertEquals(values[i], v); } int c = 0; --- 71,82 ---- } while(values[r] == null); table.remove(keys[r]); values[r] = null; } for(int i = 0; i <tabSize; i++) { ! while(values[i] == null) ! i++; String v = (String)table.get(keys[i]); ! assertNotNull("Key not found", v); ! assertEquals(values[i], v); } int c = 0; *************** *** 93,96 **** --- 93,97 ---- SequencedLongHashMap table = new SequencedLongHashMap(tabSize); Random rand = new Random(System.currentTimeMillis()); + System.out.println("Generating " + tabSize + " random keys..."); for(int i = 0; i < tabSize; i++) { do { *************** *** 100,107 **** --- 101,110 ---- table.put(keys[i], values[i]); } + // check SequencedLongHashMap.get() for(int i = 0; i < tabSize; i++) { Object v = table.get(keys[i]); assertEquals( values[i], v); } + // check SequencedLongHashMap.iterator() int c = 0; for(Iterator i = table.iterator(); i.hasNext(); c++) { *************** *** 109,115 **** assertEquals(keys[c], v.longValue()); } ! System.out.println(table.size() + " = " + c); System.out.println("maxRehash: " + table.getMaxRehash()); - assertEquals(table.size(), c); } } --- 112,179 ---- assertEquals(keys[c], v.longValue()); } ! assertEquals(c, table.size()); ! ! // remove 1000 random items ! for(int i = 0; i < 1000; i++) { ! int k; ! do { ! k = rand.nextInt(tabSize - 1); ! } while(values[k] == null); ! table.remove(keys[k]); ! values[k] = null; ! assertNull(table.get(keys[k])); ! } ! System.out.println("Hashtable size: " + table.size()); ! ! // iterate through the sequence again ! int k = 0; ! c = 0; ! for(Iterator i = table.iterator(); i.hasNext(); k++, c++) { ! while(values[k] == null) ! k++; ! Long v = (Long)i.next(); ! assertTrue("Value has been removed and should be null", values[k] != null); ! assertEquals("Keys don't match", keys[k], v.longValue()); ! } ! assertEquals("Hashtable size is incorrect", table.size(), values.length - 1000); ! assertEquals("Hashtable size is incorrect", table.size(), c); ! ! System.gc(); ! ! // add some new items ! for(int i = 0; i < values.length; i++) { ! if(values[i] == null) { ! do { ! keys[i] = rand.nextInt(Integer.MAX_VALUE); ! } while(table.get(keys[i]) != null); ! values[i] = new String("a" + keys[i]); ! table.put(keys[i], values[i]); ! } ! } ! ! // check SequencedLongHashMap.get() ! for(int i = 0; i < tabSize; i++) { ! Object v = table.get(keys[i]); ! assertEquals( values[i], v); ! } ! ! // check SequencedLongHashMap.iterator() ! c = 0; ! for(Iterator i = table.iterator(); i.hasNext(); c++) { ! Long v = (Long)i.next(); ! } ! assertEquals(c, table.size()); ! System.gc(); ! ! for(int i = 0; i < values.length; i++) { ! table.removeFirst(); ! } ! System.gc(); ! Iterator iter = table.iterator(); ! assertFalse("Hashtable should be empty", iter.hasNext()); ! assertTrue(table.size() == 0); ! ! System.out.println("Hashtable size: " + table.size()); System.out.println("maxRehash: " + table.getMaxRehash()); } } |
From: Thomas J. <zal...@us...> - 2004-09-22 09:34:27
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12043/src/org/exist/util Modified Files: XMLString.java Log Message: added equals and hashCode to use this class in other Sets than TreeSet Index: XMLString.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/XMLString.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** XMLString.java 15 Aug 2004 20:29:09 -0000 1.10 --- XMLString.java 22 Sep 2004 09:34:17 -0000 1.11 *************** *** 27,31 **** * pool the backing char arrays. */ ! public class XMLString implements CharSequence, Comparable { public final static int SUPPRESS_NONE = 0; --- 27,31 ---- * pool the backing char arrays. */ ! public final class XMLString implements CharSequence, Comparable { public final static int SUPPRESS_NONE = 0; *************** *** 225,242 **** */ public final int compareTo(Object o) { ! CharSequence cs = (CharSequence)o; ! for(int i = 0; i < length_ && i < cs.length(); i++) { ! if(value_[start_ + i] < cs.charAt(i)) ! return -1; ! else if(value_[start_ + i] > cs.charAt(i)) ! return 1; ! } ! if(length_ < cs.length()) ! return -1; ! else if(length_ > cs.length()) ! return 1; ! else ! return 0; ! } } --- 225,290 ---- */ public final int compareTo(Object o) { ! CharSequence cs = (CharSequence) o; ! for (int i = 0; i < length_ && i < cs.length(); i++) { ! if (value_[start_ + i] < cs.charAt(i)) ! return -1; ! else if (value_[start_ + i] > cs.charAt(i)) ! return 1; ! } ! if (length_ < cs.length()) ! return -1; ! else if (length_ > cs.length()) ! return 1; ! else ! return 0; ! } + /* + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object anObject) { + if (this == anObject) { + return true; + } + if (anObject instanceof XMLString) { + XMLString anotherString = (XMLString) anObject; + int n = length_; + if (n == anotherString.length_) { + char v1[] = value_; + char v2[] = anotherString.value_; + int i = start_; + int j = anotherString.start_; + + while (n-- != 0) { + if (v1[i++] != v2[j++]) + return false; + } + return true; + } + } + return false; + } + + /* + * @see hashCode() + */ + private int hash = 0; + + /* + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + int h = hash; + if (h == 0) { + int off = start_; + char val[] = value_; + int len = length_; + + for (int i = 0; i < len; i++) { + h = 31 * h + val[off++]; + } + hash = h; + } + return h; + } } |
From: Thomas J. <zal...@us...> - 2004-09-22 09:33:04
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11684/src/org/exist Modified Files: xmldb.xsl Log Message: remove excalibur depency Index: xmldb.xsl =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb.xsl,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** xmldb.xsl 1 Dec 2003 08:22:59 -0000 1.13 --- xmldb.xsl 22 Sep 2004 09:32:42 -0000 1.14 *************** *** 427,431 **** if(<xsl:value-of select="$as"/>.equals("xml")) { if(_resource instanceof org.exist.xmldb.RemoteXMLResource) ! ((org.exist.xmldb.RemoteXMLResource)_resource).setCocoonParser( newParser ); IncludeXMLFilter _consumer = new IncludeXMLFilter(this.contentHandler); --- 427,431 ---- if(<xsl:value-of select="$as"/>.equals("xml")) { if(_resource instanceof org.exist.xmldb.RemoteXMLResource) ! ((org.exist.xmldb.RemoteXMLResource)_resource).setXMLReader(new org.exist.cocoon.XMLReaderWrapper(newParser)); IncludeXMLFilter _consumer = new IncludeXMLFilter(this.contentHandler); *************** *** 527,531 **** if(<xsl:value-of select="$as"/>.equals("xml")) { if(_res instanceof org.exist.xmldb.RemoteXMLResource) ! ((org.exist.xmldb.RemoteXMLResource)_res).setCocoonParser( newParser ); //String _content = (String)_res.getContent(); //XSPUtil.include(new InputSource(new StringReader(_content)), --- 527,531 ---- if(<xsl:value-of select="$as"/>.equals("xml")) { if(_res instanceof org.exist.xmldb.RemoteXMLResource) ! ((org.exist.xmldb.RemoteXMLResource)_res).setXMLReader(new org.exist.cocoon.XMLReaderWrapper(newParser)); //String _content = (String)_res.getContent(); //XSPUtil.include(new InputSource(new StringReader(_content)), |
From: Thomas J. <zal...@us...> - 2004-09-22 09:32:55
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11684/src/org/exist/xmldb Modified Files: RemoteXMLResource.java Log Message: remove excalibur depency Index: RemoteXMLResource.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/RemoteXMLResource.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** RemoteXMLResource.java 17 Sep 2004 10:07:24 -0000 1.17 --- RemoteXMLResource.java 22 Sep 2004 09:32:42 -0000 1.18 *************** *** 46,53 **** /** ! * if this class is used from Cocoon, use the Cocoon parser component ! * instead of JAXP */ ! private org.apache.excalibur.xml.sax.SAXParser cocoonParser = null; protected String id; --- 46,52 ---- /** ! * Use external XMLReader to parse XML. */ ! private XMLReader xmlReader = null; protected String id; *************** *** 185,215 **** if (file != null) getData(); ! if (cocoonParser == null) { SAXParserFactory saxFactory = SAXParserFactory.newInstance(); saxFactory.setNamespaceAware(true); saxFactory.setValidating(false); ! try { ! SAXParser sax = saxFactory.newSAXParser(); ! XMLReader reader = sax.getXMLReader(); ! reader.setContentHandler(handler); ! if(lexicalHandler != null) ! reader.setProperty("http://xml.org/sax/properties/lexical-handler", lexicalHandler); ! reader.parse(new InputSource(new StringReader(content))); ! } catch (SAXException saxe) { ! saxe.printStackTrace(); ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, saxe.getMessage(), saxe); ! } catch (ParserConfigurationException pce) { ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, pce.getMessage(), pce); ! } catch (IOException ioe) { ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ioe.getMessage(), ioe); ! } ! } else ! try { ! cocoonParser.parse(new InputSource(new StringReader(content)), handler, lexicalHandler); ! } catch (SAXException saxe) { ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, saxe.getMessage(), saxe); ! } catch (IOException ioe) { ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ioe.getMessage(), ioe); ! } } --- 184,217 ---- if (file != null) getData(); ! ! XMLReader reader = null; ! if (xmlReader == null) { SAXParserFactory saxFactory = SAXParserFactory.newInstance(); saxFactory.setNamespaceAware(true); saxFactory.setValidating(false); ! try { ! SAXParser sax = saxFactory.newSAXParser(); ! reader = sax.getXMLReader(); ! } catch (ParserConfigurationException pce) { ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, pce.getMessage(), pce); ! } catch (SAXException saxe) { ! saxe.printStackTrace(); ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, saxe.getMessage(), saxe); ! } ! } else { ! reader = xmlReader; ! } ! try { ! reader.setContentHandler(handler); ! if(lexicalHandler != null) { ! reader.setProperty("http://xml.org/sax/properties/lexical-handler", lexicalHandler); ! } ! reader.parse(new InputSource(new StringReader(content))); ! } catch (SAXException saxe) { ! saxe.printStackTrace(); ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, saxe.getMessage(), saxe); ! } catch (IOException ioe) { ! throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ioe.getMessage(), ioe); ! } } *************** *** 233,242 **** /** ! * Sets the cocoonParser to be used. * ! *@param parser The new cocoonParser value */ ! public void setCocoonParser(org.apache.excalibur.xml.sax.SAXParser parser) { ! this.cocoonParser = parser; } --- 235,244 ---- /** ! * Sets the external XMLReader to use. * ! * @param xmlReader the XMLReader */ ! public void setXMLReader(XMLReader xmlReader) { ! this.xmlReader = xmlReader; } |
From: Wolfgang M. M. <wol...@us...> - 2004-09-22 08:43:14
|
Update of /cvsroot/exist/eXist-1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv753 Modified Files: build.xml Log Message: Index: build.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/build.xml,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** build.xml 20 Sep 2004 10:25:49 -0000 1.56 --- build.xml 22 Sep 2004 08:43:03 -0000 1.57 *************** *** 210,214 **** <copy file="${src}/org/exist/xmldb2.xsl" todir="${build.classes}/org/exist"/> - <copy file="${src}/org/exist/start/MANIFEST.MF" todir="${build.classes}/org/exist/start"/> <copy file="${src}/org/exist/start/start.config" todir="${build.classes}/org/exist/start"/> <copy file="${src}/org/exist/security/security.properties" todir="${build.classes}/org/exist/security"/> --- 210,213 ---- *************** *** 227,232 **** <echo message="Creating start.jar ..."/> ! <jar basedir="${build.classes}" compress="true" jarfile="start.jar" ! manifest="${src}/org/exist/start/MANIFEST.MF"> <include name="org/exist/start/**"/> </jar> --- 226,236 ---- <echo message="Creating start.jar ..."/> ! <jar basedir="${build.classes}" compress="true" jarfile="start.jar"> ! <manifest> ! <attribute name="Main-Class" value="org.exist.start.Main"/> ! <attribute name="Package-Title" value="org.exist"/> ! <attribute name="Implementation-Title" value="eXist XML Database"/> ! <attribute name="Implementation-URL" value="http://exist-db.org"/> ! </manifest> <include name="org/exist/start/**"/> </jar> *************** *** 300,305 **** ----------------- </echo> ! <test fork="yes" name="org.exist.xmldb.test.concurrent.AllTests" ! todir="${junit.reports}"/> </target> --- 304,314 ---- ----------------- </echo> ! <junit haltonfailure="yes" printsummary="yes" ! showoutput="${junit.output}"> ! <classpath refid="classpath.core"/> ! <formatter type="plain"/> ! <test fork="yes" name="org.exist.xmldb.test.concurrent.AllTests" ! todir="${junit.reports}"/> ! </junit> </target> |
From: Thomas J. <zal...@us...> - 2004-09-21 21:14:24
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/cocoon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27382/src/org/exist/cocoon Added Files: XMLReaderWrapper.java Log Message: preparation to replace setCocoonParser in RemoteXMLResource with this wrapper. --- NEW FILE: XMLReaderWrapper.java --- package org.exist.cocoon; import java.io.IOException; import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.ContentHandler; import org.xml.sax.DTDHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.ext.LexicalHandler; /** * Wrapper around SAXParser interface from excalibur to * provide an (excalibur) independend implementation of XMLReader. */ public class XMLReaderWrapper implements XMLReader { private SAXParser saxParser; private ContentHandler contentHandler = null; private LexicalHandler lexicalHandler = null; /** * @param saxParser to wrap around */ public XMLReaderWrapper(SAXParser saxParser) { this.saxParser = saxParser; } /** * @see org.xml.sax.XMLReader#parse(java.lang.String) */ public void parse(String systemId) throws IOException, SAXException { parse(new InputSource(systemId)); } /** * Not supported. * * @see org.xml.sax.XMLReader#getFeature(java.lang.String) */ public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { return false; } /** * Not supported. * * @see org.xml.sax.XMLReader#setFeature(java.lang.String, boolean) */ public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { } /** * @see org.xml.sax.XMLReader#getContentHandler() */ public ContentHandler getContentHandler() { return contentHandler; } /** * @see org.xml.sax.XMLReader#setContentHandler(org.xml.sax.ContentHandler) */ public void setContentHandler(ContentHandler handler) { this.contentHandler = handler; } /** * Not supported. * * @see org.xml.sax.XMLReader#getDTDHandler() */ public DTDHandler getDTDHandler() { return null; } /** * Not supported. * * @see org.xml.sax.XMLReader#setDTDHandler(org.xml.sax.DTDHandler) */ public void setDTDHandler(DTDHandler handler) { } /** * Not supported. * * @see org.xml.sax.XMLReader#getEntityResolver() */ public EntityResolver getEntityResolver() { return null; } /** * Not supported. * * @see org.xml.sax.XMLReader#setEntityResolver(org.xml.sax.EntityResolver) */ public void setEntityResolver(EntityResolver resolver) { } /** * Not supported. * * @see org.xml.sax.XMLReader#getErrorHandler() */ public ErrorHandler getErrorHandler() { return null; } /** * Not supported. * * @see org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler) */ public void setErrorHandler(ErrorHandler handler) { } /** * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource) */ public void parse(InputSource input) throws IOException, SAXException { if (lexicalHandler != null) { saxParser.parse(input, contentHandler, lexicalHandler); } else { saxParser.parse(input, contentHandler); } } /** * @see org.xml.sax.XMLReader#getProperty(java.lang.String) */ public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals("http://xml.org/sax/properties/lexical-handler")) { return lexicalHandler; } else { throw new SAXNotRecognizedException("Property " + name + " not recognized"); } } /** * Only property <i>http://xml.org/sax/properties/lexical-handler</i> is * supported. * * @see org.xml.sax.XMLReader#setProperty(java.lang.String, java.lang.Object) */ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals("http://xml.org/sax/properties/lexical-handler")) { if (!(value instanceof LexicalHandler)) { throw new SAXNotSupportedException("Value not of type LexicalHandler"); } lexicalHandler = (LexicalHandler) value; } else { throw new SAXNotRecognizedException("Property " + name + " not recognized"); } } } |
From: Wolfgang M. M. <wol...@us...> - 2004-09-21 21:05:03
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25241/src/org/exist/xupdate Modified Files: XUpdateProcessor.java Log Message: Fixed wrong test for duplicate attribute declarations. Index: XUpdateProcessor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/XUpdateProcessor.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** XUpdateProcessor.java 21 Sep 2004 14:42:04 -0000 1.26 --- XUpdateProcessor.java 21 Sep 2004 21:04:53 -0000 1.27 *************** *** 320,324 **** } else { Element last = (Element) stack.peek(); ! if(last.getAttributeNS(namespace, name) != null) throw new SAXException("The attribute " + attrib.getNodeName() + " cannot be specified " + "twice on the same element"); --- 320,324 ---- } else { Element last = (Element) stack.peek(); ! if(last.hasAttributeNS(namespace, name)) throw new SAXException("The attribute " + attrib.getNodeName() + " cannot be specified " + "twice on the same element"); |