jline.console.history.History.size()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(196)

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

History.size介绍

暂无

代码示例

代码示例来源:origin: jline/jline

public int searchForwards(String searchTerm, int startIndex, boolean startsWith) {
  if (startIndex >= history.size()) {
    startIndex = history.size() - 1;
  }
  ListIterator<History.Entry> it = history.entries(startIndex);
  if (searchIndex != -1 && it.hasNext()) {
    it.next();
  }
  while (it.hasNext()) {
    History.Entry e = it.next();
    if (startsWith) {
      if (e.value().toString().startsWith(searchTerm)) {
        return e.index();
      }
    } else {
      if (e.value().toString().contains(searchTerm)) {
        return e.index();
      }
    }
  }
  return -1;
}

代码示例来源:origin: jline/jline

switch (c) {
  case '!':
    if (history.size() == 0) {
      throw new IllegalArgumentException("!!: event not found");
    if (history.size() == 0) {
      throw new IllegalArgumentException("!$: event not found");
      if (idx > 0 && idx <= history.size()) {
        rep = (history.get(history.index() - idx)).toString();
      } else {
      if (idx > history.index() - history.size() && idx <= history.index()) {
        rep = (history.get(idx - 1)).toString();
      } else {

代码示例来源:origin: jline/jline

/**
 * Possible states in which the current readline operation may be in.
 */
private static enum State {
  /**
   * The user is just typing away
   */
  NORMAL,
  /**
   * In the middle of a emacs seach
   */
  SEARCH,
  FORWARD_SEARCH,
  /**
   * VI "yank-to" operation ("y" during move mode)
   */
  VI_YANK_TO,
  /**
   * VI "delete-to" operation ("d" during move mode)
   */
  VI_DELETE_TO,
  /**
   * VI "change-to" operation ("c" during move mode)
   */
  VI_CHANGE_TO
}

代码示例来源:origin: jline/jline

int start = (end <= history.size()) ? 0 : end - history.size();

代码示例来源:origin: com.netflix.eureka2/eureka-testkit

@Override
  protected boolean executeCommand(Context context, String[] args) {
    for (int i = 0; i < consoleReader.getHistory().size(); i++) {
      System.out.println(String.format("%4d %s", i + 1, consoleReader.getHistory().get(i)));
    }
    return true;
  }
}

代码示例来源:origin: com.netflix.eureka/eureka2-testkit

@Override
  protected boolean executeCommand(Context context, String[] args) {
    for (int i = 0; i < consoleReader.getHistory().size(); i++) {
      System.out.println(String.format("%4d %s", i + 1, consoleReader.getHistory().get(i)));
    }
    return true;
  }
}

代码示例来源:origin: com.typesafe.sbt/incremental-compiler

public int searchForwards(String searchTerm, int startIndex, boolean startsWith) {
  if (startIndex >= history.size()) {
    startIndex = history.size() - 1;
  }
  ListIterator<History.Entry> it = history.entries(startIndex);
  if (searchIndex != -1 && it.hasNext()) {
    it.next();
  }
  while (it.hasNext()) {
    History.Entry e = it.next();
    if (startsWith) {
      if (e.value().toString().startsWith(searchTerm)) {
        return e.index();
      }
    } else {
      if (e.value().toString().contains(searchTerm)) {
        return e.index();
      }
    }
  }
  return -1;
}

代码示例来源:origin: com.typesafe.sbt/incremental-compiler

switch (c) {
  case '!':
    if (history.size() == 0) {
      throw new IllegalArgumentException("!!: event not found");
    if (history.size() == 0) {
      throw new IllegalArgumentException("!$: event not found");
      if (idx > 0 && idx <= history.size()) {
        rep = (history.get(history.index() - idx)).toString();
      } else {
      if (idx > history.index() - history.size() && idx <= history.index()) {
        rep = (history.get(idx - 1)).toString();
      } else {

代码示例来源:origin: com.typesafe.sbt/incremental-compiler

/**
 * Possible states in which the current readline operation may be in.
 */
private static enum State {
  /**
   * The user is just typing away
   */
  NORMAL,
  /**
   * In the middle of a emacs seach
   */
  SEARCH,
  FORWARD_SEARCH,
  /**
   * VI "yank-to" operation ("y" during move mode)
   */
  VI_YANK_TO,
  /**
   * VI "delete-to" operation ("d" during move mode)
   */
  VI_DELETE_TO,
  /**
   * VI "change-to" operation ("c" during move mode)
   */
  VI_CHANGE_TO
}

代码示例来源:origin: future-architect/uroborosql

int sizeLen = String.valueOf(console.getHistory().size()).length();
console.getHistory().forEach(entry -> {
  try {

代码示例来源:origin: com.typesafe.sbt/incremental-compiler

int start = (end <= history.size()) ? 0 : end - history.size();

代码示例来源:origin: dariober/ASCIIGenome

@Test
public void canReadHistory() throws IOException {
  ASCIIGenomeHistory ag= new ASCIIGenomeHistory("test_data/asciigenome.yaml");
  assertEquals(8, ag.getFiles().size());
  assertEquals(4, ag.getPositions().size());
  assertEquals(6, ag.getCommandHistory().size());
  assertEquals(1, ag.getReference().size());
  
  ag= new ASCIIGenomeHistory("non-existing.yaml");
  assertEquals(0, ag.getFiles().size());
  ag= new ASCIIGenomeHistory();
  assertNotNull(ag.getFileName());
}

相关文章