code: private void updateStats(ContentEvent event) {
          Instance instance;
          if (event instanceof ClusteringContentEvent){
              //Local Clustering
              ClusteringContentEvent ev = (ClusteringContentEvent) event;
              instance = ev.getInstance();
              DataPoint point = new DataPoint(instance, Integer.parseInt(event.getKey()));
              model.trainOnInstance(point);
              instancesCount++;
          }
          
          if (event instanceof ClusteringResultContentEvent){
              //Global Clustering
              ClusteringResultContentEvent ev = (ClusteringResultContentEvent) event;
              Clustering clustering = ev.getClustering(); 
              
              for (int i=0; i<clustering.size(); i++) { 
                  instance = new DenseInstance(1.0,clustering.get(i).getCenter());
                  instance.setDataset(model.getDataset());
                  DataPoint point = new DataPoint(instance, Integer.parseInt(event.getKey()));
                  model.trainOnInstance(point);
                  instancesCount++;
              }
          }    
  
          if (instancesCount % this.sampleFrequency == 0) {
              logger.info("Trained model using {} events with classifier id {}", instancesCount, this.modelId); // getId());
          }
      }
docs: Update stats.
  
  @param event the event