int prevType = -1; String prevDescription = ""; int nextEventIndex = -1;  for (int i = 0; i < n; i++) { NodeEvent nodeEvent = (NodeEvent)nodeEvents.get(i);   int nodeEventType = nodeEvent.getType(); if (nodeEventType == NodeEvent.IDLE_UPDATE) { String s = nodeEvent.getMessage(); handleIdleUpdate(getIdleness(s), getTimestamp(s)); } else { updateStatus(nodeEvent); if (filter != null && !filter.includeEventInDisplay(nodeEvent)) continue; prevType = nodeEventType; prevDescription = getNodeEventDescription(nodeEvent); nextEventIndex = i+1; break; } } if (nextEventIndex == -1) return;  for (int j = nextEventIndex; j < n; j++) { NodeEvent nodeEvent = (NodeEvent)nodeEvents.get(j);   int nodeEventType = nodeEvent.getType(); String description = getNodeEventDescription(nodeEvent); updateStatus(nodeEvent); if (nodeEventType == NodeEvent.IDLE_UPDATE) { String s = nodeEvent.getMessage(); handleIdleUpdate(getIdleness(s), getTimestamp(s)); } else if (nodeEventType == prevType) { prevDescription += description; } else { if (filter == null || filter.includeEventTypeInDisplay(prevType)) doc.appendString(prevDescription, getNodeEventStyle(prevType)); prevDescription = description; prevType = nodeEventType; } } if (filter == null || filter.includeEventTypeInDisplay(prevType)) doc.appendString(prevDescription, getNodeEventStyle(prevType)); }
synchronized (logFileLock) { try { logFile.flush(); } catch (Exception e) { } } }
	public void run() {	  int prevType = -1;	  String prevDescription = "";	  int nextEventIndex = -1;	  // get the first description which is not an idle update	  for (int i = 0; i < n; i++) {	    NodeEvent nodeEvent = (NodeEvent)nodeEvents.get(i);            //            if (filter != null && !filter.includeEventInDisplay(nodeEvent))            //              continue; // skip events user isn't interested in	    int nodeEventType = nodeEvent.getType();	    if (nodeEventType == NodeEvent.IDLE_UPDATE) {	      String s = nodeEvent.getMessage();	      handleIdleUpdate(getIdleness(s), getTimestamp(s));            } else {	      updateStatus(nodeEvent);              if (filter != null && !filter.includeEventInDisplay(nodeEvent))                continue; // don't append events user isn't interested in	      prevType = nodeEventType;	      prevDescription = getNodeEventDescription(nodeEvent);	      nextEventIndex = i+1;	      break;	    }	  }	  if (nextEventIndex == -1)	    return; // all the events were idle updates or ignored	  // start batching descriptions	  for (int j = nextEventIndex; j < n; j++) {	    NodeEvent nodeEvent = (NodeEvent)nodeEvents.get(j);            //            if (filter != null && !filter.includeEventInDisplay(nodeEvent))            //              continue; // skip events user isn't interested in	    int nodeEventType = nodeEvent.getType();	    String description = getNodeEventDescription(nodeEvent);	    updateStatus(nodeEvent);	    if (nodeEventType == NodeEvent.IDLE_UPDATE) {	      String s = nodeEvent.getMessage();	      handleIdleUpdate(getIdleness(s), getTimestamp(s));	    } else if (nodeEventType == prevType) {	      prevDescription += description;	    } else {              if (filter == null || filter.includeEventTypeInDisplay(prevType))                doc.appendString(prevDescription,                                  getNodeEventStyle(prevType));	      prevDescription = description;	      prevType = nodeEventType;	    }	  }          if (filter == null || filter.includeEventTypeInDisplay(prevType))            doc.appendString(prevDescription,                             getNodeEventStyle(prevType));	}