Tabnine Logo
Time.toDouble
Code IndexAdd Tabnine to your IDE (free)

How to use
toDouble
method
in
it.unibo.alchemist.model.interfaces.Time

Best Java code snippets using it.unibo.alchemist.model.interfaces.Time.toDouble (Showing top 6 results out of 315)

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

@Override
public Number getCurrentTime() {
  return react.getTau().toDouble();
}
origin: it.unibo.alchemist/alchemist-incarnation-protelis

@Override
public Map<DeviceUID, Map<CodePath, Object>> getNeighborState() {
  /*
   * If retentionTime is a number, use it. Otherwise clean all messages
   */
  if (msgs.isEmpty()) {
    return Collections.emptyMap();
  }
  if (Double.isNaN(retentionTime)) {
    final Map<DeviceUID, Map<CodePath, Object>> res = convertMessages(m -> true);
    msgs = new LinkedHashMap<>();
    return res;
  }
  final double currentTime = event.getTau().toDouble();
  return convertMessages(m -> currentTime - m.time < retentionTime);
}
origin: it.unibo.alchemist/alchemist-swingui

if (lasttime + TIME_STEP > time.toDouble()) {
  return;
final long timeSimulated = (long) (time.toDouble() * MS_PER_SECOND);
if (timeSimulated == 0) {
  timeInit = System.currentTimeMillis();
origin: it.unibo.alchemist/alchemist-incarnation-protelis

@Override
public void execute() {
  final AlchemistNetworkManager mgr = getNode().getNetworkManager(prog);
  Objects.requireNonNull(mgr);
  mgr.simulateMessageArrival(reaction.getTau().toDouble());
  prog.prepareForComputationalCycle();
}
origin: it.unibo.alchemist/alchemist-swingui

private void update(final Environment<T> env, final Time time) {
  if (Thread.holdsLock(env)) {
    if (envHasMobileObstacles(env)) {
      loadObstacles(env);
    }
    lasttime = time.toDouble();
    currentEnv = env;
    accessData();
    positions.clear();
    neighbors.clear();
    env.getNodes().parallelStream().forEach(node -> {
      positions.put(node, env.getPosition(node));
      try {
        neighbors.put(node, env.getNeighborhood(node).clone());
      } catch (Exception e) {
        L.error("Unable to clone neighborhood for " + node, e);
      }
    });
    releaseData();
    repaint();
  } else {
    throw new IllegalStateException("Only the simulation thread can dictate GUI updates");
  }
}
origin: it.unibo.alchemist/alchemist-incarnation-protelis

@Override
public Field nbrRange() {
  final boolean useRoutesAsDistances = env instanceof MapEnvironment<?> && node.contains(USE_ROUTES_AS_DISTANCES);
  return buildFieldWithPosition(p -> {
    if (useRoutesAsDistances) {
      if (node.contains(APPROXIMATE_NBR_RANGE)) {
        try {
          final double tolerance = (double) node.getConcentration(APPROXIMATE_NBR_RANGE);
          final double currTime = env.getSimulation().getTime().toDouble();
          if (currTime > nbrRangeTimeout) {
            nbrRangeTimeout = currTime + tolerance;
            precalcdRoutingDistance = routingDistance(p);
          }
          assert !Double.isNaN(precalcdRoutingDistance);
          return precalcdRoutingDistance;
        } catch (final ClassCastException e) {
          throw new IllegalStateException(APPROXIMATE_NBR_RANGE + " should be associated with a double concentration", e);
        }
      }
      return routingDistance(p);
    }
    return getDevicePosition().getDistanceTo(p);
  });
}
it.unibo.alchemist.model.interfacesTimetoDouble

Popular methods of Time

  • compareTo

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • getExternalFilesDir (Context)
  • getContentResolver (Context)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • JLabel (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • 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