(Object keyObj)
| 3883 | } |
| 3884 | |
| 3885 | @SuppressWarnings("unchecked") |
| 3886 | Entry<K, V> find(Object keyObj) { |
| 3887 | java.lang.Comparable<K> object = comparator == null ? toComparable((K) keyObj) |
| 3888 | : null; |
| 3889 | K keyK = (K) keyObj; |
| 3890 | Node<K, V> node = root; |
| 3891 | while (node != null) { |
| 3892 | K[] keys = node.keys; |
| 3893 | int left_idx = node.left_idx; |
| 3894 | int result = cmp(object, keyK, keys[left_idx]); |
| 3895 | if (result < 0) { |
| 3896 | node = node.left; |
| 3897 | } else if (result == 0) { |
| 3898 | return createEntry(node,left_idx); |
| 3899 | } else { |
| 3900 | int right_idx = node.right_idx; |
| 3901 | if (left_idx != right_idx) { |
| 3902 | result = cmp(object, keyK, keys[right_idx]); |
| 3903 | } |
| 3904 | if (result > 0) { |
| 3905 | node = node.right; |
| 3906 | } else if (result == 0) { |
| 3907 | return createEntry(node,right_idx); |
| 3908 | } else { /* search in node */ |
| 3909 | int low = left_idx + 1, mid = 0, high = right_idx - 1; |
| 3910 | while (low <= high) { |
| 3911 | mid = (low + high) >> 1; |
| 3912 | result = cmp(object, keyK, keys[mid]); |
| 3913 | if (result > 0) { |
| 3914 | low = mid + 1; |
| 3915 | } else if (result == 0) { |
| 3916 | return createEntry(node,mid); |
| 3917 | } else { |
| 3918 | high = mid - 1; |
| 3919 | } |
| 3920 | } |
| 3921 | return null; |
| 3922 | } |
| 3923 | } |
| 3924 | } |
| 3925 | return null; |
| 3926 | } |
| 3927 | |
| 3928 | Entry<K, V> createEntry(Node<K,V> node, int index) { |
| 3929 | TreeMap.Entry<K, V> entry = new TreeMap.Entry<K, V>(node.keys[index], node.values[index]); |
nothing calls this directly
no test coverage detected