Codota Logo
Scenario$Builder.ensureFrequency
Code IndexAdd Codota to your IDE (free)

How to use
ensureFrequency
method
in
com.github.rinde.rinsim.scenario.Scenario$Builder

Best Java code snippets using com.github.rinde.rinsim.scenario.Scenario$Builder.ensureFrequency (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: rinde/RinSim

/**
 * Empty events list is not allowed.
 */
@Test(expected = IllegalStateException.class)
public void testEnsureFrequencyFailEmptyEventsList() {
 Scenario.builder(Scenario.DEFAULT_PROBLEM_CLASS)
  .ensureFrequency(Predicates.<TimedEvent>alwaysTrue(), 1);
}
origin: rinde/RinSim

/**
 * Negative frequency is not allowed.
 */
@Test(expected = IllegalArgumentException.class)
public void testEnsureFrequencyFailFrequency() {
 Scenario.builder(Scenario.DEFAULT_PROBLEM_CLASS)
  .ensureFrequency(Predicates.<TimedEvent>alwaysTrue(), -1);
}
origin: rinde/RinSim

assertTrue(b.eventList.isEmpty());
b.addEvents(events)
 .ensureFrequency(Predicates.equalTo(ev3), 1);
assertEquals(asList(ev1, ev2, ev4, ev5, ev3), b.eventList);
b.ensureFrequency(Predicates.equalTo(ev1), 3);
assertEquals(asList(ev1, ev2, ev4, ev5, ev3, ev1, ev1), b.eventList);
b.ensureFrequency(Predicates.equalTo(ev1), 3);
assertEquals(asList(ev1, ev2, ev4, ev5, ev3, ev1, ev1), b.eventList);
origin: rinde/RinSim

/**
 * Filter must match at least one event.
 */
@Test(expected = IllegalArgumentException.class)
public void testEnsureFrequencyFailFilter1() {
 Scenario.builder(Scenario.DEFAULT_PROBLEM_CLASS)
  .addEvent(EventA.create(0))
  .ensureFrequency(Predicates.<TimedEvent>alwaysFalse(), 1);
}
origin: rinde/RinSim

/**
 * Filter matches must be equal.
 */
@Test(expected = IllegalArgumentException.class)
public void testEnsureFrequencyFailFilter2() {
 Scenario
  .builder(Scenario.DEFAULT_PROBLEM_CLASS)
  .addEvent(EventA.create(0))
  .addEvent(EventA.create(1))
  .ensureFrequency(Predicates.instanceOf(EventA.class), 1);
}
com.github.rinde.rinsim.scenarioScenario$BuilderensureFrequency

Javadoc

Limits or grows the number of TimedEvents that satisfy the specified Predicate to such that the number of occurrences is equal to frequency. If the number of events that satisfy the filter already equals the specified frequency, nothing happens.

Preconditions:

  • Frequency may not be negative
  • This Builder must contain at least one event.
  • The specified Predicate must match at least one event in this Builder.
  • All events that satisfy the Predicate must be equal.

Postconditions:

  • The number of events that match the Predicate is equal to frequency.

Popular methods of Scenario$Builder

  • build
    Build a new Scenario instance.
  • addEvent
    Add the specified TimedEvent to the builder.
  • addEvents
    Add the specified TimedEvents to the builder.
  • addModel
    Adds the model builder. The builders will be used to instantiate Models needed for the scenario.
  • setStopCondition
  • addModels
    Adds the model builders. The builders will be used to instantiate Models needed for the scenario.
  • clearEvents
    Removes all events.
  • instanceId
    The instance id to use for the next scenario that is created.
  • removeModelsOfType
    Removes all previously added model builders that are an instance of the specified type.
  • scenarioLength
  • copyProperties
  • problemClass
    The ProblemClass to use for the next scenario that is created.
  • copyProperties,
  • problemClass,
  • <init>,
  • filterEvents,
  • getStopCondition,
  • getTimeWindow,
  • self

Popular in Java

  • Running tasks concurrently on multiple threads
  • putExtra (Intent)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getApplicationContext (Context)
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Socket (java.net)
    Provides a client-side TCP socket.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now