@Override
    public void run() {
        try {
            while (true) {
                CalcState state = Main.workQueue.take();
                CalcState returnState = work(state);
                Main.doneQueue.put(returnState);
            }
        } catch (InterruptedException ex) {
            Logger.getLogger(TriangleWorker.class.getName()).log(Level.SEVERE, Integer.toString(workerNumber), ex);
        }
    }