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

How to use
TimedEvent
in
com.github.rinde.rinsim.scenario

Best Java code snippets using com.github.rinde.rinsim.scenario.TimedEvent (Showing top 11 results out of 315)

origin: rinde/RinSim

 @Override
 public int compare(@Nullable TimedEvent o1, @Nullable TimedEvent o2) {
  return Long.compare(
   verifyNotNull(o1).getTime(),
   verifyNotNull(o2).getTime());
 }
}
origin: com.github.rinde/rinsim-scenario

 @Override
 public int compare(@Nullable TimedEvent o1, @Nullable TimedEvent o2) {
  return Long.compare(
   verifyNotNull(o1).getTime(),
   verifyNotNull(o2).getTime());
 }
}
origin: com.github.rinde/rinsim-scenario

/**
 * Dispatch all setup events (the ones that define initial settings). For
 * example, a vehicle that is added during setup (at time < 0) will receive
 * its first tick at time 0. If the vehicle is added at the beginning of the
 * simulation (time 0) the first tick it will receive will be the second
 * (globally) tick.
 */
protected void dispatchSetupEvents() {
 TimedEvent e = null;
 while ((e = scenarioQueue.peek()) != null && e.getTime() < 0) {
  scenarioQueue.poll();
  dispatch(e);
 }
}
origin: rinde/RinSim

/**
 * Collects all event arrival times of the specified {@link Scenario}.
 * @param s The scenario.
 * @return {@link ImmutableList} containing event arrival times.
 */
public static ImmutableList<Long> getArrivalTimes(Scenario s) {
 final ImmutableList.Builder<Long> builder = ImmutableList.builder();
 for (final TimedEvent te : s.getEvents()) {
  if (te instanceof AddParcelEvent) {
   builder.add(te.getTime());
  }
 }
 return builder.build();
}
origin: rinde/RinSim

/**
 * Dispatch all setup events (the ones that define initial settings). For
 * example, a vehicle that is added during setup (at time &lt; 0) will receive
 * its first tick at time 0. If the vehicle is added at the beginning of the
 * simulation (time 0) the first tick it will receive will be the second
 * (globally) tick.
 */
protected void dispatchSetupEvents() {
 TimedEvent e = null;
 while ((e = scenarioQueue.peek()) != null && e.getTime() < 0) {
  scenarioQueue.poll();
  dispatch(e);
 }
}
origin: rinde/RinSim

static boolean isOnline(Gendreau06Scenario scen) {
 for (final TimedEvent e : scen.getEvents()) {
  if (e instanceof AddParcelEvent && e.getTime() == -1) {
   return false;
  }
 }
 return true;
}
origin: rinde/RinSim

private void dispatchEvents(TimeLapse timeLapse) {
 TimedEvent e = null;
 while ((e = scenarioQueue.peek()) != null
  && e.getTime() <= timeLapse.getTime()) {
  scenarioQueue.poll();
  if (status == null) {
   LOGGER.info("scenario started at virtual time:" + timeLapse.getTime());
   status = EventType.SCENARIO_STARTED;
   disp.dispatchEvent(new Event(status, this));
  }
  dispatch(e);
 }
 if ((e = scenarioQueue.peek()) != null
  && e.getTime() <= timeLapse.getTime() + timeLapse.getTickLength()
  && clock instanceof RealtimeClockController) {
  LOGGER.trace("Found an event in next tick, switch to RT");
  ((RealtimeClockController) clock).switchToRealTime();
 }
 if (e == null && status != EventType.SCENARIO_FINISHED) {
  status = EventType.SCENARIO_FINISHED;
  disp.dispatchEvent(new Event(status, this));
 }
}
origin: com.github.rinde/rinsim-scenario

private void dispatchEvents(TimeLapse timeLapse) {
 TimedEvent e = null;
 while ((e = scenarioQueue.peek()) != null
  && e.getTime() <= timeLapse.getTime()) {
  scenarioQueue.poll();
  if (status == null) {
   LOGGER.info("scenario started at virtual time:" + timeLapse.getTime());
   status = EventType.SCENARIO_STARTED;
   disp.dispatchEvent(new Event(status, this));
  }
  dispatch(e);
 }
 if ((e = scenarioQueue.peek()) != null
  && e.getTime() <= timeLapse.getTime() + timeLapse.getTickLength()
  && clock instanceof RealtimeClockController) {
  LOGGER.trace("Found an event in next tick, switch to RT");
  ((RealtimeClockController) clock).switchToRealTime();
 }
 if (e == null && status != EventType.SCENARIO_FINISHED) {
  status = EventType.SCENARIO_FINISHED;
  disp.dispatchEvent(new Event(status, this));
 }
}
origin: rinde/RinSim

static void containsTimeOut(Gendreau06Scenario scen, int minutes) {
 final TimedEvent e = scen.getEvents().get(scen.getEvents().size() - 1);
 assertThat(e).isInstanceOf(TimeOutEvent.class);
 assertEquals(minutes * 60 * 1000, e.getTime());
}
origin: com.github.rinde/rinsim-pdptw

} else if (se.getTimedEvent() instanceof TimeOutEvent) {
 simFinish = true;
 scenarioEndTime = se.getTimedEvent().getTime();
origin: rinde/RinSim

} else if (se.getTimedEvent() instanceof TimeOutEvent) {
 simFinish = true;
 scenarioEndTime = se.getTimedEvent().getTime();
com.github.rinde.rinsim.scenarioTimedEvent

Javadoc

An event that is part of a scenario. It has a time at which it should be dispatched. Implementations should be immutable.

Most used methods

  • getTime

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top 12 Jupyter Notebook extensions
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