JADE_SL
Class CaseInsensitiveString

java.lang.Object
  extended byJADE_SL.CaseInsensitiveString

public class CaseInsensitiveString
extends java.lang.Object

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: 2003/10/09 13:00:35 $ $Revision: 1.1.1.1 $ Updated 1/06/2001 12:50 by Dmitri Toropov - Siemens AG
Author:
Giovanni Rimassa - Universita` di Parma

Field Summary
(package private)  java.lang.String s
           
 
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
 

Field Detail

s

java.lang.String s
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.

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.

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.

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.

Returns:
true if the strings are equal, apart from case.


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.