void doTest1(int size) { //System.out.println("Doing test with size = "+size); CyclicBuffer cb = new CyclicBuffer(size); assertEquals(cb.getMaxSize(), size); for(int i = -(size+10); i < (size+10); i++) { assertNull(cb.get(i)); } for(int i = 0; i < MAX; i++) { cb.add(e[i]); int limit = i < size-1 ? i : size-1; //System.out.println("\nLimit is " + limit + ", i="+i); for(int j = limit; j >= 0; j--) { //System.out.println("i= "+i+", j="+j); assertEquals(cb.get(j), e[i-(limit-j)]); } assertNull(cb.get(-1)); assertNull(cb.get(limit+1)); } }
void doTestResize(int initialSize, int numberOfAdds, int newSize) { //System.out.println("initialSize = "+initialSize+", numberOfAdds=" // +numberOfAdds+", newSize="+newSize); CyclicBuffer cb = new CyclicBuffer(initialSize); for(int i = 0; i < numberOfAdds; i++) { cb.add(e[i]); } cb.resize(newSize); int offset = numberOfAdds - initialSize; if(offset< 0) offset = 0; int len = newSize < numberOfAdds ? newSize : numberOfAdds; len = len < initialSize ? len : initialSize; //System.out.println("Len = "+len+", offset="+offset); for(int j = 0; j < len; j++) { assertEquals(cb.get(j), e[offset+j]); } }
/** * Options are activated and become effective only after calling this method. */ @Override public void activateOptions() { try { cb = new CyclicBuffer(bufferSize); // Create a connection to the XMPP server LogLog.debug("Stablishing connection with XMPP server"); con = new XMPPConnection(InstantMessagingModule.getConnectionConfiguration()); // Most servers require you to login before performing other tasks LogLog.debug("About to login as [" + username + "/" + password + "]"); con.connect(); con.login(username, password); // Start a conversation with IMAddress if (chatroom) { LogLog.debug("About to create ChatGroup"); groupchat = new MultiUserChat(con, (String) recipientsList.get(0)); LogLog.debug("About to join room"); groupchat.join(nickname != null ? nickname : username); } else { final Iterator iter = recipientsList.iterator(); while (iter.hasNext()) { chats.add(con.getChatManager().createChat((String) iter.next(), null)); } // chat = con.createChat(recipients); } } catch (final XMPPException xe) { errorHandler.error("Error while activating options for appender named [" + name + "] Could not connect to instant messaging server with user: " + getUsername(), xe, ErrorCode.GENERIC_FAILURE); } catch (final Exception e) { errorHandler.error("Error while activating options for appender named [" + name + "]", e, ErrorCode.GENERIC_FAILURE); } }
JListViewModel(int size) { cb = new CyclicBuffer(size); }
JTableAppenderModel(int size) { cb = new CyclicBuffer(size); }
AppenderTableModel(int size) { cb = new CyclicBuffer(size); }
public void setCb(CyclicBuffer cb) { this.cb = cb; }
public CyclicBuffer getCb() { return cb; }
/** * The <b>BufferSize</b> option takes a positive integer representing the number of events this appender will buffer and send to newly connected * clients. */ public void setBufferSize(int _bufferSize) { buffer = new CyclicBuffer(_bufferSize); }