private TextClusterData findCluster(String text,Date timeStamp,boolean isTrace) throws AdeException {
  boolean pathsAreOneToken=false;
  if (m_messageTextPreprocessor != null) {
    pathsAreOneToken=m_messageTextPreprocessor.treatPathsAsOneToken();
  }
  Word[] words;
  if (pathsAreOneToken) {
    words=LevenshteinTextSummary.prepareStringToken(text);
  }
 else {
    words=LevenshteinTextSummary.prepareString(text);
  }
  final Iterator<TextClusterData> e=m_clustersData.iterator();
  while (e.hasNext()) {
    final TextClusterData cluster=e.next();
    final String clusterRepresentative=cluster.getTextRepresentative();
    Word[] clusterRepresentativeWords;
    if (pathsAreOneToken) {
      clusterRepresentativeWords=LevenshteinTextSummary.prepareStringToken(clusterRepresentative);
    }
 else {
      clusterRepresentativeWords=LevenshteinTextSummary.prepareString(clusterRepresentative);
    }
    final int threshold=m_thresholdSetter.getThreshold(clusterRepresentativeWords.length,words.length);
    final boolean areClose=areClose(clusterRepresentativeWords,words,threshold,isTrace);
    boolean updatedLastObserved;
    if (areClose) {
      updatedLastObserved=cluster.setLastObserved(timeStamp);
      e.remove();
      m_clustersData.push(cluster);
      if (m_updateDataStore && updatedLastObserved) {
        m_dsTextClustering.updateTextClusterTimeStamp(cluster.getClusterId(),cluster.getLastObserved());
      }
      return cluster;
    }
  }
  return null;
}

private TextClusterData findCluster ( String text , Date timeStamp , boolean isTrace ) throws AdeException { boolean pathsAreOneToken = false ; if ( m_messageTextPreprocessor != null ) { pathsAreOneToken = m_messageTextPreprocessor . treatPathsAsOneToken ( ) ; } Word [ ] words ; if ( pathsAreOneToken ) { words = LevenshteinTextSummary . prepareStringToken ( text ) ; } else { words = LevenshteinTextSummary . prepareString ( text ) ; } final Iterator < TextClusterData > e = m_clustersData . iterator ( ) ; while ( e . hasNext ( ) ) { final TextClusterData cluster = e . next ( ) ; final String clusterRepresentative = cluster . getTextRepresentative ( ) ; Word [ ] clusterRepresentativeWords ; if ( pathsAreOneToken ) { clusterRepresentativeWords = LevenshteinTextSummary . prepareStringToken ( clusterRepresentative ) ; } else { clusterRepresentativeWords = LevenshteinTextSummary . prepareString ( clusterRepresentative ) ; } final int threshold = m_thresholdSetter . getThreshold ( clusterRepresentativeWords . length , words . length ) ; final boolean areClose = areClose ( clusterRepresentativeWords , words , threshold , isTrace ) ; boolean updatedLastObserved ; if ( areClose ) { updatedLastObserved = cluster . setLastObserved ( timeStamp ) ; e . remove ( ) ; m_clustersData . push ( cluster ) ; if ( m_updateDataStore && updatedLastObserved ) { m_dsTextClustering . updateTextClusterTimeStamp ( cluster . getClusterId ( ) , cluster . getLastObserved ( ) ) ; } return cluster ; } } return null ; }
find the first cluster that is close to the passed in text .
