// file: $isip/class/pr/NGramNode/nnode_00.cc
// version: $Id: nnode_00.cc 8731 2002-09-29 17:56:46Z huang $
//

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

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

// method: eq
//
// arguments:
//  const NGramNode& 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 NGramNode::eq(const NGramNode& arg_a) const {

  // compare all protected data
  //
  if ( !(lm_score_d.almostEqual(arg_a.lm_score_d)) ||
       !(backoff_d.almostEqual(arg_a.backoff_d))) {
    return false;
  }
  else if (next_gram_d != NULL) {
    if (arg_a.next_gram_d == NULL) {
      return false;
    }
    else if (!(next_gram_d->eq(*(arg_a.next_gram_d)))) {
      return false;
    }
  }
  else if (arg_a.next_gram_d != NULL) {
    return false;
  }
  return true;
}

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

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

// constants: i/o related
//
const String NGramNode::DEF_PARAM(L"");
const String NGramNode::PARAM_INDEX(L"index");
const String NGramNode::PARAM_LM_SCORE(L"lm_score");
const String NGramNode::PARAM_BACKOFF(L"backoff");
const String NGramNode::PARAM_NEXT_GRAM(L"next_gram");
const String NGramNode::PARAM_HASH(L"next_ngram_d");

// constants: i/o related constants
//
const long NGramNode::DEF_INDEX((long)0);
const float NGramNode::DEF_LM_SCORE(-1.0e10);
const float NGramNode::DEF_BACKOFF((float)0);

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

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

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