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/beans CollectionPointer.java
Date Sat, 10 Aug 2002 01:46:19 GMT
dmitri      2002/08/09 18:46:19

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri/model/beans
                        CollectionPointer.java
  Log:
  Fixed a problem where the case of index specified was not distinguished from the case of
index unspecified
  
  Revision  Changes    Path
  1.5       +29 -6     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionPointer.java
  
  Index: CollectionPointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/CollectionPointer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CollectionPointer.java	8 May 2002 23:05:05 -0000	1.4
  +++ CollectionPointer.java	10 Aug 2002 01:46:19 -0000	1.5
  @@ -98,6 +98,10 @@
           return collection;
       }
   
  +    public boolean isNode(){
  +        return index == WHOLE_COLLECTION;
  +    }
  +
       public Object getNodeValue(){
           if (index != WHOLE_COLLECTION){
               return ValueUtils.getValue(collection, index);
  @@ -114,10 +118,20 @@
           }
       }
   
  +    public void setIndex(int index){
  +        super.setIndex(index);
  +        valuePointer = null;
  +    }
  +
       public NodePointer getValuePointer(){
           if (valuePointer == null){
  -            Object value = getNodeValue();
  -            valuePointer = NodePointer.newChildNodePointer(this, getName(), value);
  +            if (index == WHOLE_COLLECTION){
  +                valuePointer = this;
  +            }
  +            else {
  +                Object value = getNodeValue();
  +                valuePointer = NodePointer.newChildNodePointer(this, getName(), value);
  +            }
           }
           return valuePointer;
       }
  @@ -190,14 +204,23 @@
       }
   
       public NodeIterator attributeIterator(QName name){
  +        if (index == WHOLE_COLLECTION){
  +            return null;
  +        }
           return getValuePointer().attributeIterator(name);
       }
   
       public NodeIterator namespaceIterator(){
  +        if (index == WHOLE_COLLECTION){
  +            return null;
  +        }
           return getValuePointer().namespaceIterator();
       }
   
       public NodePointer namespacePointer(String namespace){
  +        if (index == WHOLE_COLLECTION){
  +            return null;
  +        }
           return getValuePointer().namespacePointer(namespace);
       }
   
  
  
  

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


Mime
View raw message