Class RecipeMatcher


  • public class RecipeMatcher
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      RecipeMatcher()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean backtrack​(java.util.BitSet data, int[] ret, int start, int elements)  
      private static boolean claim​(int[] ret, java.util.BitSet data, int claimed, int elements)  
      static <T> int[] findMatches​(java.util.List<T> inputs, java.util.List<? extends java.util.function.Predicate<T>> tests)
      Attempts to match inputs to the specified tests.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RecipeMatcher

        public RecipeMatcher()
    • Method Detail

      • findMatches

        public static <T> int[] findMatches​(java.util.List<T> inputs,
                                            java.util.List<? extends java.util.function.Predicate<T>> tests)
        Attempts to match inputs to the specified tests. In the best way that all inputs are used by one test. Will return null in any of these cases: input/test lengths don't match. This is only for matching paired outputs. any input doesn't match a test any test doesn't match a input If we are unable to determine a proper pair
        Returns:
        An array mapping inputs to tests. ret[x] = y means input[x] = test[y]
      • claim

        private static boolean claim​(int[] ret,
                                     java.util.BitSet data,
                                     int claimed,
                                     int elements)
      • backtrack

        private static boolean backtrack​(java.util.BitSet data,
                                         int[] ret,
                                         int start,
                                         int elements)