publicintcompare(final I obj1, final I obj2) { finalOvalue1=this.transformer.transform(obj1); finalOvalue2=this.transformer.transform(obj2); returnthis.decorated.compare(value1, value2); }
此前传入的c即为obj1
向前执行到InvokerTransformer.transform()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
public O transform(final Object input) { if (input == null) { returnnull; } try { final Class<?> cls = input.getClass(); finalMethodmethod= cls.getMethod(iMethodName, iParamTypes); return (O) method.invoke(input, iArgs); } catch (final NoSuchMethodException ex) { thrownewFunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' does not exist"); } catch (final IllegalAccessException ex) { thrownewFunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' cannot be accessed"); } catch (final InvocationTargetException ex) { thrownewFunctorException("InvokerTransformer: The method '" + iMethodName + "' on '" + input.getClass() + "' threw an exception", ex); } }
publicbooleanoffer(E e) { if (e == null) thrownewNullPointerException(); modCount++; inti= size; if (i >= queue.length) grow(i + 1); size = i + 1; if (i == 0) queue[0] = e; else siftUp(i, e); returntrue; }
privatevoidsiftUp(int k, E x) { if (comparator != null) siftUpUsingComparator(k, x); else siftUpComparable(k, x); }
privatevoidsiftUpUsingComparator(int k, E x) { while (k > 0) { intparent= (k - 1) >>> 1; Objecte= queue[parent]; if (comparator.compare(x, (E) e) >= 0) break; queue[k] = e; k = parent; } queue[k] = x; }