code: private TLinkedList computeEventCounts(EventStream eventStream,
                                             TObjectIntHashMap predicatesInOut,
                                             int cutoff) {
          TObjectIntHashMap counter = new TObjectIntHashMap();
          TLinkedList events = new TLinkedList();
          int predicateIndex = 0;
          while (eventStream.hasNext()) {
              Event ev = eventStream.nextEvent();
              events.addLast(ev);
              String[] ec = ev.getContext();
              for (int j=0; j<ec.length; j++) {
                  if (! predicatesInOut.containsKey(ec[j])) {
  		    if (counter.increment(ec[j])) {
  		    } else {
                          counter.put(ec[j], 1);
                      }
  		    if (counter.get(ec[j]) >= cutoff) {
  		      predicatesInOut.put(ec[j], predicateIndex++);
  		      counter.remove(ec[j]);
                        //if (predicateIndex %1000 == 0) {
                        //  System.err.println(predicateIndex+ " predicates"+ "event.length="+ec.length+" "+Arrays.asList(ec));                        
                        //  counter.trimToSize();
                        //}
  		    }
                  }
              }
          }
          predicatesInOut.trimToSize();
          return events;
      }
docs: Reads events from <tt>eventStream</tt> into a linked list.  The
  predicates associated with each event are counted and any which
  occur at least <tt>cutoff</tt> times are added to the
  <tt>predicatesInOut</tt> map along with a unique integer index.
  
  @param eventStream an <code>EventStream</code> value
  @param predicatesInOut a <code>TObjectIntHashMap</code> value
  @param cutoff an <code>int</code> value
  @return a <code>TLinkedList</code> value