// Path: tda/src/java/com/pironet/tda/utils/IconFactory.java
// public class IconFactory {
//     public static IconFactory iconFactory;
//     
//     public static final int THREADS = 0;
//     public static final int THREADS_WAITING = 1;
//     public static final int THREADS_SLEEPING = 2;
//     public static final int THREADS_LOCKING = 3;
//     public static final int DEADLOCKS = 4;
//     public static final int DIFF_DUMPS = 5;
//     public static final int MONITORS = 6;
//     public static final int MONITORS_NOLOCKS = 7;
//     public static final int CUSTOM_CATEGORY = 8;
//     
//     private final Icon[] icons = { TDA.createImageIcon("Threads.png"),
//                                    TDA.createImageIcon("ThreadsWaiting.png"),
//                                    TDA.createImageIcon("ThreadsSleeping.png"),
//                                    TDA.createImageIcon("ThreadsLocking.png"),
//                                    TDA.createImageIcon("Deadlock.png"),
//                                    TDA.createImageIcon("DiffDumps.png"),
//                                    TDA.createImageIcon("Monitors.png"),
//                                    TDA.createImageIcon("Monitors-nolocks.png"),
//                                    TDA.createImageIcon("CustomCat.png")
//     };
//     
//     public static IconFactory get() {
//         if(iconFactory == null) {
//             iconFactory = new IconFactory();
//         }
//         
//         return(iconFactory);
//     }
//     
//     private IconFactory() {
//         // private empty constructor
//     }
//     
//     public Icon getIconFor(int index) {
//         return(icons[index]);
//     }
//     
// }


import com.pironet.tda.utils.DateMatcher;
import com.pironet.tda.utils.IconFactory;
import java.io.BufferedReader;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.MutableTreeNode;
     * @return null if no more thread dumps were found.
    */
    public MutableTreeNode parseNext() {
        if (nextDump != null) {
            MutableTreeNode tmpDump = nextDump;
            nextDump = null;
            return(tmpDump);
        }      
        boolean retry = false;
        
        do {
            DefaultMutableTreeNode threadDump = null;
            ThreadDumpInfo overallTDI = null;
            DefaultMutableTreeNode catMonitors = null;
            DefaultMutableTreeNode catMonitorsLocks = null;
            DefaultMutableTreeNode catThreads = null;
            DefaultMutableTreeNode catLocking = null;
            DefaultMutableTreeNode catSleeping = null;
            DefaultMutableTreeNode catWaiting = null;
            
            try {
                Map threads = new HashMap();
                overallTDI = new ThreadDumpInfo("Dump No. " + counter++, 0);
                threadDump = new DefaultMutableTreeNode(overallTDI);
                catThreads = new DefaultMutableTreeNode(new TableCategory("Threads", IconFactory.THREADS));
                threadDump.add(catThreads);
                catWaiting = new DefaultMutableTreeNode(new TableCategory("Threads waiting for Monitors", IconFactory.THREADS_WAITING));

                catSleeping = new DefaultMutableTreeNode(new TableCategory("Threads sleeping on Monitors", IconFactory.THREADS_SLEEPING));

// Path: tda/src/java/com/pironet/tda/utils/IconFactory.java
// public class IconFactory {
//     public static IconFactory iconFactory;
//     
//     public static final int THREADS = 0;
//     public static final int THREADS_WAITING = 1;
//     public static final int THREADS_SLEEPING = 2;
//     public static final int THREADS_LOCKING = 3;
//     public static final int DEADLOCKS = 4;
//     public static final int DIFF_DUMPS = 5;
//     public static final int MONITORS = 6;
//     public static final int MONITORS_NOLOCKS = 7;
//     public static final int CUSTOM_CATEGORY = 8;
//     
//     private final Icon[] icons = { TDA.createImageIcon("Threads.png"),
//                                    TDA.createImageIcon("ThreadsWaiting.png"),
//                                    TDA.createImageIcon("ThreadsSleeping.png"),
//                                    TDA.createImageIcon("ThreadsLocking.png"),
//                                    TDA.createImageIcon("Deadlock.png"),
//                                    TDA.createImageIcon("DiffDumps.png"),
//                                    TDA.createImageIcon("Monitors.png"),
//                                    TDA.createImageIcon("Monitors-nolocks.png"),
//                                    TDA.createImageIcon("CustomCat.png")
//     };
//     
//     public static IconFactory get() {
//         if(iconFactory == null) {
//             iconFactory = new IconFactory();
//         }
//         
//         return(iconFactory);
//     }
//     
//     private IconFactory() {
//         // private empty constructor
//     }
//     
//     public Icon getIconFor(int index) {
//         return(icons[index]);
//     }
//     
// }


// Path: tda/src/java/com/pironet/tda/BeaJDKParser.java
import com.pironet.tda.utils.DateMatcher;
import com.pironet.tda.utils.IconFactory;
import java.io.BufferedReader;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.MutableTreeNode;

     * @return null if no more thread dumps were found.
    */
    public MutableTreeNode parseNext() {
        if (nextDump != null) {
            MutableTreeNode tmpDump = nextDump;
            nextDump = null;
            return(tmpDump);
        }      
        boolean retry = false;
        
        do {
            DefaultMutableTreeNode threadDump = null;
            ThreadDumpInfo overallTDI = null;
            DefaultMutableTreeNode catMonitors = null;
            DefaultMutableTreeNode catMonitorsLocks = null;
            DefaultMutableTreeNode catThreads = null;
            DefaultMutableTreeNode catLocking = null;
            DefaultMutableTreeNode catSleeping = null;
            DefaultMutableTreeNode catWaiting = null;
            
            try {
                Map threads = new HashMap();
                overallTDI = new ThreadDumpInfo("Dump No. " + counter++, 0);
                threadDump = new DefaultMutableTreeNode(overallTDI);
                catThreads = new DefaultMutableTreeNode(new TableCategory("Threads", IconFactory.THREADS));
                threadDump.add(catThreads);
                catWaiting = new DefaultMutableTreeNode(new TableCategory("Threads waiting for Monitors", IconFactory.THREADS_WAITING));

                catSleeping = new DefaultMutableTreeNode(new TableCategory("Threads sleeping on Monitors", IconFactory.THREADS_SLEEPING));

                catLocking = new DefaultMutableTreeNode(new TableCategory("Threads locking Monitors", IconFactory.THREADS_LOCKING));