jade.core
Class CaseInsensitiveString

java.lang.Object
  |
  +--jade.core.CaseInsensitiveString

public class CaseInsensitiveString
extends java.lang.Object
implements Serializable

A name string, with case insensitive comparison and equality operations. This class holds a String inside, preserving the case; however, all the equality and comparision operations are performed in a case insensitive fashion.

Version:
$Date: 2001/08/14 10:07:59 $ $Revision: 1.4 $ Updated 1/06/2001 12:50 by Dmitri Toropov - Siemens AG
Author:
Giovanni Rimassa - Universita` di Parma
See Also:
Serialized Form

Constructor Summary
CaseInsensitiveString(java.lang.String name)
          Create a new Name object.
 
Method Summary
 boolean equals(java.lang.Object o)
          Equality operation.
static boolean equalsIgnoreCase(java.lang.String s1, java.lang.String s2)
          Static method for case insensitive string comparasion.
 int hashCode()
          Hash code.
 java.lang.String toString()
          Converts the Name object into a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaseInsensitiveString

public CaseInsensitiveString(java.lang.String name)
Create a new Name object.
Parameters:
name - The string that will be kept inside this object.
Method Detail

toString

public java.lang.String toString()
Converts the Name object into a string.
Overrides:
toString in class java.lang.Object
Returns:
The string stored inside by the constructor.

equals

public boolean equals(java.lang.Object o)
Equality operation. This method compares a Name object with another or with a Java String. The comparison is case insensitive.
Overrides:
equals in class java.lang.Object
Parameters:
o - The Java object to compare this Name to.
Returns:
true if the strings contained within the two objects are equal, apart from case.

hashCode

public int hashCode()
Hash code. This method returns an hash code in such a way that two Name objects differing only in case have the same hash code.
Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this Name object.

equalsIgnoreCase

public static boolean equalsIgnoreCase(java.lang.String s1,
                                       java.lang.String s2)
Static method for case insensitive string comparasion. For comparasion used the regionMatches approach which doesn't allocate any additional memory.
Parameters:
s1, - s2 The String objects to compare
Returns:
true if the strings are equal, apart from case.