class PhraseMatcher extends LineMatcher {
    private final String[] phraseTerms;
    private int cur;

    PhraseMatcher(String[] phraseTerms, boolean caseInsensitive) {
        super(caseInsensitive);
        this.phraseTerms  = phraseTerms.clone();
        cur = 0;
    }

    @Override
    public int match(String token) {<FILL_FUNCTION_BODY>}
}

        if (equal(token, phraseTerms[cur])) {
            if (cur < phraseTerms.length - 1) {
                cur++;
                return WAIT; //matching.
            }
            cur = 0;
            return MATCHED; //matched!
        } else if (cur > 0) {
            cur = 0;
            if (equal(token, phraseTerms[cur])) {
                cur++;
                return WAIT; //matching.
            }
        }
        return NOT_MATCHED;
    
<methods>public abstract int match(java.lang.String) <variables>public static final int MATCHED,public static final int NOT_MATCHED,public static final int WAIT,private final non-sealed boolean caseInsensitive