Package jade.core

Class CaseInsensitiveString

  • All Implemented Interfaces:
    Serializable, Serializable

    public class CaseInsensitiveString
    extends 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$ $Revision$ Updated 1/06/2001 12:50 by Dmitri Toropov - Siemens AG
    Author:
    Giovanni Rimassa - Universita' di Parma
    See Also:
    Serialized Form
    • Constructor Detail

      • CaseInsensitiveString

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

      • toString

        public final String toString()
        Converts the CaseInsensitiveString object into a string.
        Overrides:
        toString in class Object
        Returns:
        The string stored inside by the constructor.
      • equals

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

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

        public static final boolean equalsIgnoreCase​(String s1,
                                                     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.