Javolution 6.0.0 java
javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl Class Reference
Inheritance diagram for javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl:
[legend]
Collaboration diagram for javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl:
[legend]

Public Member Functions

int hashCodeOf (CharSequence csq)
 
boolean areEqual (CharSequence csq1, CharSequence csq2)
 
int compare (CharSequence left, CharSequence right)
 
int hashCodeOf (T object)
 
boolean areEqual (T left, T right)
 
int compare (T left, T right)
 

Static Private Member Functions

static char up (char c)
 

Static Private Attributes

static final long serialVersionUID = -1046672327934410697L
 

Detailed Description

The case insensitive lexical comparator implementation.

Definition at line 18 of file LexicalCaseInsensitiveComparatorImpl.java.

Member Function Documentation

◆ areEqual() [1/2]

boolean javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.areEqual ( CharSequence  csq1,
CharSequence  csq2 
)

Definition at line 35 of file LexicalCaseInsensitiveComparatorImpl.java.

35  {
36  if (csq1 == csq2)
37  return true;
38  if ((csq1 == null) || (csq2 == null))
39  return false;
40  if ((csq1 instanceof String) && (csq2 instanceof String)) // Optimization.
41  return ((String) csq1).equalsIgnoreCase((String) csq2);
42  int n = csq1.length();
43  if (csq2.length() != n)
44  return false;
45  for (int i = 0; i < n;) {
46  if (up(csq1.charAt(i)) != up(csq2.charAt(i++)))
47  return false;
48  }
49  return true;
50  }

References javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.up().

Here is the call graph for this function:

◆ areEqual() [2/2]

boolean javolution.util.function.Equality< T >.areEqual ( left,
right 
)
inherited

Indicates if the specified objects can be considered equal. This methods is equivalent to

(compare(o1, o2) == 0)

but usually faster.

Parameters
leftthe first object (or null).
rightthe second object (or null).
Returns
true if both objects are considered equal; false otherwise.

Referenced by javolution.util.internal.map.MapView< K, V >.EntryComparator.areEqual(), javolution.util.internal.collection.CollectionView< R >.contains(), javolution.util.internal.collection.CollectionView< R >.equals(), javolution.util.internal.table.TableView< E >.indexOf(), javolution.util.internal.table.TableView< E >.lastIndexOf(), javolution.util.internal.map.FastMapImpl< K, V >.remove(), javolution.util.internal.collection.CollectionView< R >.remove(), and javolution.util.internal.map.FastMapImpl< K, V >.replace().

Here is the caller graph for this function:

◆ compare() [1/2]

int javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.compare ( CharSequence  left,
CharSequence  right 
)

Definition at line 53 of file LexicalCaseInsensitiveComparatorImpl.java.

53  {
54  if (left == null)
55  return -1;
56  if (right == null)
57  return 1;
58  if ((left instanceof String) && (right instanceof String)) // Optimization.
59  return ((String) left).compareToIgnoreCase((String) right);
60  int i = 0;
61  int n = Math.min(left.length(), right.length());
62  while (n-- != 0) {
63  char c1 = up(left.charAt(i));
64  char c2 = up(right.charAt(i++));
65  if (c1 != c2)
66  return c1 - c2;
67  }
68  return left.length() - right.length();
69  }

References javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.up().

Here is the call graph for this function:

◆ compare() [2/2]

int javolution.util.function.Equality< T >.compare ( left,
right 
)
inherited

Compares the specified objects for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, possibly equal to, or greater than the second. Implementation classes should ensure that comparisons with

null

is supported.

Parameters
leftthe first object.
rightthe second object.
Returns
a negative integer, zero, or a positive integer as the first argument is less than, possibly equal to, or greater than the second.

Referenced by javolution.util.internal.set.sorted.SubSortedSetImpl< E >.add(), javolution.util.internal.map.MapView< K, V >.EntryComparator.compare(), javolution.text.CharArray.compareTo(), javolution.text.Text.compareTo(), javolution.util.internal.set.sorted.SubSortedSetImpl< E >.contains(), javolution.util.internal.map.sorted.SubSortedMapImpl< K, V >.containsKey(), javolution.util.internal.map.sorted.SubSortedMapImpl< K, V >.get(), javolution.util.internal.set.sorted.SubSortedSetImpl< E >.IteratorImpl.hasNext(), javolution.util.internal.map.sorted.SubSortedMapImpl< K, V >.IteratorImpl.hasNext(), javolution.util.internal.map.sorted.SubSortedMapImpl< K, V >.put(), javolution.util.internal.set.sorted.SubSortedSetImpl< E >.remove(), and javolution.util.internal.map.sorted.SubSortedMapImpl< K, V >.remove().

Here is the caller graph for this function:

◆ hashCodeOf() [1/2]

int javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.hashCodeOf ( CharSequence  csq)

Definition at line 24 of file LexicalCaseInsensitiveComparatorImpl.java.

24  {
25  if (csq == null)
26  return 0;
27  int h = 0;
28  for (int i = 0, n = csq.length(); i < n;) {
29  h = 31 * h + up(csq.charAt(i++));
30  }
31  return h;
32  }

References javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.up().

Here is the call graph for this function:

◆ hashCodeOf() [2/2]

int javolution.util.function.Equality< T >.hashCodeOf ( object)
inherited

Returns the hash code for the specified object (consistent with areEqual). Two objects considered equal have the same hash code. The hash code of null is always 0.

Parameters
objectthe object to return the hashcode for.
Returns
the hashcode for the specified object.

Referenced by javolution.util.internal.map.FastMapImpl< K, V >.containsKey(), javolution.util.internal.map.FastMapImpl< K, V >.get(), javolution.util.internal.collection.CollectionView< R >.hashCode(), javolution.util.internal.map.MapView< K, V >.EntryComparator.hashCodeOf(), javolution.util.internal.map.FastMapImpl< K, V >.put(), javolution.util.internal.map.FastMapImpl< K, V >.putIfAbsent(), javolution.util.internal.map.FastMapImpl< K, V >.remove(), and javolution.util.internal.map.FastMapImpl< K, V >.replace().

Here is the caller graph for this function:

◆ up()

static char javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.up ( char  c)
staticprivate

Definition at line 72 of file LexicalCaseInsensitiveComparatorImpl.java.

72  {
73  return Character.toUpperCase(c);
74  }

Referenced by javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.areEqual(), javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.compare(), and javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.hashCodeOf().

Here is the caller graph for this function:

Member Data Documentation

◆ serialVersionUID

final long javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.serialVersionUID = -1046672327934410697L
staticprivate

Definition at line 21 of file LexicalCaseInsensitiveComparatorImpl.java.


The documentation for this class was generated from the following file:
javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.up
static char up(char c)
Definition: LexicalCaseInsensitiveComparatorImpl.java:72
javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl.compare
int compare(CharSequence left, CharSequence right)
Definition: LexicalCaseInsensitiveComparatorImpl.java:53