mapBoost function

String mapBoost(
  1. WidgetRef ref,
  2. String code
)

Map boost template patterns in code to their current values.

Implementation

String mapBoost(WidgetRef ref, String code) {
  // Obtain the current values of the global variables.

  int boostIterations = ref.read(iterationsBoostProvider);
  int boostMaxDepth = ref.read(maxDepthBoostProvider);
  int boostMinSplit = ref.read(minSplitBoostProvider);
  int boostThreads = ref.read(threadsBoostProvider);
  int boostXVal = ref.read(xValueBoostProvider);

  double boostComplexity = ref.read(complexityBoostProvider);
  double boostLearningRate = ref.read(learningRateBoostProvider);

  String boostObjective = ref.read(objectiveBoostProvider);

  // Perform the mapping.

  code = code.replaceAll('<BOOST_MAX_DEPTH>', boostMaxDepth.toString());
  code = code.replaceAll('<BOOST_MIN_SPLIT>', boostMinSplit.toString());
  code = code.replaceAll('<BOOST_X_VALUE>', boostXVal.toString());
  code = code.replaceAll('<BOOST_LEARNING_RATE>', boostLearningRate.toString());
  code = code.replaceAll('<BOOST_COMPLEXITY>', boostComplexity.toString());
  code = code.replaceAll('<BOOST_THREADS>', boostThreads.toString());
  code = code.replaceAll('<BOOST_ITERATIONS>', boostIterations.toString());
  code = code.replaceAll('<BOOST_OBJECTIVE>', '"$boostObjective"');

  return (code);
}