/**
 * @license
 * Copyright (c) 2017 Google Inc. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * Code distributed by Google as part of this project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
"use strict";

let assert = require('assert');
var tracing = require('tracelib');
const scheduler = require('./scheduler.js');
const Relevance = require('./relevance.js');

class Speculator {

  speculate(arc, plan) {
    var callTrace = tracing.start({cat: "speculator", name: "Speculator::speculate"});
    var newArc = arc.clone();

    plan.instantiate(newArc);
    callTrace.end();
    let relevance = new Relevance();
    async function awaitCompletion() {
      await scheduler.idle;
      var messageCount = newArc.pec.messageCount;
      relevance.apply(await newArc.pec.idle);

      if (newArc.pec.messageCount !== messageCount + 1)
        return awaitCompletion();
      else {
        return relevance.relevanceScore();
      }
    }

    return awaitCompletion();

  }
}

module.exports = Speculator;

@@ -665,17 +665,16 @@
 lone();%0A
-%0A
     plan

remove redundant empty line