@@ -0,0 +1,880 @@
+package it.cavallium.warppi.math.rules.dsl;%0A%0Aimport it.cavallium.warppi.math.Function;%0A%0Aimport java.util.Map;%0Aimport java.util.Optional;%0A%0A/**%0A * Recognizes and generates functions of some specific shape.%0A */%0Apublic interface Pattern %7B%0A    /**%0A     * Tries to match this pattern against a function and capture sub-functions.%0A     *%0A     * @param function The function to test the pattern against.%0A     * @return The captured sub-functions, or an empty %3Ccode%3EOptional%3C/code%3E if%0A     *         the pattern doesn't match.%0A     */%0A    Optional%3CMap%3CString, Function%3E%3E match(Function function);%0A%0A    /**%0A     * Creates a new function by filling in sub-functions within this pattern.%0A     *%0A     * @param subFunctions A map of named sub-functions to be inserted into this pattern.%0A     * @return The resulting function.%0A     */%0A    Function replace(Map%3CString, Function%3E subFunctions);%0A%7D%0A

Define the Pattern interface and its core methods