[pkg-java] r3603 - in branches/libjaxen-java/upstream/current: . src src/java/main/org/jaxen src/java/main/org/jaxen/dom src/java/main/org/jaxen/expr src/java/main/org/jaxen/function/ext src/java/main/org/jaxen/util src/java/main/org/jaxen/xom src/java/test/org/jaxen/test
marcusb-guest at alioth.debian.org
marcusb-guest at alioth.debian.org
Wed Jun 6 12:47:20 UTC 2007
Author: marcusb-guest
Date: 2007-06-06 12:47:20 +0000 (Wed, 06 Jun 2007)
New Revision: 3603
Added:
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/xom/package.html
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/BinaryExprTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultNamestepTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultXPathFactoryTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ExprComparator.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/IterableAxisTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/LiteralExprTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ProcessingInstructionNodeTest.java
Removed:
branches/libjaxen-java/upstream/current/src/conf/
branches/libjaxen-java/upstream/current/src/doc/
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Visitable.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Visitor.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/VisitorSupport.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/function/ext/MatrixConcatFunction.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/pantry/
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/XPath2XMLVisitor.java
branches/libjaxen-java/upstream/current/src/javadoc/
Modified:
branches/libjaxen-java/upstream/current/build.xml
branches/libjaxen-java/upstream/current/maven.xml
branches/libjaxen-java/upstream/current/project.properties
branches/libjaxen-java/upstream/current/project.xml
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/BaseXPath.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/Context.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/XPath.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/XPathFunctionContext.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/dom/DocumentNavigator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/AdditiveExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/AllNodeStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/BinaryExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/CommentNodeStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAbsoluteLocationPath.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAllNodeStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAndExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultBinaryExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultCommentNodeStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultDivExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultEqualsExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultFilterExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultFunctionCallExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultGreaterThanEqualExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultGreaterThanExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLessThanEqualExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLessThanExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLiteralExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultMinusExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultModExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultMultiplyExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNameStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNotEqualsExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNumberExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultOrExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPathExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPlusExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPredicate.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultProcessingInstructionNodeStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultRelativeLocationPath.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultTextNodeStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultUnaryExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultUnionExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultVariableReferenceExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultXPathFactory.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/EqualityExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Expr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/FilterExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/FunctionCallExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LiteralExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LocationPath.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LogicalExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/MultiplicativeExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/NameStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/NumberExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/PathExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Predicate.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/PredicateSet.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Predicated.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/ProcessingInstructionNodeStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/RelationalExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Step.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/TextNodeStep.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/UnaryExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/UnionExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/VariableReferenceExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/XPathExpr.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/XPathFactory.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/AncestorAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/AncestorOrSelfAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/DescendantAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/DescendantOrSelfAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/FollowingAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/FollowingSiblingAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/LinkedIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/PrecedingAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/PrecedingSiblingAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SelfAxisIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SingleObjectIterator.java
branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SingletonList.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ContextTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/CoreTests.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultXPathExprTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ExprTests.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ModTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/SimpleVariableContextTest.java
branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/XPathTestBase.java
Log:
Merge with new upstream release 1.1.1.
Modified: branches/libjaxen-java/upstream/current/build.xml
===================================================================
--- branches/libjaxen-java/upstream/current/build.xml 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/build.xml 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--build.xml generated by maven from project.xml version 1.1-beta-11
- on date October 8 2006, time 1741-->
+<!--build.xml generated by maven from project.xml version 1.1.1
+ on date May 5 2007, time 1501-->
<project default="jar" name="jaxen" basedir=".">
<property name="defaulttargetdir" value="target">
@@ -20,7 +20,7 @@
</property>
<property name="javadocdir" value="dist/docs/api">
</property>
- <property name="final.name" value="jaxen-1.1-beta-11">
+ <property name="final.name" value="jaxen-1.1.1">
</property>
<path id="build.classpath">
<fileset dir="${libdir}">
@@ -130,9 +130,9 @@
<format pattern="2001-yyyy" property="year">
</format>
</tstamp>
- <property name="copyright" value="Copyright &copy; 2001-2006 Codehaus. All Rights Reserved.">
+ <property name="copyright" value="Copyright &copy; 2001-2007 Codehaus. All Rights Reserved.">
</property>
- <property name="title" value="jaxen 1.1-beta-11 API">
+ <property name="title" value="jaxen 1.1.1 API">
</property>
<javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="src/java/main" packagenames="org.jaxen.*">
<classpath>
@@ -146,19 +146,19 @@
<setproxy>
</setproxy>
- <get dest="${libdir}/dom4j-1.6.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven//dom4j/jars/dom4j-1.6.1.jar">
+ <get dest="${libdir}/dom4j-1.6.1.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/dom4j/jars/dom4j-1.6.1.jar">
</get>
- <get dest="${libdir}/jdom-1.0.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven//jdom/jars/jdom-1.0.jar">
+ <get dest="${libdir}/jdom-1.0.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/jdom/jars/jdom-1.0.jar">
</get>
- <get dest="${libdir}/xml-apis-1.3.02.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven//xml-apis/jars/xml-apis-1.3.02.jar">
+ <get dest="${libdir}/xml-apis-1.3.02.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/xml-apis/jars/xml-apis-1.3.02.jar">
</get>
- <get dest="${libdir}/xercesImpl-2.6.2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven//xerces/jars/xercesImpl-2.6.2.jar">
+ <get dest="${libdir}/xercesImpl-2.6.2.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/xerces/jars/xercesImpl-2.6.2.jar">
</get>
- <get dest="${libdir}/xom-1.0b3.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven//xom/jars/xom-1.0b3.jar">
+ <get dest="${libdir}/xom-1.0.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/xom/jars/xom-1.0.jar">
</get>
- <get dest="${libdir}/maven-cobertura-plugin-1.1.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven//maven-plugins/plugins/maven-cobertura-plugin-1.1.1.jar">
+ <get dest="${libdir}/maven-cobertura-plugin-1.3.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/maven-plugins/plugins/maven-cobertura-plugin-1.3.jar">
</get>
- <get dest="${libdir}/maven-findbugs-plugin-0.9.2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven//maven-plugins/plugins/maven-findbugs-plugin-0.9.2.jar">
+ <get dest="${libdir}/maven-findbugs-plugin-1.3.1.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven/maven-plugins/plugins/maven-findbugs-plugin-1.3.1.jar">
</get>
</target>
<target name="install-maven">
Modified: branches/libjaxen-java/upstream/current/maven.xml
===================================================================
--- branches/libjaxen-java/upstream/current/maven.xml 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/maven.xml 2007-06-06 12:47:20 UTC (rev 3603)
@@ -5,6 +5,12 @@
<attainGoal name="dist:build-src" />
</preGoal>
+ <postGoal name="dist:build-bin">
+ <ant:copy
+ tofile="${maven.build.dir}/distributions/jaxen-${pom.currentVersion}.pom"
+ file="project.xml" />
+ </postGoal>
+
<postGoal name="dist:prepare-bin-filesystem">
<ant:copy todir="${maven.dist.bin.assembly.dir}">
<fileset dir=".">
Modified: branches/libjaxen-java/upstream/current/project.properties
===================================================================
--- branches/libjaxen-java/upstream/current/project.properties 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/project.properties 2007-06-06 12:47:20 UTC (rev 3603)
@@ -12,6 +12,7 @@
maven.compile.target = 1.2
maven.compile.source = 1.3
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# xdocs
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -47,8 +48,8 @@
# pmd
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-maven.jar.override=on
-maven.jar.pmd=3.2
+# maven.jar.override=on
+# maven.jar.pmd=3.8
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# javadoc
@@ -60,6 +61,13 @@
http://java.sun.com/j2se/1.4.2/docs/api/
maven.javadoc.excludepackagenames = org.jaxen.saxpath.base,org.jaxen.saxpath.helpers
+maven.javadoc.customtags=tag1
+tag1.name=todo
+tag1.description=To Do:
+tag1.enabled=false
+tag1.scope=all
+
+
maven.jarResources.basedir = src/java/main/
maven.xdoc.date = left
@@ -71,7 +79,7 @@
#maven.latex.src.dir = ${basedir}/src/latex/
#maven.latex.docs = intro-slides.tex
-maven.repo.remote=http://www.ibiblio.org/maven/,http://dist.codehaus.org/
+maven.repo.remote=http://repo1.maven.org/maven,http://dist.codehaus.org/
maven.repo.central=dist.codehaus.org
maven.repo.central.directory=/dist
maven.remote.group=jaxen
\ No newline at end of file
Modified: branches/libjaxen-java/upstream/current/project.xml
===================================================================
--- branches/libjaxen-java/upstream/current/project.xml 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/project.xml 2007-06-06 12:47:20 UTC (rev 3603)
@@ -5,11 +5,11 @@
<pomVersion>3</pomVersion>
<id>jaxen</id>
<name>jaxen</name>
- <currentVersion>1.1-beta-11</currentVersion>
+ <currentVersion>1.1.1</currentVersion>
<organization>
<name>Codehaus</name>
- <url>http://www.codehaus.org</url>
+ <url>http://codehaus.org</url>
<logo>http://codehaus.org/codehaus-small.gif</logo>
</organization>
<inceptionYear>2001</inceptionYear>
@@ -30,37 +30,36 @@
<distributionDirectory>/dist</distributionDirectory>
<repository>
- <connection>scm:cvs:pserver:anonymous at cvs.jaxen.codehaus.org:/home/projects/jaxen/scm:jaxen</connection>
+ <connection>scm:cvs:pserver:anonymous at cvs.jaxen.codehaus.org:/cvs/jaxen:jaxen</connection>
<url>http://cvs.jaxen.codehaus.org</url>
</repository>
- <!-- the archive URLs are broken ???? -->
- <mailingLists>
- <mailingList>
- <name>Jaxen Users List</name>
- <subscribe>user-subscribe at jaxen.codehaus.org</subscribe>
- <unsubscribe>user-unsubscribe at jaxen.codehaus.org</unsubscribe>
- <!--<archive>http://archive.jaxen.codehaus.org/user/</archive> -->
- </mailingList>
- <mailingList>
- <name>Jaxen Developers List</name>
- <subscribe>dev-subscribe at jaxen.codehaus.org</subscribe>
- <unsubscribe>dev-unsubscribe at jaxen.codehaus.org</unsubscribe>
- <!-- <archive>http://archive.jaxen.codehaus.org/dev/</archive> -->
- </mailingList>
- <mailingList>
- <name>Jaxen CVS Commits List</name>
- <subscribe>scm-subscribe at jaxen.codehaus.org</subscribe>
- <unsubscribe>scm-unsubscribe at jaxen.codehaus.org</unsubscribe>
- <!-- <archive>http://archive.jaxen.codehaus.org/scm/</archive> -->
- </mailingList>
- <mailingList>
- <name>Jaxen Announcement List</name>
- <subscribe>announce-subscribe at jaxen.codehaus.org</subscribe>
- <unsubscribe>announce-unsubscribe at jaxen.codehaus.org</unsubscribe>
- <!-- <archive>http://archive.jaxen.codehaus.org/announce/</archive> -->
- </mailingList>
- </mailingLists>
+ <mailingLists>
+ <mailingList>
+ <name>Jaxen Users List</name>
+ <subscribe>user-subscribe at jaxen.codehaus.org</subscribe>
+ <unsubscribe>user-unsubscribe at jaxen.codehaus.org</unsubscribe>
+ <archive>http://archive.jaxen.codehaus.org/user/</archive>
+ </mailingList>
+ <mailingList>
+ <name>Jaxen Developers List</name>
+ <subscribe>dev-subscribe at jaxen.codehaus.org</subscribe>
+ <unsubscribe>dev-unsubscribe at jaxen.codehaus.org</unsubscribe>
+ <archive>http://archive.jaxen.codehaus.org/dev/</archive>
+ </mailingList>
+ <mailingList>
+ <name>Jaxen CVS Commits List</name>
+ <subscribe>scm-subscribe at jaxen.codehaus.org</subscribe>
+ <unsubscribe>scm-unsubscribe at jaxen.codehaus.org</unsubscribe>
+ <archive>http://archive.jaxen.codehaus.org/scm/</archive>
+ </mailingList>
+ <!-- <mailingList>
+ <name>Jaxen Announcement List</name>
+ <subscribe>announce-subscribe at jaxen.codehaus.org</subscribe>
+ <unsubscribe>announce-unsubscribe at jaxen.codehaus.org</unsubscribe>
+ <archive>http://archive.jaxen.codehaus.org/announce/</archive>
+ </mailingList> -->
+ </mailingLists>
<developers>
@@ -157,6 +156,11 @@
<contributors>
<contributor>
+ <name>Ryan Gustafson</name>
+ <email>rgustav at users.sourceforge.net</email>
+ </contributor>
+
+ <contributor>
<name>David Peterson</name>
<email>david at randombits.org</email>
</contributor>
@@ -210,11 +214,17 @@
<email>cao at ispsoft.com</email>
</contributor>
- <contributor>
+ <contributor>
<name>Jérôme Nègre</name>
<email>jerome.negre at e-xmlmedia.fr</email>
</contributor>
+ <!-- org.jaxen.ext.MatrixConcat function -->
+ <!-- <contributor>
+ <name>James Pereira</name>
+ <email>JPereira at CT.BBD.CO.ZA</email>
+ </contributor> -->
+
<!-- found next two in CVS-->
<contributor>
<name>Eddie McGreal</name>
@@ -240,7 +250,6 @@
<report>maven-jxr-plugin</report>
<report>maven-junit-report-plugin</report>
<report>maven-linkcheck-plugin</report>
- <report>maven-tasklist-plugin</report>
<report>maven-pmd-plugin</report>
<report>maven-findbugs-plugin</report>
<!-- commenting out until they fix their repository <report>jutils-lint4j-plugin</report> -->
@@ -279,13 +288,13 @@
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
- <version>1.0b3</version>
+ <version>1.0</version>
</dependency>
<dependency>
<groupId>maven-plugins</groupId>
<artifactId>maven-cobertura-plugin</artifactId>
- <version>1.1.1</version>
+ <version>1.3</version>
<type>plugin</type>
</dependency>
@@ -299,7 +308,7 @@
<dependency>
<groupId>maven-plugins</groupId>
<artifactId>maven-findbugs-plugin</artifactId>
- <version>0.9.2</version>
+ <version>1.3.1</version>
<type>plugin</type>
</dependency>
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/BaseXPath.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/BaseXPath.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/BaseXPath.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/BaseXPath.java,v 1.49 2006/02/05 21:47:41 elharo Exp $
- * $Revision: 1.49 $
- * $Date: 2006/02/05 21:47:41 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/BaseXPath.java,v 1.50 2007/04/16 15:44:37 elharo Exp $
+ * $Revision: 1.50 $
+ * $Date: 2007/04/16 15:44:37 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: BaseXPath.java,v 1.49 2006/02/05 21:47:41 elharo Exp $
+ * $Id: BaseXPath.java,v 1.50 2007/04/16 15:44:37 elharo Exp $
*/
@@ -85,10 +85,10 @@
public class BaseXPath implements XPath, Serializable
{
/** Original expression text. */
- private String exprText;
+ private final String exprText;
/** the parsed form of the XPath expression */
- private XPathExpr xpath;
+ private final XPathExpr xpath;
/** the support information and function, namespace and variable contexts */
private ContextSupport support;
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/Context.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/Context.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/Context.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
package org.jaxen;
/*
- $Id: Context.java,v 1.17 2006/09/07 15:47:03 elharo Exp $
+ $Id: Context.java,v 1.20 2006/10/15 21:08:16 elharo Exp $
Copyright 2003 The Werken Company. All Rights Reserved.
@@ -63,9 +63,8 @@
*
* @author <a href="mailto:bob at werken.com">bob mcwhirter</a>
*/
-public class Context
- implements Serializable
-{
+public class Context implements Serializable {
+
/**
*
*/
@@ -99,17 +98,27 @@
{
this.contextSupport = contextSupport;
this.nodeSet = Collections.EMPTY_LIST;
- this.size = 0;
- // XXX What should position be?
+ this.size = 0;
+ this.position = 0;
}
// ----------------------------------------------------------------------
// Instance methods
// ----------------------------------------------------------------------
- /** Set the context node-set, and sets the current context size to the size
- * of this node-set. The actual list is stored in this object. A copy
- * is not made.
+ /**
+ * <p>
+ * Set the context node-set, and sets the current context size to the size
+ * of this node-set. </p>
+ *
+ * <p>The actual list is stored in this object. A copy
+ * is not made. This list should not be modified in other code after
+ * calling this method.</p>
+ *
+ * <p>
+ * After invoking this method, the client should immediately call
+ * {@link #setSize(int) setSize} and {@link #setPosition(int) setPosition}.
+ *</p>
*
* @param nodeSet the context node-set
*/
@@ -117,10 +126,12 @@
{
this.nodeSet = nodeSet;
this.size = nodeSet.size();
- // XXX How should we set position?
+ if (position >= size) this.position = 0;
}
- /** Retrieve the context node-set. This is a live list. It is not a copy.
+ /** Retrieve the context node-set.
+ * This is a live list. It is not a copy.
+ * Do not modify it.
*
* @return the context node-set
*/
@@ -266,7 +277,7 @@
List dupeNodeSet = new ArrayList( thisNodeSet.size() );
dupeNodeSet.addAll( thisNodeSet );
dupe.setNodeSet( dupeNodeSet );
- // XXX should set the size of the duplicate
+ dupe.setPosition(this.position);
}
return dupe;
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/XPath.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/XPath.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/XPath.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
package org.jaxen;
/*
- $Id: XPath.java,v 1.12 2006/06/03 20:07:37 elharo Exp $
+ $Id: XPath.java,v 1.13 2007/05/02 15:00:13 elharo Exp $
Copyright 2003 The Werken Company. All Rights Reserved.
@@ -36,7 +36,7 @@
import java.util.List;
-/** Defines the interface to an object which represents an XPath 1.0 expression which
+/** Represents an XPath 1.0 expression which
* can be evaluated against a variety of different XML object models.
*
* <p>
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/XPathFunctionContext.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/XPathFunctionContext.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/XPathFunctionContext.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/XPathFunctionContext.java,v 1.28 2006/02/05 21:47:41 elharo Exp $
- * $Revision: 1.28 $
- * $Date: 2006/02/05 21:47:41 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/XPathFunctionContext.java,v 1.29 2006/11/08 13:59:38 elharo Exp $
+ * $Revision: 1.29 $
+ * $Date: 2006/11/08 13:59:38 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: XPathFunctionContext.java,v 1.28 2006/02/05 21:47:41 elharo Exp $
+ * $Id: XPathFunctionContext.java,v 1.29 2006/11/08 13:59:38 elharo Exp $
*/
@@ -78,7 +78,6 @@
import org.jaxen.function.ext.EndsWithFunction;
import org.jaxen.function.ext.EvaluateFunction;
import org.jaxen.function.ext.LowerFunction;
-import org.jaxen.function.ext.MatrixConcatFunction;
import org.jaxen.function.ext.UpperFunction;
import org.jaxen.function.xslt.DocumentFunction;
@@ -96,8 +95,7 @@
* default instance, it is inadvisable to call
* {@link #registerFunction(String, String, Function)}
* as that will extend the global function context, affecting other
- * users. But that's your call, really, now isn't
- * it? That may be what you really want to do.
+ * users.
* </p>
*
* <p>
@@ -105,7 +103,6 @@
* </p>
*
* <ul>
- * <li>matrix-concat(..)</li>
* <li>evaluate(..)</li>
* <li>upper-case(..)</li>
* <li>lower-case(..)</li>
@@ -144,7 +141,7 @@
* All core XPath functions are registered.
*
* @param includeExtensionFunctions if true extension functions are included;
- * if false, they aren't.
+ * if false, they aren't
*/
public XPathFunctionContext(boolean includeExtensionFunctions)
{
@@ -279,10 +276,6 @@
// for now, keep them in default namespace to not break any code
registerFunction( null, // namespace URI
- "matrix-concat",
- new MatrixConcatFunction() );
-
- registerFunction( null, // namespace URI
"evaluate",
new EvaluateFunction() );
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/dom/DocumentNavigator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/dom/DocumentNavigator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/dom/DocumentNavigator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,9 +1,9 @@
package org.jaxen.dom;
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/dom/DocumentNavigator.java,v 1.56 2006/07/03 13:08:43 elharo Exp $
- * $Revision: 1.56 $
- * $Date: 2006/07/03 13:08:43 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/dom/DocumentNavigator.java,v 1.57 2007/05/05 18:08:55 elharo Exp $
+ * $Revision: 1.57 $
+ * $Date: 2007/05/05 18:08:55 $
*
* ====================================================================
*
@@ -45,7 +45,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DocumentNavigator.java,v 1.56 2006/07/03 13:08:43 elharo Exp $
+ * $Id: DocumentNavigator.java,v 1.57 2007/05/05 18:08:55 elharo Exp $
*/
import javax.xml.parsers.DocumentBuilder;
@@ -199,17 +199,17 @@
/**
- * Return the XPath parent of this DOM node.
+ * Return the XPath parent of the supplied DOM node.
* XPath has slightly different definition of parent than DOM does.
* In particular, the parent of an attribute is not null.
*
- * @param o
+ * @param child the child node
*
* @return the parent of the specified node; or null if
* the node does not have a parent
*/
- public Object getParentNode(Object o) {
- Node node = (Node) o;
+ public Object getParentNode(Object child) {
+ Node node = (Node) child;
if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
return ((Attr) node).getOwnerElement();
}
@@ -803,6 +803,8 @@
* @return the new W3C DOM Level 2 Document instance
* @throws FunctionCallException containing a nested exception
* if a problem occurs trying to parse the given document
+ *
+ * @todo Possibly we could make the factory a thread local.
*/
public Object getDocument(String uri) throws FunctionCallException
{
@@ -810,7 +812,6 @@
{
// We really do need to construct a new factory here each time.
// DocumentBuilderFactory is not guaranteed to be thread safe?
- // Possibly we could make this a thread local.????
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
@@ -1049,7 +1050,7 @@
* does not know about attribute types
* @see javax.xml.parsers.DocumentBuilderFactory
*
- * @throws ClassCastException if object is not an org.w3c.dom.Node object
+ * @throws ClassCastException if object is not an <code>org.w3c.dom.Node</code> object
*
*/
public Object getElementById(Object object, String elementId)
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/AdditiveExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/AdditiveExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/AdditiveExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/AdditiveExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/AdditiveExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/11/09 16:21:05 $
*
* ====================================================================
*
@@ -43,11 +43,25 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: AdditiveExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
+ * $Id: AdditiveExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents an XPath additive expression. This is production 25 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr">XPath 1.0 specification</a>:
+ *
+ * <table><tr valign="baseline"><td><a name="NT-AdditiveExpr"></a>[25] </td><td>AdditiveExpr</td><td> ::= </td><td><a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr#NT-MultiplicativeExpr">MultiplicativeExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr">AdditiveExpr</a> '+' <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr#NT-MultiplicativeExpr">MultiplicativeExpr</a></td><td></td>
+ * </tr>
+ *
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr#NT-AdditiveExpr">AdditiveExpr</a> '-' <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr#NT-MultiplicativeExpr">MultiplicativeExpr</a>
+ * </tr></table>
+ *
+ */
public interface AdditiveExpr extends BinaryExpr
{
- String getOperator();
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/AllNodeStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/AllNodeStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/AllNodeStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/AllNodeStep.java,v 1.5 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.5 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/AllNodeStep.java,v 1.6 2006/11/08 15:41:05 elharo Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/11/08 15:41:05 $
*
* ====================================================================
*
@@ -42,10 +42,15 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: AllNodeStep.java,v 1.5 2006/02/05 21:47:40 elharo Exp $
+ * $Id: AllNodeStep.java,v 1.6 2006/11/08 15:41:05 elharo Exp $
*/
package org.jaxen.expr;
+
+/**
+ * Represents the XPath node-test <code>node()</code>.
+ *
+ */
public interface AllNodeStep extends Step
{
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/BinaryExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/BinaryExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/BinaryExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/BinaryExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.6 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/BinaryExpr.java,v 1.8 2006/11/09 16:21:04 elharo Exp $
+ * $Revision: 1.8 $
+ * $Date: 2006/11/09 16:21:04 $
*
* ====================================================================
*
@@ -42,15 +42,45 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: BinaryExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
+ * $Id: BinaryExpr.java,v 1.8 2006/11/09 16:21:04 elharo Exp $
*/
package org.jaxen.expr;
+
+/**
+ * Represents a binary expression.
+ * This does not match anything in the XPath 1.0 grammar, but in Jaxen
+ * it includes the usual binary operations such as addition, multiplication,
+ * logical and, logical or, and so forth.
+ *
+ */
public interface BinaryExpr extends Expr
{
+
+ /**
+ * Returns the left-hand side of the binary expression.
+ *
+ * @return the left hand side expression
+ */
Expr getLHS();
+
+
+ /**
+ * Returns the right-hand side of the binary expression.
+ *
+ * @return the right-hand side expression
+ */
Expr getRHS();
+
+ /**
+ * Returns the operator for the binary expression such as "+" or
+ * "div".
+ *
+ * @return the operator for the expression
+ */
+ String getOperator();
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/CommentNodeStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/CommentNodeStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/CommentNodeStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/CommentNodeStep.java,v 1.5 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.5 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/CommentNodeStep.java,v 1.6 2006/11/08 15:42:39 elharo Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/11/08 15:42:39 $
*
* ====================================================================
*
@@ -42,10 +42,14 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: CommentNodeStep.java,v 1.5 2006/02/05 21:47:40 elharo Exp $
+ * $Id: CommentNodeStep.java,v 1.6 2006/11/08 15:42:39 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents the XPath node-test <code>comment()</code>.
+ *
+ */
public interface CommentNodeStep extends Step
{
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAbsoluteLocationPath.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAbsoluteLocationPath.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAbsoluteLocationPath.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultAbsoluteLocationPath.java,v 1.17 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.17 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultAbsoluteLocationPath.java,v 1.18 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.18 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultAbsoluteLocationPath.java,v 1.17 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultAbsoluteLocationPath.java,v 1.18 2006/11/30 18:49:27 elharo Exp $
*/
package org.jaxen.expr;
@@ -113,9 +113,5 @@
return super.evaluate( absContext );
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAllNodeStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAllNodeStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAllNodeStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultAllNodeStep.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultAllNodeStep.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultAllNodeStep.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultAllNodeStep.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
*/
@@ -83,9 +83,5 @@
{
return true;
}
-
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAndExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAndExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultAndExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultAndExpr.java,v 1.15 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.15 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultAndExpr.java,v 1.16 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.16 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultAndExpr.java,v 1.15 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultAndExpr.java,v 1.16 2006/11/30 18:49:27 elharo Exp $
*/
package org.jaxen.expr;
@@ -97,10 +97,6 @@
return Boolean.TRUE;
}
+
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
-
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultBinaryExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultBinaryExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultBinaryExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultBinaryExpr.java,v 1.8 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.8 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultBinaryExpr.java,v 1.10 2007/01/05 18:25:43 elharo Exp $
+ * $Revision: 1.10 $
+ * $Date: 2007/01/05 18:25:43 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultBinaryExpr.java,v 1.8 2006/02/05 21:47:40 elharo Exp $
+ * $Id: DefaultBinaryExpr.java,v 1.10 2007/01/05 18:25:43 elharo Exp $
*/
@@ -54,8 +54,7 @@
private Expr lhs;
private Expr rhs;
- DefaultBinaryExpr(Expr lhs,
- Expr rhs)
+ DefaultBinaryExpr(Expr lhs, Expr rhs)
{
this.lhs = lhs;
this.rhs = rhs;
@@ -85,12 +84,12 @@
public String getText()
{
- return "(" + getLHS().getText() + " " + getOperator() + " " + getRHS().getText() + ")";
+ return "(" + getLHS().getText() + " " + getOperator() + " " + getRHS().getText() +")";
}
public String toString()
{
- return "[(" + getClass().getName() + "): " + getLHS() + ", " + getRHS() + "]";
+ return "[" + getClass().getName() + ": " + getLHS() + ", " + getRHS() + "]";
}
public Expr simplify()
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultCommentNodeStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultCommentNodeStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultCommentNodeStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultCommentNodeStep.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultCommentNodeStep.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultCommentNodeStep.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultCommentNodeStep.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
*/
@@ -85,8 +85,5 @@
return nav.isComment( node );
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultDivExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultDivExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultDivExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultDivExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultDivExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultDivExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultDivExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
*/
@@ -58,6 +58,7 @@
*
*/
private static final long serialVersionUID = 6318739386201615441L;
+
DefaultDivExpr(Expr lhs,
Expr rhs)
{
@@ -81,8 +82,5 @@
return new Double( result );
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultEqualsExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultEqualsExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultEqualsExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultEqualsExpr.java,v 1.12 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.12 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultEqualsExpr.java,v 1.13 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultEqualsExpr.java,v 1.12 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultEqualsExpr.java,v 1.13 2006/11/30 18:49:26 elharo Exp $
*/
@@ -85,9 +85,5 @@
return lhs.equals( rhs );
}
-
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultFilterExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultFilterExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultFilterExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultFilterExpr.java,v 1.18 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.18 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultFilterExpr.java,v 1.19 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.19 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultFilterExpr.java,v 1.18 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultFilterExpr.java,v 1.19 2006/11/30 18:49:26 elharo Exp $
*/
@@ -176,8 +176,5 @@
return results;
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultFunctionCallExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultFunctionCallExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultFunctionCallExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultFunctionCallExpr.java,v 1.16 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.16 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultFunctionCallExpr.java,v 1.17 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.17 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultFunctionCallExpr.java,v 1.16 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultFunctionCallExpr.java,v 1.17 2006/11/30 18:49:27 elharo Exp $
*/
package org.jaxen.expr;
@@ -195,9 +195,5 @@
return paramValues;
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultGreaterThanEqualExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultGreaterThanEqualExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultGreaterThanEqualExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultGreaterThanEqualExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultGreaterThanEqualExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultGreaterThanEqualExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultGreaterThanEqualExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
*/
package org.jaxen.expr;
@@ -67,8 +67,5 @@
{
return lhs.compareTo( rhs ) >= 0;
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultGreaterThanExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultGreaterThanExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultGreaterThanExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultGreaterThanExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultGreaterThanExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultGreaterThanExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultGreaterThanExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
*/
package org.jaxen.expr;
@@ -69,8 +69,4 @@
return lhs.compareTo( rhs ) > 0;
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLessThanEqualExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLessThanEqualExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLessThanEqualExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultLessThanEqualExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultLessThanEqualExpr.java,v 1.14 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultLessThanEqualExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultLessThanEqualExpr.java,v 1.14 2006/11/30 18:49:26 elharo Exp $
*/
package org.jaxen.expr;
@@ -67,9 +67,5 @@
{
return lhs.compareTo( rhs ) <= 0;
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLessThanExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLessThanExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLessThanExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultLessThanExpr.java,v 1.14 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.14 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultLessThanExpr.java,v 1.15 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.15 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultLessThanExpr.java,v 1.14 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultLessThanExpr.java,v 1.15 2006/11/30 18:49:27 elharo Exp $
*/
package org.jaxen.expr;
@@ -67,8 +67,5 @@
{
return lhs.compareTo( rhs ) < 0;
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLiteralExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLiteralExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultLiteralExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultLiteralExpr.java,v 1.11 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.11 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultLiteralExpr.java,v 1.13 2007/01/03 20:47:42 elharo Exp $
+ * $Revision: 1.13 $
+ * $Date: 2007/01/03 20:47:42 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultLiteralExpr.java,v 1.11 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultLiteralExpr.java,v 1.13 2007/01/03 20:47:42 elharo Exp $
*/
@@ -76,16 +76,19 @@
public String getText()
{
- return "\"" + getLiteral() + "\"";
+
+ if (literal.indexOf('"') == -1 ) {
+ return "\"" + getLiteral() + "\"";
+ }
+ else { // Not possible for string literal to contain both " and '
+ return "'" + getLiteral() + "'";
+ }
+
}
public Object evaluate(Context context)
{
return getLiteral();
}
-
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultMinusExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultMinusExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultMinusExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultMinusExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultMinusExpr.java,v 1.14 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultMinusExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultMinusExpr.java,v 1.14 2006/11/30 18:49:26 elharo Exp $
*/
@@ -83,8 +83,4 @@
return new Double( result );
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultModExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultModExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultModExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultModExpr.java,v 1.14 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.14 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultModExpr.java,v 1.15 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.15 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultModExpr.java,v 1.14 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultModExpr.java,v 1.15 2006/11/30 18:49:26 elharo Exp $
*/
package org.jaxen.expr;
@@ -81,8 +81,4 @@
return new Double( result );
}
- public void accept( Visitor visitor )
- {
- visitor.visit( this );
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultMultiplyExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultMultiplyExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultMultiplyExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultMultiplyExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultMultiplyExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultMultiplyExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultMultiplyExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
*/
package org.jaxen.expr;
@@ -82,8 +82,4 @@
return new Double( result );
}
- public void accept( Visitor visitor )
- {
- visitor.visit( this );
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNameStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNameStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNameStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,5 +1,5 @@
/*
- $Id: DefaultNameStep.java,v 1.50 2006/10/06 13:11:45 elharo Exp $
+ $Id: DefaultNameStep.java,v 1.53 2007/04/17 01:26:35 bewins Exp $
Copyright 2003 The Werken Company. All Rights Reserved.
@@ -179,7 +179,7 @@
}
Iterator axisNodeIter = iterableAxis.namedAccessIterator(
contextNode, support, localName, prefix, uri);
- if (axisNodeIter == null || axisNodeIter.hasNext() == false) {
+ if (axisNodeIter == null || !axisNodeIter.hasNext()) {
return Collections.EMPTY_LIST;
}
@@ -197,7 +197,7 @@
else {
// get the iterator over the nodes and check it
Iterator axisNodeIter = iterableAxis.iterator(contextNode, support);
- if (axisNodeIter == null || axisNodeIter.hasNext() == false) {
+ if (axisNodeIter == null || !axisNodeIter.hasNext()) {
return Collections.EMPTY_LIST;
}
@@ -234,30 +234,39 @@
Iterator axisNodeIter = iterableAxis.namedAccessIterator(
eachContextNode, support, localName, prefix, uri);
- if (axisNodeIter == null || axisNodeIter.hasNext() == false) {
+ if (axisNodeIter == null || !axisNodeIter.hasNext()) {
continue;
}
- // ensure only one of each node in the result
- while (axisNodeIter.hasNext()) {
- Object eachAxisNode = axisNodeIter.next();
- if (! unique.contains(eachAxisNode)) {
- unique.add(eachAxisNode);
- interimSet.add(eachAxisNode);
- }
- }
+ while (axisNodeIter.hasNext())
+ {
+ Object eachAxisNode = axisNodeIter.next();
+ interimSet.add(eachAxisNode);
+ }
- // evaluate the predicates
- newNodeSet.addAll(getPredicateSet().evaluatePredicates(interimSet, support));
- interimSet.clear();
- }
+ // evaluate the predicates
+ List predicateNodes = getPredicateSet().evaluatePredicates(interimSet, support);
+
+ // ensure only one of each node in the result
+ Iterator predicateNodeIter = predicateNodes.iterator();
+ while (predicateNodeIter.hasNext())
+ {
+ Object eachPredicateNode = predicateNodeIter.next();
+ if (! unique.contains(eachPredicateNode))
+ {
+ unique.add(eachPredicateNode);
+ newNodeSet.add(eachPredicateNode);
+ }
+ }
+ interimSet.clear();
+ }
} else {
for (int i = 0; i < contextSize; ++i) {
Object eachContextNode = contextNodeSet.get(i);
Iterator axisNodeIter = axisIterator(eachContextNode, support);
- if (axisNodeIter == null || axisNodeIter.hasNext() == false) {
+ if (axisNodeIter == null || !axisNodeIter.hasNext()) {
continue;
}
@@ -274,15 +283,24 @@
Object eachAxisNode = axisNodeIter.next();
if (matches(eachAxisNode, support)) {
- if (! unique.contains(eachAxisNode)) {
- unique.add(eachAxisNode);
- interimSet.add(eachAxisNode);
- }
+ interimSet.add(eachAxisNode);
}
}
// evaluate the predicates
- newNodeSet.addAll(getPredicateSet().evaluatePredicates(interimSet, support));
+ List predicateNodes = getPredicateSet().evaluatePredicates(interimSet, support);
+
+ // ensure only one of each node in the result
+ Iterator predicateNodeIter = predicateNodes.iterator();
+ while (predicateNodeIter.hasNext())
+ {
+ Object eachPredicateNode = predicateNodeIter.next();
+ if (! unique.contains(eachPredicateNode))
+ {
+ unique.add(eachPredicateNode);
+ newNodeSet.add(eachPredicateNode);
+ }
+ }
interimSet.clear();
}
}
@@ -389,15 +407,6 @@
}
return uri1.equals(uri2);
}
-
- /**
- * Visitor pattern for the step.
- *
- * @param visitor the visitor object
- */
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
/**
* Returns a full information debugging string.
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNotEqualsExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNotEqualsExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNotEqualsExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultNotEqualsExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultNotEqualsExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultNotEqualsExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultNotEqualsExpr.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
*/
@@ -86,9 +86,5 @@
}
return !lhs.equals( rhs );
}
-
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNumberExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNumberExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultNumberExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultNumberExpr.java,v 1.11 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.11 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultNumberExpr.java,v 1.13 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultNumberExpr.java,v 1.11 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultNumberExpr.java,v 1.13 2006/11/30 18:49:26 elharo Exp $
*/
@@ -58,9 +58,9 @@
*
*/
private static final long serialVersionUID = -6021898973386269611L;
- private Number number;
+ private Double number;
- DefaultNumberExpr( Number number )
+ DefaultNumberExpr( Double number )
{
this.number = number;
}
@@ -84,9 +84,5 @@
{
return getNumber();
}
-
- public void accept( Visitor visitor )
- {
- visitor.visit( this );
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultOrExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultOrExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultOrExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultOrExpr.java,v 1.16 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.16 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultOrExpr.java,v 1.17 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.17 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultOrExpr.java,v 1.16 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultOrExpr.java,v 1.17 2006/11/30 18:49:26 elharo Exp $
*/
@@ -100,9 +100,4 @@
return Boolean.FALSE;
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
-
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPathExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPathExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPathExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultPathExpr.java,v 1.15 2006/10/03 16:24:32 elharo Exp $
- * $Revision: 1.15 $
- * $Date: 2006/10/03 16:24:32 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultPathExpr.java,v 1.16 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.16 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultPathExpr.java,v 1.15 2006/10/03 16:24:32 elharo Exp $
+ * $Id: DefaultPathExpr.java,v 1.16 2006/11/30 18:49:26 elharo Exp $
*/
package org.jaxen.expr;
@@ -143,9 +143,6 @@
}
return results;
}
-
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPlusExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPlusExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPlusExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultPlusExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultPlusExpr.java,v 1.14 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultPlusExpr.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultPlusExpr.java,v 1.14 2006/11/30 18:49:26 elharo Exp $
*/
@@ -81,8 +81,5 @@
return new Double( result );
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPredicate.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPredicate.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultPredicate.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultPredicate.java,v 1.12 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.12 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultPredicate.java,v 1.13 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultPredicate.java,v 1.12 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultPredicate.java,v 1.13 2006/11/30 18:49:27 elharo Exp $
*/
@@ -94,8 +94,5 @@
{
return getExpr().evaluate( context );
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultProcessingInstructionNodeStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultProcessingInstructionNodeStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultProcessingInstructionNodeStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultProcessingInstructionNodeStep.java,v 1.16 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.16 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultProcessingInstructionNodeStep.java,v 1.18 2007/01/06 12:21:12 elharo Exp $
+ * $Revision: 1.18 $
+ * $Date: 2007/01/06 12:21:12 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultProcessingInstructionNodeStep.java,v 1.16 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultProcessingInstructionNodeStep.java,v 1.18 2007/01/06 12:21:12 elharo Exp $
*/
@@ -80,17 +80,31 @@
return this.name;
}
+ public String getText()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getAxisName());
+ buf.append("::processing-instruction(");
+ String name = getName();
+ if (name != null && name.length() != 0)
+ {
+ buf.append("'");
+ buf.append(name);
+ buf.append("'");
+ }
+ buf.append(")");
+ buf.append(super.getText());
+ return buf.toString();
+ }
+
public boolean matches(Object node,
ContextSupport support)
{
+
Navigator nav = support.getNavigator();
-
- boolean isPi = nav.isProcessingInstruction( node );
-
- if ( isPi )
+ if ( nav.isProcessingInstruction( node ) )
{
String name = getName();
-
if ( name == null || name.length() == 0 )
{
return true;
@@ -102,10 +116,7 @@
}
return false;
+
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultRelativeLocationPath.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultRelativeLocationPath.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultRelativeLocationPath.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultRelativeLocationPath.java,v 1.12 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.12 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultRelativeLocationPath.java,v 1.13 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultRelativeLocationPath.java,v 1.12 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultRelativeLocationPath.java,v 1.13 2006/11/30 18:49:27 elharo Exp $
*/
@@ -66,8 +66,4 @@
return "[(DefaultRelativeLocationPath): " + super.toString() + "]";
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultTextNodeStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultTextNodeStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultTextNodeStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultTextNodeStep.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultTextNodeStep.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultTextNodeStep.java,v 1.13 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultTextNodeStep.java,v 1.14 2006/11/30 18:49:27 elharo Exp $
*/
@@ -82,8 +82,4 @@
return getAxisName() + "::text()" + super.getText();
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultUnaryExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultUnaryExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultUnaryExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultUnaryExpr.java,v 1.15 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.15 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultUnaryExpr.java,v 1.16 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.16 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultUnaryExpr.java,v 1.15 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultUnaryExpr.java,v 1.16 2006/11/30 18:49:27 elharo Exp $
*/
@@ -95,8 +95,5 @@
return new Double( number.doubleValue() * -1 );
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultUnionExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultUnionExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultUnionExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultUnionExpr.java,v 1.16 2006/06/03 20:52:26 elharo Exp $
- * $Revision: 1.16 $
- * $Date: 2006/06/03 20:52:26 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultUnionExpr.java,v 1.17 2006/11/30 18:49:27 elharo Exp $
+ * $Revision: 1.17 $
+ * $Date: 2006/11/30 18:49:27 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultUnionExpr.java,v 1.16 2006/06/03 20:52:26 elharo Exp $
+ * $Id: DefaultUnionExpr.java,v 1.17 2006/11/30 18:49:27 elharo Exp $
*/
@@ -122,10 +122,5 @@
}
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
-
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultVariableReferenceExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultVariableReferenceExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultVariableReferenceExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultVariableReferenceExpr.java,v 1.15 2006/10/06 13:19:57 elharo Exp $
- * $Revision: 1.15 $
- * $Date: 2006/10/06 13:19:57 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultVariableReferenceExpr.java,v 1.16 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.16 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultVariableReferenceExpr.java,v 1.15 2006/10/06 13:19:57 elharo Exp $
+ * $Id: DefaultVariableReferenceExpr.java,v 1.16 2006/11/30 18:49:26 elharo Exp $
*/
package org.jaxen.expr;
@@ -105,8 +105,4 @@
localName );
}
- public void accept(Visitor visitor)
- {
- visitor.visit(this);
- }
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultXPathFactory.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultXPathFactory.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/DefaultXPathFactory.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultXPathFactory.java,v 1.15 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.15 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/DefaultXPathFactory.java,v 1.17 2006/11/09 16:07:36 elharo Exp $
+ * $Revision: 1.17 $
+ * $Date: 2006/11/09 16:07:36 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DefaultXPathFactory.java,v 1.15 2006/02/05 21:47:40 elharo Exp $
+ * $Id: DefaultXPathFactory.java,v 1.17 2006/11/09 16:07:36 elharo Exp $
*/
package org.jaxen.expr;
@@ -65,6 +65,12 @@
import org.jaxen.saxpath.Axis;
import org.jaxen.saxpath.Operator;
+/**
+ * The concrete implementation of the XPathFactory anstract factory.
+ *
+ *
+ * @see XPathFactory
+ */
public class DefaultXPathFactory implements XPathFactory
{
public XPathExpr createXPath( Expr rootExpr ) throws JaxenException
@@ -295,82 +301,46 @@
return new DefaultPredicate( predicateExpr );
}
- protected IterableAxis getIterableAxis( int axis )
+ protected IterableAxis getIterableAxis( int axis ) throws JaxenException
{
- IterableAxis iter = null;
+
switch( axis )
{
case Axis.CHILD:
- {
- iter = new IterableChildAxis( axis );
- break;
- }
+ return new IterableChildAxis( axis );
case Axis.DESCENDANT:
- {
- iter = new IterableDescendantAxis( axis );
- break;
- }
+ return new IterableDescendantAxis( axis );
case Axis.PARENT:
- {
- iter = new IterableParentAxis( axis );
- break;
- }
+ return new IterableParentAxis( axis );
case Axis.FOLLOWING_SIBLING:
- {
- iter = new IterableFollowingSiblingAxis( axis );
- break;
- }
+ return new IterableFollowingSiblingAxis( axis );
case Axis.PRECEDING_SIBLING:
- {
- iter = new IterablePrecedingSiblingAxis( axis );
- break;
- }
+ return new IterablePrecedingSiblingAxis( axis );
case Axis.FOLLOWING:
- {
- iter = new IterableFollowingAxis( axis );
- break;
- }
+ return new IterableFollowingAxis( axis );
case Axis.PRECEDING:
- {
- iter = new IterablePrecedingAxis( axis );
- break;
- }
+ return new IterablePrecedingAxis( axis );
case Axis.ATTRIBUTE:
- {
- iter = new IterableAttributeAxis( axis );
- break;
- }
+ return new IterableAttributeAxis( axis );
case Axis.NAMESPACE:
- {
- iter = new IterableNamespaceAxis( axis );
- break;
- }
+ return new IterableNamespaceAxis( axis );
case Axis.SELF:
- {
- iter = new IterableSelfAxis( axis );
- break;
- }
+ return new IterableSelfAxis( axis );
case Axis.DESCENDANT_OR_SELF:
- {
- iter = new IterableDescendantOrSelfAxis( axis );
- break;
- }
+ return new IterableDescendantOrSelfAxis( axis );
case Axis.ANCESTOR_OR_SELF:
- {
- iter = new IterableAncestorOrSelfAxis( axis );
- break;
- }
+ return new IterableAncestorOrSelfAxis( axis );
case Axis.ANCESTOR:
- {
- iter = new IterableAncestorAxis( axis );
- break;
- }
+ return new IterableAncestorAxis( axis );
+ default:
+ throw new JaxenException("Unrecognized axis code: " + axis);
}
- return iter;
+
}
public PredicateSet createPredicateSet() throws JaxenException
{
return new PredicateSet();
}
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/EqualityExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/EqualityExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/EqualityExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/EqualityExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/EqualityExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/11/09 16:21:05 $
*
* ====================================================================
*
@@ -42,9 +42,23 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: EqualityExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
+ * $Id: EqualityExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
*/
package org.jaxen.expr;
+
+/**
+ * Represents an XPath equality expression. This is production 23 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-EqualityExpr">XPath 1.0 specification</a>:
+ *
+ * <table><tr valign="baseline">
+ * <td><a name="NT-EqualityExpr"></a>[23] </td><td>EqualityExpr</td><td> ::= </td><td><a href="http://www.w3.org/TR/xpath#NT-RelationalExpr">RelationalExpr</a></td><td></td></tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-EqualityExpr">EqualityExpr</a> '=' <a href="http://www.w3.org/TR/xpath#NT-RelationalExpr">RelationalExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-EqualityExpr">EqualityExpr</a> '!=' <a href="http://www.w3.org/TR/xpath#NT-RelationalExpr">RelationalExpr</a></td><td></td></tr>
+ * </table>
+ *
+ */
public interface EqualityExpr extends BinaryExpr{
- public String getOperator();
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Expr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Expr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Expr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Expr.java,v 1.11 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.11 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Expr.java,v 1.14 2006/11/30 18:49:26 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/30 18:49:26 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: Expr.java,v 1.11 2006/02/05 21:47:40 elharo Exp $
+ * $Id: Expr.java,v 1.14 2006/11/30 18:49:26 elharo Exp $
*/
@@ -53,9 +53,48 @@
import org.jaxen.Context;
import org.jaxen.JaxenException;
-public interface Expr extends Serializable, Visitable
+/**
+ * Represents an XPath expression. This is production 14 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-Expr">XPath 1.0 specification</a>:
+ *
+ * <pre>[14] Expr ::= OrExpr</pre>
+ *
+ */
+public interface Expr extends Serializable
{
+
+
+ /**
+ * Returns a String containing the XPath expression.
+ *
+ * @return the text form of this XPath expression
+ */
String getText();
+
+ /**
+ * Simplifies the XPath expression. For example, the expression
+ * <code>//para[1 = 1]</code> could be simplified to
+ * <code>//para</code>. In practice, this is usually a noop.
+ * Jaxen does not currently perform any simplification.
+ *
+ * @return the simplified expression
+ */
Expr simplify();
+
+
+ /**
+ * Evaluate the expression in the given context, and return the result.
+ * The result will be a <code>java.lang.Double</code> for expressions that
+ * return a number, a <code>java.lang.String</code> for expressions that
+ * return a string, a <code>java.lang.Boolean</code> for expressions that
+ * return a boolean, and a <code>java.util.List</code> for expressions that
+ * return a node-set. In the latter case, the elements of the list are
+ * the actual objects from the source document model. Copies are not made.
+ *
+ * @param context the context in which the expression is evaluated
+ * @return an object representing the result of the evaluation
+ * @throws JaxenException
+ */
Object evaluate(Context context) throws JaxenException;
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/FilterExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/FilterExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/FilterExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/FilterExpr.java,v 1.9 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.9 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/FilterExpr.java,v 1.10 2006/11/08 16:28:04 elharo Exp $
+ * $Revision: 1.10 $
+ * $Date: 2006/11/08 16:28:04 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: FilterExpr.java,v 1.9 2006/02/05 21:47:40 elharo Exp $
+ * $Id: FilterExpr.java,v 1.10 2006/11/08 16:28:04 elharo Exp $
*/
@@ -52,15 +52,32 @@
import org.jaxen.Context;
import org.jaxen.JaxenException;
+/**
+ * Represents an XPath filter expression. This is production 20 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-EqualityExpr">XPath 1.0 specification</a>:
+ *
+ * <table><tr valign="baseline">
+ * <td><a name="NT-FilterExpr"></a>[20] </td><td>FilterExpr</td><td> ::= </td><td><a href="http://www.w3.org/TR/xpath#NT-PrimaryExpr">PrimaryExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-FilterExpr">FilterExpr</a> <a href="http://www.w3.org/TR/xpath#NT-Predicate">Predicate</a></td><td></td>
+ * </tr>
+ * </table>
+ *
+ */
public interface FilterExpr extends Expr, Predicated
{
- /** Evaluates the filter expression on the current context
+ /**
+ * Evaluates the filter expression on the current context
* and returns true if at least one node matches.
+ *
+ * @return true if a node matches; false if no node matches
*/
public boolean asBoolean(Context context) throws JaxenException;
+
/**
- * @return underlying filter expression
+ * @return the underlying filter expression
*/
public Expr getExpr();
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/FunctionCallExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/FunctionCallExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/FunctionCallExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/FunctionCallExpr.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.7 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/FunctionCallExpr.java,v 1.9 2006/11/08 16:37:59 elharo Exp $
+ * $Revision: 1.9 $
+ * $Date: 2006/11/08 16:37:59 $
*
* ====================================================================
*
@@ -42,18 +42,52 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: FunctionCallExpr.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
+ * $Id: FunctionCallExpr.java,v 1.9 2006/11/08 16:37:59 elharo Exp $
*/
+package org.jaxen.expr;
-package org.jaxen.expr;
import java.util.List;
+/**
+ * Represents an XPath function call expression. This is production 16 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-FunctionCall">XPath 1.0 specification</a>:
+ *
+ * <<pre>[16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')'</pre>
+ *
+ */
public interface FunctionCallExpr extends Expr
{
+
+ /**
+ * Returns the namespace prefix of the function. This is the empty
+ * string for XPath's built-in functions.
+ *
+ * @return the namespace prefix of the function
+ */
public String getPrefix();
+
+ /**
+ * Returns the local name of the function.
+ *
+ * @return the local name of the function
+ */
public String getFunctionName();
+
+ /**
+ * Add the next argument to the function.
+ *
+ * @param parameter a function argument
+ */
public void addParameter(Expr parameter);
+
+ /**
+ * Returns the the ordered list of function arguments.
+ * Each member of the list is an <code>Expr</code> object.
+ *
+ * @return the ordered list of function arguments
+ */
public List getParameters();
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LiteralExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LiteralExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LiteralExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/LiteralExpr.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.7 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/LiteralExpr.java,v 1.9 2006/11/08 16:47:30 elharo Exp $
+ * $Revision: 1.9 $
+ * $Date: 2006/11/08 16:47:30 $
*
* ====================================================================
*
@@ -42,14 +42,29 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: LiteralExpr.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
+ * $Id: LiteralExpr.java,v 1.9 2006/11/08 16:47:30 elharo Exp $
*/
package org.jaxen.expr;
+
+/**
+ * Represents an XPath string literal. This is production 29 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-Literal">XPath 1.0 specification</a>:
+ *
+ * <pre>[29] Literal ::= '"' [^"]* '"'
+ * | "'" [^']* "'"</pre>
+ *
+ */
public interface LiteralExpr extends Expr
{
+ /**
+ * Returns the contents of the string literal, not including the
+ * quote marks.
+ *
+ * @return the contents of the string literal
+ */
public String getLiteral();
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LocationPath.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LocationPath.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LocationPath.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/LocationPath.java,v 1.8 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.8 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/LocationPath.java,v 1.9 2006/11/08 17:02:21 elharo Exp $
+ * $Revision: 1.9 $
+ * $Date: 2006/11/08 17:02:21 $
*
* ====================================================================
*
@@ -42,20 +42,47 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: LocationPath.java,v 1.8 2006/02/05 21:47:40 elharo Exp $
+ * $Id: LocationPath.java,v 1.9 2006/11/08 17:02:21 elharo Exp $
*/
-
-
package org.jaxen.expr;
import java.util.List;
+/**
+ * Represents an XPath location path such as <code>//foo/bar</code>
+ * or <code>pre:baz[position()=last()]</code>.
+ * This is production 1 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-LocationPath">XPath 1.0 specification</a>:
+ *
+ * <pre>[1] LocationPath ::= RelativeLocationPath
+ * | AbsoluteLocationPath</pre>
+ *
+ */
public interface LocationPath extends Expr
{
+
+ /**
+ * Add the next step to this location path.
+ *
+ * @param step
+ */
void addStep(Step step);
+ /**
+ * Returns the ordered list of steps in this location path.
+ * This list may be live.
+ *
+ * @return the ordered list of steps in this location path
+ */
List getSteps();
+ /**
+ * Returns true if this is an absolute location path; false if it isn't.
+ * Absolute location paths all begiune with <code>/</code>
+ * or <code>//</code>.
+ *
+ * @return true if this is an absol;ute location path; false if it isn't
+ */
boolean isAbsolute();
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LogicalExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LogicalExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/LogicalExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/LogicalExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/LogicalExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/11/09 16:21:05 $
*
* ====================================================================
*
@@ -42,10 +42,28 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: LogicalExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
+ * $Id: LogicalExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
*/
package org.jaxen.expr;
-public interface LogicalExpr extends BinaryExpr{
- public String getOperator();
+/**
+ * Represents an XPath logical expression. This represents productions
+ * <a href="http://www.w3.org/TR/xpath#NT-OrExpr">21 OrExpr</a> and
+ * <a href="http://www.w3.org/TR/xpath#NT-AndExpr">22 AndExpr</a> in the XPath specification.
+ *
+ * <table><tr valign="baseline">
+ * <td><a name="NT-OrExpr"></a>[21] </td><td>OrExpr</td><td> ::= </td><td><a href="http://www.w3.org/TR/xpath#NT-AndExpr">AndExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-OrExpr">OrExpr</a> 'or' <a href="http://www.w3.org/TR/xpath#NT-AndExpr">AndExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td><a name="NT-AndExpr"></a>[22] </td><td>AndExpr</td><td> ::= </td><td><a href="http://www.w3.org/TR/xpath#NT-EqualityExpr">EqualityExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-AndExpr">AndExpr</a> 'and' <a href="http://www.w3.org/TR/xpath#NT-EqualityExpr">EqualityExpr</a></td><td></td>
+ * </tr></table>
+ *
+ */
+public interface LogicalExpr extends BinaryExpr {
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/MultiplicativeExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/MultiplicativeExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/MultiplicativeExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/MultiplicativeExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/MultiplicativeExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/11/09 16:21:05 $
*
* ====================================================================
*
@@ -42,10 +42,28 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: MultiplicativeExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
+ * $Id: MultiplicativeExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
*/
package org.jaxen.expr;
-public interface MultiplicativeExpr extends BinaryExpr{
- public String getOperator();
+/**
+ * Represents an XPath multiplicative expression. This is production 26 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">XPath 1.0 specification</a>:
+ *
+ * <table><tr valign="baseline">
+ * <td><a name="NT-MultiplicativeExpr"></a>[26] </td><td>MultiplicativeExpr</td><td> ::= </td><td><a href="http://www.w3.org/TR/xpath#NT-UnaryExpr">UnaryExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-MultiplicativeExpr">MultiplicativeExpr</a> <a href="http://www.w3.org/TR/xpath#NT-MultiplyOperator">MultiplyOperator</a> <a href="http://www.w3.org/TR/xpath#NT-UnaryExpr">UnaryExpr</a></td><td></td>
+ *
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-MultiplicativeExpr">MultiplicativeExpr</a> 'div' <a href="http://www.w3.org/TR/xpath#NT-UnaryExpr">UnaryExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-MultiplicativeExpr">MultiplicativeExpr</a> 'mod' <a href="http://www.w3.org/TR/xpath#NT-UnaryExpr">UnaryExpr</a></td><td></td>
+ * </tr></table>
+ *
+ */
+public interface MultiplicativeExpr extends BinaryExpr {
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/NameStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/NameStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/NameStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/NameStep.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/NameStep.java,v 1.5 2006/11/08 17:10:02 elharo Exp $
+ * $Revision: 1.5 $
+ * $Date: 2006/11/08 17:10:02 $
*
* ====================================================================
*
@@ -42,13 +42,34 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: NameStep.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
+ * $Id: NameStep.java,v 1.5 2006/11/08 17:10:02 elharo Exp $
*/
package org.jaxen.expr;
-//public interface Step extends Predicated, Expr
+/**
+ * Represents an XPath name test such as <code>para</code> or
+ * <code>svg:rect</code>. This is production 37 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-NameTest">XPath 1.0 specification</a>:
+ *
+ * <pre>[37] NameTest ::= '*'
+ * | NCName ':' '*'
+ * | QName</pre>
+ *
+ */
public interface NameStep extends Step
{
+
+ /**
+ * Returns the namespace prefix of the matched node. This is the empty
+ * string for nodes in the default namespace.
+ *
+ * @return the namespace prefix of the natched node
+ */
public String getPrefix();
- public String getLocalName();
-}
+
+ /**
+ * Returns the local name of the matched node
+ *
+ * @return the local name of the test
+ */
+ public String getLocalName();}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/NumberExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/NumberExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/NumberExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/NumberExpr.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.7 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/NumberExpr.java,v 1.8 2006/11/08 17:17:32 elharo Exp $
+ * $Revision: 1.8 $
+ * $Date: 2006/11/08 17:17:32 $
*
* ====================================================================
*
@@ -43,11 +43,26 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: NumberExpr.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
+ * $Id: NumberExpr.java,v 1.8 2006/11/08 17:17:32 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents an XPath floating point literal. This is production 30 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-Number">XPath 1.0 specification</a>:
+ *
+ * <pre>[30] Number ::= Digits ('.' Digits?)?
+ * | '.' Digits</pre>
+ *
+ */
public interface NumberExpr extends Expr
{
+
+
+ /**
+ * Returns a <code>java.lang.Double</code> representing the number.
+ *
+ * @return a <code>java.lang.Double</code> representing the number
+ */
public Number getNumber();
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/PathExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/PathExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/PathExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/PathExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.6 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/PathExpr.java,v 1.9 2007/05/02 14:26:41 elharo Exp $
+ * $Revision: 1.9 $
+ * $Date: 2007/05/02 14:26:41 $
*
* ====================================================================
*
@@ -42,17 +42,47 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: PathExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
+ * $Id: PathExpr.java,v 1.9 2007/05/02 14:26:41 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents an XPath path expression.
+ * This is production 19 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-PathExpr">XPath 1.0 specification</a>:
+ *
+ * <pre>[19] PathExpr ::= LocationPath
+ * | FilterExpr
+ * | FilterExpr '/' RelativeLocationPath
+ * | FilterExpr '//' RelativeLocationPath </pre>
+ *
+ */
public interface PathExpr extends Expr
{
+
+ /**
+ * Returns the filter expression that starts the path expression.
+ *
+ * @return the filter expression that starts the path expression
+ */
Expr getFilterExpr();
+
+
+ /**
+ * Changes the expression's filter expression.
+ *
+ * @param filterExpr the new filter expression
+ */
void setFilterExpr(Expr filterExpr);
+ /**
+ * Returns the location path part of this path expression.
+ *
+ * @return the location path part of this expression
+ */
LocationPath getLocationPath();
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Predicate.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Predicate.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Predicate.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Predicate.java,v 1.10 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.10 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Predicate.java,v 1.14 2007/05/02 14:27:46 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2007/05/02 14:27:46 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: Predicate.java,v 1.10 2006/02/05 21:47:40 elharo Exp $
+ * $Id: Predicate.java,v 1.14 2007/05/02 14:27:46 elharo Exp $
*/
@@ -53,15 +53,61 @@
import org.jaxen.Context;
import org.jaxen.JaxenException;
-public interface Predicate extends Serializable, Visitable
+
+/**
+ * Represents an XPath predicate such as <code>[position() = last()]</code>.
+ * This is production 8 and 9 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-Predicate">XPath 1.0 specification</a>:
+ *
+ * <pre> [8] Predicate ::= '[' PredicateExpr ']'
+ * [9] PredicateExpr ::= Expr</pre>
+ *
+ */
+public interface Predicate extends Serializable
{
+ /**
+ * Returns the expression in this predicate.
+ *
+ * @return the expression between the brackets
+ */
Expr getExpr();
+
+ /**
+ * Change the expression used by this predicate.
+ *
+ * @param expr the new expression
+ */
void setExpr(Expr expr);
+ /**
+ * Simplify the expression in this predicate.
+ *
+ * @see Expr#simplify()
+ */
void simplify();
+ /**
+ * Returns the string form of the predicate,
+ * including the square brackets.
+ *
+ * @return the bracketed form of this predicate
+ */
String getText();
+ /**
+ * Evaluates this predicate's expression and returns the result.
+ * The result will be a <code>java.lang.Double</code> for expressions that
+ * return a number, a <code>java.lang.String</code> for expressions that
+ * return a string, a <code>java.lang.Boolean</code> for expressions that
+ * return a boolean, and a <code>java.util.List</code> for expressions that
+ * return a node-set. In the latter case, the elements of the list are
+ * the actual objects from the source document model. Copies are not made.
+ *
+ * @param context the context in which the expression is evaluated
+ * @return an object representing the result of the evaluation
+ * @throws JaxenException
+ * @see Expr#evaluate(Context)
+ */
Object evaluate(Context context) throws JaxenException;
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/PredicateSet.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/PredicateSet.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/PredicateSet.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/PredicateSet.java,v 1.22 2006/09/15 21:03:23 elharo Exp $
- * $Revision: 1.22 $
- * $Date: 2006/09/15 21:03:23 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/PredicateSet.java,v 1.23 2006/11/13 22:38:17 elharo Exp $
+ * $Revision: 1.23 $
+ * $Date: 2006/11/13 22:38:17 $
*
* ====================================================================
*
@@ -43,7 +43,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: PredicateSet.java,v 1.22 2006/09/15 21:03:23 elharo Exp $
+ * $Id: PredicateSet.java,v 1.23 2006/11/13 22:38:17 elharo Exp $
*/
@@ -60,6 +60,19 @@
import org.jaxen.JaxenException;
import org.jaxen.function.BooleanFunction;
+/**
+ * <p>
+ * Represents the collection of predicates that follow the node-test in a
+ * location path.
+ * </p>
+ *
+ * <p>
+ * There is no rule that the same predicate may not
+ * appear twice in an XPath expression, nor does this class enforce any such rule.
+ * This is implemented more as a list than a set. However, adding the swme predicate
+ * twice should have no effect on the final result other than slowing it down.
+ * </p>
+ */
public class PredicateSet implements Serializable
{
@@ -67,11 +80,19 @@
private List predicates;
+ /**
+ * Create a new empty predicate set.
+ */
public PredicateSet()
{
this.predicates = Collections.EMPTY_LIST;
}
+ /**
+ * Add a predicate to the set.
+ *
+ * @param predicate the predicate to be inserted
+ */
public void addPredicate(Predicate predicate)
{
if ( this.predicates == Collections.EMPTY_LIST )
@@ -82,11 +103,20 @@
this.predicates.add( predicate );
}
+ /**
+ * Returns the list containing the predicates.
+ * This list is live, not a copy.
+ *
+ * @return a live list of predicates
+ */
public List getPredicates()
{
return this.predicates;
}
+ /**
+ * Simplify each of the predicates in the list.
+ */
public void simplify()
{
Iterator predIter = this.predicates.iterator();
@@ -99,6 +129,11 @@
}
}
+ /**
+ * Returns the XPath string containing each of the predicates.
+ *
+ * @return the XPath string containing each of the predicates
+ */
public String getText()
{
StringBuffer buf = new StringBuffer();
@@ -115,6 +150,17 @@
return buf.toString();
}
+ /**
+ * <p>Returns true if any of the supplied nodes satisfy
+ * all the predicates in the set. Returns false if none of the supplied
+ * nodes matches all the predicates in the set. Returns false if the
+ * node-set is empty.</p>
+ *
+ * @param contextNodeSet the nodes to test against these predicates
+ * @param support ????
+ * @return true if any node in the contextNodeSet matches all the predicates
+ * @throws JaxenException
+ */
protected boolean evaluateAsBoolean(List contextNodeSet,
ContextSupport support) throws JaxenException
{
@@ -174,6 +220,15 @@
+ /**
+ * <p>Returns all of the supplied nodes that satisfy
+ * all the predicates in the set. </p>
+ *
+ * @param contextNodeSet the nodes to test against these predicates
+ * @param support ????
+ * @return all the nodes that match each of the predicates
+ * @throws JaxenException
+ */
protected List evaluatePredicates(List contextNodeSet, ContextSupport support)
throws JaxenException {
// Easy way out (necessary)
@@ -231,4 +286,5 @@
}
return filteredNodes;
}
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Predicated.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Predicated.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Predicated.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Predicated.java,v 1.8 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.8 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Predicated.java,v 1.9 2006/11/08 18:07:25 elharo Exp $
+ * $Revision: 1.9 $
+ * $Date: 2006/11/08 18:07:25 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: Predicated.java,v 1.8 2006/02/05 21:47:40 elharo Exp $
+ * $Id: Predicated.java,v 1.9 2006/11/08 18:07:25 elharo Exp $
*/
@@ -52,9 +52,32 @@
import java.io.Serializable;
import java.util.List;
+/**
+ * Interface for objects which can have one or more predicates.
+ *
+ */
public interface Predicated extends Serializable
{
+ /**
+ * Add an additional predicate to this object.
+ *
+ * @param predicate the predicate to add
+ */
void addPredicate(Predicate predicate);
+
+
+ /**
+ * Returns a possibly empty list of predicates.
+ *
+ * @return the list of predicates
+ */
List getPredicates();
+
+
+ /**
+ * Returns a possibly empty set of predicates.
+ *
+ * @return the set of predicates
+ */
PredicateSet getPredicateSet();
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/ProcessingInstructionNodeStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/ProcessingInstructionNodeStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/ProcessingInstructionNodeStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/ProcessingInstructionNodeStep.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/ProcessingInstructionNodeStep.java,v 1.5 2006/11/08 15:44:33 elharo Exp $
+ * $Revision: 1.5 $
+ * $Date: 2006/11/08 15:44:33 $
*
* ====================================================================
*
@@ -42,11 +42,20 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: ProcessingInstructionNodeStep.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
+ * $Id: ProcessingInstructionNodeStep.java,v 1.5 2006/11/08 15:44:33 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents the XPath node-test <code>processing-instruction()</code>.
+ *
+ */
public interface ProcessingInstructionNodeStep extends Step
{
+ /**
+ * Returns the target matched by this processing instruction node-step.
+ *
+ * @return the target of the processing instruction
+ */
public String getName();
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/RelationalExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/RelationalExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/RelationalExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/RelationalExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/RelationalExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/11/09 16:21:05 $
*
* ====================================================================
*
@@ -42,9 +42,28 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: RelationalExpr.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
+ * $Id: RelationalExpr.java,v 1.6 2006/11/09 16:21:05 elharo Exp $
*/
package org.jaxen.expr;
-public interface RelationalExpr extends BinaryExpr{
- public String getOperator();
+
+/**
+ * Represents an XPath relational expression such as
+ * <code>count(//p) > count(//div)</code>.
+ * This is production 24 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-RelationalExpr">XPath 1.0 specification</a>:
+ *
+ *<table><tr valign="baseline"><td><a name="NT-RelationalExpr"></a>[24] </td><td>RelationalExpr</td><td> ::= </td><td><a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr">AdditiveExpr</a></td><td></td>
+ *</tr><tr valign="baseline">
+ *<td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-RelationalExpr">RelationalExpr</a> '<' <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr">AdditiveExpr</a></td><td></td>
+ *</tr><tr valign="baseline">
+ *<td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-RelationalExpr">RelationalExpr</a> '>' <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr">AdditiveExpr</a></td><td></td>
+ *</tr>
+ *<tr valign="baseline">
+ *<td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-RelationalExpr">RelationalExpr</a> '<=' <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr">AdditiveExpr</a></td><td></td>
+ * </tr>
+ * <tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-RelationalExpr">RelationalExpr</a> '>=' <a href="http://www.w3.org/TR/xpath#NT-AdditiveExpr">AdditiveExpr</a></td><td></td>v * </tr></table>
+ *
+ */
+public interface RelationalExpr extends BinaryExpr {
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Step.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Step.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Step.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Step.java,v 1.10 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.10 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Step.java,v 1.13 2006/12/10 15:32:14 elharo Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/12/10 15:32:14 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: Step.java,v 1.10 2006/02/05 21:47:40 elharo Exp $
+ * $Id: Step.java,v 1.13 2006/12/10 15:32:14 elharo Exp $
*/
package org.jaxen.expr;
@@ -56,44 +56,67 @@
import org.jaxen.UnsupportedAxisException;
/**
- * A Step represents a location step in a LocationPath. The node-set selected by
+ * <p>Represents a location step in a LocationPath. The node-set selected by
* the location step is the node-set that results from generating an initial
* node-set from the axis and node-test, and then filtering that node-set by
- * each of the predicates in turn.
+ * each of the predicates in turn.</p>
*
+ * <p>
* The initial node-set consists of the nodes having the relationship to the
* context node specified by the axis, and having the node type and expanded-name
- * specified by the node test.
+ * specified by the node test.</p>
*/
-public interface Step extends Predicated, Visitable
+public interface Step extends Predicated
{
/**
* Performs the node-test part of evaluating the step for the given node
* (which must be on the axis).
+ *
+ * @return true if the node matches this step; false if it doesn't
*/
boolean matches(Object node,
ContextSupport contextSupport) throws JaxenException;
+ /**
+ * Returns a <code>String</code> containing the XPath expression.
+ *
+ * @return the text form of this step
+ */
String getText();
+ /**
+ * Simplifies the XPath step. In practice, this is usually a noop.
+ * Jaxen does not currently perform any simplification.
+ */
void simplify();
/**
* Get an identifier for the current axis.
+ *
+ * @return the axis identifier
* @see org.jaxen.saxpath.Axis
*/
public int getAxis();
/**
* Get an Iterator for the current axis starting in the given contextNode.
- */
+ *
+ * @param contextNode the node from which to follow this step
+ * @param support the remaining context for the traversal
+ * @return an iterator over the nodes along the axis
+ * @throws UnsupportedAxisException if the navigator does not support this step's axis
+ *
+ */
Iterator axisIterator(Object contextNode,
ContextSupport support) throws UnsupportedAxisException;
+
/**
* For each node in the given context calls matches() for every node on the
* axis, then filters the result by each of the predicates.
+ *
+ * @return a list of matching nodes
*/
List evaluate(Context context) throws JaxenException;
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/TextNodeStep.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/TextNodeStep.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/TextNodeStep.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/TextNodeStep.java,v 1.5 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.5 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/TextNodeStep.java,v 1.6 2006/11/08 18:52:02 elharo Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/11/08 18:52:02 $
*
* ====================================================================
*
@@ -42,10 +42,14 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: TextNodeStep.java,v 1.5 2006/02/05 21:47:40 elharo Exp $
+ * $Id: TextNodeStep.java,v 1.6 2006/11/08 18:52:02 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents the XPath node-test <code>text()</code>.
+ *
+ */
public interface TextNodeStep extends Step
{
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/UnaryExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/UnaryExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/UnaryExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/UnaryExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.6 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/UnaryExpr.java,v 1.7 2006/11/08 19:06:30 elharo Exp $
+ * $Revision: 1.7 $
+ * $Date: 2006/11/08 19:06:30 $
*
* ====================================================================
*
@@ -42,14 +42,29 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: UnaryExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
+ * $Id: UnaryExpr.java,v 1.7 2006/11/08 19:06:30 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents an XPath unary expression such as <code>-78</code>.
+ * This is production 27 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-UnaryExpr">XPath 1.0 specification</a>:
+ *
+ * <pre>[27] UnaryExpr ::= UnionExpr | '-' UnaryExpr</pre>
+ *
+ */
public interface UnaryExpr extends Expr
{
+
+ /**
+ * Returns the expression following the minus sign.
+ *
+ * @return the expression following the minus sign
+ */
Expr getExpr();
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/UnionExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/UnionExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/UnionExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/UnionExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.6 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/UnionExpr.java,v 1.7 2006/11/08 15:57:20 elharo Exp $
+ * $Revision: 1.7 $
+ * $Date: 2006/11/08 15:57:20 $
*
* ====================================================================
*
@@ -42,13 +42,24 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: UnionExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
+ * $Id: UnionExpr.java,v 1.7 2006/11/08 15:57:20 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents an XPath union expression. This is production 18 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">XPath 1.0 specification</a>:
+ *
+ * <table><tr valign="baseline">
+ * <td><a name="NT-UnionExpr"></a>[18] </td><td>UnionExpr</td><td> ::= </td><td><a href="http://www.w3.org/TR/xpath#NT-PathExpr">PathExpr</a></td><td></td>
+ * </tr><tr valign="baseline">
+ * <td></td><td></td><td></td><td>| <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a> '|' <a href="http://www.w3.org/TR/xpath#NT-PathExpr">PathExpr</a>
+ * </tr></table>
+ *
+ */
public interface UnionExpr extends BinaryExpr
{
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/VariableReferenceExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/VariableReferenceExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/VariableReferenceExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/VariableReferenceExpr.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.7 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/VariableReferenceExpr.java,v 1.8 2006/11/08 19:20:29 elharo Exp $
+ * $Revision: 1.8 $
+ * $Date: 2006/11/08 19:20:29 $
*
* ====================================================================
*
@@ -42,15 +42,35 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: VariableReferenceExpr.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
+ * $Id: VariableReferenceExpr.java,v 1.8 2006/11/08 19:20:29 elharo Exp $
*/
package org.jaxen.expr;
+/**
+ * Represents an XPath variable reference. This is production 36 in the
+ * <a href="http://www.w3.org/TR/xpath#NT-VariableReference">XPath 1.0 specification</a>:
+ *
+ * <pre>[36] VariableReference ::= '$' QName</pre>
+ *
+ */
public interface VariableReferenceExpr extends Expr
{
+ /**
+ * Returns the namespace prefix of the variable. This is the empty
+ * string for variables with no namespace prefix.
+ *
+ * @return the namespace prefix of the variable
+ */
public String getPrefix();
+
+ /**
+ * Returns the local name of the variable.
+ *
+ * @return the local name of the variable
+ */
public String getVariableName();
+
}
Deleted: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Visitable.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Visitable.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Visitable.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,50 +0,0 @@
-/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Visitable.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
- *
- * ====================================================================
- *
- * Copyright 2000-2002 bob mcwhirter & James Strachan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of the Jaxen Project nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ====================================================================
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Jaxen Project and was originally
- * created by bob mcwhirter <bob at werken.com> and
- * James Strachan <jstrachan at apache.org>. For more information on the
- * Jaxen Project, please see <http://www.jaxen.org/>.
- *
- * $Id: Visitable.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- */
-package org.jaxen.expr;
-public interface Visitable {
- public void accept(Visitor visitor);
-}
Deleted: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Visitor.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Visitor.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/Visitor.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,71 +0,0 @@
-/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/Visitor.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
- *
- * ====================================================================
- *
- * Copyright 2000-2002 bob mcwhirter & James Strachan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of the Jaxen Project nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ====================================================================
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Jaxen Project and was originally
- * created by bob mcwhirter <bob at werken.com> and
- * James Strachan <jstrachan at apache.org>. For more information on the
- * Jaxen Project, please see <http://www.jaxen.org/>.
- *
- * $Id: Visitor.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- */
-package org.jaxen.expr;
-
-public interface Visitor {
- public void visit(PathExpr path);
- public void visit(LocationPath path);
- public void visit(LogicalExpr expr);
- public void visit(EqualityExpr expr);
- public void visit(FilterExpr expr);
- public void visit(RelationalExpr expr);
- public void visit(AdditiveExpr expr);
- public void visit(MultiplicativeExpr expr);
- public void visit(UnaryExpr expr);
- public void visit(UnionExpr expr);
- public void visit(NumberExpr expr);
- public void visit(LiteralExpr expr);
- public void visit(VariableReferenceExpr expr);
- public void visit(FunctionCallExpr expr);
- // Steps
- public void visit(NameStep step);
- public void visit(ProcessingInstructionNodeStep step);
- public void visit(AllNodeStep step);
- public void visit(TextNodeStep step);
- public void visit(CommentNodeStep step);
- public void visit(Predicate predicate);
-}
Deleted: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/VisitorSupport.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/VisitorSupport.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/VisitorSupport.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,89 +0,0 @@
-/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/VisitorSupport.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.4 $
- * $Date: 2006/02/05 21:47:40 $
- *
- * ====================================================================
- *
- * Copyright 2000-2002 bob mcwhirter & James Strachan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of the Jaxen Project nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ====================================================================
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Jaxen Project and was originally
- * created by bob mcwhirter <bob at werken.com> and
- * James Strachan <jstrachan at apache.org>. For more information on the
- * Jaxen Project, please see <http://www.jaxen.org/>.
- *
- * $Id: VisitorSupport.java,v 1.4 2006/02/05 21:47:40 elharo Exp $
- */
-package org.jaxen.expr;
-public class VisitorSupport implements Visitor {
- public void visit(PathExpr path) {
- }
- public void visit(LocationPath path) {
- }
- public void visit(LogicalExpr expr) {
- }
- public void visit(EqualityExpr expr) {
- }
- public void visit(FilterExpr expr) {
- }
- public void visit(RelationalExpr expr) {
- }
- public void visit(AdditiveExpr expr) {
- }
- public void visit(MultiplicativeExpr expr) {
- }
- public void visit(UnaryExpr expr) {
- }
- public void visit(UnionExpr expr) {
- }
- public void visit(NumberExpr expr) {
- }
- public void visit(LiteralExpr expr) {
- }
- public void visit(VariableReferenceExpr expr) {
- }
- public void visit(FunctionCallExpr expr) {
- }
- public void visit(NameStep step){
- }
- public void visit(ProcessingInstructionNodeStep step){
- }
- public void visit(AllNodeStep step){
- }
- public void visit(TextNodeStep step){
- }
- public void visit(CommentNodeStep step){
- }
- public void visit(Predicate predicate){
- }
-}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/XPathExpr.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/XPathExpr.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/XPathExpr.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/XPathExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.6 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/XPathExpr.java,v 1.9 2007/05/02 15:04:46 elharo Exp $
+ * $Revision: 1.9 $
+ * $Date: 2007/05/02 15:04:46 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: XPathExpr.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
+ * $Id: XPathExpr.java,v 1.9 2007/05/02 15:04:46 elharo Exp $
*/
@@ -55,13 +55,54 @@
import org.jaxen.Context;
import org.jaxen.JaxenException;
+
+/**
+ * A wrapper around an XPath expression.
+ *
+ */
public interface XPathExpr extends Serializable
{
+
+ /**
+ * Returns the wrapped expression object.
+ *
+ * @return the wrapped Expr object
+ */
Expr getRootExpr();
+
+
+ /**
+ * Changes the wrapped expression object.
+ *
+ * @param rootExpr the new expression object to wrap
+ */
void setRootExpr(Expr rootExpr);
+
+ /**
+ * Returns a String containing the XPath expression.
+ *
+ * @return the text form of this XPath expression
+ */
String getText();
- void simplify();
-
+
+ /**
+ * Simplifies the XPath expression. For example, the expression
+ * <code>//para[1 = 1]</code> could be simplified to
+ * <code>//para</code>. In practice, this is usually a noop.
+ * Jaxen does not currently perform any simplification.
+ */
+ void simplify();
+
+
+ /**
+ * Evaluates the expression and returns a list cintaing the resulting nodes,
+ * or a singleton list containing a <code>Double</code>, <code>String</code>,
+ * or <code>Boolean</code>.
+ *
+ * @param context the context in which to evaluate this expression
+ * @return a list
+ * @throws JaxenException
+ */
List asList(Context context) throws JaxenException;
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/XPathFactory.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/XPathFactory.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/expr/XPathFactory.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/XPathFactory.java,v 1.11 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.11 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/expr/XPathFactory.java,v 1.13 2007/05/02 14:32:38 elharo Exp $
+ * $Revision: 1.13 $
+ * $Date: 2007/05/02 14:32:38 $
*
* ====================================================================
*
@@ -43,79 +43,282 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: XPathFactory.java,v 1.11 2006/02/05 21:47:40 elharo Exp $
+ * $Id: XPathFactory.java,v 1.13 2007/05/02 14:32:38 elharo Exp $
*/
package org.jaxen.expr;
import org.jaxen.JaxenException;
+import org.jaxen.saxpath.Operator;
+/**
+ * An abstract factory used to create individual path component objects.
+ *
+ */
public interface XPathFactory
{
+
+ /**
+ * Create a new <code>XPathExpr</code> from an <code>Expr</code>.
+ *
+ * @param rootExpr the expression wrapped by the resuolting XPathExpr
+ * @return an XPathExpr wrapping the root expression
+ * @throws JaxenException
+ */
XPathExpr createXPath( Expr rootExpr ) throws JaxenException;
+ /**
+ * Create a new path expression.
+ *
+ * @param filterExpr the filter expression that starts the path expression
+ * @param locationPath the location path that follows the filter expression
+ * @return a path expression formed by concatenating the two arguments
+ * @throws JaxenException
+ */
PathExpr createPathExpr( FilterExpr filterExpr,
LocationPath locationPath ) throws JaxenException;
+ /**
+ * Create a new empty relative location path.
+ *
+ * @return an empty relative location path
+ * @throws JaxenException
+ */
LocationPath createRelativeLocationPath() throws JaxenException;
+ /**
+ * Create a new empty absolute location path.
+ *
+ * @return an empty absolute location path
+ * @throws JaxenException
+ */
LocationPath createAbsoluteLocationPath() throws JaxenException;
+ /**
+ * Returns a new XPath Or expression.
+ *
+ * @param lhs the left hand side of the expression
+ * @param rhs the right hand side of the expression
+ * @return <code><i>lhs</i> or <i>rhs</i></code>
+ * @throws JaxenException
+ */
BinaryExpr createOrExpr( Expr lhs,
Expr rhs ) throws JaxenException;
+ /**
+ * Returns a new XPath And expression.
+ *
+ * @param lhs the left hand side of the expression
+ * @param rhs the right hand side of the expression
+ * @return <code><i>lhs</i> and <i>rhs</i></code>
+ * @throws JaxenException
+ */
BinaryExpr createAndExpr( Expr lhs,
Expr rhs ) throws JaxenException;
+ /**
+ * Returns a new XPath equality expression.
+ *
+ * @param lhs the left hand side of the expression
+ * @param rhs the right hand side of the expression
+ * @param equalityOperator <code>Operator.EQUALS</code> or <code>Operator.NOT_EQUALS</code>
+ * @return <code><i>lhs</i> = <i>rhs</i></code> or <code><i>lhs</i> != <i>rhs</i></code>
+ * @throws JaxenException if the third argument is not
+ * <code>Operator.EQUALS</code> or <code>Operator.NOT_EQUALS</code>
+ */
BinaryExpr createEqualityExpr( Expr lhs,
Expr rhs,
int equalityOperator ) throws JaxenException;
+ /**
+ * Returns a new XPath relational expression.
+ *
+ * @param lhs the left hand side of the expression
+ * @param rhs the right hand side of the expression
+ * @param relationalOperator <code>Operator.LESS_THAN</code>, <code>Operator.GREATER_THAN</code>,
+ * <code>Operator.LESS_THAN_EQUALS</code>, or <code>Operator.GREATER_THAN_EQUALS</code>
+ * @return <code><i>lhs</i> <i>relationalOperator</i> <i>rhs</i></code> or <code><i>lhs</i> != <i>rhs</i></code>
+ * @throws JaxenException if the third argument is not a relational operator constant
+ */
BinaryExpr createRelationalExpr( Expr lhs,
Expr rhs,
int relationalOperator ) throws JaxenException;
+ /**
+ * Returns a new XPath additive expression.
+ *
+ * @param lhs the left hand side of the expression
+ * @param rhs the right hand side of the expression
+ * @param additiveOperator <code>Operator.ADD</code> or <code>Operator.SUBTRACT</code>
+ * @return <code><i>lhs</i> + <i>rhs</i></code> or <code><i>lhs</i> - <i>rhs</i></code>
+ * @throws JaxenException if the third argument is not
+ * <code>Operator.ADD</code> or <code>Operator.SUBTRACT</code>
+ */
BinaryExpr createAdditiveExpr( Expr lhs,
Expr rhs,
int additiveOperator ) throws JaxenException;
+ /**
+ * Returns a new XPath multiplicative expression.
+ *
+ * @param lhs the left hand side of the expression
+ * @param rhs the right hand side of the expression
+ * @param multiplicativeOperator <code>Operator.MULTIPLY</code>,
+ * <code>Operator.DIV</code>, or <code>Operator.MOD</code>
+ * @return <code><i>lhs</i> * <i>rhs</i></code>, <code><i>lhs</i> div <i>rhs</i></code>,
+ * or <code><i>lhs</i> mod <i>rhs</i></code>
+ * @throws JaxenException if the third argument is not a multiplicative operator constant
+ */
BinaryExpr createMultiplicativeExpr( Expr lhs,
Expr rhs,
int multiplicativeOperator ) throws JaxenException;
+ /**
+ * Returns a new XPath unary expression.
+ *
+ * @param expr the expression to be negated
+ * @param unaryOperator <code>Operator.NEGATIVE</code>
+ * @return <code>- <i>expr</i></code> or <code><i>expr</i></code>
+ * @throws JaxenException
+ */
Expr createUnaryExpr( Expr expr,
int unaryOperator ) throws JaxenException;
+ /**
+ * Returns a new XPath union expression.
+ *
+ * @param lhs the left hand side of the expression
+ * @param rhs the right hand side of the expression
+ * @return <code><i>lhs</i> | <i>rhs</i></code></code>
+ * @throws JaxenException
+ */
UnionExpr createUnionExpr( Expr lhs,
Expr rhs ) throws JaxenException;
+ /**
+ * Returns a new XPath filter expression.
+ *
+ * @param expr the basic expression to which the predicate will be added
+ * @return the expression with an empty predicate set
+ * @throws JaxenException
+ */
FilterExpr createFilterExpr( Expr expr ) throws JaxenException;
+
+ /**
+ * Create a new function call expression.
+ *
+ * @param prefix the namespace prefix of the function
+ * @param functionName the local name of the function
+ * @return a function with an empty argument list
+ * @throws JaxenException
+ */
FunctionCallExpr createFunctionCallExpr( String prefix,
String functionName ) throws JaxenException;
+ /**
+ * Create a number expression.
+ *
+ * @param number the value
+ * @return a number expression wrapping that value
+ * @throws JaxenException
+ */
NumberExpr createNumberExpr( int number ) throws JaxenException;
+ /**
+ * Create a number expression.
+ *
+ * @param number the value
+ * @return a number expression wrapping that value
+ * @throws JaxenException
+ */
NumberExpr createNumberExpr( double number ) throws JaxenException;
+ /**
+ * Create a string literal expression.
+ *
+ * @param literal the value
+ * @return a literal expression wrapping that value
+ * @throws JaxenException
+ */
LiteralExpr createLiteralExpr( String literal ) throws JaxenException;
+ /**
+ * Create a new variable reference expression.
+ *
+ * @param prefix the namespace prefix of the variable
+ * @param variableName the local name of the variable
+ * @return a variable expression
+ * @throws JaxenException
+ */
VariableReferenceExpr createVariableReferenceExpr( String prefix,
String variableName ) throws JaxenException;
+ /**
+ * Create a step with a named node-test.
+ *
+ * @param axis the axis to create the name-test on
+ * @param prefix the namespace prefix for the test
+ * @param localName the local name for the test
+ * @return a name step
+ * @throws JaxenException if <code>axis</code> is not one of the axis constants????
+ */
Step createNameStep( int axis,
String prefix,
String localName ) throws JaxenException;
+ /**
+ * Create a step with a node() node-test.
+ *
+ * @param axis the axis to create the node-test on
+ * @return an all node step
+ * @throws JaxenException if <code>axis</code> is not one of the axis constants????
+ */
Step createAllNodeStep( int axis ) throws JaxenException;
+ /**
+ * Create a step with a <code>comment()</code> node-test.
+ *
+ * @param axis the axis to create the <code>comment()</code> node-test on
+ * @return a comment node step
+ * @throws JaxenException if <code>axis</code> is not one of the axis constants????
+ */
Step createCommentNodeStep( int axis ) throws JaxenException;
+ /**
+ * Create a step with a <code>text()</code> node-test.
+ *
+ * @param axis the axis to create the <code>text()</code> node-test on
+ * @return a text node step
+ * @throws JaxenException if <code>axis</code> is not one of the axis constants????
+ */
Step createTextNodeStep( int axis ) throws JaxenException;
+ /**
+ * Create a step with a <code>processing-instruction()</code> node-test.
+ *
+ * @param axis the axis to create the <code>processing-instruction()</code> node-test on
+ * @param name the target to match, may be empty
+ * @return a processing instruction node step
+ * @throws JaxenException if <code>axis</code> is not one of the axis constants????
+ */
Step createProcessingInstructionNodeStep( int axis,
String name ) throws JaxenException;
+ /**
+ * Create from the supplied expression.
+ *
+ * @param predicateExpr the expression to evaluate in the predicate
+ * @return a predicate
+ * @throws JaxenException
+ */
Predicate createPredicate( Expr predicateExpr ) throws JaxenException;
+ /**
+ * Create an empty predicate set.
+ *
+ * @return an empty predicate set
+ * @throws JaxenException
+ */
PredicateSet createPredicateSet() throws JaxenException;
+
}
Deleted: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/function/ext/MatrixConcatFunction.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/function/ext/MatrixConcatFunction.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/function/ext/MatrixConcatFunction.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,165 +0,0 @@
-/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/function/ext/MatrixConcatFunction.java,v 1.6 2006/02/05 21:47:42 elharo Exp $
- * $Revision: 1.6 $
- * $Date: 2006/02/05 21:47:42 $
- *
- * ====================================================================
- *
- * Copyright 2000-2002 bob mcwhirter & James Strachan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of the Jaxen Project nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ====================================================================
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Jaxen Project and was originally
- * created by bob mcwhirter <bob at werken.com> and
- * James Strachan <jstrachan at apache.org>. For more information on the
- * Jaxen Project, please see <http://www.jaxen.org/>.
- *
- * $Id: MatrixConcatFunction.java,v 1.6 2006/02/05 21:47:42 elharo Exp $
- */
-
-package org.jaxen.function.ext;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jaxen.Context;
-import org.jaxen.Function;
-import org.jaxen.Navigator;
-import org.jaxen.function.StringFunction;
-
-/** <p><b>Extension Function</b> <code><i>boolean</i> matrix-concat(<i>nodeSet</i>,<i>nodeSet</i>,<i>nodeSet*</i>)</code>
- *
- * @author James Pereira (JPereira at CT.BBD.CO.ZA)
- */
-
-public class MatrixConcatFunction implements Function {
-
- public Object call(Context context, List args) {
- if ( args.size() >= 2 ) {
- return evaluate(args, context.getNavigator());
- }
- return null;
- }
-
- public static Object evaluate(List list, Navigator nav) {
- ArrayList matrix = new ArrayList();
-
- Iterator argIter = list.iterator();
-
- while (argIter.hasNext()) {
- ArrayList v = new ArrayList();
- Object obj = argIter.next();
- if (obj instanceof List) {
- List args = (List) obj;
- for ( int i = 0, size = args.size(); i < size; i++ ) {
- v.add( StringFunction.evaluate( args.get(i), nav ) );
- }
- }
- else {
- v.add( StringFunction.evaluate( obj, nav ) );
- }
- matrix.add(v);
- }
-
- ArrayList result = new ArrayList();
- Enumeration elemList = new MatrixEnum( matrix );
- while (elemList.hasMoreElements()) {
- Object obj = elemList.nextElement();
- if (obj instanceof List) {
- StringBuffer text = new StringBuffer(127);
- List args = (List) obj;
- for (Iterator it = args.iterator(); it.hasNext(); ) {
- text.append(it.next());
- }
- result.add( text.toString() );
- }
- else {
- result.add( obj );
- }
- }
- return result;
- }
-
- public static class MatrixEnum implements Enumeration {
- private ArrayList m_source;
- private int m_maxSize = 0;
- private int m_currIdx = -1;
-
- public MatrixEnum (ArrayList _source) {
- m_source = _source;
-
- for ( Iterator iter = m_source.iterator(); iter.hasNext(); ) {
- ArrayList element = (ArrayList) iter.next();
- int size = element.size();
- if (size > m_maxSize) {
- m_maxSize = size;
- }
- }
- }
-
- public MatrixEnum (ArrayList _source, int _maxSize) {
- m_source = _source;
- m_maxSize = _maxSize;
- }
-
- public boolean hasMoreElements() {
- if ((m_maxSize != 0) && (++m_currIdx < m_maxSize)) {
- return true;
- }
- else {
- return false;
- }
- }
-
- public Object nextElement() {
- ArrayList result = new ArrayList();
- for ( Iterator iter = m_source.iterator(); iter.hasNext(); ) {
- ArrayList element = (ArrayList) iter.next();
- int size = element.size();
- if ( m_currIdx < size ) {
- result.add( element.get( m_currIdx ) );
- }
- else {
- if ( size > 0 ) {
- result.add( element.get( size - 1 ) );
- }
- else {
- // XXXX: what to do now?
- result.add( "" );
- }
- }
- }
- return result;
- }
- }
-}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/AncestorAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/AncestorAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/AncestorAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/AncestorAxisIterator.java,v 1.13 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/AncestorAxisIterator.java,v 1.14 2006/11/09 18:20:12 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/09 18:20:12 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: AncestorAxisIterator.java,v 1.13 2006/02/05 21:47:40 elharo Exp $
+ * $Id: AncestorAxisIterator.java,v 1.14 2006/11/09 18:20:12 elharo Exp $
*/
@@ -52,8 +52,24 @@
import org.jaxen.Navigator;
+/**
+ * Represents the XPath <code>ancestor</code> axis.
+ * The "<code>ancestor</code> axis contains the ancestors of the context node;
+ * the ancestors of the context node consist of the parent of context node and
+ * the parent's parent and so on; thus, the ancestor axis will always include
+ * the root node, unless the context node is the root node."
+ *
+ * @version 1.2b12
+ */
public class AncestorAxisIterator extends AncestorOrSelfAxisIterator
{
+
+ /**
+ * Create a new ancestor axis iterator.
+ *
+ * @param contextNode the node to start from
+ * @param navigator the object model specific navigator
+ */
public AncestorAxisIterator(Object contextNode,
Navigator navigator)
{
@@ -61,4 +77,5 @@
navigator );
next();
}
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/AncestorOrSelfAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/AncestorOrSelfAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/AncestorOrSelfAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,9 +1,9 @@
package org.jaxen.util;
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/AncestorOrSelfAxisIterator.java,v 1.13 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.13 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/AncestorOrSelfAxisIterator.java,v 1.14 2006/11/09 18:20:12 elharo Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/11/09 18:20:12 $
*
* ====================================================================
*
@@ -45,7 +45,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: AncestorOrSelfAxisIterator.java,v 1.13 2006/02/05 21:47:40 elharo Exp $
+ * $Id: AncestorOrSelfAxisIterator.java,v 1.14 2006/11/09 18:20:12 elharo Exp $
*/
import java.util.Iterator;
@@ -55,11 +55,28 @@
import org.jaxen.UnsupportedAxisException;
import org.jaxen.JaxenRuntimeException;
+/**
+ * <p>
+ * Represents the XPath <code>ancestor-or-self</code> axis.
+ * The "<code>ancestor-or-self</code> axis contains the context node and
+ * the ancestors of the context node; thus, the ancestor axis will
+ * always include the root node."
+ * </p>
+ *
+ * @version 1.2b12
+ */
public class AncestorOrSelfAxisIterator implements Iterator
{
+
private Object contextNode;
private Navigator navigator;
+ /**
+ * Create a new <code>ancestor-or-self</code> axis iterator.
+ *
+ * @param contextNode the node to start from
+ * @param navigator the object model specific navigator
+ */
public AncestorOrSelfAxisIterator(Object contextNode,
Navigator navigator)
{
@@ -68,11 +85,28 @@
this.navigator = navigator;
}
+ /**
+ * Returns true if there are any nodes remaining
+ * on the ancestor-or-self axis; false otherwise.
+ *
+ * @return true if any ancestors or self remain
+ *
+ * @see java.util.Iterator#hasNext()
+ */
public boolean hasNext()
{
return contextNode != null;
}
+ /**
+ * Returns the next ancestor-or-self node.
+ *
+ * @return the next ancestor-or-self node
+ *
+ * @throws NoSuchElementException if no ancestors remain
+ *
+ * @see java.util.Iterator#next()
+ */
public Object next()
{
try
@@ -90,8 +124,14 @@
}
}
+ /**
+ * This operation is not supported.
+ *
+ * @throws UnsupportedOperationException always
+ */
public void remove()
{
throw new UnsupportedOperationException();
}
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/DescendantAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/DescendantAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/DescendantAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,9 +1,9 @@
package org.jaxen.util;
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/DescendantAxisIterator.java,v 1.12 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.12 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/DescendantAxisIterator.java,v 1.13 2006/11/09 18:20:11 elharo Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/11/09 18:20:11 $
*
* ====================================================================
*
@@ -45,7 +45,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DescendantAxisIterator.java,v 1.12 2006/02/05 21:47:40 elharo Exp $
+ * $Id: DescendantAxisIterator.java,v 1.13 2006/11/09 18:20:11 elharo Exp $
*/
import org.jaxen.Navigator;
@@ -56,6 +56,14 @@
import java.util.NoSuchElementException;
import java.util.ArrayList;
+/**
+ * Represents the XPath <code>descendant</code> axis.
+ * The "<code>descendant</code> axis contains the descendants of the context node;
+ * a descendant is a child or a child of a child and so on; thus
+ * the descendant axis never contains attribute or namespace nodes."
+ *
+ * @version 1.2b12
+ */
public class DescendantAxisIterator implements Iterator
{
@@ -63,6 +71,12 @@
private Iterator children;
private Navigator navigator;
+ /**
+ * Create a new <code>descendant</code> axis iterator.
+ *
+ * @param contextNode the node to start from
+ * @param navigator the object model specific navigator
+ */
public DescendantAxisIterator(Object contextNode,
Navigator navigator) throws UnsupportedAxisException
{
@@ -76,7 +90,13 @@
this.children = iterator;
}
- public boolean hasNext()
+ /**
+ * Returns true if there are any descendants remaining; false otherwise.
+ *
+ * @return true if any descendants remain; false otherwise
+ *
+ * @see java.util.Iterator#hasNext()
+ */ public boolean hasNext()
{
while (!children.hasNext())
{
@@ -89,6 +109,15 @@
return true;
}
+ /**
+ * Returns the next descendant node.
+ *
+ * @return the next descendant node
+ *
+ * @throws NoSuchElementException if no descendants remain
+ *
+ * @see java.util.Iterator#next()
+ */
public Object next()
{
try
@@ -108,6 +137,11 @@
}
}
+ /**
+ * This operation is not supported.
+ *
+ * @throws UnsupportedOperationException always
+ */
public void remove()
{
throw new UnsupportedOperationException();
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/DescendantOrSelfAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/DescendantOrSelfAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/DescendantOrSelfAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,9 +1,9 @@
package org.jaxen.util;
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/DescendantOrSelfAxisIterator.java,v 1.10 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.10 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/DescendantOrSelfAxisIterator.java,v 1.11 2006/11/09 18:20:12 elharo Exp $
+ * $Revision: 1.11 $
+ * $Date: 2006/11/09 18:20:12 $
*
* ====================================================================
*
@@ -45,16 +45,31 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: DescendantOrSelfAxisIterator.java,v 1.10 2006/02/05 21:47:40 elharo Exp $
+ * $Id: DescendantOrSelfAxisIterator.java,v 1.11 2006/11/09 18:20:12 elharo Exp $
*/
import org.jaxen.Navigator;
+/**
+ * Represents the XPath <code>descendant-or-self</code> axis.
+ * The "<code>descendant-or-self</code> axis contains the context node
+ * and the descendants of the context node."
+ *
+ * @version 1.2b12
+ */
public class DescendantOrSelfAxisIterator extends DescendantAxisIterator
{
+
+ /**
+ * Create a new <code>desscendant-or-self</code> axis iterator.
+ *
+ * @param contextNode the node to start from
+ * @param navigator the object model specific navigator
+ */
public DescendantOrSelfAxisIterator(Object contextNode,
Navigator navigator)
{
super(navigator, new SingleObjectIterator(contextNode));
}
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/FollowingAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/FollowingAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/FollowingAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,9 +1,9 @@
package org.jaxen.util;
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/FollowingAxisIterator.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.7 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/FollowingAxisIterator.java,v 1.8 2006/11/09 18:20:12 elharo Exp $
+ * $Revision: 1.8 $
+ * $Date: 2006/11/09 18:20:12 $
*
* ====================================================================
*
@@ -45,7 +45,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: FollowingAxisIterator.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
+ * $Id: FollowingAxisIterator.java,v 1.8 2006/11/09 18:20:12 elharo Exp $
*/
import java.util.Iterator;
@@ -56,6 +56,14 @@
import org.jaxen.JaxenRuntimeException;
import org.jaxen.JaxenConstants;
+/**
+ * Represents the XPath <code>following</code> axis.
+ * The "<code>following</code> axis contains all nodes in the same document as the context
+ * node that are after the context node in document order, excluding any descendants
+ * and excluding attribute nodes and namespace nodes."
+ *
+ * @version 1.2b12
+ */
public class FollowingAxisIterator implements Iterator
{
private Object contextNode;
@@ -66,6 +74,12 @@
private Iterator currentSibling;
+ /**
+ * Create a new <code>following</code> axis iterator.
+ *
+ * @param contextNode the node to start from
+ * @param navigator the object model specific navigator
+ */
public FollowingAxisIterator(Object contextNode,
Navigator navigator) throws UnsupportedAxisException
{
@@ -123,6 +137,14 @@
}
}
+ /**
+ * Returns true if there are any following nodes remaining;
+ * false otherwise.
+ *
+ * @return true if any following nodes remain
+ *
+ * @see java.util.Iterator#hasNext()
+ */
public boolean hasNext()
{
while ( ! currentSibling.hasNext() )
@@ -136,6 +158,15 @@
return true;
}
+ /**
+ * Returns the next following node.
+ *
+ * @return the next following node
+ *
+ * @throws NoSuchElementException if no following nodes remain
+ *
+ * @see java.util.Iterator#next()
+ */
public Object next() throws NoSuchElementException
{
if ( ! hasNext() )
@@ -146,6 +177,11 @@
return currentSibling.next();
}
+ /**
+ * This operation is not supported.
+ *
+ * @throws UnsupportedOperationException always
+ */
public void remove() throws UnsupportedOperationException
{
throw new UnsupportedOperationException();
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/FollowingSiblingAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/FollowingSiblingAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/FollowingSiblingAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/FollowingSiblingAxisIterator.java,v 1.10 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.10 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/FollowingSiblingAxisIterator.java,v 1.11 2006/11/09 18:20:12 elharo Exp $
+ * $Revision: 1.11 $
+ * $Date: 2006/11/09 18:20:12 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: FollowingSiblingAxisIterator.java,v 1.10 2006/02/05 21:47:40 elharo Exp $
+ * $Id: FollowingSiblingAxisIterator.java,v 1.11 2006/11/09 18:20:12 elharo Exp $
*/
@@ -56,12 +56,29 @@
import org.jaxen.Navigator;
import org.jaxen.UnsupportedAxisException;
+/**
+ *
+ * Represents the XPath <code>following-sibling</code> axis.
+ * The "<code>following-sibling</code> axis contains all the
+ * folowing siblings of the context node; if the context node is an
+ * attribute node or namespace node, the <code>following-sibling</code>
+ * axis is empty."
+ *
+ * @version 1.2b12
+ *
+ */
public class FollowingSiblingAxisIterator implements Iterator
{
private Object contextNode;
private Navigator navigator;
private Iterator siblingIter;
+ /**
+ * Create a new <code>following-sibling</code> axis iterator.
+ *
+ * @param contextNode the node to start from
+ * @param navigator the object model specific navigator
+ */
public FollowingSiblingAxisIterator(Object contextNode,
Navigator navigator) throws UnsupportedAxisException
{
@@ -89,17 +106,38 @@
}
}
-
+
+ /**
+ * Returns true if there are any following siblings remain; false otherwise.
+ *
+ * @return true if any following siblings remain; false otherwise
+ *
+ * @see java.util.Iterator#hasNext()
+ */
public boolean hasNext()
{
return siblingIter.hasNext();
}
+ /**
+ * Returns the next following sibling.
+ *
+ * @return the next following sibling
+ *
+ * @throws NoSuchElementException if no following siblings remain
+ *
+ * @see java.util.Iterator#next()
+ */
public Object next() throws NoSuchElementException
{
return siblingIter.next();
}
+ /**
+ * This operation is not supported.
+ *
+ * @throws UnsupportedOperationException always
+ */
public void remove() throws UnsupportedOperationException
{
throw new UnsupportedOperationException();
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/LinkedIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/LinkedIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/LinkedIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/LinkedIterator.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.7 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/LinkedIterator.java,v 1.8 2006/11/09 18:20:12 elharo Exp $
+ * $Revision: 1.8 $
+ * $Date: 2006/11/09 18:20:12 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: LinkedIterator.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
+ * $Id: LinkedIterator.java,v 1.8 2006/11/09 18:20:12 elharo Exp $
*/
@@ -54,7 +54,7 @@
import java.util.NoSuchElementException;
/**
- * @deprecated elharo this class is undocumented and untested.
+ * @deprecated This class is undocumented and untested.
* It will be removed in a future release.
*/
public class LinkedIterator implements Iterator
@@ -107,6 +107,11 @@
return ((Iterator)this.iterators.get( this.cur )).next();
}
+ /**
+ * This operation is not supported.
+ *
+ * @throws UnsupportedOperationException
+ */
public void remove()
{
throw new UnsupportedOperationException();
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/PrecedingAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/PrecedingAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/PrecedingAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,9 +1,9 @@
package org.jaxen.util;
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/PrecedingAxisIterator.java,v 1.9 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.9 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/PrecedingAxisIterator.java,v 1.11 2006/11/13 22:10:09 elharo Exp $
+ * $Revision: 1.11 $
+ * $Date: 2006/11/13 22:10:09 $
*
* ====================================================================
*
@@ -45,7 +45,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: PrecedingAxisIterator.java,v 1.9 2006/02/05 21:47:40 elharo Exp $
+ * $Id: PrecedingAxisIterator.java,v 1.11 2006/11/13 22:10:09 elharo Exp $
*/
import org.jaxen.JaxenConstants;
@@ -59,21 +59,34 @@
import java.util.NoSuchElementException;
/**
- * This implementation of 'preceding' works like so:
- * the preceding axis includes preceding-siblings of this node and their
- * descendants. Also, for each ancestor node of this node, it includes
- * all preceding-siblings of that ancestor, and their descendants. Finally, it
+ * <p>
+ * Represents the XPath <code>preceding</code> axis.
+ * The "<code>preceding</code> axis contains all nodes in the same document as the context
+ * node that are before the context node in document order, excluding any ancestors
+ * and excluding attribute nodes and namespace nodes."
+ *
+ * <p>
+ * This implementation of '<code>preceding</code>' works like so:
+ * the <code>preceding</code> axis includes preceding siblings of this node and
+ * their descendants. Also, for each ancestor node of this node, it includes
+ * all preceding siblings of that ancestor, and their descendants. Finally, it
* includes the ancestor nodes themselves.
- * <p/>
- * The reversed descendant-or-self axes that are required are calculated using a
+ * </p>
+ *
+ * <p>
+ * The reversed <code>descendant-or-self</code> axes that are required are calculated using a
* stack of reversed 'child-or-self' axes. When asked for a node, it is always taken
* from a child-or-self axis. If it was the last node on that axis, the node is returned.
* Otherwise, this axis is pushed on the stack, and the process is repeated with the child-or-self
* of the node. Eventually this recurses down to the last descendant of any node, then works
* back up to the root.
- * <p/>
- * I reckon most object models could provide a faster implementation of the reversed
- * 'children-or-self' used here.
+ * </p>
+ *
+ * <p>
+ * Most object models could provide a faster implementation of the reversed
+ * 'children-or-self' used here.</p>
+ *
+ * @version 1.2b12
*/
public class PrecedingAxisIterator implements Iterator
{
@@ -84,6 +97,12 @@
private Navigator navigator;
+ /**
+ * Create a new <code>preceding</code> axis iterator.
+ *
+ * @param contextNode the node to start from
+ * @param navigator the object model specific navigator
+ */
public PrecedingAxisIterator(Object contextNode,
Navigator navigator) throws UnsupportedAxisException
{
@@ -95,6 +114,13 @@
}
+ /**
+ * Returns true if there are any preceding nodes remaining; false otherwise.
+ *
+ * @return true if any preceding nodes remain; false otherwise
+ *
+ * @see java.util.Iterator#hasNext()
+ */
public boolean hasNext()
{
try
@@ -150,6 +176,15 @@
}
}
+ /**
+ * Returns the next preceding node.
+ *
+ * @return the next preceding node
+ *
+ * @throws NoSuchElementException if no preceding nodes remain
+ *
+ * @see java.util.Iterator#next()
+ */
public Object next() throws NoSuchElementException
{
if (!hasNext())
@@ -171,8 +206,14 @@
}
+ /**
+ * This operation is not supported.
+ *
+ * @throws UnsupportedOperationException always
+ */
public void remove() throws UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/PrecedingSiblingAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/PrecedingSiblingAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/PrecedingSiblingAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/PrecedingSiblingAxisIterator.java,v 1.14 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.14 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/PrecedingSiblingAxisIterator.java,v 1.16 2006/11/13 22:10:09 elharo Exp $
+ * $Revision: 1.16 $
+ * $Date: 2006/11/13 22:10:09 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: PrecedingSiblingAxisIterator.java,v 1.14 2006/02/05 21:47:40 elharo Exp $
+ * $Id: PrecedingSiblingAxisIterator.java,v 1.16 2006/11/13 22:10:09 elharo Exp $
*/
@@ -57,6 +57,17 @@
import org.jaxen.Navigator;
import org.jaxen.UnsupportedAxisException;
+/**
+ *
+ * Represents the XPath <code>preceding-sibling</code> axis.
+ * The "<code>preceding-sibling</code> axis contains all the
+ * preceding siblings of the context node; if the context node is an
+ * attribute node or namespace node, the <code>preceding-sibling</code>
+ * axis is empty."
+ *
+ * @version 1.2b12
+ *
+ */
public class PrecedingSiblingAxisIterator implements Iterator
{
private Object contextNode;
@@ -65,6 +76,12 @@
private Iterator siblingIter;
private Object nextObj;
+ /**
+ * Create a new <code>preceding-sibling</code> axis iterator.
+ *
+ * @param contextNode the node to start from
+ * @param navigator the object model specific navigator
+ */
public PrecedingSiblingAxisIterator(Object contextNode,
Navigator navigator) throws UnsupportedAxisException
{
@@ -107,11 +124,27 @@
}
+ /**
+ * Returns true if there are any preceding siblings remaining; false otherwise.
+ *
+ * @return true if any preceding siblings remain; false otherwise
+ *
+ * @see java.util.Iterator#hasNext()
+ */
public boolean hasNext()
{
return ( this.nextObj != null );
}
+ /**
+ * Returns the next preceding sibling.
+ *
+ * @return the next preceding sibling
+ *
+ * @throws NoSuchElementException if no preceding siblings remain
+ *
+ * @see java.util.Iterator#next()
+ */
public Object next() throws NoSuchElementException
{
if ( ! hasNext() )
@@ -130,6 +163,11 @@
return obj;
}
+ /**
+ * This operation is not supported.
+ *
+ * @throws UnsupportedOperationException
+ */
public void remove() throws UnsupportedOperationException
{
throw new UnsupportedOperationException();
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SelfAxisIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SelfAxisIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SelfAxisIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/SelfAxisIterator.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.7 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/SelfAxisIterator.java,v 1.10 2007/05/02 14:33:29 elharo Exp $
+ * $Revision: 1.10 $
+ * $Date: 2007/05/02 14:33:29 $
*
* ====================================================================
*
@@ -42,16 +42,29 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: SelfAxisIterator.java,v 1.7 2006/02/05 21:47:40 elharo Exp $
+ * $Id: SelfAxisIterator.java,v 1.10 2007/05/02 14:33:29 elharo Exp $
*/
package org.jaxen.util;
+/**
+ *
+ * Represents the XPath <code>self</code> axis. The "<code>self</code> axis contains
+ * just the context node itself."
+ *
+ * @version 1.1.1
+ *
+ */
public class SelfAxisIterator extends SingleObjectIterator
{
+ /**
+ * Create a new <code>self</code> axis iterator.
+ *
+ * @param node the node to start from
+ */
public SelfAxisIterator(Object node)
{
super(node);
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SingleObjectIterator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SingleObjectIterator.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SingleObjectIterator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/SingleObjectIterator.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.6 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/SingleObjectIterator.java,v 1.8 2006/11/09 18:20:12 elharo Exp $
+ * $Revision: 1.8 $
+ * $Date: 2006/11/09 18:20:12 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: SingleObjectIterator.java,v 1.6 2006/02/05 21:47:40 elharo Exp $
+ * $Id: SingleObjectIterator.java,v 1.8 2006/11/09 18:20:12 elharo Exp $
*/
@@ -58,20 +58,44 @@
*/
public class SingleObjectIterator implements Iterator
{
+
private Object object;
private boolean seen;
+ /**
+ * Creates a new single object iterator.
+ *
+ * @param object the object to iterate over
+ */
public SingleObjectIterator(Object object)
{
this.object = object;
this.seen = false;
}
+
+ /**
+ * Returns true if this iterator's element has not yet been seen; false if it has.
+ *
+ * @return true if this iterator has another element; false if it doesn't
+ *
+ * @see java.util.Iterator#hasNext()
+ */
public boolean hasNext()
{
return ! this.seen;
}
+ /**
+ * Returns the single element in this iterator if it has not yet
+ * been seen.
+ *
+ * @return the next element in this iterator
+ *
+ * @throws NoSuchElementException if the element has already been seen
+ *
+ * @see java.util.Iterator#next()
+ */
public Object next()
{
if ( hasNext() )
@@ -83,8 +107,14 @@
throw new NoSuchElementException();
}
+ /**
+ * This operation is not supported.
+ *
+ * @throws UnsupportedOperationException always
+ */
public void remove()
{
throw new UnsupportedOperationException();
}
+
}
Modified: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SingletonList.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SingletonList.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/SingletonList.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,7 +1,7 @@
/*
- * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/SingletonList.java,v 1.3 2006/02/05 21:47:40 elharo Exp $
- * $Revision: 1.3 $
- * $Date: 2006/02/05 21:47:40 $
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/util/SingletonList.java,v 1.4 2006/11/09 16:39:19 elharo Exp $
+ * $Revision: 1.4 $
+ * $Date: 2006/11/09 16:39:19 $
*
* ====================================================================
*
@@ -42,7 +42,7 @@
* James Strachan <jstrachan at apache.org>. For more information on the
* Jaxen Project, please see <http://www.jaxen.org/>.
*
- * $Id: SingletonList.java,v 1.3 2006/02/05 21:47:40 elharo Exp $
+ * $Id: SingletonList.java,v 1.4 2006/11/09 16:39:19 elharo Exp $
*/
@@ -53,25 +53,49 @@
/**
* A utility class that implements singleton lists
- * (to avoid dependency on JDK 1.3).
- * @version $Id: SingletonList.java,v 1.3 2006/02/05 21:47:40 elharo Exp $
+ * (to avoid dependency on JDK 1.3). Many operations
+ * including <code>add()</code> and <code>remove()</code> throw
+ * UnsupportedOperationExceptions.
+ *
+ * @version 1.2b12
* @author Attila Szegedi
+ *
*/
public class SingletonList extends AbstractList {
+
private final Object element;
+ /**
+ * Creates a new singleton list.
+ *
+ * @param element the single member of the list
+ */
public SingletonList(Object element) {
this.element = element;
}
+ /**
+ * Returns 1.
+ *
+ * @return 1
+ */
public int size() {
return 1;
}
+ /**
+ * Returns the single element in the list.
+ *
+ * @return the only element in the list
+ *
+ * @throws IndexOutOfBoundsException if index is not 0
+ *
+ */
public Object get(int index) {
if(index == 0) {
return element;
}
throw new IndexOutOfBoundsException(index + " != 0");
}
+
}
Deleted: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/XPath2XMLVisitor.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/XPath2XMLVisitor.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/util/XPath2XMLVisitor.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -1,237 +0,0 @@
-package org.jaxen.util;
-
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jaxen.expr.AdditiveExpr;
-import org.jaxen.expr.AllNodeStep;
-import org.jaxen.expr.CommentNodeStep;
-import org.jaxen.expr.EqualityExpr;
-import org.jaxen.expr.Expr;
-import org.jaxen.expr.FilterExpr;
-import org.jaxen.expr.FunctionCallExpr;
-import org.jaxen.expr.LiteralExpr;
-import org.jaxen.expr.LocationPath;
-import org.jaxen.expr.LogicalExpr;
-import org.jaxen.expr.MultiplicativeExpr;
-import org.jaxen.expr.NameStep;
-import org.jaxen.expr.NumberExpr;
-import org.jaxen.expr.PathExpr;
-import org.jaxen.expr.Predicate;
-import org.jaxen.expr.ProcessingInstructionNodeStep;
-import org.jaxen.expr.RelationalExpr;
-import org.jaxen.expr.Step;
-import org.jaxen.expr.TextNodeStep;
-import org.jaxen.expr.UnaryExpr;
-import org.jaxen.expr.UnionExpr;
-import org.jaxen.expr.VariableReferenceExpr;
-import org.jaxen.expr.Visitor;
-
-public class XPath2XMLVisitor implements Visitor {
-
- protected PrintWriter printer;
- protected int tabIndex;
-
- public XPath2XMLVisitor() {
- this.printer = new PrintWriter(System.out);
- }
-
- public XPath2XMLVisitor(PrintWriter printer) {
- this.printer = printer;
- }
-
- public void visit(PathExpr expr) {
- printLn("<PathExpr>");
- if (expr.getFilterExpr() != null){
- expr.getFilterExpr().accept(this);
- }
- if (expr.getLocationPath() != null){
- expr.getLocationPath().accept(this);
- }
- printLn("</PathExpr>");
- }
-
- public void visit(LocationPath expr) {
- printLn("<LocationPath absolute=\"" + expr.isAbsolute() + "\">");
- Iterator steps = expr.getSteps().iterator();
-
- while (steps.hasNext()){
- Step step = (Step)steps.next();
- step.accept(this);
- }
- printLn("</LocationPath>");
- }
-
- public void visit(LogicalExpr expr) {
- printLn("<LogicalExpr operator=\""+ expr.getOperator() + "\">");
- printLhsRhs(expr.getLHS(), expr.getRHS());
- printLn("</LogicalExpr>");
- }
-
- void printLhsRhs(Expr lhs, Expr rhs){
- tabIndex++;
- printLn("<lhsExpr>");
- lhs.accept(this);
- printLn("</lhsExpr>");
- printLn("<rhsExpr>");
- rhs.accept(this);
- printLn("</rhsExpr>");
- tabIndex--;
- }
-
- public void visit(EqualityExpr expr) {
- printLn("<EqualityExpr operator=\""+ expr.getOperator() + "\">");
- printLhsRhs(expr.getLHS(), expr.getRHS());
- printLn("</EqualityExpr>");
- }
-
- public void visit(FilterExpr expr) {
- printLn("<FilterExpr>");
- tabIndex++;
- if (expr.getExpr() != null){
- expr.getExpr().accept(this);
- }
- Iterator iter = expr.getPredicates().iterator();
- while (iter.hasNext()){
- ((Predicate)iter.next()).getExpr().accept(this);
- }
- tabIndex--;
- printLn("</FilterExpr>");
- }
-
- public void visit(RelationalExpr expr) {
- printLn("<RelationalExpr operator=\""+ expr.getOperator() + "\">");
- printLhsRhs(expr.getLHS(), expr.getRHS());
- printLn("</RelationalExpr>");
- }
-
- public void visit(AdditiveExpr expr) {
- printLn("<AdditiveExpr operator=\""+ expr.getOperator() + "\">");
- printLhsRhs(expr.getLHS(), expr.getRHS());
- printLn("</AdditiveExpr>");
- }
-
- public void visit(MultiplicativeExpr expr) {
- printLn("<MultiplicativeExpr operator=\""+ expr.getOperator() + "\">");
- printLhsRhs(expr.getLHS(), expr.getRHS());
- printLn("</MultiplicativeExpr>");
- }
-
- public void visit(UnaryExpr expr) {
- printLn("<UnaryExpr>");
- expr.getExpr().accept(this);
- printLn("</UnaryExpr>");
- }
-
- public void visit(UnionExpr expr) {
- printLn("<UnionExpr>");
- printLhsRhs(expr.getLHS(), expr.getRHS());
- printLn("</UnionExpr>");
- }
-
- public void visit(NumberExpr expr) {
- printLn("<NumberExpr>");
- printLn(expr.getNumber().toString());
- printLn("</NumberExpr>");
- }
-
- public void visit(LiteralExpr expr) {
- printLn("<LiteralExpr literal=\"" + expr.getLiteral() + "\"/>");
- }
-
- public void visit(VariableReferenceExpr expr) {
- printLn("<VariableReferenceExpr name=\"" + expr.getVariableName() + "\"/>");
- }
-
- public void visit(FunctionCallExpr expr){
- printLn("<FunctionCallExpr prefix=\"" + expr.getPrefix() +
- "\" functionName=\"" + expr.getFunctionName() + "\">");
-
- Iterator iterator = expr.getParameters().iterator();
- tabIndex++;
- printLn("<Args>");
- while (iterator.hasNext()){
- ((Expr)iterator.next()).accept(this);
- }
- printLn("</Args>");
- tabIndex--;
- printLn("</FunctionCallExpr>");
- }
-
- public void visit(NameStep step){
- printLn("<NameStep prefix=\"" + step.getPrefix()+
- "\" localName=\"" + step.getLocalName() + "\">");
- Iterator iter = step.getPredicates().iterator();
- tabIndex++;
- while(iter.hasNext()){
- Predicate predicate = (Predicate)iter.next();
- predicate.accept(this);
- }
- tabIndex--;
- printLn("</NameStep>");
- }
-
- public void visit(ProcessingInstructionNodeStep step){
- printLn("<ProcessingInstructionNodeStep name=\"" + step.getName() +
- "\" axis=\"" + step.getAxis() + ">");
-
- tabIndex++;
- handlePredicates(step.getPredicates());
- tabIndex--;
- printLn("</ProcessingInstructionNodeStep>");
- }
-
- public void visit(AllNodeStep step){
- printLn("<AllNodeStep>");
- tabIndex++;
- handlePredicates(step.getPredicates());
- tabIndex--;
- printLn("</AllNodeStep>");
- }
-
- public void visit(TextNodeStep step){
- printLn("<TextNodeStep>");
- tabIndex++;
- handlePredicates(step.getPredicates());
- tabIndex--;
- printLn("</TextNodeStep>");
- }
-
- public void visit(CommentNodeStep step){
- printLn("<CommentNodeStep>");
- tabIndex++;
- handlePredicates(step.getPredicates());
- tabIndex--;
- printLn("</CommentNodeStep>");
- }
-
- public void visit(Predicate predicate){
- printLn("<Predicate>");
- tabIndex++;
- predicate.getExpr().accept(this);
- tabIndex--;
- printLn("</Predicate>");
- }
-
- //---------------------------------------------------------------
- protected void printLn(String str){
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tabIndex; i++) {
- buffer.append("\t");
- }
- buffer.append(str);
-
- printer.println(buffer.toString());
- }
-
- protected void handlePredicates(List predicates){
- if (predicates != null){
- Iterator iter = predicates.iterator();
- while(iter.hasNext()){
- ((Predicate)iter.next()).accept(this);
- }
- }
- }
-
-}
Added: branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/xom/package.html
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/xom/package.html (rev 0)
+++ branches/libjaxen-java/upstream/current/src/java/main/org/jaxen/xom/package.html 2007-06-06 12:47:20 UTC (rev 3603)
@@ -0,0 +1,16 @@
+<html>
+ <head>
+ <title>
+ org.jaxen.xom.*
+ </title>
+ </head>
+
+ <body>
+ <p>
+ Navigation for <a href="http://www.xom.nu/">XOM</a> trees.
+ Note that XOM includes its own navigator which is likely
+ faster and less buggy than this one, though it doesn't
+ provide access to the full Jaxen API.
+ </p>
+ </body>
+</html>
Added: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/BinaryExprTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/BinaryExprTest.java (rev 0)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/BinaryExprTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -0,0 +1,90 @@
+/*
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/test/BinaryExprTest.java,v 1.2 2007/01/05 18:25:26 elharo Exp $
+ * $Revision: 1.2 $
+ * $Date: 2007/01/05 18:25:26 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2007 bob mcwhirter & James Strachan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the Jaxen Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jaxen Project and was originally
+ * created by bob mcwhirter <bob at werken.com> and
+ * James Strachan <jstrachan at apache.org>. For more information on the
+ * Jaxen Project, please see <http://www.jaxen.org/>.
+ *
+ * $Id: BinaryExprTest.java,v 1.2 2007/01/05 18:25:26 elharo Exp $
+ */
+
+
+
+package org.jaxen.test;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jaxen.JaxenException;
+import org.jaxen.dom.DOMXPath;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>
+ * Test for various kinds of binary expressions.
+ * </p>
+ *
+ * @author Elliotte Rusty Harold
+ * @version 1.1.1
+ *
+ */
+public class BinaryExprTest extends TestCase
+{
+
+ public void testBooleanPrecedence()
+ throws JaxenException, ParserConfigurationException {
+
+ // Note how the parentheses change the precedence and the result
+ DOMXPath xpath1 = new DOMXPath("false() and (false() or true())");
+ Boolean result1 = (Boolean) xpath1.evaluate(null);
+ assertFalse(result1.booleanValue());
+ DOMXPath xpath2 = new DOMXPath("false() and false() or true()");
+ Boolean result2 = (Boolean) xpath2.evaluate(null);
+ assertTrue(result2.booleanValue());
+
+ String expr = xpath1.getRootExpr().getText();
+ DOMXPath xpath3 = new DOMXPath(expr);
+ Boolean result3 = (Boolean) xpath3.evaluate(null);
+ assertEquals(expr, result1, result3);
+ assertFalse(expr, result3.booleanValue());
+
+ }
+
+}
\ No newline at end of file
Modified: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ContextTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ContextTest.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ContextTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -96,6 +96,29 @@
this.nodeSet = null;
}
+ public void testSetNodeSet()
+ {
+ Context original = new Context( this.support );
+ assertEquals(0, original.getNodeSet().size() );
+ original.setNodeSet( this.nodeSet );
+ assertEquals(4, original.getNodeSet().size() );
+ }
+
+ public void testShrinkNodeSet()
+ {
+
+ Context original = new Context( this.support );
+ original.setNodeSet( this.nodeSet );
+ original.setPosition(3);
+ ArrayList list = new ArrayList();
+ list.add("1");
+ list.add("2");
+ list.add("3");
+ original.setNodeSet(list);
+ assertEquals(0, original.getPosition());
+
+ }
+
public void testDuplicate()
{
Context original = new Context( this.support );
@@ -107,6 +130,9 @@
Context dupe = original.duplicate();
+ assertEquals(2, dupe.getPosition());
+ assertEquals(4, dupe.getSize());
+
assertTrue( original != dupe );
List dupeNodeSet = dupe.getNodeSet();
@@ -139,7 +165,8 @@
assertEquals( 2,
original.getPosition() );
- }
+ }
+
public void testXMLPrefixIsAlwaysBound()
throws ParserConfigurationException, SAXException, IOException, JaxenException
Modified: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/CoreTests.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/CoreTests.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/CoreTests.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -58,7 +58,7 @@
* </p>
*
* @author Elliotte Rusty Harold
- * @version 1.1b9
+ * @version 1.1b12
*
*/
public class CoreTests extends TestCase {
@@ -87,6 +87,8 @@
result.addTest(new TestSuite(UnsupportedAxisExceptionTest.class));
result.addTest(new TestSuite(JaxenExceptionTest.class));
result.addTest(new TestSuite(ArithmeticTest.class));
+ result.addTest(new TestSuite(IterableAxisTest.class));
+ result.addTest(new TestSuite(DefaultXPathFactoryTest.class));
return result;
}
Added: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultNamestepTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultNamestepTest.java (rev 0)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultNamestepTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -0,0 +1,113 @@
+/*
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/test/DefaultNamestepTest.java,v 1.1 2007/04/16 15:56:54 elharo Exp $
+ * $Revision: 1.1 $
+ * $Date: 2007/04/16 15:56:54 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2007 Elliotte Rusty Harold
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the Jaxen Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jaxen Project and was originally
+ * created by bob mcwhirter <bob at werken.com> and
+ * James Strachan <jstrachan at apache.org>. For more information on the
+ * Jaxen Project, please see <http://www.jaxen.org/>.
+ *
+ * $Id: DefaultNamestepTest.java,v 1.1 2007/04/16 15:56:54 elharo Exp $
+ */
+
+package org.jaxen.test;
+
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.TestCase;
+
+import org.jaxen.JaxenException;
+import org.jaxen.XPath;
+import org.jaxen.dom.DOMXPath;
+import org.w3c.dom.Document;
+
+/**
+ * @author Elliotte Rusty Harold
+ *
+ */
+public class DefaultNamestepTest extends TestCase {
+
+ private Document doc;
+
+ public void setUp() throws ParserConfigurationException
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ doc = builder.newDocument();
+ }
+
+
+ public DefaultNamestepTest(String name) {
+ super(name);
+ }
+
+
+ public void testIdentitySetUsageInDefaultNameStep()
+ throws JaxenException {
+
+ XPath xpath = new DOMXPath("/a/x/preceding-sibling::x[last()]");
+ org.w3c.dom.Element a = doc.createElementNS("", "a");
+ doc.appendChild(a);
+ org.w3c.dom.Element x1 = doc.createElementNS("", "x");
+ org.w3c.dom.Element x2 = doc.createElementNS("", "x");
+ org.w3c.dom.Element x3 = doc.createElementNS("", "x");
+ org.w3c.dom.Element x4 = doc.createElementNS("", "x");
+ org.w3c.dom.Element x5 = doc.createElementNS("", "x");
+ a.appendChild(x1);
+ a.appendChild(x2);
+ a.appendChild(x3);
+ a.appendChild(x4);
+ a.appendChild(x5);
+ x1.appendChild(doc.createTextNode("1"));
+ x2.appendChild(doc.createTextNode("2"));
+ x3.appendChild(doc.createTextNode("3"));
+ x4.appendChild(doc.createTextNode("4"));
+ x5.appendChild(doc.createTextNode("5"));
+
+ List result = xpath.selectNodes(doc);
+ assertEquals(1, result.size());
+ assertEquals(x1, result.get(0));
+
+ }
+
+}
Modified: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultXPathExprTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultXPathExprTest.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultXPathExprTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -57,7 +57,6 @@
import org.jaxen.JaxenException;
import org.jaxen.dom.DOMXPath;
import org.jaxen.expr.Expr;
-import org.jaxen.expr.PathExpr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -69,7 +68,7 @@
* </p>
*
* @author Elliotte Rusty Harold
- * @version 1.1b11
+ * @version 1.1b12
*
*/
public class DefaultXPathExprTest extends TestCase
Added: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultXPathFactoryTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultXPathFactoryTest.java (rev 0)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/DefaultXPathFactoryTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -0,0 +1,80 @@
+/*
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/test/DefaultXPathFactoryTest.java,v 1.1 2006/11/09 16:11:10 elharo Exp $
+ * $Revision: 1.1 $
+ * $Date: 2006/11/09 16:11:10 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2000-2002 bob mcwhirter & James Strachan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the Jaxen Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jaxen Project and was originally
+ * created by bob mcwhirter <bob at werken.com> and
+ * James Strachan <jstrachan at apache.org>. For more information on the
+ * Jaxen Project, please see <http://www.jaxen.org/>.
+ *
+ * $Id: DefaultXPathFactoryTest.java,v 1.1 2006/11/09 16:11:10 elharo Exp $
+ */
+
+
+
+package org.jaxen.test;
+
+import org.jaxen.JaxenException;
+import org.jaxen.expr.*;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>
+ * Test for function context.
+ * </p>
+ *
+ * @author Elliotte Rusty Harold
+ * @version 1.1b12
+ *
+ */
+public class DefaultXPathFactoryTest extends TestCase {
+
+ public void testBadAxis() throws JaxenException {
+
+ DefaultXPathFactory factory = new DefaultXPathFactory();
+ try {
+ factory.createAllNodeStep(123434);
+ fail("Allowed bad axis");
+ }
+ catch (JaxenException ex) {
+ assertNotNull(ex.getMessage());
+ }
+ }
+
+}
Added: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ExprComparator.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ExprComparator.java (rev 0)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ExprComparator.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -0,0 +1,461 @@
+/*
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/test/ExprComparator.java,v 1.1 2007/01/06 15:48:58 elharo Exp $
+ * $Revision: 1.1 $
+ * $Date: 2007/01/06 15:48:58 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2007 Ryan Gustafson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the Jaxen Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jaxen Project and was originally
+ * created by bob mcwhirter <bob at werken.com> and
+ * James Strachan <jstrachan at apache.org>. For more information on the
+ * Jaxen Project, please see <http://www.jaxen.org/>.
+ *
+ * $Id: ExprComparator.java,v 1.1 2007/01/06 15:48:58 elharo Exp $
+ */
+
+package org.jaxen.test;
+
+import java.util.Comparator;
+import java.util.List;
+
+import org.jaxen.expr.AdditiveExpr;
+import org.jaxen.expr.AllNodeStep;
+import org.jaxen.expr.CommentNodeStep;
+import org.jaxen.expr.EqualityExpr;
+import org.jaxen.expr.FilterExpr;
+import org.jaxen.expr.FunctionCallExpr;
+import org.jaxen.expr.LiteralExpr;
+import org.jaxen.expr.LocationPath;
+import org.jaxen.expr.LogicalExpr;
+import org.jaxen.expr.MultiplicativeExpr;
+import org.jaxen.expr.NameStep;
+import org.jaxen.expr.NumberExpr;
+import org.jaxen.expr.PathExpr;
+import org.jaxen.expr.Predicate;
+import org.jaxen.expr.ProcessingInstructionNodeStep;
+import org.jaxen.expr.RelationalExpr;
+import org.jaxen.expr.TextNodeStep;
+import org.jaxen.expr.UnaryExpr;
+import org.jaxen.expr.UnionExpr;
+import org.jaxen.expr.VariableReferenceExpr;
+
+
+class ExprComparator implements Comparator {
+
+ public static final Comparator EXPR_COMPARATOR = new ExprComparator();
+
+ private static final int TYPE_ADDITIVE_EXPR = 1;
+ private static final int TYPE_ALL_NODE_STEP = 2;
+ private static final int TYPE_COMMENT_NODE_STEP = 3;
+ private static final int TYPE_EQUALITY_EXPR = 4;
+ private static final int TYPE_FILTER_EXPR = 5;
+ private static final int TYPE_FUNCTION_CALL_EXPR = 6;
+ private static final int TYPE_LITERAL_EXPR = 7;
+ private static final int TYPE_LOCATION_PATH = 8;
+ private static final int TYPE_LOGICAL_EXP = 9;
+ private static final int TYPE_MULTIPLICATIVE_EXPR = 10;
+ private static final int TYPE_NAME_STEP = 11;
+ private static final int TYPE_NUMBER_EXPR = 12;
+ private static final int TYPE_PATH_EXPR = 13;
+ private static final int TYPE_PREDICATE = 14;
+ private static final int TYPE_PROCESSING_INSTRUCTION_NODE_STEP = 15;
+ private static final int TYPE_RELATIONAL_EXPR = 16;
+ private static final int TYPE_TEXT_NODE_STEP = 17;
+ private static final int TYPE_UNARY_EXPR = 18;
+ private static final int TYPE_UNION_EXPR = 19;
+ private static final int TYPE_VARIABLE_REFERENCE_EXPR = 20;
+
+ private ExprComparator()
+ {
+ }
+
+ public int compare(Object o1, Object o2)
+ {
+ int type1 = getType(o1);
+ int type2 = getType(o2);
+
+ int cmp;
+ if (type1 == type2)
+ {
+ switch (type1)
+ {
+ case TYPE_ADDITIVE_EXPR:
+ AdditiveExpr additiveExpr1 = (AdditiveExpr)o1;
+ AdditiveExpr additiveExpr2 = (AdditiveExpr)o2;
+ cmp = additiveExpr1.getOperator().compareTo(additiveExpr2.getOperator());
+ if (cmp == 0)
+ {
+ cmp = compare(additiveExpr1.getLHS(), additiveExpr2.getLHS());
+ if (cmp == 0)
+ {
+ cmp = compare(additiveExpr1.getRHS(), additiveExpr2.getRHS());
+ }
+ }
+ break;
+ case TYPE_ALL_NODE_STEP:
+ AllNodeStep allNodeStep1 = (AllNodeStep)o1;
+ AllNodeStep allNodeStep2 = (AllNodeStep)o2;
+ cmp = allNodeStep1.getAxis() - allNodeStep2.getAxis();
+ if (cmp == 0)
+ {
+ cmp = compareLists(allNodeStep1.getPredicates(), allNodeStep2.getPredicates());
+ }
+ break;
+ case TYPE_COMMENT_NODE_STEP:
+ CommentNodeStep commentNodeStep1 = (CommentNodeStep)o1;
+ CommentNodeStep commentNodeStep2 = (CommentNodeStep)o2;
+ cmp = commentNodeStep1.getAxis() - commentNodeStep2.getAxis();
+ if (cmp == 0)
+ {
+ cmp = compareLists(commentNodeStep1.getPredicates(), commentNodeStep2.getPredicates());
+ }
+ break;
+ case TYPE_EQUALITY_EXPR:
+ EqualityExpr equalityExpr1 = (EqualityExpr)o1;
+ EqualityExpr equalityExpr2 = (EqualityExpr)o2;
+ cmp = equalityExpr1.getOperator().compareTo(equalityExpr2.getOperator());
+ if (cmp == 0)
+ {
+ cmp = compare(equalityExpr1.getLHS(), equalityExpr1.getLHS());
+ if (cmp == 0)
+ {
+ cmp = compare(equalityExpr1.getRHS(), equalityExpr1.getRHS());
+ }
+ }
+ break;
+ case TYPE_FILTER_EXPR:
+ if (true)
+ throw new RuntimeException("Not yet implemented!");
+ break;
+ case TYPE_FUNCTION_CALL_EXPR:
+ FunctionCallExpr functionCallExpr1 = (FunctionCallExpr)o1;
+ FunctionCallExpr functionCallExpr2 = (FunctionCallExpr)o2;
+ cmp = compareStrings(functionCallExpr1.getPrefix(), functionCallExpr2.getPrefix());
+ if (cmp == 0)
+ {
+ cmp = functionCallExpr1.getFunctionName().compareTo(functionCallExpr2.getFunctionName());
+ if (cmp == 0)
+ {
+ cmp = compareLists(functionCallExpr1.getParameters(), functionCallExpr2.getParameters());
+ }
+ }
+ break;
+ case TYPE_LITERAL_EXPR:
+ LiteralExpr literalExpr1 = (LiteralExpr)o1;
+ LiteralExpr literalExpr2 = (LiteralExpr)o2;
+ cmp = literalExpr1.getLiteral().compareTo(literalExpr2.getLiteral());
+ break;
+ case TYPE_LOCATION_PATH:
+ LocationPath locationPath1 = (LocationPath)o1;
+ LocationPath locationPath2 = (LocationPath)o2;
+ if (locationPath1.isAbsolute() == locationPath2.isAbsolute())
+ {
+ cmp = compareLists(locationPath1.getSteps(), locationPath2.getSteps());
+ }
+ else if (locationPath1.isAbsolute())
+ {
+ cmp = 1;
+ }
+ else
+ {
+ cmp = -1;
+ }
+ break;
+ case TYPE_LOGICAL_EXP:
+ LogicalExpr logicalExpr1 = (LogicalExpr)o1;
+ LogicalExpr logicalExpr2 = (LogicalExpr)o2;
+ cmp = logicalExpr1.getOperator().compareTo(logicalExpr2.getOperator());
+ if (cmp == 0)
+ {
+ cmp = compare(logicalExpr1.getLHS(), logicalExpr2.getLHS());
+ if (cmp == 0)
+ {
+ cmp = compare(logicalExpr1.getRHS(), logicalExpr2.getRHS());
+ }
+ }
+ break;
+ case TYPE_MULTIPLICATIVE_EXPR:
+ MultiplicativeExpr multiplicativeExpr1 = (MultiplicativeExpr)o1;
+ MultiplicativeExpr multiplicativeExpr2 = (MultiplicativeExpr)o2;
+ cmp = multiplicativeExpr1.getOperator().compareTo(multiplicativeExpr2.getOperator());
+ if (cmp == 0)
+ {
+ cmp = compare(multiplicativeExpr1.getLHS(), multiplicativeExpr2.getLHS());
+ if (cmp == 0)
+ {
+ cmp = compare(multiplicativeExpr1.getRHS(), multiplicativeExpr2.getRHS());
+ }
+ }
+ break;
+ case TYPE_NAME_STEP:
+ NameStep nameStep1 = (NameStep)o1;
+ NameStep nameStep2 = (NameStep)o2;
+ cmp = nameStep1.getAxis() - nameStep2.getAxis();
+ if (cmp == 0)
+ {
+ cmp = compareStrings(nameStep1.getPrefix(), nameStep2.getPrefix());
+
+ if (cmp == 0)
+ {
+ cmp = nameStep1.getLocalName().compareTo(nameStep2.getLocalName());
+ if (cmp == 0)
+ {
+ cmp = compareLists(nameStep1.getPredicates(), nameStep2.getPredicates());
+ }
+ }
+ }
+ break;
+ case TYPE_NUMBER_EXPR:
+ NumberExpr numberExpr1 = (NumberExpr)o1;
+ NumberExpr numberExpr2 = (NumberExpr)o2;
+ cmp = new Double(numberExpr1.getNumber().doubleValue()).compareTo(new Double(numberExpr2.getNumber().doubleValue()));
+ break;
+ case TYPE_PATH_EXPR:
+ PathExpr pathExpr1 = (PathExpr)o1;
+ PathExpr pathExpr2 = (PathExpr)o2;
+ cmp = compare(pathExpr1.getLocationPath(), pathExpr2.getLocationPath());
+ if (cmp == 0)
+ {
+ cmp = compare(pathExpr1.getFilterExpr(), pathExpr2.getFilterExpr());
+ }
+ break;
+ case TYPE_PREDICATE:
+ Predicate predicate1 = (Predicate)o1;
+ Predicate predicate2 = (Predicate)o2;
+ cmp = compare(predicate1.getExpr(), predicate2.getExpr());
+ break;
+ case TYPE_PROCESSING_INSTRUCTION_NODE_STEP:
+ ProcessingInstructionNodeStep processingInstructionNodeStep1 = (ProcessingInstructionNodeStep)o1;
+ ProcessingInstructionNodeStep processingInstructionNodeStep2 = (ProcessingInstructionNodeStep)o2;
+ cmp = processingInstructionNodeStep1.getAxis() - processingInstructionNodeStep2.getAxis();
+ if (cmp == 0)
+ {
+ cmp = compareStrings(processingInstructionNodeStep1.getName(), processingInstructionNodeStep2.getName());
+ if (cmp == 0)
+ {
+ cmp = compareLists(processingInstructionNodeStep1.getPredicates(), processingInstructionNodeStep2.getPredicates());
+ }
+ }
+ break;
+ case TYPE_RELATIONAL_EXPR:
+ RelationalExpr relationalExpr1 = (RelationalExpr)o1;
+ RelationalExpr relationalExpr2 = (RelationalExpr)o2;
+ cmp = relationalExpr1.getOperator().compareTo(relationalExpr2.getOperator());
+ if (cmp == 0)
+ {
+ cmp = compare(relationalExpr1.getLHS(), relationalExpr2.getLHS());
+ if (cmp == 0)
+ {
+ cmp = compare(relationalExpr1.getRHS(), relationalExpr2.getRHS());
+ }
+ }
+ break;
+ case TYPE_TEXT_NODE_STEP:
+ TextNodeStep textNodeStep1 = (TextNodeStep)o1;
+ TextNodeStep textNodeStep2 = (TextNodeStep)o2;
+ cmp = textNodeStep1.getAxis() - textNodeStep2.getAxis();
+ if (cmp == 0)
+ {
+ cmp = compareLists(textNodeStep1.getPredicates(), textNodeStep2.getPredicates());
+ }
+ break;
+ case TYPE_UNARY_EXPR:
+ UnaryExpr unaryExpr1 = (UnaryExpr)o1;
+ UnaryExpr unaryExpr2 = (UnaryExpr)o2;
+ cmp = compare(unaryExpr1.getExpr(), unaryExpr2.getExpr());
+ break;
+ case TYPE_UNION_EXPR:
+ if (true)
+ throw new RuntimeException("Not yet implemented!");
+ break;
+ case TYPE_VARIABLE_REFERENCE_EXPR:
+ VariableReferenceExpr variableReferenceExpr1 = (VariableReferenceExpr)o1;
+ VariableReferenceExpr variableReferenceExpr2 = (VariableReferenceExpr)o2;
+ cmp = compareStrings(variableReferenceExpr1.getPrefix(), variableReferenceExpr2.getPrefix());
+ if (cmp == 0)
+ {
+ cmp = variableReferenceExpr1.getVariableName().compareTo(variableReferenceExpr2.getVariableName());
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("Unhandled type: " + type1);
+ }
+ }
+ else
+ {
+ cmp = type1 - type2;
+ }
+ return cmp;
+ }
+
+ private int compareStrings(String s1, String s2)
+ {
+ int cmp;
+ if (s1 == s2)
+ {
+ cmp = 0;
+ }
+ else if (s1 == null)
+ {
+ cmp = -1;
+ }
+ else if (s2 == null)
+ {
+ cmp = 1;
+ }
+ else
+ {
+ cmp = s1.compareTo(s2);
+ }
+ return cmp;
+ }
+
+ private int compareLists(List list1, List list2)
+ {
+ int cmp;
+ if (list1 == list2)
+ {
+ cmp = 0;
+ }
+ else if (list1 == null)
+ {
+ cmp = -1;
+ }
+ else if (list2 == null)
+ {
+ cmp = 1;
+ }
+ else
+ {
+ cmp = list1.size() - list2.size();
+ if (cmp == 0)
+ {
+ for (int i = 0; i < list1.size() && cmp == 0; i++)
+ {
+ cmp = compare(list1.get(i), list2.get(i));
+ }
+ }
+ }
+ return cmp;
+ }
+
+ private int getType(Object node)
+ {
+ if (node instanceof AdditiveExpr)
+ {
+ return TYPE_ADDITIVE_EXPR;
+ }
+ else if (node instanceof AllNodeStep)
+ {
+ return TYPE_ALL_NODE_STEP;
+ }
+ else if (node instanceof CommentNodeStep)
+ {
+ return TYPE_COMMENT_NODE_STEP;
+ }
+ else if (node instanceof EqualityExpr)
+ {
+ return TYPE_EQUALITY_EXPR;
+ }
+ else if (node instanceof FilterExpr)
+ {
+ return TYPE_FILTER_EXPR;
+ }
+ else if (node instanceof FunctionCallExpr)
+ {
+ return TYPE_FUNCTION_CALL_EXPR;
+ }
+ else if (node instanceof LiteralExpr)
+ {
+ return TYPE_LITERAL_EXPR;
+ }
+ else if (node instanceof LocationPath)
+ {
+ return TYPE_LOCATION_PATH;
+ }
+ else if (node instanceof LogicalExpr)
+ {
+ return TYPE_LOGICAL_EXP;
+ }
+ else if (node instanceof MultiplicativeExpr)
+ {
+ return TYPE_MULTIPLICATIVE_EXPR;
+ }
+ else if (node instanceof NameStep)
+ {
+ return TYPE_NAME_STEP;
+ }
+ else if (node instanceof NumberExpr)
+ {
+ return TYPE_NUMBER_EXPR;
+ }
+ else if (node instanceof PathExpr)
+ {
+ return TYPE_PATH_EXPR;
+ }
+ else if (node instanceof Predicate)
+ {
+ return TYPE_PREDICATE;
+ }
+ else if (node instanceof ProcessingInstructionNodeStep)
+ {
+ return TYPE_PROCESSING_INSTRUCTION_NODE_STEP;
+ }
+ else if (node instanceof RelationalExpr)
+ {
+ return TYPE_RELATIONAL_EXPR;
+ }
+ else if (node instanceof TextNodeStep)
+ {
+ return TYPE_TEXT_NODE_STEP;
+ }
+ else if (node instanceof UnaryExpr)
+ {
+ return TYPE_UNARY_EXPR;
+ }
+ else if (node instanceof UnionExpr)
+ {
+ return TYPE_UNION_EXPR;
+ }
+ else if (node instanceof VariableReferenceExpr)
+ {
+ return TYPE_VARIABLE_REFERENCE_EXPR;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown Jaxen AST node type: " + node);
+ }
+ }
+}
Modified: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ExprTests.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ExprTests.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ExprTests.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -57,7 +57,7 @@
* </p>
*
* @author Elliotte Rusty Harold
- * @version 1.1b9
+ * @version 1.1.1
*
*/
public class ExprTests {
@@ -67,8 +67,12 @@
TestSuite result = new TestSuite();
result.addTest(new TestSuite(DefaultXPathExprTest.class));
+ result.addTest(new TestSuite(DefaultNamestepTest.class));
result.addTest(new TestSuite(ModTest.class));
result.addTest(new TestSuite(EqualsTest.class));
+ result.addTest(new TestSuite(LiteralExprTest.class));
+ result.addTest(new TestSuite(BinaryExprTest.class));
+ result.addTest(new TestSuite(ProcessingInstructionNodeTest.class));
return result;
}
Added: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/IterableAxisTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/IterableAxisTest.java (rev 0)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/IterableAxisTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -0,0 +1,78 @@
+/*
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/test/IterableAxisTest.java,v 1.1 2006/10/11 21:57:12 elharo Exp $
+ * $Revision: 1.1 $
+ * $Date: 2006/10/11 21:57:12 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2006 Elliotte Rusty Harold
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the Jaxen Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jaxen Project and was originally
+ * created by bob mcwhirter <bob at werken.com> and
+ * James Strachan <jstrachan at apache.org>. For more information on the
+ * Jaxen Project, please see <http://www.jaxen.org/>.
+ *
+ * $Id: IterableAxisTest.java,v 1.1 2006/10/11 21:57:12 elharo Exp $
+ */
+
+package org.jaxen.test;
+
+import junit.framework.TestCase;
+
+import org.jaxen.JaxenException;
+import org.jaxen.expr.iter.IterableAxis;
+import org.jaxen.expr.iter.IterableSelfAxis;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Elliotte Rusty Harold
+ * @version 1.1b12
+ *
+ */
+public class IterableAxisTest extends TestCase {
+
+ public void testIterableSelfNamedAxis()
+ throws JaxenException, SAXException {
+
+ IterableAxis axis = new IterableSelfAxis(0);
+ try {
+ axis.namedAccessIterator(null, null, "name", "pre", "http://www.example.org/");
+ fail("should not support operation");
+ }
+ catch (UnsupportedOperationException ex) {
+ assertEquals("Named access unsupported", ex.getMessage());
+ }
+
+ }
+
+}
Added: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/LiteralExprTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/LiteralExprTest.java (rev 0)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/LiteralExprTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -0,0 +1,101 @@
+/*
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/test/LiteralExprTest.java,v 1.2 2007/01/05 18:25:09 elharo Exp $
+ * $Revision: 1.2 $
+ * $Date: 2007/01/05 18:25:09 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2006 bob mcwhirter & James Strachan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the Jaxen Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jaxen Project and was originally
+ * created by bob mcwhirter <bob at werken.com> and
+ * James Strachan <jstrachan at apache.org>. For more information on the
+ * Jaxen Project, please see <http://www.jaxen.org/>.
+ *
+ * $Id: LiteralExprTest.java,v 1.2 2007/01/05 18:25:09 elharo Exp $
+ */
+
+
+
+package org.jaxen.test;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jaxen.BaseXPath;
+import org.jaxen.JaxenException;
+import org.jaxen.dom.DOMXPath;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>
+ * Test for various kinds of literals.
+ * </p>
+ *
+ * @author Elliotte Rusty Harold
+ * @version 1.1.1
+ *
+ */
+public class LiteralExprTest extends TestCase
+{
+
+ public void testStringLiteralContainsDoubleQuote()
+ throws JaxenException, ParserConfigurationException {
+
+ DOMXPath xpath = new DOMXPath("'\"'");
+ String expr = xpath.getRootExpr().getText();
+ assertEquals("'\"'", expr);
+
+ }
+
+ public void testStringLiteralContainsSingleQuote()
+ throws JaxenException, ParserConfigurationException {
+
+ DOMXPath xpath = new DOMXPath("\"'\"");
+ String expr = xpath.getRootExpr().getText();
+ assertEquals("\"'\"", expr);
+
+ }
+
+ public void testJaxen177()
+ throws JaxenException, ParserConfigurationException {
+
+ BaseXPath baseXPath = new BaseXPath("//Name[@Attribute = '\"']", null);
+ BaseXPath baseXPath2 = new BaseXPath(baseXPath.getRootExpr().getText(), null);
+ assertEquals(
+ "/descendant-or-self::node()/child::Name[(attribute::Attribute = '\"')]",
+ baseXPath2.getRootExpr().getText());
+
+ }
+
+}
\ No newline at end of file
Modified: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ModTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ModTest.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ModTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -61,11 +61,11 @@
/**
* <p>
- * Test for function context.
+ * Test for the remainder function.
* </p>
*
* @author Elliotte Rusty Harold
- * @version 1.1b9
+ * @version 1.1.1
*
*/
public class ModTest extends TestCase
Added: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ProcessingInstructionNodeTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ProcessingInstructionNodeTest.java (rev 0)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/ProcessingInstructionNodeTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -0,0 +1,97 @@
+/*
+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/test/ProcessingInstructionNodeTest.java,v 1.2 2007/01/06 15:39:50 elharo Exp $
+ * $Revision: 1.2 $
+ * $Date: 2007/01/06 15:39:50 $
+ *
+ * ====================================================================
+ *
+ * Copyright 2007 Elliotte Rusty Harold
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the Jaxen Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jaxen Project and was originally
+ * created by bob mcwhirter <bob at werken.com> and
+ * James Strachan <jstrachan at apache.org>. For more information on the
+ * Jaxen Project, please see <http://www.jaxen.org/>.
+ *
+ * $Id: ProcessingInstructionNodeTest.java,v 1.2 2007/01/06 15:39:50 elharo Exp $
+ */
+
+
+
+package org.jaxen.test;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jaxen.JaxenException;
+import org.jaxen.dom.DOMXPath;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>
+ * Test for processing instruction node-steps.
+ * </p>
+ *
+ * @author Elliotte Rusty Harold
+ * @version 1.1.1
+ *
+ */
+public class ProcessingInstructionNodeTest extends TestCase {
+
+ public void testGetText()
+ throws JaxenException, ParserConfigurationException {
+
+ DOMXPath xpath = new DOMXPath("processing-instruction()");
+ String expr = xpath.getRootExpr().getText();
+ assertEquals("child::processing-instruction()", expr);
+
+ }
+
+ public void testGetTextWithName()
+ throws JaxenException, ParserConfigurationException {
+
+ DOMXPath xpath = new DOMXPath("processing-instruction('foo')");
+ String expr = xpath.getRootExpr().getText();
+ assertEquals("child::processing-instruction('foo')", expr);
+
+ }
+
+ public void testGetTextWithPredicate()
+ throws JaxenException, ParserConfigurationException {
+
+ DOMXPath xpath = new DOMXPath("processing-instruction('foo')[1 = 1]");
+ String expr = xpath.getRootExpr().getText();
+ assertEquals("child::processing-instruction('foo')[(1.0 = 1.0)]", expr);
+
+ }
+
+}
\ No newline at end of file
Modified: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/SimpleVariableContextTest.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/SimpleVariableContextTest.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/SimpleVariableContextTest.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -69,7 +69,7 @@
* </p>
*
* @author Elliotte Rusty Harold
- * @version 1.1b10
+ * @version 1.1b12
*
*/
public class SimpleVariableContextTest extends TestCase
@@ -99,7 +99,7 @@
// test the result
assertEquals("String Value", copy.getVariableValue("", "", "s"));
- assertEquals(Double.valueOf(3.1415292), copy.getVariableValue("", "", "x"));
+ assertEquals(new Double(3.1415292), copy.getVariableValue("", "", "x"));
assertEquals(Boolean.TRUE, copy.getVariableValue("", "", "b"));
assertEquals("", "");
@@ -116,7 +116,7 @@
// test the result
assertEquals("String Value", context.getVariableValue("", "", "s"));
- assertEquals(Double.valueOf(3.1415292), context.getVariableValue("", "", "x"));
+ assertEquals(new Double(3.1415292), context.getVariableValue("", "", "x"));
assertEquals(Boolean.TRUE, context.getVariableValue("", "", "b"));
assertEquals("", "");
Modified: branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/XPathTestBase.java
===================================================================
--- branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/XPathTestBase.java 2007-06-06 12:37:24 UTC (rev 3602)
+++ branches/libjaxen-java/upstream/current/src/java/test/org/jaxen/test/XPathTestBase.java 2007-06-06 12:47:20 UTC (rev 3603)
@@ -125,6 +125,7 @@
assertEquals(xpathStr,
expectedSize,
results.size());
+ assertExprGetTextIdempotent(xpath);
if (expectedSize > 0)
{
return results.get(0);
@@ -172,8 +173,15 @@
assertEquals(xpathStr,
expected,
result);
+ assertExprGetTextIdempotent(xpath);
}
+ private void assertExprGetTextIdempotent(BaseXPath xpath) throws JaxenException
+ {
+ assertEquals(0, ExprComparator.EXPR_COMPARATOR.compare(xpath.getRootExpr(),
+ new BaseXPath(xpath.getRootExpr().getText(), null).getRootExpr()));
+ }
+
private Context getContext(Object contextNode)
{
Context context = new Context(getContextSupport());
More information about the pkg-java-commits
mailing list