// file: $isip/class/pr/RegressionDecisionTree/rdt_00.cc
// version: $Id: rdt_00.cc 9460 2004-04-19 22:27:11Z gao $
//

// isip include files
//
#include "RegressionDecisionTree.h"

//------------------------------------------------------------------------
//
// required public methods
//
//-----------------------------------------------------------------------

// method: assign
//
// arguments:
//  const RegressionDecisionTree& arg: (input) object to be assigned
//
// return: a boolean value indicating status
//
// this method assigns the input object to the current object
//
boolean RegressionDecisionTree::assign(const RegressionDecisionTree& arg_a) {

  // assign data from the input RegressionDecisionTree object
  //
  algorithm_d = arg_a.algorithm_d;
  implementation_d = arg_a.implementation_d;

  num_terminals_d = arg_a.num_terminals_d;
  
  rdt_rootnode_d.assign(arg_a.rdt_rootnode_d);

  mixture_offset_d.assign(arg_a.mixture_offset_d);
  map_stat_to_trans_d.assign(arg_a.map_stat_to_trans_d);
  stat_models_d.assign(arg_a.stat_models_d);
  
  // assign DecisionTreeBase and exit gracefully
  //
  return DecisionTreeBase<RegressionDecisionTreeNode>::assign(arg_a);
}

// method: eq
//
// arguments:
//  const RegressionDecisionTree& arg: (input) object to be compared
//
// return: a boolean value indicating status
//
// this method checks whether the current object is identical to the
// input object
//
boolean RegressionDecisionTree::eq(const RegressionDecisionTree& arg_a) const {
  
  // compare the data members
  //
  if ((algorithm_d != arg_a.algorithm_d) ||
      (implementation_d != arg_a.implementation_d) ||
      (num_terminals_d != arg_a.num_terminals_d) ||
      (!rdt_rootnode_d.eq(arg_a.rdt_rootnode_d)) ||
      (!DecisionTreeBase<RegressionDecisionTreeNode>::eq(arg_a))) {
    return false;
  }
  
  // exit gracefully
  //
  return true;
}

// method: clear
//
// arguments:
//  Integral::CMODE ctype: (input) clear mode
//
// return: a boolean value indicating status
//
// this method resets the data members to the default values
//
boolean RegressionDecisionTree::clear(Integral::CMODE ctype_a) {
  
  // reset the data members unless the mode is RETAIN
  //
  if (ctype_a != Integral::RETAIN) {
    
    // clear the design parameters
    //
    algorithm_d = DEF_ALGORITHM;
    implementation_d = DEF_IMPLEMENTATION;

    num_terminals_d = DEF_NUM_TERMINALS;
    
  }
  
  // exit gracefully
  //
  return DecisionTreeBase<RegressionDecisionTreeNode>::clear(ctype_a);
}

//-----------------------------------------------------------------------------
//
// we define non-integral constants in the default constructor
//      
//-----------------------------------------------------------------------------

// constants: class name
//
const String RegressionDecisionTree::CLASS_NAME(L"RegressionDecisionTree");

// constants: i/o related constants
//
const String RegressionDecisionTree::DEF_PARAM(L"");
const String RegressionDecisionTree::PARAM_ALGORITHM(L"algorithm");
const String RegressionDecisionTree::PARAM_IMPLEMENTATION(L"implementation");
const String RegressionDecisionTree::PARAM_SUPERVISION_MODE(L"supervision_mode");
const String RegressionDecisionTree::PARAM_SEQUENCE_MODE(L"sequence_mode");
const String RegressionDecisionTree::PARAM_SPEECH_FLAG(L"speech_flag");
const String RegressionDecisionTree::PARAM_NUM_TERMINALS(L"num_terminals");
const String RegressionDecisionTree::PARAM_PERTURB_DEPTH(L"perturb_depth");
const String RegressionDecisionTree::PARAM_OCC_THRESHOLD(L"occ_threshold");
const String RegressionDecisionTree::PARAM_COMPONENTS_THRESHOLD(L"components_threshold");
const String RegressionDecisionTree::PARAM_MIXTURE_OFFSET(L"mixture_offset");
const String RegressionDecisionTree::PARAM_MAP_STAT_TO_TRANS(L"map_stat_to_trans");

const String RegressionDecisionTree::PARAM_BDT(L"base_dt");

// constants: name map(s) for the enumerated values
//
const NameMap RegressionDecisionTree::ALGO_MAP(L"MLLR");
const NameMap RegressionDecisionTree::IMPL_MAP(L"MEAN, VARIANCE, COMBINED");
const NameMap RegressionDecisionTree::SUP_MODE_MAP(L"SUPERVISED, UNSUPERVISED");
const NameMap RegressionDecisionTree::SEQ_MODE_MAP(L"BATCH, INCREMENTAL");

// static instantiations: memory manager
//
MemoryManager RegressionDecisionTree::mgr_d(sizeof(RegressionDecisionTree), RegressionDecisionTree::name());
