/** * Get a singleton root node for a dependency graph. * @return A root node for a dependency graph with no resolved objects. */ public static DAGNode<Component,Dependency> rootNode() { return DAGNode.singleton(ROOT_SATISFACTION); }
/** * Create a DependencySolver that uses the given functions, and max * depth of the dependency graph. * * @param bindFunctions The binding functions that control desire bindings * @param maxDepth A maximum depth of the graph before it's determined that * a cycle exists * @throws IllegalArgumentException if maxDepth is less than 1 * @throws NullPointerException if bindFunctions is null */ DependencySolver(List<BindingFunction> bindFunctions, List<BindingFunction> triggers, CachePolicy defaultPolicy, int maxDepth) { Preconditions.notNull("bindFunctions", bindFunctions); Preconditions.notNull("defaultPolicy", defaultPolicy); if (maxDepth <= 0) { throw new IllegalArgumentException("Max depth must be at least 1"); } this.functions = new ArrayList<BindingFunction>(bindFunctions); this.triggerFunctions = new ArrayList<BindingFunction>(triggers); this.maxDepth = maxDepth; this.defaultPolicy = defaultPolicy; graph = DAGNode.singleton(ROOT_SATISFACTION); backEdges = HashMultimap.create(); mergePool = MergePool.create(); logger.info("DependencySolver created, max depth: {}", maxDepth); }
node = DAGNode.singleton(result.makeSatisfaction()); deferQueue.add(new Deferral(node, newContext)); } else {