You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/01/07 04:39:20 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/serialize CharInfo.java

sboag       01/01/06 19:39:20

  Modified:    java/src/org/apache/xalan/serialize CharInfo.java
  Log:
  Use the new CharKey class so that chars can be looked up without
  creating a Character object for each lookup.  This showed up fairly
  high on the JProbe profiler.
  
  Revision  Changes    Path
  1.4       +7 -2      xml-xalan/java/src/org/apache/xalan/serialize/CharInfo.java
  
  Index: CharInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/serialize/CharInfo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CharInfo.java	2000/12/09 22:25:27	1.3
  +++ CharInfo.java	2001/01/07 03:39:19	1.4
  @@ -66,6 +66,8 @@
   
   import java.util.Hashtable;
   
  +import org.apache.xml.utils.CharKey;
  +
   /**
    * This class provides services that tell if a character should have
    * special treatement, such as entity reference substitution or normalization
  @@ -208,11 +210,13 @@
     protected void defineEntity(String name, char value)
     {
   
  -    Character character = new Character(value);
  +    CharKey character = new CharKey(value);
   
       m_charToEntityRef.put(character, name);
       m_specialsMap.set(value);
     }
  +  
  +  private CharKey m_charKey = new CharKey();
   
     /**
      * Resolve a character to an entity reference name.
  @@ -223,7 +227,8 @@
      */
     public String getEntityNameForChar(char value)
     {
  -    return (String) m_charToEntityRef.get(new Character(value));
  +    m_charKey.setChar(value);
  +    return (String) m_charToEntityRef.get(m_charKey);
     }
   
     /**