@Test void testSuitableForGeneratingWeightedMap() { assertTrue( categoryAlgorithmGenerator.suitableForGeneratingWeightedMap( targetAttribute, Arrays.asList(sourceAttribute, sourceAttribute1))); assertFalse( categoryAlgorithmGenerator.suitableForGeneratingWeightedMap( targetAttribute, Arrays.asList(sourceAttribute, sourceAttribute1, sourceAttribute2))); }
boolean suitableForGeneratingWeightedMap( Attribute targetAttribute, List<Attribute> sourceAttributes) { boolean isTargetSuitable = oneToOneCategoryAlgorithmGenerator.isFrequencyCategory(convertToCategory(targetAttribute)); boolean areSourcesSuitable = sourceAttributes.stream() .map(this::convertToCategory) .allMatch(oneToOneCategoryAlgorithmGenerator::isFrequencyCategory); return isTargetSuitable && areSourcesSuitable; }
OneToManyCategoryAlgorithmGenerator extends AbstractCategoryAlgorithmGenerator { boolean suitableForGeneratingWeightedMap( Attribute targetAttribute, List<Attribute> sourceAttributes) { boolean isTargetSuitable = oneToOneCategoryAlgorithmGenerator.isFrequencyCategory(convertToCategory(targetAttribute)); boolean areSourcesSuitable = sourceAttributes.stream() .map(this::convertToCategory) .allMatch(oneToOneCategoryAlgorithmGenerator::isFrequencyCategory); return isTargetSuitable && areSourcesSuitable; } }
OneToManyCategoryAlgorithmGenerator extends AbstractCategoryAlgorithmGenerator { boolean suitableForGeneratingWeightedMap( Attribute targetAttribute, List<Attribute> sourceAttributes) { boolean isTargetSuitable = oneToOneCategoryAlgorithmGenerator.isFrequencyCategory(convertToCategory(targetAttribute)); boolean areSourcesSuitable = sourceAttributes.stream() .map(this::convertToCategory) .allMatch(oneToOneCategoryAlgorithmGenerator::isFrequencyCategory); return isTargetSuitable && areSourcesSuitable; } OneToManyCategoryAlgorithmGenerator(DataService dataService); }
OneToManyCategoryAlgorithmGenerator extends AbstractCategoryAlgorithmGenerator { boolean suitableForGeneratingWeightedMap( Attribute targetAttribute, List<Attribute> sourceAttributes) { boolean isTargetSuitable = oneToOneCategoryAlgorithmGenerator.isFrequencyCategory(convertToCategory(targetAttribute)); boolean areSourcesSuitable = sourceAttributes.stream() .map(this::convertToCategory) .allMatch(oneToOneCategoryAlgorithmGenerator::isFrequencyCategory); return isTargetSuitable && areSourcesSuitable; } OneToManyCategoryAlgorithmGenerator(DataService dataService); @Override boolean isSuitable(Attribute targetAttribute, List<Attribute> sourceAttributes); @Override String generate(
      Attribute targetAttribute,
      List<Attribute> sourceAttributes,
      EntityType targetEntityType,
      EntityType sourceEntityType); String generateWeightedMap(Attribute attribute); String groupCategoryValues(Attribute attribute); }
OneToManyCategoryAlgorithmGenerator extends AbstractCategoryAlgorithmGenerator { boolean suitableForGeneratingWeightedMap( Attribute targetAttribute, List<Attribute> sourceAttributes) { boolean isTargetSuitable = oneToOneCategoryAlgorithmGenerator.isFrequencyCategory(convertToCategory(targetAttribute)); boolean areSourcesSuitable = sourceAttributes.stream() .map(this::convertToCategory) .allMatch(oneToOneCategoryAlgorithmGenerator::isFrequencyCategory); return isTargetSuitable && areSourcesSuitable; } OneToManyCategoryAlgorithmGenerator(DataService dataService); @Override boolean isSuitable(Attribute targetAttribute, List<Attribute> sourceAttributes); @Override String generate(
      Attribute targetAttribute,
      List<Attribute> sourceAttributes,
      EntityType targetEntityType,
      EntityType sourceEntityType); String generateWeightedMap(Attribute attribute); String groupCategoryValues(Attribute attribute);  }