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

io.cucumber.cucumberexpressions.Group Maven / Gradle / Ivy

There is a newer version: 17.1.0
Show newest version
package io.cucumber.cucumberexpressions;

import java.util.ArrayList;
import java.util.List;

import static java.util.Collections.singletonList;

public class Group {
    private final List children;
    private final String value;
    private final int start;
    private final int end;

    public Group(String value, int start, int end, List children) {
        this.value = value;
        this.start = start;
        this.end = end;
        this.children = children;
    }

    public String getValue() {
        return value;
    }

    public int getStart() {
        return start;
    }

    public int getEnd() {
        return end;
    }

    public List getChildren() {
        return children;
    }

    public List getValues() {
        List list = new ArrayList<>();
        for (Group group : (getChildren().isEmpty() ? singletonList(this) : getChildren())) {
            String groupValue = group.getValue();
            if (groupValue != null) {
                list.add(groupValue);
            }
        }
        return list;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy