gpt4 book ai didi

org.mozilla.zest.core.v1.ZestLoopTokenStringSet类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:34:24 26 4
gpt4 key购买 nike

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

ZestLoopTokenStringSet介绍

[英]The Class ZestLoopTokenStringSet.
[中]类ZestLoopTokenStringSet。

代码示例

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

@Override
public ZestLoopTokenStringSet deepCopy() {
  if (this.tokens == null) {
    return new ZestLoopTokenStringSet();
  }
  ZestLoopTokenStringSet copy = new ZestLoopTokenStringSet();
  for (String token : this.tokens) {
    copy.addToken(token);
  }
  return copy;
}

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

/**
 * Gets the values.
 *
 * @return the values
 */
public String[] getValues() {
  ZestLoopTokenStringSet set = this.getSet();
  String[] array = new String[set.size()];
  for (int i = 0; i < array.length; i++) {
    array[i] = set.getToken(i);
  }
  return array;
}

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

public List<String> getTokens() {
  try {
    return Collections.unmodifiableList(getConvertedSet().getTokens());
  } catch (ZestClientFailException e) {
    return null;
  }
}

代码示例来源: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));
    }
  }
}

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

@Test
public void testRemoveToken() {
  ZestLoopTokenStringSet set = new ZestLoopTokenStringSet(arrayValueS);
  String tokenRemoved = set.getToken(0);
  boolean isPresentBeforeRemove = set.indexOf(tokenRemoved) >= 0;
  set.removeToken(0);
  assertTrue(isPresentBeforeRemove && set.indexOf(tokenRemoved) < 0);
}

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

@Test
public void testSize() {
  ZestLoopTokenStringSet set = new ZestLoopTokenStringSet(arrayValueS);
  int prevSize = set.size();
  set.addToken("ernvgqiup");
  assertTrue(prevSize == arrayValueS.length && set.size() == prevSize + 1);
}

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

@Test
public void testIndexOf() {
  ZestLoopTokenStringSet set = new ZestLoopTokenStringSet(arrayValueS);
  int indexConsidered = 3;
  String token = set.getToken(indexConsidered);
  int indexFound = set.indexOf(token);
  assertTrue(indexFound == indexConsidered);
}

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

@Test
public void testReplace() {
  int indexOfReplace = 2;
  String valueOfNewToken = "CHANGED";
  ZestLoopTokenStringSet set = new ZestLoopTokenStringSet(arrayValueS);
  String newToken = valueOfNewToken;
  set.replace(indexOfReplace, newToken);
  assertTrue(set.getToken(indexOfReplace).equals(valueOfNewToken));
}

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

@Test
public void testGetToken() {
  ZestLoopTokenStringSet set = new ZestLoopTokenStringSet(arrayValueS);
  for (int i = 0; i < arrayValueS.length; i++) {
    String msg = i + " expected " + arrayValueS[i] + ", obtained " + set.getToken(i);
    assertTrue(msg, arrayValueS[i].equals(set.getToken(i)));
  }
}

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

@Test
public void testZestLoopTokenSetString() {
  ZestLoopTokenStringSet set = new ZestLoopTokenStringSet();
  assertFalse(set.getTokens() == null);
}

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

/**
 * Instantiates a new zest loop state string.
 *
 * @param values the values
 */
public ZestLoopStateString(String[] values) {
  this(new ZestLoopTokenStringSet(values));
}

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

@Override
public int size() {
  try {
    return this.getConvertedSet().size();
  } catch (ZestClientFailException e) {
    return -1;
  }
}

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

@Override
public String getToken(int index) {
  try {
    return this.getConvertedSet().getToken(index);
  } catch (ZestClientFailException e) {
    return null;
  }
}

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

@Override
public int indexOf(String token) {
  try {
    return getConvertedSet().indexOf(token);
  } catch (ZestClientFailException e) {
    return -1;
  }
}

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

@Override
public ZestLoopTokenFileSet deepCopy() {
  try {
    ZestLoopTokenFileSet copy = new ZestLoopTokenFileSet(pathToFile);
    copy.convertedSet = this.getConvertedSet().deepCopy();
    return copy;
  } catch (FileNotFoundException e) {
    e.printStackTrace();
  }
  return null;
}

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

@Override
public String getLastToken() {
  try {
    return getConvertedSet().getLastToken();
  } catch (ZestClientFailException e) {
    return null;
  }
}

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

/**
 * Instantiates a new zest loop string.
 *
 * @param index the index of the statement
 * @param values the values
 */
public ZestLoopString(int index, String[] values) {
  super(index);
  this.set = new ZestLoopTokenStringSet(values);
  super.init(set, new LinkedList<ZestStatement>());
}

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

@Override
public int size() {
  try {
    return this.getConvertedSet().size();
  } catch (ZestClientFailException e) {
    return -1;
  }
}

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

@Override
public String getToken(int index) {
  try {
    return this.getConvertedSet().getToken(index);
  } catch (ZestClientFailException e) {
    return null;
  }
}

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

@Override
public int indexOf(String token) {
  try {
    return getConvertedSet().indexOf(token);
  } catch (ZestClientFailException e) {
    return -1;
  }
}

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