/** * Handles all the topics with duplicate occurrences. */ private void getDuplicateOccurrences() { //Create a new DuplicateOccurrences object. DuplicateOccurrences dupocc = new DuplicateOccurrences(tm); //Get the result from the dupocc object, and prints the result. Collection duplicateoccurrences = dupocc.getDuplicateOccurrences(); if (duplicateoccurrences.size() > 0) { print("\nNumber of duplicate occurrences : " + duplicateoccurrences.size() + "\n"); print("Topics containing duplicate occurrences :\n"); Iterator it = duplicateoccurrences.iterator(); while (it.hasNext()) { print(getTopicId((TopicIF)it.next()) + "\n"); } } else { print("\nThis TopicMap contains no duplicate occurrences.\n"); } }
public void testDuplicateOccurrences() { DuplicateOccurrences test = new DuplicateOccurrences(tm); assertTrue("type checking (getDuplicateOccurrences)", test.getDuplicateOccurrences() instanceof Collection); assertEquals(1, test.getDuplicateOccurrences().size()); }