public DAGNode<Component, Dependency> processNode(@Nonnull DAGNode<Component, Dependency> node, @Nonnull DAGNode<Component, Dependency> original) { Component label = node.getLabel(); if (!label.getSatisfaction().hasInstance()) { Satisfaction instanceSat = Satisfactions.nullOfType(label.getSatisfaction().getErasedType()); Component newLbl = Component.create(instanceSat, label.getCachePolicy()); // build new node with replacement label DAGNodeBuilder<Component,Dependency> bld = DAGNode.newBuilder(newLbl); // retain all non-transient edges for (DAGEdge<Component,Dependency> edge: node.getOutgoingEdges()) { if (!GraphtUtils.edgeIsTransient(edge)) { bld.addEdge(edge.getTail(), edge.getLabel()); } } DAGNode<Component,Dependency> repl = bld.build(); logger.debug("simulating instantiation of {}", node); return repl; } else { return node; } } }
bld.addEdge(edge.getTail(), edge.getLabel());
public DAGNode<Component, Dependency> processNode(@Nonnull DAGNode<Component, Dependency> node, @Nonnull DAGNode<Component, Dependency> original) { Component label = node.getLabel(); Satisfaction satisfaction = label.getSatisfaction(); if (satisfaction.hasInstance()) { return node; } Object obj = instantiator.apply(node); Satisfaction instanceSat; if (obj == null) { instanceSat = Satisfactions.nullOfType(satisfaction.getErasedType()); } else { instanceSat = Satisfactions.instance(obj); } Component newLabel = Component.create(instanceSat, label.getCachePolicy()); // build new node with replacement label DAGNodeBuilder<Component,Dependency> bld = DAGNode.newBuilder(newLabel); // retain all non-transient edges for (DAGEdge<Component, Dependency> edge: node.getOutgoingEdges()) { if (!GraphtUtils.edgeIsTransient(edge)) { bld.addEdge(edge.getTail(), edge.getLabel()); } } return bld.build(); } }
/** * Add an edge. * @param target The target node. * @param label The edge label. * @return The builder (for chaining). */ @Nonnull public DAGNodeBuilder<V,E> addEdge(@Nonnull DAGNode<V,E> target, @Nonnull E label) { Preconditions.checkNotNull(target, "edge target"); Preconditions.checkNotNull(label, "edge label"); return addEdge(Pair.of(target, label)); }
for (DAGEdge<V,E> edge: outgoingEdges) { DAGNode<V,E> newTail = edge.getTail().replaceNode(node, replacement, memory); bld.addEdge(newTail, edge.getLabel());
bld.addEdge(filtered, edge.getLabel());
/** * Create a new builder initialized to build a copy of the specified node. * @param node The node to copy. * @param <V> The type of node labels. * @param <E> The type of edge labels. * @return A new builder initialized with the labels and edges of {@code node}. */ public static <V,E> DAGNodeBuilder<V,E> copyBuilder(DAGNode<V,E> node) { DAGNodeBuilder<V,E> bld = newBuilder(node.getLabel()); for (DAGEdge<V,E> edge: node.getOutgoingEdges()) { bld.addEdge(edge.getTail(), edge.getLabel()); } return bld; }
public DAGNode<Component, Dependency> processNode(@Nonnull DAGNode<Component, Dependency> node, @Nonnull DAGNode<Component, Dependency> original) { Component label = node.getLabel(); if (!label.getSatisfaction().hasInstance()) { Satisfaction instanceSat = Satisfactions.nullOfType(label.getSatisfaction().getErasedType()); Component newLbl = Component.create(instanceSat, label.getCachePolicy()); // build new node with replacement label DAGNodeBuilder<Component,Dependency> bld = DAGNode.newBuilder(newLbl); // retain all non-transient edges for (DAGEdge<Component,Dependency> edge: node.getOutgoingEdges()) { if (!GraphtUtils.edgeIsTransient(edge)) { bld.addEdge(edge.getTail(), edge.getLabel()); } } DAGNode<Component,Dependency> repl = bld.build(); logger.debug("simulating instantiation of {}", node); return repl; } else { return node; } } }
public DAGNode<Component, Dependency> processNode(@Nonnull DAGNode<Component, Dependency> node, @Nonnull DAGNode<Component, Dependency> original) { Component label = node.getLabel(); Satisfaction satisfaction = label.getSatisfaction(); if (satisfaction.hasInstance()) { return node; } Object obj = instantiator.apply(node); Satisfaction instanceSat; if (obj == null) { instanceSat = Satisfactions.nullOfType(satisfaction.getErasedType()); } else { instanceSat = Satisfactions.instance(obj); } Component newLabel = Component.create(instanceSat, label.getCachePolicy()); // build new node with replacement label DAGNodeBuilder<Component,Dependency> bld = DAGNode.newBuilder(newLabel); // retain all non-transient edges for (DAGEdge<Component, Dependency> edge: node.getOutgoingEdges()) { if (!GraphtUtils.edgeIsTransient(edge)) { bld.addEdge(edge.getTail(), edge.getLabel()); } } return bld.build(); } }
nodeBuilder.addEdge(resolveFully(d, newContext, deferQueue));
bld.addEdge(edge.getTail(), edge.getLabel());