// file: ngrm_set_2.cc
//

// isip include files
//
#include "ngram.h"
#include "ngram_constants.h"

// method: set_list_cc
//
// arguments:
//  int_4 index: (input) index of the ngram list
//  Ngram_list* ngram_list: (input) ngram list to set
//
// return: a logical_1 indicating status
//
// this method sets a particular ngram node list at the specified
// index
//
logical_1 Ngram::set_list_cc(int_4 index_a, Ngram_list* ngram_list_a) {

  // make sure there is memory
  //
  if ((ngram_order_d == (int_4)0) || (ngram_lists_d == (Ngram_list**)NULL)) {
    error_handler_cc((char_1*)"set_list_cc",
		     (char_1*)"memory in ngram not initialized");
  }

  // check the validity of the index
  //
  if ((index_a < 0) || (index_a > ngram_order_d - 1)) {
    error_handler_cc((char_1*)"set_list_cc",
		     (char_1*)"invalid list index");
  }
  
  // set the desired ngram list
  //
  ngram_lists_d[index_a] = ngram_list_a;
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
