@Override public void addElement(LookupElement t, ProcessingContext context) { Comparable weight = myWeigher.weigh(t, context.get(CompletionLookupArranger.WEIGHING_CONTEXT)); if (weight instanceof ForceableComparable) { ((ForceableComparable)weight).force(); } if (!myWeigher.isPrefixDependent() && myPrimitive) { if (myFirstWeight == null) { myFirstWeight = Ref.create(weight); } else if (!Comparing.equal(myFirstWeight.get(), weight)) { myPrimitive = false; } } myWeights.put(t, weight); super.addElement(t, context); }
@Override public void addElement(LookupElement t) { Comparable weight = myWeigher.weigh(t); if (weight instanceof ForceableComparable) { ((ForceableComparable)weight).force(); } if (!myWeigher.isPrefixDependent() && myPrimitive) { if (myFirstWeight == null) { myFirstWeight = Ref.create(weight); } else if (!Comparing.equal(myFirstWeight.get(), weight)) { myPrimitive = false; } } myWeights.put(t, weight); super.addElement(t); }
@Override public void addElement(@Nonnull LookupElement t, @Nonnull ProcessingContext context) { Comparable weight = myWeigher.weigh(t, context.get(CompletionLookupArranger.WEIGHING_CONTEXT)); if (weight instanceof ForceableComparable) { ((ForceableComparable)weight).force(); } if (!myWeigher.isPrefixDependent() && myPrimitive) { if (myFirstWeight == null) { myFirstWeight = Ref.create(weight); } else if (!Comparing.equal(myFirstWeight.get(), weight)) { myPrimitive = false; } } myWeights.put(t, weight); super.addElement(t, context); }
@Override public void force() { if (myWeigh instanceof ForceableComparable) { ((ForceableComparable)myWeigh).force(); } }