// file: $isip/class/stat/NGramModel/ngrm_00.cc
// version: $Id: ngrm_00.cc 8546 2002-08-08 21:53:44Z zheng $
//

// isip include files
//
#include "NGramModel.h"
 
//------------------------------------------------------------------------
//
// required public methods
//
//-----------------------------------------------------------------------

// method: eq
//
// arguments:
//  const NGramModel& arg: (input) input object to assign
//
// return: a boolean value indicating status
//
// this method checks whether the current object is identical to the
// input object
//
boolean NGramModel::eq(const NGramModel& arg_a) const {

  // compare all protected data
  //
  if ( !(order_d == arg_a.order_d) ||
       !(gram_hash_d.eq(arg_a.gram_hash_d))) {
    return false;
  }
  else {
    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 NGramModel::clear(Integral::CMODE ctype_a) {

  // reset all protected data
  //
  order_d = DEF_ORDER;
  
  if (ctype_a == Integral::FREE) {
    gram_hash_d.clear(ctype_a);
  }

  // exit gracefully
  //
  return true; 
}

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

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

// constants: i/o related
//
const String NGramModel::PARAM_ORDER(L"order");
const String NGramModel::PARAM_KEYS(L"keys");
const String NGramModel::PARAM_VALUES(L"values");
const String NGramModel::PARAM_GRAM_HASH(L"gram_hash_table");

// constants: i/o related constants
//
const String NGramModel::DEF_PARAM(L"");
const Long NGramModel::DEF_ORDER(0);
const Float NGramModel::DEF_LM_SCORE(0.0);

// constants: NameMap(s) for the enumerated values
//

// static instantiations: debug level
//
Integral::DEBUG NGramModel::debug_level_d = Integral::NONE;

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