Go to the documentation of this file.
3 void olap_resolve(mstr_struc *mstr,
int mstr_last,
int new_start,
int new_end,
36 int cum_cur, cum_new, *ca_cur, *ca_new,
i, olap_st, olap_en, n_olap,
45 if (new_end < mstr_last) {
50 printf(
"olap_resolve: overlap is inside current range\n");
52 for (
i = new_start;
i < new_end;
i++) {
53 if (mstr->exist[
i] == 0)
55 else if (mstr->qual[
i] != 0)
58 if (mstr->in_exist[
i] == 0)
60 else if (mstr->in_qual[
i] != 0)
63 printf(
"olap_resolve: cum_new = %d, cum_cur = %d\n", cum_new, cum_cur);
64 if (cum_new < cum_cur) {
69 printf(
"olap_resolve: new data better, cum_new = %d, cum_cur = %d\n",
71 for (
i = new_start;
i < (new_end + 1);
i++) {
72 mstr->exist[
i] = mstr->in_exist[
i];
73 mstr->qual[
i] = mstr->in_qual[
i];
75 mstr->msec[
i] = mstr->in_msec[
i];
76 mstr->scan[
i] = mstr->in_scan[
i];
79 printf(
"olap_resolve: current data has equal of better quality\n");
84 printf(
"olap_resolve: overlap is at / beyond the current end\n");
87 n_olap = olap_en - olap_st + 1;
91 ca_cur = malloc(n_olap *
sizeof (
int));
92 ca_new = malloc(n_olap *
sizeof (
int));
97 for (
i = 0;
i < n_olap;
i++) {
98 if (mstr->exist[
i + olap_st ] == 0)
100 else if (mstr->qual[
i + olap_st ] != 0)
105 if (mstr->in_exist[ olap_en -
i ] == 0)
107 else if (mstr->in_qual[ olap_en -
i ] != 0)
110 ca_new[ n_olap - 1 -
i ] = cum_new;
112 printf(
"olap_resolve: current total bad: %d, new total bad: %d\n",
120 for (
i = 0;
i < n_olap;
i++) {
121 if ((ca_new[
i] + ca_cur[
i]) < sum) {
122 sum = ca_new[
i] + ca_cur[
i];
126 printf(
"olap_resolve: break at line %d of overlap, total # olap = %d\n",
128 printf(
"olap_resolve: lowest sum is %d\n", sum);
133 if (break_scan < (n_olap - 1)) {
134 for (
i = break_scan;
i < n_olap;
i++) {
135 mstr->exist[
i + olap_st ] = mstr->in_exist[
i + olap_st ];
136 mstr->qual[
i + olap_st ] = mstr->in_qual[
i + olap_st ];
137 mstr->ds_num[
i + olap_st ] =
ds_num;
138 mstr->msec[
i + olap_st ] = mstr->in_msec[
i + olap_st ];
139 mstr->scan[
i + olap_st ] = mstr->in_scan[
i + olap_st ];
void olap_resolve(mstr_struc *mstr, int mstr_last, int new_start, int new_end, int ds_num)