axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/description FieldDesc.java TypeDesc.java
Date Tue, 20 Aug 2002 01:29:22 GMT
rubys       2002/08/19 18:29:22

  Modified:    java/src/org/apache/axis/description FieldDesc.java
                        TypeDesc.java
  Log:
  Linear scans can be expensive...
  
  Revision  Changes    Path
  1.5       +11 -0     xml-axis/java/src/org/apache/axis/description/FieldDesc.java
  
  Index: FieldDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/FieldDesc.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FieldDesc.java	11 Jun 2002 14:53:54 -0000	1.4
  +++ FieldDesc.java	20 Aug 2002 01:29:22 -0000	1.5
  @@ -73,6 +73,9 @@
       /** The Java type of this field */
       private Class javaType;
   
  +    /*** The hash code of the localPart of the xmlName */
  +    private int xmlLocalHash = 0;
  +
       /** An indication of whether this should be an element or an attribute */
       // Q : should this be a boolean, or just "instanceof ElementDesc", etc.
       private boolean _isElement = true;
  @@ -111,10 +114,18 @@
       }
   
       /**
  +     * Obtain the hash of the local part of the XML QName for this field
  +     */
  +    public int getXmlLocalHash() {
  +        return xmlLocalHash;
  +    }
  +
  +    /**
        * Set the XML QName for this field
        */
       public void setXmlName(QName xmlName) {
           this.xmlName = xmlName;
  +        xmlLocalHash = xmlName.getLocalPart().hashCode();
       }
   
       public Class getJavaType() {
  
  
  
  1.19      +5 -2      xml-axis/java/src/org/apache/axis/description/TypeDesc.java
  
  Index: TypeDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/TypeDesc.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TypeDesc.java	16 Aug 2002 11:07:09 -0000	1.18
  +++ TypeDesc.java	20 Aug 2002 01:29:22 -0000	1.19
  @@ -280,11 +280,14 @@
           if (fields == null)
               return null;
   
  +        String localPart = qname.getLocalPart();
  +        int    localHash = localPart.hashCode();
  +
           for (int i = 0; i < fields.length; i++) {
               FieldDesc field = fields[i];
  -            if (field.isElement()) {
  +            if (field.isElement() && localHash == field.getXmlLocalHash()) {
                   QName xmlName = field.getXmlName();
  -                if (qname.getLocalPart().equals(xmlName.getLocalPart())) {
  +                if (localPart.equals(xmlName.getLocalPart())) {
                       if (ignoreNS || qname.getNamespaceURI().
                                           equals(xmlName.getNamespaceURI())) {
                           return field.getFieldName();
  
  
  

Mime
View raw message