Tabnine Logo
Context
Code IndexAdd Tabnine to your IDE (free)

How to use
Context
in
it.unibo.alchemist.model.interfaces

Best Java code snippets using it.unibo.alchemist.model.interfaces.Context (Showing top 5 results out of 315)

origin: it.unibo.alchemist/alchemist-engine

private Set<Reaction<T>> initCandidates(final Reaction<T> newReaction, final Context c) {
  if (c.equals(Context.GLOBAL)) {
    return hndlrs.keySet();
  }
  final Set<Reaction<T>> list = new LinkedHashSet<>();
  addNeighborhoodReactions(list, newReaction);
  if (c.equals(Context.LOCAL)) {
    addLocalReactions(list, newReaction);
  } else {
    addExtendedNeighborhoodReactions(list, newReaction);
  }
  return list;
}
origin: it.unibo.alchemist/alchemist-engine

private boolean mayInfluence(final Reaction<T> source, final Reaction<T> target) {
  final Context in = target.getInputContext();
  final Context out = source.getOutputContext();
  if (// Same node
  target.getNode().equals(source.getNode())
  // If reaction writes something globally
      || out.equals(Context.GLOBAL)
      // If reaction reads something globally
      || in.equals(Context.GLOBAL)) {
    return true;
  }
  return influenceNeighborCheck(env, source, target, in, out);
}
origin: it.unibo.alchemist/alchemist-engine

private void updateNeighborhood(final Node<T> n) {
  for (final Reaction<T> r : n.getReactions()) {
    if (r.getInputContext().equals(Context.NEIGHBORHOOD)) {
      updateReaction(handlers.get(r));
    }
  }
}
origin: it.unibo.alchemist/alchemist-engine

private void updateDependenciesForOperationOnNode(final Neighborhood<T> oldNeighborhood) {
  /*
   * A reaction in the neighborhood may have changed due to the content of
   * this new node. Must check.
   */
  for (final Node<T> n : oldNeighborhood) {
    for (final Reaction<T> r : n.getReactions()) {
      if (r.getInputContext().equals(Context.NEIGHBORHOOD)) {
        updateReaction(handlers.get(r));
      }
    }
  }
  /*
   * It is possible that some global reaction is changed due to the
   * creation of a new node. Checking.
   */
  for (final Node<T> n : env) {
    for (final Reaction<T> r : n.getReactions()) {
      if (r.getInputContext().equals(Context.GLOBAL)) {
        updateReaction(handlers.get(r));
      }
    }
  }
}
origin: it.unibo.alchemist/alchemist-engine

/**
 * This method checks if there may be a dependency considering the
 * neighborhoods
 */
private static <T> boolean influenceNeighborCheck(final Environment<T> env, final Reaction<T> source, final Reaction<T> target, final Context in, final Context out) {
  final Neighborhood<T> sn = env.getNeighborhood(source.getNode());
  final boolean scn = in.equals(Context.NEIGHBORHOOD);
  // If source reads from neighborhood and target is within
  if (scn && sn.contains(target.getNode())) {
    return true;
  }
  // If target writes in neighborhood and source is within
  final Neighborhood<T> tn = env.getNeighborhood(target.getNode());
  final boolean tcn = out.equals(Context.NEIGHBORHOOD);
  if (tcn && tn.contains(source.getNode())) {
    return true;
  }
  // If source writes on the neighborhood, target reads on its
  // neighborhood and there is at least one common node
  return scn && tcn && commonNeighbor(env, sn, target.getNode());
}
it.unibo.alchemist.model.interfacesContext

Most used methods

  • equals

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • runOnUiThread (Activity)
  • putExtra (Intent)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JPanel (javax.swing)
  • CodeWhisperer alternatives
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