@Ignore @Test public void shouldSetSentimentLabelsOnProgressionBars(){ queueState = setSentimentLabelsEvent.set(queueState); for(ProgressionUnit progressionUnit : queueState.getStructure()){ boolean skipBar = false; for(ProgressionUnitBar progressionUnitBar : progressionUnit.getProgressionUnitBars()){ if(!skipBar){ assertThat(countSentimentMixVariations(progressionUnitBar.getSentimentLabels())).isEqualTo(6); assertThat(allMixVariationsContainLabels(progressionUnitBar.getSentimentLabels())).isTrue(); }else{ assertThat(progressionUnitBar.getSentimentLabels()).isNull(); } skipBar = !skipBar; } } }
@Override public QueueState set(QueueState queueState) { for (ProgressionUnit progressionUnit : queueState.getStructure()) { for (int i = 0; i < progressionUnit.getProgressionUnitBars().size(); i++) { if((i%2)==0){ Map<String, List<String>> variationToSentiment = new HashMap<>(); for(int mixIndex=0; mixIndex<numOfGeneratedMixes; mixIndex++){ for(int variationIndex=0; variationIndex<numOfGeneratedMixVariations; variationIndex++){ List<String> characteristicExtraction = this.sentimentCharacteristicsExtraction.extract(); String mixVariationId = generateMixVariationId(queueState.getQueueItem().getQueueItemId(), mixIndex, variationIndex); String suffix= mixVariationId.substring(mixVariationId.length() - 1); List<String> variationSentiment = new ArrayList<>(); if(suffix.equalsIgnoreCase("1")){ variationSentiment.add("bass"); }else if(suffix.equalsIgnoreCase("2")){ variationSentiment.add("bright"); }else if(suffix.equalsIgnoreCase("3")){ variationSentiment.add("ambient"); }else{ Application.logger.debug("LOG: CANNOT FIX MIX VARIATION SUFFIX !!!!"); Application.logger.debug("LOG: LAST CHARACTOR WAS: " + suffix); throw new RuntimeException("CANNOT FIND MIX VARIATION SUFFIX"); } variationToSentiment.put(mixVariationId, variationSentiment); } } progressionUnit.getProgressionUnitBars().get(i).setSentimentLabels(variationToSentiment); } } } return queueState; }
SetSentimentLabelsEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for (ProgressionUnit progressionUnit : queueState.getStructure()) { for (int i = 0; i < progressionUnit.getProgressionUnitBars().size(); i++) { if((i%2)==0){ Map<String, List<String>> variationToSentiment = new HashMap<>(); for(int mixIndex=0; mixIndex<numOfGeneratedMixes; mixIndex++){ for(int variationIndex=0; variationIndex<numOfGeneratedMixVariations; variationIndex++){ List<String> characteristicExtraction = this.sentimentCharacteristicsExtraction.extract(); String mixVariationId = generateMixVariationId(queueState.getQueueItem().getQueueItemId(), mixIndex, variationIndex); String suffix= mixVariationId.substring(mixVariationId.length() - 1); List<String> variationSentiment = new ArrayList<>(); if(suffix.equalsIgnoreCase("1")){ variationSentiment.add("bass"); }else if(suffix.equalsIgnoreCase("2")){ variationSentiment.add("bright"); }else if(suffix.equalsIgnoreCase("3")){ variationSentiment.add("ambient"); }else{ Application.logger.debug("LOG: CANNOT FIX MIX VARIATION SUFFIX !!!!"); Application.logger.debug("LOG: LAST CHARACTOR WAS: " + suffix); throw new RuntimeException("CANNOT FIND MIX VARIATION SUFFIX"); } variationToSentiment.put(mixVariationId, variationSentiment); } } progressionUnit.getProgressionUnitBars().get(i).setSentimentLabels(variationToSentiment); } } } return queueState; } }
SetSentimentLabelsEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for (ProgressionUnit progressionUnit : queueState.getStructure()) { for (int i = 0; i < progressionUnit.getProgressionUnitBars().size(); i++) { if((i%2)==0){ Map<String, List<String>> variationToSentiment = new HashMap<>(); for(int mixIndex=0; mixIndex<numOfGeneratedMixes; mixIndex++){ for(int variationIndex=0; variationIndex<numOfGeneratedMixVariations; variationIndex++){ List<String> characteristicExtraction = this.sentimentCharacteristicsExtraction.extract(); String mixVariationId = generateMixVariationId(queueState.getQueueItem().getQueueItemId(), mixIndex, variationIndex); String suffix= mixVariationId.substring(mixVariationId.length() - 1); List<String> variationSentiment = new ArrayList<>(); if(suffix.equalsIgnoreCase("1")){ variationSentiment.add("bass"); }else if(suffix.equalsIgnoreCase("2")){ variationSentiment.add("bright"); }else if(suffix.equalsIgnoreCase("3")){ variationSentiment.add("ambient"); }else{ Application.logger.debug("LOG: CANNOT FIX MIX VARIATION SUFFIX !!!!"); Application.logger.debug("LOG: LAST CHARACTOR WAS: " + suffix); throw new RuntimeException("CANNOT FIND MIX VARIATION SUFFIX"); } variationToSentiment.put(mixVariationId, variationSentiment); } } progressionUnit.getProgressionUnitBars().get(i).setSentimentLabels(variationToSentiment); } } } return queueState; } @Autowired  SetSentimentLabelsEvent(SentimentMixExtraction sentimentMixExtraction,
                                   SentimentCharacteristicsExtraction sentimentCharacteristicsExtraction,
                                   @Value("${num_of_generated_mixes}") int numOfGeneratedMixes,
                                   @Value("${num_of_generated_mix_variations}") int numOfGeneratedMixVariations); }
SetSentimentLabelsEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for (ProgressionUnit progressionUnit : queueState.getStructure()) { for (int i = 0; i < progressionUnit.getProgressionUnitBars().size(); i++) { if((i%2)==0){ Map<String, List<String>> variationToSentiment = new HashMap<>(); for(int mixIndex=0; mixIndex<numOfGeneratedMixes; mixIndex++){ for(int variationIndex=0; variationIndex<numOfGeneratedMixVariations; variationIndex++){ List<String> characteristicExtraction = this.sentimentCharacteristicsExtraction.extract(); String mixVariationId = generateMixVariationId(queueState.getQueueItem().getQueueItemId(), mixIndex, variationIndex); String suffix= mixVariationId.substring(mixVariationId.length() - 1); List<String> variationSentiment = new ArrayList<>(); if(suffix.equalsIgnoreCase("1")){ variationSentiment.add("bass"); }else if(suffix.equalsIgnoreCase("2")){ variationSentiment.add("bright"); }else if(suffix.equalsIgnoreCase("3")){ variationSentiment.add("ambient"); }else{ Application.logger.debug("LOG: CANNOT FIX MIX VARIATION SUFFIX !!!!"); Application.logger.debug("LOG: LAST CHARACTOR WAS: " + suffix); throw new RuntimeException("CANNOT FIND MIX VARIATION SUFFIX"); } variationToSentiment.put(mixVariationId, variationSentiment); } } progressionUnit.getProgressionUnitBars().get(i).setSentimentLabels(variationToSentiment); } } } return queueState; } @Autowired  SetSentimentLabelsEvent(SentimentMixExtraction sentimentMixExtraction,
                                   SentimentCharacteristicsExtraction sentimentCharacteristicsExtraction,
                                   @Value("${num_of_generated_mixes}") int numOfGeneratedMixes,
                                   @Value("${num_of_generated_mix_variations}") int numOfGeneratedMixVariations); @Override QueueState set(QueueState queueState); }
SetSentimentLabelsEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for (ProgressionUnit progressionUnit : queueState.getStructure()) { for (int i = 0; i < progressionUnit.getProgressionUnitBars().size(); i++) { if((i%2)==0){ Map<String, List<String>> variationToSentiment = new HashMap<>(); for(int mixIndex=0; mixIndex<numOfGeneratedMixes; mixIndex++){ for(int variationIndex=0; variationIndex<numOfGeneratedMixVariations; variationIndex++){ List<String> characteristicExtraction = this.sentimentCharacteristicsExtraction.extract(); String mixVariationId = generateMixVariationId(queueState.getQueueItem().getQueueItemId(), mixIndex, variationIndex); String suffix= mixVariationId.substring(mixVariationId.length() - 1); List<String> variationSentiment = new ArrayList<>(); if(suffix.equalsIgnoreCase("1")){ variationSentiment.add("bass"); }else if(suffix.equalsIgnoreCase("2")){ variationSentiment.add("bright"); }else if(suffix.equalsIgnoreCase("3")){ variationSentiment.add("ambient"); }else{ Application.logger.debug("LOG: CANNOT FIX MIX VARIATION SUFFIX !!!!"); Application.logger.debug("LOG: LAST CHARACTOR WAS: " + suffix); throw new RuntimeException("CANNOT FIND MIX VARIATION SUFFIX"); } variationToSentiment.put(mixVariationId, variationSentiment); } } progressionUnit.getProgressionUnitBars().get(i).setSentimentLabels(variationToSentiment); } } } return queueState; } @Autowired  SetSentimentLabelsEvent(SentimentMixExtraction sentimentMixExtraction,
                                   SentimentCharacteristicsExtraction sentimentCharacteristicsExtraction,
                                   @Value("${num_of_generated_mixes}") int numOfGeneratedMixes,
                                   @Value("${num_of_generated_mix_variations}") int numOfGeneratedMixVariations); @Override QueueState set(QueueState queueState);  }