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

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

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

ZestLoopTokenSet.getToken介绍

[英]returns the token at a given index.
[中]返回给定索引处的标记。

代码示例

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

/**
 * main construptor.
 *
 * @param initializationTokenSet the set of token and the fisrt value to consider inside the
 *     loop
 */
protected ZestLoopState(ZestLoopTokenSet<T> initializationTokenSet) {
  if (initializationTokenSet == null) {
    throw new IllegalArgumentException("a null token set is not allowed");
  }
  if (initializationTokenSet.size() > 0) {
    this.currentToken = initializationTokenSet.getToken(0);
    this.currentIndex = 0;
  }
}

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

@Override
public boolean increase(ZestLoopTokenSet<String> set) {
  this.increaseIndex();
  if (this.getCurrentIndex() >= set.size()) {
    this.setCurrentToken(null);
  } else {
    this.setCurrentToken(set.getToken(getCurrentIndex()));
  }
  return true;
}

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

@Test
  public void testDeepCopy() {
    ZestLoopTokenStringSet set = new ZestLoopTokenStringSet(arrayValueS);
    ZestLoopTokenSet<String> copy = set.deepCopy();
    for (int i = 0; i < set.size(); i++) {
      String expected = set.getToken(i);
      String obtained = copy.getToken(i);
      String msg = i + " obtained " + obtained + " instead of " + expected;
      assertTrue(msg, expected.equals(obtained));
    }
  }
}

相关文章