test_class.declarator: dist1
test_class.modifier: private
test_class.original_string: private ScoreDistribution dist1;
test_class.type: ScoreDistribution
test_class.var_name: dist1
test_class.declarator: dist2
test_class.modifier: private
test_class.original_string: private ScoreDistribution dist2;
test_class.type: ScoreDistribution
test_class.var_name: dist2
test_class.declarator: tid1 = TermId.of("HP:1")
test_class.modifier: private final
test_class.original_string: private final TermId tid1 = TermId.of("HP:1");
test_class.type: TermId
test_class.var_name: tid1
test_class.declarator: tid2 = TermId.of("HP:2")
test_class.modifier: private final
test_class.original_string: private final TermId tid2 = TermId.of("HP:2");
test_class.type: TermId
test_class.var_name: tid2
test_class.file: phenol-core/src/test/java/org/monarchinitiative/phenol/ontology/scoredist/ScoreDistributionsTest.java
test_class.identifier: ScoreDistributionsTest
test_case.body: @Test
    public void test() {
      ScoreDistribution result = ScoreDistributions.merge(dist1, dist2);
      assertEquals(2, result.getNumTerms());
      assertEquals("[HP:1, HP:2]", ImmutableSortedSet.copyOf(result.getObjectIds()).toString());
      assertEquals(tid1, result.getObjectScoreDistribution(tid1).getObjectId());
      assertEquals(tid2, result.getObjectScoreDistribution(tid2).getObjectId());
    }
test_case.class_method_signature: ScoreDistributionsTest.test()
test_case.full_signature: @Test public void test()
test_case.identifier: test
test_case.invocations: merge assertEquals getNumTerms assertEquals toString copyOf getObjectIds assertEquals getObjectId getObjectScoreDistribution assertEquals getObjectId getObjectScoreDistribution
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test()
focal_class.file: phenol-core/src/main/java/org/monarchinitiative/phenol/ontology/scoredist/ScoreDistributions.java
focal_class.identifier: ScoreDistributions
focal_class.class_method_signature: ScoreDistributions.merge(Collection<? extends ScoreDistribution> distributions)
focal_class.full_signature: public static ScoreDistribution merge(Collection<? extends ScoreDistribution> distributions)
focal_class.identifier: merge
focal_class.modifiers: public static
focal_class.parameters: (Collection<? extends ScoreDistribution> distributions)
focal_class.return: ScoreDistribution
focal_class.signature: ScoreDistribution merge(Collection<? extends ScoreDistribution> distributions)
focal_class.class_method_signature: ScoreDistributions.merge(ScoreDistribution... distributions)
focal_class.full_signature: public static ScoreDistribution merge(ScoreDistribution... distributions)
focal_class.identifier: merge
focal_class.modifiers: public static
focal_class.parameters: (ScoreDistribution... distributions)
focal_class.return: ScoreDistribution
focal_class.signature: ScoreDistribution merge(ScoreDistribution... distributions)
focal_method.body: public static ScoreDistribution merge(Collection<? extends ScoreDistribution> distributions) {
      if (distributions.isEmpty()) {
        throw new CannotMergeScoreDistributions("Cannot merge zero ScoreDistributions objects.");
      }
      if (distributions.stream().map(ScoreDistribution::getNumTerms).collect(Collectors.toSet()).size() != 1) {
        throw new CannotMergeScoreDistributions("Different numbers of terms used for precomputation");
      }
  
      Map<TermId, ObjectScoreDistribution> mapping = new HashMap<>();
      for (ScoreDistribution d : distributions) {
        for (TermId objectId : d.getObjectIds()) {
          final ObjectScoreDistribution dist = d.getObjectScoreDistribution(objectId);
          if (mapping.containsKey(objectId)) {
            throw new CannotMergeScoreDistributions("Duplicate object ID " + objectId + " detected");
          } else {
            mapping.put(objectId, dist);
          }
        }
      }
  
      return new ScoreDistribution(distributions.stream().findAny().get().getNumTerms(), mapping);
    }
focal_method.class_method_signature: ScoreDistributions.merge(Collection<? extends ScoreDistribution> distributions)
focal_method.full_signature: public static ScoreDistribution merge(Collection<? extends ScoreDistribution> distributions)
focal_method.identifier: merge
focal_method.invocations: isEmpty size collect map stream toSet getObjectIds getObjectScoreDistribution containsKey put getNumTerms get findAny stream
focal_method.modifiers: public static
focal_method.parameters: (Collection<? extends ScoreDistribution> distributions)
focal_method.return: ScoreDistribution
focal_method.signature: ScoreDistribution merge(Collection<? extends ScoreDistribution> distributions)