gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-13 09:41:18 27 4
gpt4 key购买 nike

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

ZestConditional.removeElse介绍

[英]Removes an else.
[中]移除一个其他的。

代码示例

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

/**
 * Removes an else statement.
 *
 * @param index the index of the else statement to remove
 */
public void removeElseStatement(int index) {
  this.removeElse(this.elseStatements.get(index));
}

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

/**
 * Moves an else.
 *
 * @param index the destination of the else statement
 * @param req the else statement to move
 */
public void moveElse(int index, ZestStatement req) {
  this.removeElse(req);
  this.addElse(index, req);
}

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

@Override
public void move(int index, ZestStatement stmt) {
  if (this.ifStatements.contains(stmt)) {
    this.removeIf(stmt);
    this.addIf(index, stmt);
  } else if (this.elseStatements.contains(stmt)) {
    this.removeElse(stmt);
    this.addElse(index, stmt);
  } else {
    throw new IllegalArgumentException("Not a direct child: " + stmt);
  }
}

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

/**
 * Method testRemoveMiddleElse.
 *
 * @throws Exception
 */
@Test
public void testRemoveMiddleElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.removeElse(req2);
  checkOrder(new ZestStatement[] {zc, req1, req3, null});
}

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

/**
 * Method testRemoveFirstElse.
 *
 * @throws Exception
 */
@Test
public void testRemoveFirstElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.removeElse(req1);
  checkOrder(new ZestStatement[] {zc, req2, req3, null});
}

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

/**
 * Method testRemoveMiddleElse.
 *
 * @throws Exception
 */
@Test
public void testRemoveMiddleElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.removeElse(req2);
  checkOrder(new ZestStatement[] {zc, req1, req3, null});
}

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

/**
 * Method testRemoveLastElse.
 *
 * @throws Exception
 */
@Test
public void testRemoveLastElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.removeElse(req3);
  checkOrder(new ZestStatement[] {zc, req1, req2, null});
}

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

/**
 * Method testRemoveFirstElse.
 *
 * @throws Exception
 */
@Test
public void testRemoveFirstElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.removeElse(req1);
  checkOrder(new ZestStatement[] {zc, req2, req3, null});
}

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

/**
 * Method testRemoveLastElse.
 *
 * @throws Exception
 */
@Test
public void testRemoveLastElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.removeElse(req3);
  checkOrder(new ZestStatement[] {zc, req1, req2, null});
}

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

zc1.removeElse(zc3);
checkOrder(new ZestStatement[] {zc1, req1, zc2, req2, req3, req5, zc4, req6, null});

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

zc1.removeElse(zc3);
checkOrder(new ZestStatement[] {zc1, req1, zc2, req2, req3, req5, zc4, req6, null});

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com