congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Scenario$Builder.ensureFrequency
Code IndexAdd Tabnine 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)

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 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);
}
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);
}
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

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • putExtra (Intent)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Reference (javax.naming)
  • Top Vim 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