// file: latn_clear_0.cc
//

// isip include files
//
#include "lattice_node.h"
#include "lattice_node_constants.h"

#include <lex_tree.h>
#include <lex_tree_constants.h>

// method: clear_cc
//
// arguments: none
//
// return:  a logical_1 indicating status
//
// this method resets the contents of the lattice node
//
logical_1 Lattice_node::clear_cc() {

  // reset node statistics
  //
  type_d = LATTICE_NODE_DEFAULT_TYPE;
  word_d = (Word*)NULL;
  pron_variant_d = LATTICE_NODE_DEFAULT_PRON_VAR;
  node_index_d = LATTICE_NODE_DEFAULT_INDEX;
  frame_d = (int_4)0;
  num_arcs_in_d = (int_4)0;
  num_arcs_out_d = (int_4)0;
  
  // delete node pointers (note that we need not delete the items in
  // in the nodes because they are only pointers to nodes held by the
  // lnode_d structure in Lattice)
  //
  if (prev_nodes_d != (Link_list*)NULL) {
    delete prev_nodes_d;
    prev_nodes_d = (Link_list*)NULL;
  }
  if (next_nodes_d != (Link_list*)NULL) {
    delete next_nodes_d;
    next_nodes_d = (Link_list*)NULL;
  }

  // delete lm scores
  //
  if (lm_scores_d != (float_4*)NULL) {
    delete [] lm_scores_d;
    lm_scores_d = (float_4*)NULL;
  }

  // delete ac scores
  //
  if (ac_scores_d != (float_4*)NULL) {
    delete [] ac_scores_d;
    ac_scores_d = (float_4*)NULL;
  }
  
  // the lexical tree contained here will be deleted externally
  //
  if (lex_tree_d != (Lex_tree*)NULL) {
    lex_tree_d = (Lex_tree*)NULL;
  }

  // exit gracefully
  //
  return ISIP_TRUE;
}
