// file: $isip/class/search/SearchNode/snod_07.cc
// version: $Id: snod_07.cc 9000 2003-01-23 20:00:34Z alphonso $
//

// isip include files
//
#include "SearchNode.h"
#include <Trace.h>
#include <Instance.h>

// method: evaluateData
//
// arguments:
//  VectorFloat& data: (input) the data to evaluate
//  long timestamp: (input) the timestamp for the incoming trace
//
// return: the score generated
//
// this method scores data with the statistical model
//
float SearchNode::evaluateData(VectorFloat& data_a, long timestamp_a) {

  if (stat_model_d == (StatisticalModel*)NULL) {
    return 0.0;
  }

  // check whether the node has been evaluaated
  // - if trace with new time frame had arrived to this node or
  // if the node had not been visited, the score was set to inactive
  // 
  //
  if (score_d == Trace::INACTIVE_SCORE) {

    score_d = stat_model_d->getLogLikelihood(data_a);

    // print debugging information
    //
    if (debug_level_d >= Integral::DETAILED) {
      String out(L"-> computed score: ");
      out.concat(score_d);
      Console::put(out);
    }    
  }

  return score_d;
}
