@Override
 public long complexity() {
   int complexity = 0;
   for (IRNode child : getChildren()) {
     complexity += child.complexity();
   }
   return complexity;
 }
示例#2
0
 @Override
 public boolean removeSelf() {
   IRNode header = getChildren().get(DoWhilePart.HEADER.ordinal());
   List<IRNode> siblings = getParent().getChildren();
   int index = siblings.indexOf(this);
   siblings.set(index++, loop.initialization);
   if (header instanceof Block) {
     siblings.addAll(index, header.getChildren());
   } else {
     siblings.add(index, header);
   }
   return true;
 }
示例#3
0
 @Override
 public long complexity() {
   IRNode header = getChild(DoWhilePart.HEADER.ordinal());
   IRNode body1 = getChild(DoWhilePart.BODY1.ordinal());
   IRNode body2 = getChild(DoWhilePart.BODY2.ordinal());
   return loop.initialization.complexity()
       + header.complexity()
       + thisLoopIterLimit
           * (body1.complexity()
               + loop.manipulator.complexity()
               + body2.complexity()
               + loop.condition.complexity());
 }
示例#4
0
文件: For.java 项目: gaoxiaojun/dync
 @Override
 public long complexity() {
   IRNode header = getChild(ForPart.HEADER.ordinal());
   IRNode statement1 = getChild(ForPart.STATEMENT1.ordinal());
   IRNode statement2 = getChild(ForPart.STATEMENT2.ordinal());
   IRNode body1 = getChild(ForPart.BODY1.ordinal());
   IRNode body2 = getChild(ForPart.BODY2.ordinal());
   IRNode body3 = getChild(ForPart.BODY3.ordinal());
   return loop.initialization.complexity()
       + header.complexity()
       + statement1.complexity()
       + thisLoopIterLimit
           * (loop.condition.complexity()
               + statement2.complexity()
               + body1.complexity()
               + loop.manipulator.complexity()
               + body2.complexity()
               + body3.complexity());
 }