コード例 #1
0
ファイル: UrlFinder.java プロジェクト: hayyuelha/iestwitter
  @Override
  public void processLine(String value) {
    Matcher matcher = pattern.matcher(value);
    totalTweets++;
    while (matcher.find()) {
      String matchedUrl = matcher.group();
      System.out.println("Found url: " + matchedUrl);

      urlCounterTable.add(new UrlKey(matchedUrl));
      totalCount1++;
    }
  }
コード例 #2
0
ファイル: UrlFinder.java プロジェクト: hayyuelha/iestwitter
  public void printResults(PrintStream stream) {
    final String outputFormat = "%1$s\t%2$s";

    Collection<CountHolder<UrlKey>> results = urlCounterTable.getReverseSorted();

    int totalCount = 0;
    for (CountHolder<UrlKey> result : results) {

      totalCount += result.getCount();
      stream.println(String.format(outputFormat, result.getComponent(), result.getCount()));
    }
    System.out.println("Tweets: " + totalTweets);
    System.out.println("(1) Total URLs found: " + totalCount1);
    System.out.println("Total URLs found: " + totalCount);
  }