congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Scenario$Builder.removeModelsOfType
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: com.github.rinde/rinsim-scenario

 @Override
 @Nullable
 public Scenario apply(@Nullable Scenario input) {
  return Scenario.builder(verifyNotNull(input))
   .removeModelsOfType(TimeModel.AbstractBuilder.class)
   .addModel(timeModel)
   .build();
 }
};
origin: rinde/RinSim

 @Override
 @Nullable
 public Scenario apply(@Nullable Scenario input) {
  return Scenario.builder(verifyNotNull(input))
   .removeModelsOfType(TimeModel.AbstractBuilder.class)
   .addModel(timeModel)
   .build();
 }
};
origin: com.github.rinde/rinsim-scenario

@Nullable
@Override
public Scenario apply(@Nullable Scenario input) {
 final Scenario in = verifyNotNull(input);
 final Optional<TimeModel.AbstractBuilder<?>> timeModel =
  getTimeModel(in);
 final TimeModel.Builder rtb = TimeModel.builder();
 if (timeModel.isPresent()) {
  rtb.withTickLength(timeModel.get().getTickLength())
   .withTimeUnit(timeModel.get().getTimeUnit());
 }
 return Scenario.builder(in)
  .removeModelsOfType(TimeModel.AbstractBuilder.class)
  .addModel(rtb)
  .build();
}
origin: rinde/RinSim

.removeModelsOfType(TimeModel.AbstractBuilder.class)
.addModel(TimeModel.builder()
 .withRealTime()
origin: rinde/RinSim

/**
 * Tests the removal of model builders.
 */
@Test
public void testRemoveModelsOfType() {
 final Scenario.Builder builder = Scenario.builder();
 builder.addModel(TimeModel.builder())
  .addModel(TimeModel.builder().withRealTime())
  .addModel(RoadModelBuilders.plane())
  .addModel(CommModel.builder());
 assertThat(builder.modelBuilders).hasSize(4);
 builder.removeModelsOfType(RoadModelBuilders.PlaneRMB.class);
 assertThat(builder.modelBuilders).hasSize(3);
 assertThat(builder.modelBuilders).containsExactly(TimeModel.builder(),
  TimeModel.builder().withRealTime(), CommModel.builder());
 builder.removeModelsOfType(RoadModelBuilders.AbstractGraphRMB.class);
 builder.removeModelsOfType(TimeModel.AbstractBuilder.class);
 assertThat(builder.modelBuilders).hasSize(1);
 assertThat(builder.modelBuilders).containsExactly(CommModel.builder());
 builder.removeModelsOfType(CommModel.Builder.class);
 assertThat(builder.modelBuilders).isEmpty();
}
origin: rinde/RinSim

@Override
@Nullable
public Scenario apply(@Nullable Scenario input) {
 final Scenario in = verifyNotNull(input);
 final Optional<TimeModel.AbstractBuilder<?>> timeModel =
  getTimeModel(in);
 RealtimeBuilder rtb = TimeModel.builder()
  .withRealTime()
  .withStartInClockMode(ClockMode.SIMULATED);
 if (timeModel.isPresent()) {
  // copy properties from existing time model
  rtb = rtb.withTickLength(timeModel.get().getTickLength())
   .withTimeUnit(timeModel.get().getTimeUnit());
 }
 // else: in this case we don't copy properties, we use the defaults
 return Scenario.builder(in)
  .removeModelsOfType(TimeModel.AbstractBuilder.class)
  .addModel(rtb)
  .build();
}
origin: com.github.rinde/rinsim-scenario

@Override
@Nullable
public Scenario apply(@Nullable Scenario input) {
 final Scenario in = verifyNotNull(input);
 final Optional<TimeModel.AbstractBuilder<?>> timeModel =
  getTimeModel(in);
 RealtimeBuilder rtb = TimeModel.builder()
  .withRealTime()
  .withStartInClockMode(ClockMode.SIMULATED);
 if (timeModel.isPresent()) {
  // copy properties from existing time model
  rtb = rtb.withTickLength(timeModel.get().getTickLength())
   .withTimeUnit(timeModel.get().getTimeUnit());
 }
 // else: in this case we don't copy properties, we use the defaults
 return Scenario.builder(in)
  .removeModelsOfType(TimeModel.AbstractBuilder.class)
  .addModel(rtb)
  .build();
}
origin: rinde/RinSim

@Nullable
@Override
public Scenario apply(@Nullable Scenario input) {
 final Scenario in = verifyNotNull(input);
 final Optional<TimeModel.AbstractBuilder<?>> timeModel =
  getTimeModel(in);
 final TimeModel.Builder rtb = TimeModel.builder();
 if (timeModel.isPresent()) {
  rtb.withTickLength(timeModel.get().getTickLength())
   .withTimeUnit(timeModel.get().getTimeUnit());
 }
 return Scenario.builder(in)
  .removeModelsOfType(TimeModel.AbstractBuilder.class)
  .addModel(rtb)
  .build();
}
com.github.rinde.rinsim.scenarioScenario$BuilderremoveModelsOfType

Javadoc

Removes all previously added model builders that are an instance of the specified type.

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.
  • scenarioLength
  • copyProperties
  • problemClass
    The ProblemClass to use for the next scenario that is created.
  • <init>
  • problemClass,
  • <init>,
  • ensureFrequency,
  • filterEvents,
  • getStopCondition,
  • getTimeWindow,
  • self

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • compareTo (BigDecimal)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Notification (javax.management)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • BoxLayout (javax.swing)
  • JTextField (javax.swing)
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now