All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cucumber.runtime.autocomplete.MetaStepdef Maven / Gradle / Ivy

There is a newer version: 1.2.6
Show newest version
package cucumber.runtime.autocomplete;

import java.util.ArrayList;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MetaStepdef {
    public String source;
    public String flags;
    public SortedSet steps = new TreeSet();
    private Pattern pattern;

    public boolean matches(String text) {
        Pattern p = pattern();
        Matcher m = p.matcher(text);
        return m.matches() || m.hitEnd();
    }

    private Pattern pattern() {
        if (pattern == null) {
            pattern = Pattern.compile(source);
        }
        return pattern;
    }

    public static class MetaStep implements Comparable {
        public String name;
        public List args = new ArrayList();

        @Override
        public int compareTo(MetaStep other) {
            return name.compareTo(other.name);
        }
    }

    public static class MetaArgument {
        public int offset;
        public String val;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy