1 32 33 package com.jeantessier.classreader; 34 35 import java.util.*; 36 37 public class LoadListenerBase implements LoadListener { 38 private LinkedList groups = new LinkedList(); 39 private Collection visitedFiles = new HashSet(); 40 41 protected GroupData getCurrentGroup() { 42 GroupData result = null; 43 44 if (!groups.isEmpty()) { 45 result = (GroupData) groups.getLast(); 46 } 47 48 return result; 49 } 50 51 protected Collection getVisitedFiles() { 52 return visitedFiles; 53 } 54 55 public void beginSession(LoadEvent event) { 56 } 58 59 public void beginGroup(LoadEvent event) { 60 groups.add(new GroupData(event.getGroupName(), event.getSize())); 61 } 62 63 public void beginFile(LoadEvent event) { 64 getCurrentGroup().incrementCount(); 65 } 66 67 public void beginClassfile(LoadEvent event) { 68 } 70 71 public void endClassfile(LoadEvent event) { 72 visitedFiles.add(event.getFilename()); 73 } 74 75 public void endFile(LoadEvent event) { 76 } 78 79 public void endGroup(LoadEvent event) { 80 visitedFiles.add(event.getGroupName()); 81 groups.removeLast(); 82 } 83 84 public void endSession(LoadEvent event) { 85 } 87 } 88 | Popular Tags |