commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmi...@apache.org
Subject cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom JDOMNodePointer.java
Date Thu, 25 Mar 2004 05:41:29 GMT
dmitri      2004/03/24 21:41:29

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri/model/dom
                        DOMNodePointer.java
               jxpath/src/java/org/apache/commons/jxpath/ri/compiler
                        NodeNameTest.java Path.java
               jxpath/src/java/org/apache/commons/jxpath/ri/model
                        NodePointer.java
               jxpath/src/java/org/apache/commons/jxpath/ri/model/beans
                        PropertyOwnerPointer.java
               jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom
                        JDOMNodePointer.java
  Log:
  Introduced NodeNameTest.isWildcard()
  
  Revision  Changes    Path
  1.22      +6 -5      jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
  
  Index: DOMNodePointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DOMNodePointer.java	29 Feb 2004 14:17:44 -0000	1.21
  +++ DOMNodePointer.java	25 Mar 2004 05:41:29 -0000	1.22
  @@ -90,16 +90,17 @@
                   return false;
               }
   
  -            QName testName = ((NodeNameTest) test).getNodeName();
  -            String testLocalName = testName.getName();
  -            boolean wildcard = testLocalName.equals("*");
  +            NodeNameTest nodeNameTest = (NodeNameTest) test;
  +            QName testName = nodeNameTest.getNodeName();
  +            boolean wildcard = nodeNameTest.isWildcard();
               String testPrefix = testName.getPrefix();
               if (wildcard && testPrefix == null) {
                   return true;
               }
   
               if (wildcard
  -                || testLocalName.equals(DOMNodePointer.getLocalName(node))) {
  +                || testName.getName()
  +                        .equals(DOMNodePointer.getLocalName(node))) {
                   String nodePrefix = DOMNodePointer.getPrefix(node);
                   if (equalStrings(testPrefix, nodePrefix)) {
                       return true;
  
  
  
  1.10      +5 -1      jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/compiler/NodeNameTest.java
  
  Index: NodeNameTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/compiler/NodeNameTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NodeNameTest.java	29 Feb 2004 14:17:38 -0000	1.9
  +++ NodeNameTest.java	25 Mar 2004 05:41:29 -0000	1.10
  @@ -31,6 +31,10 @@
       public QName getNodeName() {
           return qname;
       }
  +    
  +    public boolean isWildcard() {
  +        return qname.getName().equals("*");
  +    }
   
       public String toString() {
           return qname.toString();
  
  
  
  1.13      +2 -3      jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/compiler/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/compiler/Path.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Path.java	29 Feb 2004 14:17:39 -0000	1.12
  +++ Path.java	25 Mar 2004 05:41:29 -0000	1.13
  @@ -105,8 +105,7 @@
                   return false;
               }
               
  -            String name = ((NodeNameTest) nodeTest).getNodeName().getName();
  -            if (name.equals("*")) {
  +            if (((NodeNameTest) nodeTest).isWildcard()) {
                   return false;
               }
               return areBasicPredicates(step.getPredicates());
  
  
  
  1.24      +5 -5      jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java
  
  Index: NodePointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/NodePointer.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- NodePointer.java	25 Mar 2004 03:49:50 -0000	1.23
  +++ NodePointer.java	25 Mar 2004 05:41:29 -0000	1.24
  @@ -332,7 +332,8 @@
               if (isContainer()) {
                   return false;
               }
  -            QName testName = ((NodeNameTest) test).getNodeName();
  +            NodeNameTest nodeNameTest = (NodeNameTest) test;
  +            QName testName = nodeNameTest.getNodeName();
               QName nodeName = getName();
               if (nodeName == null) {
                   return false;
  @@ -347,11 +348,10 @@
                       return false;
                   }
               }
  -            String testLocalName = testName.getName();
  -            if (testLocalName.equals("*")) {
  +            if (nodeNameTest.isWildcard()) {
                   return true;
               }
  -            return testLocalName.equals(nodeName.getName());
  +            return testName.getName().equals(nodeName.getName());
           }
           else if (test instanceof NodeTypeTest) {
               if (((NodeTypeTest) test).getNodeType()
  
  
  
  1.18      +4 -3      jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
  
  Index: PropertyOwnerPointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- PropertyOwnerPointer.java	29 Feb 2004 14:17:41 -0000	1.17
  +++ PropertyOwnerPointer.java	25 Mar 2004 05:41:29 -0000	1.18
  @@ -45,12 +45,13 @@
               return createNodeIterator(null, reverse, startWith);
           }
           else if (test instanceof NodeNameTest) {
  -            QName testName = ((NodeNameTest) test).getNodeName();
  +            NodeNameTest nodeNameTest = (NodeNameTest) test;
  +            QName testName = nodeNameTest.getNodeName();
               String property;
               if (!isDefaultNamespace(testName.getPrefix())) {
                   return null;
               }
  -            else if (testName.getName().equals("*")) {
  +            else if (nodeNameTest.isWildcard()) {
                   property = null;
               }
               else {
  
  
  
  1.15      +5 -5      jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
  
  Index: JDOMNodePointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- JDOMNodePointer.java	4 Mar 2004 01:01:27 -0000	1.14
  +++ JDOMNodePointer.java	25 Mar 2004 05:41:29 -0000	1.15
  @@ -351,15 +351,15 @@
                   return false;
               }
   
  -            QName testName = ((NodeNameTest) test).getNodeName();
  -            String testLocalName = testName.getName();
  -            boolean wildcard = testLocalName.equals("*");
  +            NodeNameTest nodeNameTest = (NodeNameTest) test;
  +            QName testName = nodeNameTest.getNodeName();
  +            boolean wildcard = nodeNameTest.isWildcard();
               if (wildcard && testName.getPrefix() == null) {
                   return true;
               }
   
               if (wildcard
  -                || testLocalName.equals(
  +                || testName.getName().equals(
                       JDOMNodePointer.getLocalName((Element) node))) {
                   String testPrefix = testName.getPrefix();
                   String nodePrefix = JDOMNodePointer.getPrefix((Element) node);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message