public function addDependency($id, $className, $constructor, Doozr_Di_Dependency $dependency)
    {
        // Prepare indices ...
        $this->initDependenciesById($id);
        $this->initIndexByClassName($className);

        // Build index to speedup lookups
        $this->dependenciesById[$id][]          = $dependency;
        $index                                  = count($this->dependenciesById[$id]) - 1;
        $this->indexedByClassName[$className][] = &$this->dependenciesById[$id][$index];
        $this->classNameById[$id]               = $className;
        $this->constructorById[$id]             = $constructor;

        // update the numerical index for iterator access
        $this->numericalIndex = array_keys($this->dependenciesById);

        return true;
    }