<commit_before>/*
 * WebhookBranch
 * Copyright (C) 2015 Nishimura Software Studio
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.vx68k.bitbucket.webhook;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.json.JsonValue;
import org.vx68k.bitbucket.api.client.Commit;
import org.vx68k.bitbucket.api.client.Entity;

/**
 * Branch, named branch, or bookmark on a Bitbucket repository.
 * @author <NAME>
 */
public class WebhookBranch extends Entity {

    private static final String BRANCH = "branch";
    private static final String NAMED_BRANCH = "named_branch";
    private static final String BOOKMARK = "bookmark";

    private static final Logger logger = Logger.getLogger(
            WebhookBranch.class.getPackage().getName());

    private String name;
    private List<Commit> heads;

    public WebhookBranch(JsonObject jsonObject) {
        super(jsonObject);
        String entityType = getType();
        if (!(entityType.equals(BRANCH) || entityType.equals(NAMED_BRANCH)
                || entityType.equals(BOOKMARK))) {
            throw new IllegalArgumentException(
                    "Not \"" + BRANCH + "\", \"" + NAMED_BRANCH + "\", or \""
                    + BOOKMARK + "\"");
        }
        logger.log(
                Level.FINE, "Parsing JSON object (\"{0}\"): {1}",
                new Object[] {entityType, jsonObject});
        name = jsonObject.getString(WebhookJsonKeys.NAME);
        parseCommits(jsonObject.getJsonArray(WebhookJsonKeys.HEADS));
    }

    public String getName() {
        return name;<commit_msg>Added the assignment to heads.<commit_after>/*
 * WebhookBranch
 * Copyright (C) 2015 Nishimura Software Studio
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.vx68k.bitbucket.webhook;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.json.JsonValue;
import org.vx68k.bitbucket.api.client.Commit;
import org.vx68k.bitbucket.api.client.Entity;

/**
 * Branch, named branch, or bookmark on a Bitbucket repository.
 * @author <NAME>
 */
public class WebhookBranch extends Entity {

    private static final String BRANCH = "branch";
    private static final String NAMED_BRANCH = "named_branch";
    private static final String BOOKMARK = "bookmark";

    private static final Logger logger = Logger.getLogger(
            WebhookBranch.class.getPackage().getName());

    private String name;
    private List<Commit> heads;

    public WebhookBranch(JsonObject jsonObject) {
        super(jsonObject);
        String entityType = getType();
        if (!(entityType.equals(BRANCH) || entityType.equals(NAMED_BRANCH)
                || entityType.equals(BOOKMARK))) {
            throw new IllegalArgumentException(
                    "Not \"" + BRANCH + "\", \"" + NAMED_BRANCH + "\", or \""
                    + BOOKMARK + "\"");
        }
        logger.log(
                Level.FINE, "Parsing JSON object (\"{0}\"): {1}",
                new Object[] {entityType, jsonObject});
        name = jsonObject.getString(WebhookJsonKeys.NAME);
        heads = parseCommits(jsonObject.getJsonArray(WebhookJsonKeys.HEADS));
    }

    public String getName() {
        return name;
{'fraction_non_alphanumeric': 0.0994239385534457, 'fraction_numerical': 0.005547258374226584, 'mean_word_length': 3.097902097902098, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3957222', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1283, 'n_words': 434}