package com.poco.PoCoRuntime;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Single unit for matching a PoCo event or result.
 */
public class Match implements Matchable {
    private String matchString;

    private boolean isWildcard;

    private boolean isAction;
    private boolean isResult;

    public Match(String matchString) {
        // This constructor creates an Action match
        isAction = true;
        isResult = false;

        isWildcard = (matchString == "%");
        this.matchString = matchString;
    }


    @Override
    public boolean accepts(Event event) {
        if (isWildcard) {
            return true;
        }

        Pattern pattern = Pattern.compile(matchString);
        Matcher matcher = pattern.matcher(event.getSignature());

        return matcher.find();
    }
}

@@ -318,16 +318,106 @@
 esult;%0A%0A
+    /**%0A     * This constructor creates an Action match%0A     * @param matchString%0A     */%0A
     publ
@@ -641,16 +641,347 @@
 %0A    %7D%0A%0A
+    /**%0A     * Constructor for Match when it is result instead of action%0A     * @param matchString%0A     */%0A    public Match(String matchString, boolean isaction, boolean isresult) %7B%0A%0A        isAction = isaction;%0A        isResult = isresult;%0A%0A        isWildcard = (matchString == %22%25%22);%0A        this.matchString = matchString;%0A    %7D%0A
 %0A    @Ov

Add a constructor for result