@Test public void testGetBestRunModeMatchCountFromSpec() { Assert.assertEquals(0, ExtendedSlingSettingsServiceImpl.getBestRunModeMatchCountFromSpec("test1.test2,-test3.test4", Collections.singleton("test5"))); Assert.assertEquals(0, ExtendedSlingSettingsServiceImpl.getBestRunModeMatchCountFromSpec("test1.test2,-test3.test4", ImmutableSet.of("test1", "test3"))); Assert.assertEquals(0, ExtendedSlingSettingsServiceImpl.getBestRunModeMatchCountFromSpec("test1.test2,-test3.test4", ImmutableSet.of("test2", "test3"))); Assert.assertEquals(2, ExtendedSlingSettingsServiceImpl.getBestRunModeMatchCountFromSpec("test1.test2,-test3.test4", ImmutableSet.of("test1", "test2"))); Assert.assertEquals(2, ExtendedSlingSettingsServiceImpl.getBestRunModeMatchCountFromSpec("test1.test2,-test3.test4", ImmutableSet.of("test2", "test4"))); Assert.assertEquals(3, ExtendedSlingSettingsServiceImpl.getBestRunModeMatchCountFromSpec("test1.test2,-test3.test4,test5.test6.test7", ImmutableSet.of("test1", "test2", "test4", "test5", "test6", "test7"))); }
static int getBestRunModeMatchCountFromSpec(String spec, Collection<String> activeRunModes) { int numMatchingRunModes = 0; for (String discjunctivePart : spec.split(Pattern.quote(RUN_MODE_SPEC_OR_SEPARATOR))) { int newNumMatchingRunModes = getBestRunModeMatchCountFromConjunctions(discjunctivePart, activeRunModes); if (newNumMatchingRunModes > numMatchingRunModes) { numMatchingRunModes = newNumMatchingRunModes; } } return numMatchingRunModes; }
ExtendedSlingSettingsServiceImpl implements ExtendedSlingSettingsService { static int getBestRunModeMatchCountFromSpec(String spec, Collection<String> activeRunModes) { int numMatchingRunModes = 0; for (String discjunctivePart : spec.split(Pattern.quote(RUN_MODE_SPEC_OR_SEPARATOR))) { int newNumMatchingRunModes = getBestRunModeMatchCountFromConjunctions(discjunctivePart, activeRunModes); if (newNumMatchingRunModes > numMatchingRunModes) { numMatchingRunModes = newNumMatchingRunModes; } } return numMatchingRunModes; } }
ExtendedSlingSettingsServiceImpl implements ExtendedSlingSettingsService { static int getBestRunModeMatchCountFromSpec(String spec, Collection<String> activeRunModes) { int numMatchingRunModes = 0; for (String discjunctivePart : spec.split(Pattern.quote(RUN_MODE_SPEC_OR_SEPARATOR))) { int newNumMatchingRunModes = getBestRunModeMatchCountFromConjunctions(discjunctivePart, activeRunModes); if (newNumMatchingRunModes > numMatchingRunModes) { numMatchingRunModes = newNumMatchingRunModes; } } return numMatchingRunModes; } ExtendedSlingSettingsServiceImpl();  ExtendedSlingSettingsServiceImpl(Set<String> extendedRunmodes); }
ExtendedSlingSettingsServiceImpl implements ExtendedSlingSettingsService { static int getBestRunModeMatchCountFromSpec(String spec, Collection<String> activeRunModes) { int numMatchingRunModes = 0; for (String discjunctivePart : spec.split(Pattern.quote(RUN_MODE_SPEC_OR_SEPARATOR))) { int newNumMatchingRunModes = getBestRunModeMatchCountFromConjunctions(discjunctivePart, activeRunModes); if (newNumMatchingRunModes > numMatchingRunModes) { numMatchingRunModes = newNumMatchingRunModes; } } return numMatchingRunModes; } ExtendedSlingSettingsServiceImpl();  ExtendedSlingSettingsServiceImpl(Set<String> extendedRunmodes); @Activate void activate(Config config); @Override Set<String> getRunModes(); @Override String getSlingId(); @Override boolean isMatchingRunModeSpec(String spec); }
ExtendedSlingSettingsServiceImpl implements ExtendedSlingSettingsService { static int getBestRunModeMatchCountFromSpec(String spec, Collection<String> activeRunModes) { int numMatchingRunModes = 0; for (String discjunctivePart : spec.split(Pattern.quote(RUN_MODE_SPEC_OR_SEPARATOR))) { int newNumMatchingRunModes = getBestRunModeMatchCountFromConjunctions(discjunctivePart, activeRunModes); if (newNumMatchingRunModes > numMatchingRunModes) { numMatchingRunModes = newNumMatchingRunModes; } } return numMatchingRunModes; } ExtendedSlingSettingsServiceImpl();  ExtendedSlingSettingsServiceImpl(Set<String> extendedRunmodes); @Activate void activate(Config config); @Override Set<String> getRunModes(); @Override String getSlingId(); @Override boolean isMatchingRunModeSpec(String spec);  }