<commit_before>package mypermissions.api.container;


import mypermissions.api.entities.PermissionLevel;

import java.util.ArrayList;

public class PermissionsContainer extends ArrayList<String> {

    public PermissionLevel hasPermission(String permission) {
        PermissionLevel permLevel = PermissionLevel.NONE;
        if (contains(permission)) {
            permLevel = PermissionLevel.ALLOWED;
        }

        for (String p : this) {
            if (permission.startsWith(p)) {
                permLevel = PermissionLevel.ALLOWED;
            } else if(p.startsWith("-") && permission.startsWith(p.substring(1))) {
                permLevel = PermissionLevel.DENIED;
            }
        }

        return permLevel;
    }

    @Override
    public String toString() {
        String formattedList = "";
        for(String perm : this) {
            if(formattedList.equals("")) {
                formattedList += perm;
            } else {
                formattedList += "\\n" + perm;
            }
        }
        return formattedList;
    }
}<commit_msg>Added permission removal in the permissions container.<commit_after>package mypermissions.api.container;


import mypermissions.MyPermissions;
import mypermissions.api.entities.PermissionLevel;

import java.util.ArrayList;
import java.util.Iterator;

public class PermissionsContainer extends ArrayList<String> {

    public PermissionLevel hasPermission(String permission) {
        PermissionLevel permLevel = PermissionLevel.NONE;
        if (contains(permission)) {
            permLevel = PermissionLevel.ALLOWED;
        }

        for (String p : this) {
            if (permission.startsWith(p)) {
                permLevel = PermissionLevel.ALLOWED;
                //MyPermissions.instance.LOG.info("PermLevel is allowed for " + permission);
            } else if(p.startsWith("-") && permission.startsWith(p.substring(1))) {
                permLevel = PermissionLevel.DENIED;
                //MyPermissions.instance.LOG.info("PermLevel is denied for " + permission);
            }
        }

        return permLevel;
    }


    public boolean remove(String perm) {
        for(Iterator<String> it = iterator(); it.hasNext(); ) {
            String p = it.next();
            if(p.equals(perm)) {
                it.remove();
                return true;
            }
        }
        return false;
    }

    @Override
    public String toString() {
        String formattedList = "";
        for(String perm : this) {
            if(formattedList.equals("")) {
                formattedList += perm;
            } else {
                formattedList += "\\n" + perm;
            }
        }
        return formattedList;
    }
}
{'fraction_non_alphanumeric': 0.10216832047041528, 'fraction_numerical': 0.000735023888276369, 'mean_word_length': 1.9427027027027026, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '5012657', 'n_tokens_mistral': 722, 'n_tokens_neox': 689, 'n_words': 147}