You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2007/08/27 15:31:36 UTC

svn commit: r570109 - in /xalan/java/trunk/src/org/apache/xml/utils: XMLString.java XMLStringDefault.java

Author: zongaro
Date: Mon Aug 27 06:31:35 2007
New Revision: 570109

URL: http://svn.apache.org/viewvc?rev=570109&view=rev
Log:
Added an equals(String) method to the XMLString interface.  This allows the
caller to compare an XMLString to a Java String without forcing the XMLString
to be converted to a String.

Part of patch for XALANJ-1243.  Reviewed by Brian Minchau (minchau@ca.ibm.com).

Modified:
    xalan/java/trunk/src/org/apache/xml/utils/XMLString.java
    xalan/java/trunk/src/org/apache/xml/utils/XMLStringDefault.java

Modified: xalan/java/trunk/src/org/apache/xml/utils/XMLString.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/utils/XMLString.java?rev=570109&r1=570108&r2=570109&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/utils/XMLString.java (original)
+++ xalan/java/trunk/src/org/apache/xml/utils/XMLString.java Mon Aug 27 06:31:35 2007
@@ -125,7 +125,7 @@
   /**
    * Compares this string to the specified object.
    * The result is <code>true</code> if and only if the argument is not
-   * <code>null</code> and is a <code>String</code> object that represents
+   * <code>null</code> and is an <code>XMLString</code> object that represents
    * the same sequence of characters as this object.
    *
    * @param   anObject   the object to compare this <code>String</code>
@@ -137,6 +137,20 @@
    */
   public abstract boolean equals(XMLString anObject);
 
+  /**
+   * Compares this string to the specified <code>String</code>.
+   * The result is <code>true</code> if and only if the argument is not
+   * <code>null</code> and is a <code>String</code> object that represents
+   * the same sequence of characters as this object.
+   *
+   * @param   anotherString   the object to compare this <code>String</code>
+   *                          against.
+   * @return  <code>true</code> if the <code>String</code>s are equal;
+   *          <code>false</code> otherwise.
+   * @see     java.lang.String#compareTo(java.lang.String)
+   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
+   */
+  public abstract boolean equals(String anotherString);
 
   /**
    * Compares this string to the specified object.

Modified: xalan/java/trunk/src/org/apache/xml/utils/XMLStringDefault.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/utils/XMLStringDefault.java?rev=570109&r1=570108&r2=570109&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/utils/XMLStringDefault.java (original)
+++ xalan/java/trunk/src/org/apache/xml/utils/XMLStringDefault.java Mon Aug 27 06:31:35 2007
@@ -149,7 +149,23 @@
       dst[destIndex++] = m_str.charAt(i);
     }
   }
-                                
+
+  /**
+   * Compares this string to the specified <code>String</code>.
+   * The result is <code>true</code> if and only if the argument is not
+   * <code>null</code> and is a <code>String</code> object that represents
+   * the same sequence of characters as this object.
+   *
+   * @param   obj2   the object to compare this <code>String</code> against.
+   * @return  <code>true</code> if the <code>String</code>s are equal;
+   *          <code>false</code> otherwise.
+   * @see     java.lang.String#compareTo(java.lang.String)
+   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
+   */
+  public boolean equals(String obj2) {
+      return m_str.equals(obj2);
+  }
+
   /**
    * Compares this string to the specified object.
    * The result is <code>true</code> if and only if the argument is not



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org