package projectzombie.worker;

import java.util.Vector;

import bdf.types.BdfReader;
import projectzombie.Main;

public class WorkerFile extends Thread
{
	private static Vector<WorkerTaskFile> tasks = new Vector<WorkerTaskFile>();
	
	public static void addTask(String path, BdfReader reader) {
		tasks.add(new WorkerTaskFile(path, reader));
	}
	
	private synchronized WorkerTaskFile getNextIfAvailable()
	{
		if(tasks.size() == 0) {
			return null;
		} else {
			return tasks.remove(0);
		}
	}
	
	@Override
	public void run()
	{
		try
		{
			while(Main.running)
			{
				WorkerTaskFile task = getNextIfAvailable();
				
				if(task == null) {
					Thread.sleep(10);
					continue;
				}
				
				
			}
		}
		
		catch(InterruptedException e) {
			e.printStackTrace();
		}
	}
}
