/** * The initial mode of the produced {@link RtSolverModel} will be 'multi'. * See {@link RtSolverModel} for more information. * @return This, as per the builder pattern. */ @CheckReturnValue public Builder withMultiMode() { return create(Mode.MULTI_MODE, getThreadPoolSize(), getThreadGrouping()); }
/** * The initial mode of the produced {@link RtSolverModel} will be 'single'. * See {@link RtSolverModel} for more information. * @return This, as per the builder pattern. */ @CheckReturnValue public Builder withSingleMode() { return create(Mode.SINGLE_MODE, getThreadPoolSize(), getThreadGrouping()); }
/** * Sets the thread grouping property. If thread grouping is enabled all * threads spawned by this model will be locked to the same CPU, if it is * disabled each thread will be locked to unique CPU (on a best effort * basis). * @param grouping Indicates whether grouping should be enabled. Default * value is <code>false</code>. * @return This, as per the builder pattern. */ @CheckReturnValue public Builder withThreadGrouping(boolean grouping) { return create(getMode(), getThreadPoolSize(), grouping); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof RtSolverModel.Builder) { RtSolverModel.Builder that = (RtSolverModel.Builder) o; return (this.mode.equals(that.getMode())) && (this.threadPoolSize == that.getThreadPoolSize()) && (this.threadGrouping == that.getThreadGrouping()); } return false; }
@Override public RtSolverModel build(DependencyProvider dependencyProvider) { final RealtimeClockController c = dependencyProvider .get(RealtimeClockController.class); final PDPRoadModel rm = dependencyProvider.get(PDPRoadModel.class); final PDPModel pm = dependencyProvider.get(PDPModel.class); return new RtSolverModel(c, rm, pm, getMode(), getThreadPoolSize(), getThreadGrouping()); }