diff --git a/bin/tests/scenarios/functional-interface/base.java b/bin/tests/scenarios/functional-interface/base.java new file mode 100644 index 0000000..c0a379f --- /dev/null +++ b/bin/tests/scenarios/functional-interface/base.java @@ -0,0 +1,25 @@ +public class CostModelMatcher> implements MatcherInterface { + private static final Logger LOG = Logger.getLogger(CostModelMatcher.class.getCanonicalName()); + + /** + * A function weighing a matching that incurred a cost. + * + * @param the type of the artifacts + */ + @FunctionalInterface + public interface SimpleWeightFunction> { + + float weigh(CMMatching matching); + } + + /** + * A function weighing a matching that incurred a specific cost. + * + * @param the type of the artifacts + */ + @FunctionalInterface + public interface WeightFunction> { + + float weigh(CMMatching matching, float quantity); + } +} \ No newline at end of file diff --git a/bin/tests/scenarios/functional-interface/left.java b/bin/tests/scenarios/functional-interface/left.java new file mode 100644 index 0000000..d40c65c --- /dev/null +++ b/bin/tests/scenarios/functional-interface/left.java @@ -0,0 +1,26 @@ +public class CostModelMatcher> implements MatcherInterface { + private static final Logger LOG = Logger.getLogger(CostModelMatcher.class.getCanonicalName()); + + /** + * A function weighing a matching that incurred a cost. + * + * @param the type of the artifacts + */ + @FunctionalInterface + public interface SimpleWeightFunction> { + + float weigh(CMMatching matching); + float weight(CMMatching matching); + } + + /** + * A function weighing a matching that incurred a specific cost. + * + * @param the type of the artifacts + */ + @FunctionalInterface + public interface WeightFunction> { + + float weigh(CMMatching matching, float quantity); + } +} \ No newline at end of file diff --git a/bin/tests/scenarios/functional-interface/merge.java b/bin/tests/scenarios/functional-interface/merge.java new file mode 100644 index 0000000..947b160 --- /dev/null +++ b/bin/tests/scenarios/functional-interface/merge.java @@ -0,0 +1 @@ + public class CostModelMatcher < T extends Artifact < T > > implements MatcherInterface < T > { private static final Logger LOG = Logger . getLogger ( CostModelMatcher . class . getCanonicalName ( ) ) ; @ FunctionalInterface public interface SimpleWeightFunction < T extends Artifact < T > > { float weigh ( CMMatching < T > matching ) ; float weight ( CMMatching < T > matching ) ; } @ FunctionalInterface public interface WeightFunction < T extends Artifact < T > > { float weigh ( CMMatching < T > matching , float quantity ) ; float weight ( CMMatching < T > matching , float quantity ) ; } } \ No newline at end of file diff --git a/bin/tests/scenarios/functional-interface/right.java b/bin/tests/scenarios/functional-interface/right.java new file mode 100644 index 0000000..43e8153 --- /dev/null +++ b/bin/tests/scenarios/functional-interface/right.java @@ -0,0 +1,26 @@ +public class CostModelMatcher> implements MatcherInterface { + private static final Logger LOG = Logger.getLogger(CostModelMatcher.class.getCanonicalName()); + + /** + * A function weighing a matching that incurred a cost. + * + * @param the type of the artifacts + */ + @FunctionalInterface + public interface SimpleWeightFunction> { + + float weigh(CMMatching matching); + } + + /** + * A function weighing a matching that incurred a specific cost. + * + * @param the type of the artifacts + */ + @FunctionalInterface + public interface WeightFunction> { + + float weigh(CMMatching matching, float quantity); + float weight(CMMatching matching, float quantity); + } +} \ No newline at end of file diff --git a/matching_handlers/src/java/mod.rs b/matching_handlers/src/java/mod.rs index 27bfe5b..4fd7f06 100644 --- a/matching_handlers/src/java/mod.rs +++ b/matching_handlers/src/java/mod.rs @@ -39,5 +39,9 @@ pub fn get_default_java_matching_handlers<'a>() -> MatchingHandlers<'a> { "enum_declaration", compute_matching_score_for_class_like_declaration, ); + matching_handlers.register( + "interface_declaration", + compute_matching_score_for_class_like_declaration, + ); matching_handlers }