31 class_id_cost_ = NULL;
35 if (class_id_alt_ != NULL) {
36 delete []class_id_alt_;
40 if (class_id_cost_ != NULL) {
41 delete []class_id_cost_;
42 class_id_cost_ = NULL;
49 if (class_id < 0 || class_id >= char_set_->
ClassCount()) {
54 if (class_id_alt_ == NULL ||
alt_cost_ == NULL) {
62 if (class_id_cost_ == NULL) {
65 class_id_cost_ =
new int[class_cnt];
67 for (
int ich = 0; ich < class_cnt; ich++) {
72 if (class_id < 0 || class_id >= char_set_->
ClassCount()) {
83 class_id_cost_[class_id] = cost;
90 for (
int alt_idx = 0; alt_idx <
alt_cnt_; alt_idx++) {
91 for (
int alt = alt_idx + 1; alt <
alt_cnt_; alt++) {
93 int temp = class_id_alt_[alt_idx];
94 class_id_alt_[alt_idx] = class_id_alt_[alt];
95 class_id_alt_[alt] = temp;
bool Insert(int class_id, int cost, void *tag=NULL)
CharAltList(const CharSet *char_set, int max_alt=kMaxCharAlt)