Tabnine Logo
DAGNode.getOutgoingEdgeWithLabel
Code IndexAdd Tabnine to your IDE (free)

How to use
getOutgoingEdgeWithLabel
method
in
org.grouplens.grapht.graph.DAGNode

Best Java code snippets using org.grouplens.grapht.graph.DAGNode.getOutgoingEdgeWithLabel (Showing top 4 results out of 315)

origin: lenskit/lenskit

@Nullable
public <T> T tryGetInstance(Class<T> type) throws InjectionException {
  Desire d = Desires.create(null, type, true);
  DAGEdge<Component, Dependency> e =
      graph.getOutgoingEdgeWithLabel(l -> l.hasInitialDesire(d));
  if (e != null) {
    return type.cast(instantiator.instantiate(e.getTail()));
  } else {
    DAGNode<Component, Dependency> node = GraphtUtils.findSatisfyingNode(graph, Qualifiers.matchDefault(), type);
    if (node != null) {
      return type.cast(instantiator.instantiate(node));
    } else {
      return null;
    }
  }
}
origin: org.grouplens.grapht/grapht

/**
 * Get an outgoing edge from this node with the specified label, if it exists.
 *
 * @param label The label.
 * @return An outgoing edge with the specified label, or {@code null} if no such edge exists.
 * If multiple edges have this label, an arbitrary one is returned.
 */
public DAGEdge<V,E> getOutgoingEdgeWithLabel(E label) {
  return getOutgoingEdgeWithLabel(Predicates.equalTo(label));
}
origin: org.lenskit/lenskit-core

@Nullable
public <T> T tryGetInstance(Class<T> type) throws InjectionException {
  Desire d = Desires.create(null, type, true);
  DAGEdge<Component, Dependency> e =
      graph.getOutgoingEdgeWithLabel(l -> l.hasInitialDesire(d));
  if (e != null) {
    return type.cast(instantiator.instantiate(e.getTail()));
  } else {
    DAGNode<Component, Dependency> node = GraphtUtils.findSatisfyingNode(graph, Qualifiers.matchDefault(), type);
    if (node != null) {
      return type.cast(instantiator.instantiate(node));
    } else {
      return null;
    }
  }
}
origin: org.grouplens.grapht/grapht

  @Override
  @SuppressWarnings("unchecked")
  public <T> T getInstance(Annotation qualifier, Class<T> type) throws InjectionException {
    // All Provider cache access, graph resolution, etc. occur
    // within this exclusive lock so we know everything is thread safe
    // albeit in a non-optimal way.
    synchronized(this) {
      Desire desire = Desires.create(qualifier, type, false);

      Predicate<Dependency> pred = Dependency.hasInitialDesire(desire);

      // check if the desire is already in the graph
      DAGEdge<Component, Dependency> resolved =
          solver.getGraph().getOutgoingEdgeWithLabel(pred);

      // The edge is only non-null if instantiate() has been called before,
      // it may be present in the graph at a deeper node. If that's the case
      // it will be properly merged after regenerating the graph at the root context.
      if (resolved == null) {
        logger.info("Must resolve desire: {}", desire);
        solver.resolve(desire);
        resolved = solver.getGraph().getOutgoingEdgeWithLabel(pred);
      }

      // Check if the provider for the resolved node is in our cache
      DAGNode<Component, Dependency> resolvedNode = resolved.getTail();
      return type.cast(instantiator.makeInstantiator(resolvedNode, solver.getBackEdges()).instantiate());
    }
  }
}
org.grouplens.grapht.graphDAGNodegetOutgoingEdgeWithLabel

Javadoc

Search for an outgoing edge by a predicate.

Popular methods of DAGNode

  • getLabel
    Get the label for this node.
  • getOutgoingEdges
    Get the outgoing edges of this node.
  • getReachableNodes
  • newBuilder
    Construct a new DAG node builder.
  • getSortedNodes
    Topographical sort all nodes reachable from the given root node. Nodes that are farther away, or mor
  • replaceNode
    Replace one node with another in this graph. All edges referencing node are replaced with edges refe
  • breadthFirstEdges
  • <init>
    Construct a new DAG node.
  • copyBuilder
    Create a new builder initialized to build a copy of the specified node.
  • getAdjacentNodes
    Get the nodes that are adjacent to this node (only considering outgoing edges).
  • getIncomingEdgeMap
    Get a multimap of incoming edges. For each node reachable from this node, the map will contain each
  • initializeCaches
    Initialize caches for traversing this node.
  • getIncomingEdgeMap,
  • initializeCaches,
  • singleton,
  • sortVisit,
  • transformEdges

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JButton (javax.swing)
  • JCheckBox (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now