PRuleSpecial::PRuleSpecial(CRule* pRule,bool bReadOnly) : CPropertyPage(PRuleSpecial::IDD) { m_pRule = pRule; m_bReadOnly = bReadOnly; //{{AFX_DATA_INIT(PRuleSpecial) m_nRun = get_run(m_pRule->bS_DoubleForRun, m_pRule->bS_DoubleForDeclaredRun, m_pRule->bS_StaticRun); m_bS_NoFriend = m_pRule->bS_DoubleForNoFriend; m_bS_NoKiruda = m_pRule->bS_DoubleForNoKiruda; m_bS_ReverseRun = m_pRule->bS_DoubleForReverseRun; m_nReverseRun = get_reverse(m_pRule->bS_AGoalReverse, m_pRule->bS_A11Reverse, m_pRule->bS_AMReverse); //}}AFX_DATA_INIT }
void Replace_Selection(LoserTree &ls, WorkArea &wa, FILE *fi, FILE *fo) { // 算法11.4 // 在败者树ls和内存工作区wa上用置换-选择排序求初始归并段,fi为输入文 // 件(只读文件)指针,fo为输出文件(只写文件)指针,两文件均已打开 RcdType RUNEND_SYMBOL; // 段结束标志 RUNEND_SYMBOL.key=MAXKEY; Construct_Loser (ls, wa); // 初建败者树 rc = rmax = 1; // rc指示当前生成的初始归并段的段号, // rmax指示wa中关键字所属初始归并段的最大段号 while (rc <= rmax) { // "rc=rmax+1"标志输入文件的置换-选择排序已完成 get_run(ls, wa); // 求得一个初始归并段 fwrite(&RUNEND_SYMBOL, sizeof(RcdType), 1, fo); // 将段结束标志写入输出文件 rc = wa[ls[0]].rnum; // 设置下一段的段号 } } // Replace_Selection