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;

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

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

    /**
     * Constructor for Match when it is result instead of action
     * @param matchString
     */
    public Match(String matchString, boolean isaction, boolean isresult) {

        isAction = isaction;
        isResult = isresult;

        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();
    }
}

@@ -314,24 +314,453 @@
  isResult;%0A%0A
+    private boolean boolUop;%0A    private String resultMatchStr; /* use to compare result*/%0A%0A%0A    public String getMatchString() %7B%0A        return matchString;%0A    %7D%0A%0A    public void setMatchString(String matchString) %7B%0A        this.matchString = matchString;%0A    %7D%0A%0A    public Match () %7B%0A        this.isAction    = true;%0A        this.isResult    = false;%0A        this.isWildcard  = false;%0A%0A        this.matchString = null;%0A    %7D%0A%0A
     /**%0A    
@@ -798,24 +798,56 @@
 Action match
+ (assuming is action by default)
 %0A     * @par
@@ -1094,32 +1094,334 @@
 hString;%0A    %7D%0A%0A
+    public boolean isAction() %7B%0A        return isAction;%0A    %7D%0A%0A    public void setAction(boolean isAction) %7B%0A        this.isAction = isAction;%0A    %7D%0A%0A    public boolean isResult() %7B%0A        return isResult;%0A    %7D%0A%0A    public void setResult(boolean isResult) %7B%0A        this.isResult = isResult;%0A    %7D%0A%0A
     /**%0A     * C
@@ -1495,32 +1495,107 @@
 ram matchString%0A
+     * @param isAction%0A     * @param isResult%0A     * @param resultMatchStr%0A
      */%0A    publ
@@ -1633,17 +1633,17 @@
 olean is
-a
+A
 ction, b
@@ -1655,18 +1655,99 @@
 n is
-result) %7B%0A
+Result, boolean boolUop,String resultMatchStr) %7B%0A        this.matchString    = matchString;
 %0A   
@@ -1743,32 +1743,37 @@
 String;%0A        
+this.
 isAction = isact
@@ -1769,13 +1769,19 @@
 ion 
+      
 = is
-a
+A
 ctio
@@ -1783,32 +1783,37 @@
 Action;%0A        
+this.
 isResult = isres
@@ -1809,29 +1809,34 @@
 ult 
+      
 = is
-r
+R
 esult;%0A
-%0A
         
 isWi
@@ -1835,70 +1835,107 @@
     
-isWildcard = (matchString == %22%25%22);%0A        this.matchString
+this.boolUop        = boolUop;%0A        this.resultMatchStr = resultMatchStr;%0A        isWildcard
  = 
+(
 matc
@@ -1933,32 +1933,40 @@
 d = (matchString
+ == %22%25%22)
 ;%0A    %7D%0A%0A    @Ov

Add constructor for Match class