// file: $isip/class/pr/PhoneticDecisionTree/pdt_00.cc
// version: $Id: pdt_00.cc 8688 2002-09-11 20:04:08Z parihar $
//

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

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

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

  // assign data from the input PhoneticDecisionTree object
  //
  algorithm_d = arg_a.algorithm_d;
  implementation_d = arg_a.implementation_d;
  split_threshold_d = arg_a.split_threshold_d;
  merge_threshold_d = arg_a.merge_threshold_d;
  num_occ_threshold_d = arg_a.num_occ_threshold_d;
  
  pdt_rootnode_d.assign(arg_a.pdt_rootnode_d);
  
  // assign DecisionTreeBase and exit gracefully
  //
  return DecisionTreeBase<PhoneticDecisionTreeNode>::assign(arg_a);
}

// method: eq
//
// arguments:
//  const PhoneticDecisionTree& 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 PhoneticDecisionTree::eq(const PhoneticDecisionTree& arg_a) const {
  
  // compare the data members
  //
  if ((algorithm_d != arg_a.algorithm_d) ||
      (implementation_d != arg_a.implementation_d) ||
      (split_threshold_d != arg_a.split_threshold_d) ||
      (merge_threshold_d != arg_a.merge_threshold_d) ||
      (num_occ_threshold_d != arg_a.num_occ_threshold_d) ||
      (!pdt_rootnode_d.eq(arg_a.pdt_rootnode_d)) ||
      (!DecisionTreeBase<PhoneticDecisionTreeNode>::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 PhoneticDecisionTree::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;
    split_threshold_d = DEF_SPLIT_THRESHOLD;  
    merge_threshold_d = DEF_MERGE_THRESHOLD;
    num_occ_threshold_d = DEF_NUM_OCC_THRESHOLD;
  }
  
  // exit gracefully
  //
  return DecisionTreeBase<PhoneticDecisionTreeNode>::clear(ctype_a);
}

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

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

// constants: i/o related constants
//
const String PhoneticDecisionTree::DEF_PARAM(L"");
const String PhoneticDecisionTree::PARAM_ALGORITHM(L"algorithm");
const String PhoneticDecisionTree::PARAM_IMPLEMENTATION(L"implementation");
const String PhoneticDecisionTree::PARAM_SPLIT_THRESHOLD(L"split_threshold");
const String PhoneticDecisionTree::PARAM_MERGE_THRESHOLD(L"merge_threshold");
const String PhoneticDecisionTree::PARAM_NUM_OCC_THRESHOLD(L"num_occ_threshold");
const String PhoneticDecisionTree::PARAM_BDT(L"base_dt");

// constants: other
//
const String PhoneticDecisionTree::YES(L"yes");
const String PhoneticDecisionTree::NO(L"no");
const String PhoneticDecisionTree::CPH(L"cph");
const String PhoneticDecisionTree::POS(L"pos");

// constants: name map(s) for the enumerated values
//
const NameMap PhoneticDecisionTree::ALGO_MAP(L"ML");
const NameMap PhoneticDecisionTree::IMPL_MAP(L"DEFAULT");

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

