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()) {
66 if (class_id_cost_ ==
NULL) {
69 class_id_cost_ =
new int[class_cnt];
70 if (class_id_cost_ ==
NULL) {
74 for (
int ich = 0; ich < class_cnt; ich++) {
79 if (class_id < 0 || class_id >= char_set_->
ClassCount()) {
90 class_id_cost_[class_id] = cost;
97 for (
int alt_idx = 0; alt_idx <
alt_cnt_; alt_idx++) {
98 for (
int alt = alt_idx + 1; alt <
alt_cnt_; alt++) {
100 int temp = class_id_alt_[alt_idx];
101 class_id_alt_[alt_idx] = class_id_alt_[alt];
102 class_id_alt_[alt] = temp;
bool Insert(int class_id, int cost, void *tag=NULL)
CharAltList(const CharSet *char_set, int max_alt=kMaxCharAlt)