Beispiel #1
0
 def _gen_line(self, method, statement):
     line = JOcLineTree(method)
     temp = [statement + ';']
     for i in range(random.randint(1, 5)):
         temp.append(JOcHelper.getOCSingleton() + ';')
     stats = []
     while len(temp) > 0:
         i = int(random.random() * len(temp))
         stats.append(temp[i])
         del temp[i]
     for ste in stats:
         line.statements.append(ste)
     return line
Beispiel #2
0
 def makeStatement(meth):
     # 赋值语句
     s = JOcMixHelper.makeAssignState(meth)
     if (s is not None):
         return s
     # 数学运算
     s = JOcMixHelper.mekeMathState(meth)
     if (s is not None):
         return s
     # 调用引用的类
     s = meth.mClass.useOtherClass(meth)
     if (s is not None):
         return s
     # 永远不报错
     return JOcHelper.getOCSingleton() + ';'