private void calculateExactPositions() {
    while (!workqueue.isEmpty()) {
      Key<?> key = workqueue.iterator().next();
      workqueue.remove(key);
      
      Set<GinjectorBindings> injectors = getSourceGinjectors(key);
      injectors.add(positions.get(key));
      GinjectorBindings newPosition = lowest(injectors);
      
      GinjectorBindings oldPosition = positions.put(key, newPosition);
      if (oldPosition != newPosition) {
        PrettyPrinter.log(logger, TreeLogger.DEBUG,
            "Moved the highest visible position of %s from %s to %s, the lowest injector of %s.",
            key, oldPosition, newPosition, injectors);

        // We don't care if GINJECTOR is present, as its Ginjector will resolve to "null", which
        // will never be reached on the path from the origin up to the root, therefore it won't
        // actually constrain anything.
        for (Dependency dependency : output.getGraph().getDependenciesTargeting(key)) {
          PrettyPrinter.log(logger, TreeLogger.DEBUG, "Re-enqueuing %s due to %s",
              dependency.getSource(), dependency);
          workqueue.add(dependency.getSource());
        }
      }
    }
  }
private void calculateExactPositions ( ) { while ( ! workqueue . isEmpty ( ) ) { Key < ? > key = workqueue . iterator ( ) . next ( ) ; workqueue . remove ( key ) ; Set < GinjectorBindings > injectors = getSourceGinjectors ( key ) ; injectors . add ( positions . get ( key ) ) ; GinjectorBindings newPosition = lowest ( injectors ) ; GinjectorBindings oldPosition = positions . put ( key , newPosition ) ; if ( oldPosition != newPosition ) { PrettyPrinter . log ( logger , TreeLogger . DEBUG , "Moved the highest visible position of %s from %s to %s, the lowest injector of %s." , key , oldPosition , newPosition , injectors ) ; for ( Dependency dependency : output . getGraph ( ) . getDependenciesTargeting ( key ) ) { PrettyPrinter . log ( logger , TreeLogger . DEBUG , "Re-enqueuing %s due to %s" , dependency . getSource ( ) , dependency ) ; workqueue . add ( dependency . getSource ( ) ) ; } } } }
Iterates on the position equation, updating each binding in the queue and re-queueing nodes
that depend on any node we move.  This will always terminate, since we only re-queue when we
make a change, and there are a finite number of entries in the injector hierarchy.