// file: ngram_node.h
//
// this is the header file for the Ngram_node class
//

// make sure definitions are made only once
//
#ifndef __ISIP_NGRAM_NODE
#define __ISIP_NGRAM_NODE

// isip include files
//
#ifndef __ISIP_INTEGRAL
#include <integral.h>
#endif

#ifndef __ISIP_INTEGRAL_CONSTANTS
#include <integral_constants.h>
#endif

#ifndef __ISIP_WORD
#include <word.h>
#endif

// ngram_node: a class that is used to store ngram node
//
class Ngram_node {

  //---------------------------------------------------------------------------
  //
  // protected data
  //
  //---------------------------------------------------------------------------
protected:

  // word represented in this node
  //
  Word* word_d;

  // a pointer to the first ngram node in the next order ngram list
  //
  Ngram_node** next_node_d;
  int_4 num_next_nodes_d;
  
  // lm and backoff score information
  //
  float_4 lmscore_d;
  float_4 backoff_d;
  
  //---------------------------------------------------------------------------
  //
  // public methods
  //
  //---------------------------------------------------------------------------
public:
  
  // required methods
  //
  char_1* name_cc();
  volatile void error_handler_cc(char_1* mname, char_1* msg);
  logical_1 debug_cc(FILE* fp, char_1* message);
  int_4 size_cc();
  
  // destructors/constructors
  //
  ~Ngram_node();                                     // destructor
  Ngram_node();                                      // default constructor
  Ngram_node(Word* word, Ngram_node** next, float_4 lmscore,
	     float_4 backoff, int_4 num_next_nodes); // overloaded
  Ngram_node(Ngram_node& ngram_node);                // copy constructor
  
  // set methods
  //
  logical_1 set_word_cc(Word* word) {
    word_d = word;
    return ISIP_TRUE;
  }

  logical_1 set_next_node_cc(Ngram_node** next) {
    next_node_d = next;
    return ISIP_TRUE;
  }

  logical_1 set_lmscore_cc(float_4 score) {
    lmscore_d = score;
    return ISIP_TRUE;
  }
  
  logical_1 set_backoff_cc(float_4 score) {
    backoff_d = score;
    return ISIP_TRUE;
  }

  logical_1 set_num_next_nodes_cc(int_4 num_next) {
    num_next_nodes_d = num_next;
    return ISIP_TRUE;
  }
  
  // get methods
  //
  Word* get_word_cc() {
    return word_d;
  }

  Ngram_node** get_next_node_cc() {
    return next_node_d;
  }

  float_4 get_lmscore_cc() {
    return lmscore_d;
  }

  float_4 get_backoff_cc() {
    return backoff_d;
  }

  int_4 get_num_next_nodes_cc() {
    return num_next_nodes_d;
  }
  
  // clear the contents of the ngram node
  //
  logical_1 clear_cc();
  
  //---------------------------------------------------------------------------
  //
  // private methods
  //
  //---------------------------------------------------------------------------
private:
  
};

// end of file
// 
#endif
