public class LocalFileChecker extends Thread
{
    //constructor
    public LocalFileChecker( char[][] a, BestPath b )
    {
        array = a;
        myBest = b;
        sleepcount = 1000;
        count = 'a';
        tg = new ThreadGroup( "LocalFileChecker" );
        done = false;
    }

    public void run()
    {
        FileAnalyzer current;
        while( !done )
        {
            if( tg.activeCount() < 6 && !done )
            {
                current = new FileAnalyzer(tg, "/users/u6/ben/java/ArrayRunners/DataProducer/data" + count, array, myBest);
                if( current.noMoreData() )
                    done = true;
                else
                    current.start();
                count++;
            }
            try{ sleep( 10 ); }
            catch( InterruptedException e ) {}
        }
        while( tg.activeCount() > 1 )
        {
            try
            {
                sleep( 5000 );
            }
            catch(Exception e )
            {}
        }

        System.out.println( myBest.path + " " + myBest.score );
    }

    char[][] array;
    BestPath myBest;
    int sleepcount;
    char count;
    ThreadGroup tg;
    boolean done;
}
