📄 testdlg.cpp
字号:
{
if(reliability == atof(pRuleTable[j][iAttNum+1]))
{
if(totalnum < atoi(pRuleTable[j][iAttNum+2]))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
}//end if
else
{
if(totalnum == atoi(pRuleTable[j][iAttNum+3]))
{
if(reliability < atof(pRuleTable[j][iAttNum+1]))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
}//end if
else
{
if(totalnum < atoi(pRuleTable[j][iAttNum+3]))
{
if(reliability < atof(pRuleTable[j][iAttNum+1]))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
else
{
if(coveragenum/(totalnum*totalnum) >
atoi(pRuleTable[j][iAttNum+2])/(atoi(pRuleTable[j][iAttNum+3])*atoi(pRuleTable[j][iAttNum+3])))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
}//end else
}//end if
else
{
if(reliability < atof(pRuleTable[j][iAttNum+1]))
{
if((coveragenum*coveragenum)/totalnum <
(atoi(pRuleTable[j][iAttNum+2])*atoi(pRuleTable[j][iAttNum+2]))/atoi(pRuleTable[j][iAttNum+3]))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
}//end if
}//end else
}//end else
}//end else
}//end else
}//end if
}//end for
m_strResult = d;
m_strRule.Format("%d",temp1+1);
delete[] temp;
delete[] d;
}
void CTestDlg::SampleRecogniseFew()
{
int j,k;
int* temp;
int temp1 = -1;
float reliability;
int totalnum;
int coveragenum;
int n = 0;
int pos;
char* d;
d = new char[MAX];
temp = new int[iRuleNum];
CString tempstring;
CString trimstring;
CString compstring;
for(j = 0;j < iRuleNum;j++)
temp[j] = 0;
for(j = 0;j < iRuleNum;j++)
{
for(k = 0;k < iAttNum;k++)
{
if(strcmp(pRuleTable[j][k],"-") == 0)
continue;
tempstring = pRuleTable[j][k];
if(tempstring[0] == '[')
{
pos = tempstring.Find(',');
trimstring = tempstring.Left(pos);
trimstring.Remove('[');
if(strcmp(trimstring,"*") != 0)
{
if(atof(trimstring) > atof(pTestData[k]))
break;
}//end if
trimstring = tempstring;
trimstring.Delete(0,pos+1);
trimstring.Remove(')');
if(strcmp(trimstring,"*") != 0)
if(atof(trimstring) <= atof(pTestData[k]))
break;
}//end if
else if(tempstring[0] == '{')
{
int m = 0;
trimstring = tempstring;
trimstring.Delete(0,1);
pos = trimstring.Find(',');
while(pos != -1)
{
compstring = trimstring.Left(pos);
trimstring.Delete(0,pos+1);
if(strcmp(compstring,pTestData[k]) == 0)
{
m =1;
break;
}//end if
pos = trimstring.Find(',');
}//end while
if(m == 0)
{
trimstring.Remove('}');
if(strcmp(trimstring,pTestData[k]) != 0)
break;
}//end if
}//end if
else
{
if(atoi(pRuleTable[j][k]) != atoi(pTestData[k]))
break;
}//end else
}//end for
if(k == iAttNum)
{
temp[j] = 1;
temp1 = j;
n++;
}//end if
}//end for
if(n != 0 && bBlock)
{
for(j = 0;j < iBlockNum;j++)
{
for(k = 0;k < iAttNum;k++)
{
if(strcmp(pBlockTable[j][k],"-") == 0)
continue;
tempstring = pBlockTable[j][k];
if(tempstring[0] == '[')
{
pos = tempstring.Find(',');
trimstring = tempstring.Left(pos);
trimstring.Remove('[');
if(strcmp(trimstring,"*") != 0)
{
if(atof(trimstring) > atof(pTestData[k]))
break;
}//end if
trimstring = tempstring;
trimstring.Delete(0,pos+1);
trimstring.Remove(')');
if(strcmp(trimstring,"*") != 0)
if(atof(trimstring) <= atof(pTestData[k]))
break;
}//end if
else if(tempstring[0] == '{')
{
int m = 0;
trimstring = tempstring;
trimstring.Delete(0,1);
pos = trimstring.Find(',');
while(pos != -1)
{
compstring = trimstring.Left(pos);
trimstring.Delete(0,pos+1);
if(strcmp(compstring,pTestData[k]) == 0)
{
m =1;
break;
}//end if
pos = trimstring.Find(',');
}//end while
if(m == 0)
{
trimstring.Remove('}');
if(strcmp(trimstring,pTestData[k]) != 0)
break;
}//end if
}//end if
else
if(atoi(pBlockTable[j][k]) != atoi(pTestData[k]))
break;
}//end for
if(k == iAttNum)
{
trimstring = pBlockTable[j][iAttNum];
trimstring.Delete(0,5);
if(temp[atoi(trimstring)] == 1)
{
temp[atoi(trimstring)] = 0;
n--;
}//end if
}//end if
}//end for
}//end if
if(n == 0)
{
m_strResult = "未识别";
m_strRule = " ";
return;
}//end if
if(n == 1)
{
for(j = 0;j < iRuleNum;j++)
{
if(temp[j] == 1)
break;
}//end for
m_strResult = pRuleTable[j][iAttNum];
m_strRule.Format("%d",temp1+1);
return;
}//end if
temp1 = -1;
for(j = 0;j < iRuleNum;j++)
{
if(temp[j] == 1)
{
if(temp1 == -1)
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
else
{
if(reliability == atof(pRuleTable[j][iAttNum+1]))
{
if(totalnum > atoi(pRuleTable[j][iAttNum+2]))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
}//end if
else
{
if(totalnum == atoi(pRuleTable[j][iAttNum+3]))
{
if(reliability < atof(pRuleTable[j][iAttNum+1]))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
}//end if
else
{
if(totalnum > atoi(pRuleTable[j][iAttNum+3]))
{
if(reliability < atof(pRuleTable[j][iAttNum+1]))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
else
{
if(coveragenum/(totalnum*totalnum) <
atoi(pRuleTable[j][iAttNum+2])/(atoi(pRuleTable[j][iAttNum+3])*atoi(pRuleTable[j][iAttNum+3])))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
}//end else
}//end if
else
{
if(reliability < atof(pRuleTable[j][iAttNum+1]))
{
if(coveragenum/(totalnum*totalnum) <
atoi(pRuleTable[j][iAttNum+2])/(atoi(pRuleTable[j][iAttNum+3])*atoi(pRuleTable[j][iAttNum+3])))
{
temp1 = j;
reliability = (float)atof(pRuleTable[j][iAttNum+1]);
coveragenum = atoi(pRuleTable[j][iAttNum+2]);
totalnum = atoi(pRuleTable[j][iAttNum+3]);
strcpy(d,pRuleTable[j][iAttNum]);
}//end if
}//end if
}//end else
}//end else
}//end else
}//end else
}//end if
}//end for
m_strResult = d;
m_strRule.Format("%d",temp1+1);
delete[] temp;
delete[] d;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -