本文整理汇总了C#中CSsemi.CSemiExp.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# CSsemi.CSemiExp.Contains方法的具体用法?C# CSsemi.CSemiExp.Contains怎么用?C# CSsemi.CSemiExp.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSsemi.CSemiExp
的用法示例。
在下文中一共展示了CSsemi.CSemiExp.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: complexityAnalysis
public int complexityAnalysis(Elem e, object file, List<Elem> fileSetInfo)
{
int count = 0;
CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
semi.open(file as string);
do
{
semi.getSemi();
} while (semi.lineCount < e.begin); // ignore all the semi before function begin
while (semi.lineCount <= e.end)
{
if (semi.Contains("if") != -1)
count++;
if (semi.Contains("else") != -1)
count++;
if (semi.Contains("for") != -1)
count++;
if (semi.Contains("foreach") != -1)
count++;
if (semi.Contains("while") != -1 && semi[semi.count - 1] != ";")
count++;
if (semi.Contains("do") != -1)
count++;
if (semi.Contains("case") != -1)
count++;
if (semi.Contains("try") != -1)
count++;
if (semi.Contains("catch") != -1)
count++;
if (specialCB(semi)) // special curly brace
count++;
semi.getSemi();
}
return count;
}
示例2: ComplexityAnalyze
public int ComplexityAnalyze(Elem e, Object file)
{
CSsemi.CSemiExp local = new CSsemi.CSemiExp();
local.open(file as string);
int complexity = 1;
while(local.lineCount<e.begin)
{
local.getSemi();
}
while(local.lineCount <= e.end)
{
local.getSemi();
if (local.Contains("if") != -1)
complexity++;
if (local.Contains("else") != -1)
complexity++;
if (local.Contains("for") != -1)
complexity++;
if (local.Contains("foreach") != -1)
complexity++;
if (local.Contains("while") != -1)
complexity++;
if (local.Contains("try") != -1)
complexity++;
if (local.Contains("catch") != -1)
complexity++;
if (local.Contains("case") != -1)
complexity++;
}
return complexity;
}