org.mozilla.zest.core.v1.ZestExpressionOr.getChildrenCondition()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中org.mozilla.zest.core.v1.ZestExpressionOr.getChildrenCondition()方法的一些代码示例,展示了ZestExpressionOr.getChildrenCondition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestExpressionOr.getChildrenCondition()方法的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestExpressionOr
类名称:ZestExpressionOr
方法名:getChildrenCondition

ZestExpressionOr.getChildrenCondition介绍

暂无

代码示例

代码示例来源:origin: mozilla/zest

@Override
public boolean isTrue(ZestRuntime runtime) {
  boolean toReturn = false;
  for (ZestExpressionElement con : getChildrenCondition()) {
    toReturn = toReturn || con.evaluate(runtime); // compute OR for each
    // child
    if (toReturn) {
      break; // lazy evaluation
    }
  }
  return toReturn;
}

代码示例来源:origin: mozilla/zest

@Override
public ZestExpressionOr deepCopy() {
  List<ZestExpressionElement> copyChildren = new LinkedList<>();
  if (getChildrenCondition() != null) {
    for (int i = 0; i < getChildrenCondition().size(); i++) {
      copyChildren.add(getChildrenCondition().get(i).deepCopy());
    }
  }
  ZestExpressionOr copy = new ZestExpressionOr(copyChildren);
  copy.setInverse(isInverse());
  return copy;
}

代码示例来源:origin: mozilla/zest

@Override
  public String toString() {
    if (this.getChildrenCondition() == null || this.getChildrenCondition().isEmpty()) {
      return "Empty OR";
    }
    StringBuilder expression = new StringBuilder(150);
    if (isInverse()) {
      expression.append("NOT ");
    }
    expression.append('(');
    int i = 0;
    for (; i < this.getChildrenCondition().size() - 1; i++) {
      expression.append(this.getChild(i).toString()).append(" OR ");
    }
    expression.append(this.getChild(i).toString()).append(')');
    return expression.toString();
  }
}

代码示例来源:origin: mozilla/zest

public void testOrDeepCopySingleAndSameChildrenSize() {
  ZestExpressionOr or = new ZestExpressionOr();
  or.addChildCondition(new ZestExpressionStatusCode(100));
  or.addChildCondition(new ZestExpressionLength("response.body", 1, 1));
  ZestExpressionOr copy = or.deepCopy();
  assertTrue(or.getChildrenCondition().size() == copy.getChildrenCondition().size());
}

代码示例来源:origin: mozilla/zest

System.out.print("OR: (");
for (lastChildPrinted = 0;
    lastChildPrinted < orElement.getChildrenCondition().size() - 1;
    lastChildPrinted++) {
  printExpression(orElement.getChild(lastChildPrinted), indent + 1);

相关文章