<commit_before>package in.twizmwaz.cardinal.module.modules.filter.parsers;

import in.twizmwaz.cardinal.GameHandler;
import in.twizmwaz.cardinal.module.GameObjective;
import in.twizmwaz.cardinal.module.modules.filter.FilterParser;
import in.twizmwaz.cardinal.module.modules.team.TeamModule;
import in.twizmwaz.cardinal.util.TeamUtils;
import org.jdom2.Element;

public class ObjectiveFilterParser extends FilterParser {

    private GameObjective objective;
    private TeamModule team;
    private boolean any;

    public ObjectiveFilterParser(final Element element) {
        super(element);
        String name = element.getText();
        for (GameObjective objective : GameHandler.getGameHandler().getMatch().getModules().getModules(GameObjective.class)) {
            if (objective.getName().equalsIgnoreCase(name)) this.objective = objective;
        }
        try {
            String team = element.getAttributeValue("team");
            this.team = TeamUtils.getTeamById(team);
        } catch (NullPointerException e) {
        }
        try {
            this.any = Boolean.getBoolean(element.getAttributeValue("any"));
        } catch (NullPointerException e) {
            any = false;
        }

    }

    public GameObjective getObjective() {
        return objective;<commit_msg>Add more ways to parse for an objective in the filter parser<commit_after>package in.twizmwaz.cardinal.module.modules.filter.parsers;

import in.twizmwaz.cardinal.GameHandler;
import in.twizmwaz.cardinal.module.GameObjective;
import in.twizmwaz.cardinal.module.modules.filter.FilterParser;
import in.twizmwaz.cardinal.module.modules.team.TeamModule;
import in.twizmwaz.cardinal.util.TeamUtils;
import org.jdom2.Element;

public class ObjectiveFilterParser extends FilterParser {

    private GameObjective objective;
    private TeamModule team;
    private boolean any;

    public ObjectiveFilterParser(final Element element) {
        super(element);
        String name = element.getText();
        for (GameObjective objective : GameHandler.getGameHandler().getMatch().getModules().getModules(GameObjective.class)) {
            if (objective.getId().replaceAll(" ", "").equalsIgnoreCase(name.replaceAll(" ", ""))) {
                this.objective = objective;
            }
        }
        for (GameObjective objective : GameHandler.getGameHandler().getMatch().getModules().getModules(GameObjective.class)) {
            if (objective.getId().replaceAll(" ", "").toLowerCase().startsWith(name.replaceAll(" ", "").toLowerCase())) {
                this.objective = objective;
            }
        }
        for (GameObjective objective : GameHandler.getGameHandler().getMatch().getModules().getModules(GameObjective.class)) {
            if (objective.getName().replaceAll(" ", "").equalsIgnoreCase(name.replaceAll(" ", ""))) {
                this.objective = objective;
            }
        }
        for (GameObjective objective : GameHandler.getGameHandler().getMatch().getModules().getModules(GameObjective.class)) {
            if (objective.getName().replaceAll(" ", "").toLowerCase().startsWith(name.replaceAll(" ", "").toLowerCase())) {
                this.objective = objective;
            }
        }
        try {
            String team = element.getAttributeValue("team");
            this.team = TeamUtils.getTeamById(team);
        } catch (NullPointerException e) {
        }
        try {
            this.any = Boolean.getBoolean(element.getAttributeValue("any"));
        } catch (NullPointerException e) {
            any = false;
        }

    }

    public GameObjective getObjective() {
        return objective;
{'fraction_non_alphanumeric': 0.11711464618760285, 'fraction_numerical': 0.0005485463521667581, 'mean_word_length': 2.946969696969697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3025635', 'n_tokens_mistral': 997, 'n_tokens_neox': 991, 'n_words': 172}