class HarmonicLoopWeighter {

    public boolean setHarmonicLoopWeight(Integer indexToWeight, ProgressionUnit currentProgressionUnit, ProgressionUnit priorProgressionUnit, Iterable<AnalyticsHorizontal> analyticsHorizontals) {

        ProgressionUnitBar progressionUnitBar = currentProgressionUnit.getProgressionUnitBars().get(indexToWeight);

        //ASSIGN RYTHMIC WEIGHTS
        //ULTIMATELY IT SHOULD FOLLOW SUIT WITH BELOW THREADED CODE FOR HARMONIC WEIGHTS..
        for (int i = 0; i < progressionUnitBar.getHarmonicLoopOptions().size(); i++) {
            WeightClass rWeight = rhythmWeighter.calculateRhythmicWeight(progressionUnitBar.getHarmonicLoop(), progressionUnitBar.getHarmonicLoopOptions().get(i));
            progressionUnitBar.getHarmonicLoopOptions().get(i).setRhythmicWeight(rWeight);
//            Application.logger.debug("LOG:","HL WEIGHT RHYTHM: " + rWeight.toString());
        }
        //END ASSIGN RYTHMIC WEIGHTS


        //position one

        //position two

        //position three

        //position four


        //ASSIGN TIME-SERIES WEIGHTS
        assignTimeSeriesWeight(indexToWeight, currentProgressionUnit, priorProgressionUnit);
        //END TIMESERIES WEIGHTS


        //Assign THEME weight
        assignThemeWeight(indexToWeight, currentProgressionUnit, priorProgressionUnit);
        //End assign THEME weight


        Collection<HarmonicLoopEqWeightTask> taskList = new ArrayList<>();

        //SET EQ & rhythmical weights ..
        for (int i = 0; i < progressionUnitBar.getHarmonicLoopOptions().size(); i++) {
            HarmonicLoopEqWeightTask task = new HarmonicLoopEqWeightTask(progressionUnitBar.getBeatLoop().getId(), progressionUnitBar.getHarmonicLoopOptions().get(i).getId(), bypassEqRatings, apiUser, apiPassword);
            taskList.add(task);
        }

        Application.logger.debug("LOG: Harmonic TaskList SIZE: " + taskList.size());
        ExecutorService executorPool = ExecutorPoolFactory.getPool();
        Application.logger.debug("LOG: EXECUTOR : CREATING");
        Application.logger.debug("LOG: TIME: " + DateTime.now());
        try {
            List<Future<WeightTaskResponse>> invokedTasks = executorPool.invokeAll(taskList);
            List<WeightTaskResponse> weightTaskResponses = new ArrayList<>();

            for (Future<WeightTaskResponse> task : invokedTasks) {
                try {
                    weightTaskResponses.add(task.get());
                    //TODO do i acctually assign the weight class!!!!!!!!@@@@@@@@&?????????????????
                    task.get(THREAD_TIMEOUT, TimeUnit.SECONDS).getWeightClass();
                } catch (TimeoutException tException) {
                    Application.logger.debug("LOG: ERROR!! : TIMEOUT EXCEPTION : HL WEIGHTING!!");
                } catch (InterruptedException ie) {
                    Application.logger.debug("LOG: ERROR!! : INTERRUPT EXCEPTION : HL WEIGHTING!!");
                }
            }

            assignWeights(progressionUnitBar, weightTaskResponses);
        } catch (Exception e) {
            Application.logger.debug("LOG: ERROR!! : HL WEIGHTING!! ", e);
        }
        executorPool.shutdownNow();

        try {
            while (!executorPool.awaitTermination(10, TimeUnit.SECONDS)) {
                Application.logger.debug("LOG: Awaiting completion of threads.");
            }

            Application.logger.debug("LOG: EXECUTOR : SHUTDOWN SUCCESS");
        } catch (InterruptedException e) {
            Application.logger.debug("LOG: ERROR AWAITING THREAD SHUTDOWN : ", e);
        }

        return true;
    }

    @Autowired public  HarmonicLoopWeighter(IRhythmWeighter rhythmWeighter, HarmonicLoopTimeseriesClassifier harmonicLoopTimeseriesClassifier, @Value("${bypass_eq_ratings}") boolean bypassEqRatings);

}