History history = new History(); // assuming this with no-args public void playMove() { int delay = 1200; // delay for 1 sec. // etc. // etc. }
reader.getHistory().addToHistory(logEntry);
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); } }
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); } }
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(); }
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(); } } }
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)); }
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++; } }
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) { }
@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); }
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;
History history = new History(); history.setHistoryFile(new File(MUTANT_HISTORY)); reader.setHistory(history); } catch (IOException e) {
@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); }
@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; }
@Override public void addToHistory(String buffer) { if (isAutoFlush()) { super.addToHistory(toHistoryLoggable(buffer)); } }
reader.getHistory().setHistoryFile(file); session.put(".jline.history", reader.getHistory()); if (completer != null) {
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();
@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; } }
reader.getHistory().addToHistory(logEntry);