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

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

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

origin: it.unibo.alchemist/alchemist-incarnation-biochemistry

private void changeConcentrationInSortedNodes(final List<EnvironmentNode> envNodesSurrounding) {
  if (delta < 0) {
    double deltaTemp = delta;
    for (final EnvironmentNode n : envNodesSurrounding) {
      final double nodeConcentration = n.getConcentration(biomolecule);
      // if nodeConcentration >= |deltaTemp|, remove the a delta quantity of the biomol only from this node
      if (nodeConcentration >= FastMath.abs(deltaTemp)) {
        n.setConcentration(biomolecule, nodeConcentration + deltaTemp);
        break;
        // else, remove all molecule of that species from that node and go on till deltaTemp is smaller than nodeConcetration
      } else {
        deltaTemp = deltaTemp + nodeConcentration;
        n.removeConcentration(biomolecule);
      }
    }
  } else {
    // if delta > 0, simply add delta to the first node of the list (which has been sorted randomly)
    final Node<Double> target = envNodesSurrounding.get(0);
    target.setConcentration(biomolecule, target.getConcentration(biomolecule) + delta);
  }
}
origin: it.unibo.alchemist/alchemist-incarnation-biochemistry

.mapToDouble(n -> n.getConcentration(biomolecule))
.distinct()
.count() == 1;
      n1.getConcentration(biomolecule), 
      n2.getConcentration(biomolecule)
origin: it.unibo.alchemist/alchemist-incarnation-biochemistry

  private void changeConcentrationInRandomNodes(final List<EnvironmentNode> envNodesSurrounding) {
    if (delta < 0) {
      double deltaTemp = delta;
      while (deltaTemp < 0) {
        final int index = getRandomGenerator().nextInt(envNodesSurrounding.size());
        final EnvironmentNode pickedNode = envNodesSurrounding.get(index);
        final double nodeConcentration = pickedNode.getConcentration(biomolecule);
        // if nodeConcentration >= |deltaTemp|, remove the a delta quantity of the biomol only from this node
        if (nodeConcentration >= FastMath.abs(deltaTemp)) {
          pickedNode.setConcentration(biomolecule, nodeConcentration + deltaTemp);
          break;
          // else, remove all molecule of that species from that node and go on till deltaTemp is smaller than nodeConcetration
        } else {
          deltaTemp = deltaTemp + nodeConcentration;
          pickedNode.removeConcentration(biomolecule);
        }
        envNodesSurrounding.remove(index);
      }
    } else {
      // if delta > 0, simply add delta to the first node of the list (which has been sorted randomly)
      final Node<Double> target = envNodesSurrounding.get(getRandomGenerator().nextInt(envNodesSurrounding.size()));
      target.setConcentration(biomolecule, target.getConcentration(biomolecule) + delta);
    }
  }
}
it.unibo.alchemist.model.interfacesEnvironmentNode

Most used methods

  • getConcentration
  • removeConcentration
  • setConcentration

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • requestLocationUpdates (LocationManager)
  • onCreateOptionsMenu (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top Sublime Text 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