当前位置: 首页>>代码示例>>C#>>正文


C# CSsemi.CSemiExp.Contains方法代码示例

本文整理汇总了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;
 }
开发者ID:bizarreWizard,项目名称:code_analyzer_engine,代码行数:35,代码来源:RulesAndActions.cs

示例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;
 }
开发者ID:DiyaChen,项目名称:DependencyAnalyzer,代码行数:31,代码来源:RulesAndActions.cs


注:本文中的CSsemi.CSemiExp.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。