jline.History类的使用及代码示例

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

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

History介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

History history = new History(); // assuming this with no-args

public void playMove() {
     int delay = 1200; // delay for 1 sec.
     // etc.
     // etc.
}

代码示例来源:origin: spring-projects/spring-roo

reader.getHistory().addToHistory(logEntry);

代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core

public void setHistoryFile(final File file) throws IOException {
    assert file != null;

    File dir = file.getParentFile();

    if (!dir.exists()) {
      // noinspection ResultOfMethodCallIgnored
      dir.mkdirs();
    }

    log.debug("History file: {}", file);

    super.setHistoryFile(file);
  }
}

代码示例来源:origin: stackoverflow.com

public void addItem(Object data) {

  History history = new History();
  history.getDataHashMap().put("planet", data);
  history.addToHistoryDB();

  mHistoryList.add(0, history);
  mPlanetsList.add(0, history.createPlanet());

  if (null != mOnItemAddHandler) {
    mOnItemAddHandler.onItemAdded(data);
  }
}

代码示例来源:origin: stackoverflow.com

protected void onChatHistory(ArrayList<? extends Parcelable> arrayList) {
  ArrayList<History> listHistory = (ArrayList<History>) arrayList;
  //chatHistoryList = new ArrayList<History>();// (Remove this line from here)
  for (int i = 0; i < listHistory.size(); i++) {
    History historyData = new History();
    historyData.setFromUser(listHistory.get(i).getFromUser());
    historyData.setMsgBody(listHistory.get(i).getMsgBody());
    historyData.setMsgTime(listHistory.get(i).getMsgTime());
    historyData.setRowId(listHistory.get(i).getRowId());
    historyData.setMsgId(listHistory.get(i).getMsgId());
    historyData.setToUser(listHistory.get(i).getToUser());
    chatHistoryList.add(historyData);
  }
  progressBar.setVisibility(View.GONE);
  progressText.setVisibility(View.GONE);
  setValuesInAdapter();
}

代码示例来源:origin: stackoverflow.com

public static ArrayList<History> getList() {
  Cursor cursor = null;
  try {
    MySQLiteOpenHelper mDbHelper = MySQLiteOpenHelper.getInstance();
    SQLiteDatabase db = mDbHelper.getWritableDatabase();

    // order by _id desc
    String sql = "select * from " + History.TABLE_NAME + " order by _id desc";
    ArrayList<History> list = new ArrayList<History>();
    cursor = db.rawQuery(sql, null);
    if (cursor != null) {
      for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
        History item = new History();
        item.fromCuror(cursor);
        list.add(item);
      }
    }
    return list;
  } finally {
    if (null != cursor && Integer.parseInt(Build.VERSION.SDK) < 14) {
      cursor.close();
    }
  }
}

代码示例来源:origin: io.snappydata/gemfire-core

private void initJline() throws Exception
  {
//        String osName = System.getProperty("os.name");
//        if (osName.startsWith("Windows")) {
//            return;
//        }

    consoleReader = new ConsoleReader();
    consoleReader.setBellEnabled(false);
//        consoleReader.setDebug(new java.io.PrintWriter("jline-debug.txt"));
    History history = consoleReader.getHistory();
    if (history == null) {
     history = new History();
     consoleReader.setHistory(history);
    }
    File historyFile = new File(System.getProperty("user.home"), ".gfshhistory");
    history.setHistoryFile(historyFile);
//        reader.setDebug(new PrintWriter(new FileWriter("writer.debug", true)));

    List completors = new LinkedList();
    completors.add(new SimpleCompletor(commands));
    consoleReader.addCompletor(new ArgumentCompletor(completors));
  }

代码示例来源:origin: org.apache.jackrabbit.vault/vault-cli

protected void doExecute(ConsoleExecutionContext ctx, CommandLine cl)
    throws Exception {
  // print the history
  Iterator iter = ctx.getConsole().getReader().getHistory().getHistoryList().iterator();
  int i=1;
  while (iter.hasNext()) {
    System.out.println("  " + i + "  " + iter.next());
    i++;
  }
}

代码示例来源:origin: stackoverflow.com

Presence presence = new Presence(Presence.Type.available);
presence.setTo(roomJID);

//Setting MaxStanzas to 0
MUCInitialPresence m = new MUCInitialPresence();
History h = new History();
h.setMaxStanzas(0);
m.setHistory(h);
presence.addExtension(m);

try {
  connection.sendStanza(presence);
} catch (NotConnectedException e) {
}

代码示例来源:origin: stackoverflow.com

@Before
  public void init() throws Exception{
    ListHistoryResponse historyResponse = new ListHistoryResponse();
    historyResponse.setHistoryId(BigInteger.valueOf(1234L));
    List<History> historyList = new ArrayList<>();
    History historyEntry = new History();
    Message message = new Message();
    message.setId("123456");
    message.setThreadId("123456");
    List<Message> messages = new ArrayList<>();
    messages.add(message);
    historyEntry.setMessages(messages);
    historyList.add(historyEntry);

    mock = mock(Gmail.class);
    Gmail.Users users = mock(Gmail.Users.class);
    Gmail.Users.History history = mock(Gmail.Users.History.class);
    Gmail.Users.History.List list = mock(Gmail.Users.History.List.class);
    when(mock.users()).thenReturn(users);
    when(users.history()).thenReturn(history);
    when(history.list("me")).thenReturn(list);
    when(list.setStartHistoryId(BigInteger.valueOf(123L))).thenReturn(list);
    when(list.setPageToken(null)).thenReturn(list);
    when(list.execute()).thenReturn(historyResponse);

}

代码示例来源:origin: org.apache.jackrabbit.vault/vault-cli

try {
  int historyIndex = Integer.valueOf(line.substring(1).trim()).intValue();
  oldLine = (String) reader.getHistory().getHistoryList().get(historyIndex - 1);
} catch (Exception e) {
  System.out.println("  " + line + ": event not found");
  continue;
reader.getHistory().addToHistory(oldLine);
System.out.println("Executing '" + oldLine + "'");
line = oldLine;

代码示例来源:origin: tinkerpop/tinkubator

History history = new History();
  history.setHistoryFile(new File(MUTANT_HISTORY));
  reader.setHistory(history);
} catch (IOException e) {

代码示例来源:origin: org.netbeans.api/org-jruby

@JRubyMethod(name = "pop")
@SuppressWarnings("unchecked")
public static IRubyObject s_pop(IRubyObject recv) throws Exception {
  Ruby runtime = recv.getRuntime();
  ConsoleHolder holder = getHolder(runtime);
  List histList = holder.history.getHistoryList();
  // TODO: Not fully implemented. We just return the last value,
  // without really popping it.
  String current = (String)histList.get(histList.size() - 1);
  return runtime.newString(current);
}

代码示例来源:origin: stackoverflow.com

List<History> list = Arrays.asList(new History("event1"), 
                  new History("event2"), 
                  new History("event1"));

Map<String, List<History>> result = list.stream()
                    .collect(Collectors.groupingBy(History::getEvent));

代码示例来源:origin: org.netbeans.api/org-jruby

@JRubyMethod(name = "to_a")
public static IRubyObject s_hist_to_a(IRubyObject recv) throws Exception {
  ConsoleHolder holder = getHolder(recv.getRuntime());
  RubyArray histList = recv.getRuntime().newArray();
  for (Iterator i = holder.history.getHistoryList().iterator(); i.hasNext();) {
    histList.append(recv.getRuntime().newString((String) i.next()));
  }
  return histList;
}

代码示例来源:origin: io.snappydata/gemfire-core

@Override
public void addToHistory(String buffer) {
 if (isAutoFlush()) {
  super.addToHistory(toHistoryLoggable(buffer));
 }
}

代码示例来源:origin: org.apache.felix.karaf.shell/org.apache.felix.karaf.shell.console

reader.getHistory().setHistoryFile(file);
session.put(".jline.history", reader.getHistory());
if (completer != null) {

代码示例来源:origin: stackoverflow.com

var history = new History();
var historyTotal = 0;

function historyTest() {
  history.happen("toggle", function () {
    historyTotal++;
  }, function () {
    historyTotal--;
  });
}

historyTest();
historyTest();
historyTest();
history.undo();
history.undo();
history.redo();
history.undo();
history.redo();

代码示例来源:origin: org.netbeans.api/org-jruby

@JRubyMethod(name = "each")
  public static IRubyObject s_hist_each(IRubyObject recv, Block block) {
    ConsoleHolder holder = getHolder(recv.getRuntime());
    for (Iterator i = holder.history.getHistoryList().iterator(); i.hasNext();) {
      block.yield(recv.getRuntime().getCurrentContext(), recv.getRuntime().newString((String) i.next()));
    }
    return recv;
  }
}

代码示例来源:origin: org.springframework.roo/org.springframework.roo.shell.jline

reader.getHistory().addToHistory(logEntry);

相关文章