<commit_before>/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License. 
 */
package org.apache.creadur.whisker.model;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;

/**
 * 
 */
public class WithLicense implements Comparable<WithLicense> {

    private final License license;
    private final Collection<ByOrganisation> organisations;
    private final String copyrightNotice;
    private final Map<String, String> parameters;

    /**
     * @param license
     * @param element
     */
    public WithLicense(final License license, final String copyrightNotice,
            final Map<String, String> parameters,
            final Collection<ByOrganisation> organisations) {
        super();
        this.license = license;
        this.copyrightNotice = copyrightNotice;
        this.parameters = Collections.unmodifiableMap(parameters);
        this.organisations = Collections.unmodifiableCollection(organisations);
    }

    public String getCopyrightNotice() {
        return this.copyrightNotice;
    }

    public String getName() {
        return this.license.getName();
    }

    public String getURL() {
        return this.license.getURL();
    }

    public License getLicense() {
        return this.license;
    }

    public String getText() throws LicenseTemplateException {
        return this.license.getText(this.parameters);
    }

    public Collection<ByOrganisation> getOrganisations() {
        return this.organisations;
    }

    public Map<String, String> getParameters() {
        return this.parameters;
    }

    /**
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    public int compareTo(final WithLicense other) {
        return this.license.compareTo(other.getLicense());
    }

    /**
     * @param visitor
     */
    public void accept(final Visitor visitor) {
        if (visitor != null && visitor.traverseWithLicense()) {
            visitor.visit(this);
            for (final ByOrganisation organisation : getOrganisations()) {
                organisation.accept(visitor);
            }
        }
    }

    /**
     * @return
     */
    public boolean isSourceRequired() {
        return this.license.isSourceRequired();
    }

}<commit_msg>Fixed some checkstyle violations<commit_after>/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License. 
 */
package org.apache.creadur.whisker.model;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;

/**
 * Groups resources sharing a license and claimed copyright.
 */
public class WithLicense implements Comparable<WithLicense> {

    /** License shared by contained resources, not null. */
    private final License license;
    /** Resources grouped by responsible organisation. */
    private final Collection<ByOrganisation> organisations;
    /** Copyright claim shared by contained resources. */
    private final String copyrightNotice;
    /** Parameters to specialise the license family template. */
    private final Map<String, String> parameters;

    /**
     * Groups resources sharing a license and copyright claim.
     * @param license License shared by contained resources,
     * not null
     * @param copyrightNotice copyright claim
     * shared by contained resources, not null
     * @param parameters parameters to specialise
     * the license family template, not null
     * @param organisations resources grouped by
     * responsible organisation, not null
     */
    public WithLicense(final License license, final String copyrightNotice,
            final Map<String, String> parameters,
            final Collection<ByOrganisation> organisations) {
        super();
        this.license = license;
        this.copyrightNotice = copyrightNotice;
        this.parameters = Collections.unmodifiableMap(parameters);
        this.organisations = Collections.unmodifiableCollection(organisations);
    }

    /**
     * Gets the copyright claim shared
     * by the resources contained.
     * @return not null
     */
    public String getCopyrightNotice() {
        return this.copyrightNotice;
    }

    /**
     * Gets the presentation name for the license
     * shared by the resources contained.
     * @return not null
     */
    public String getName() {
        return this.license.getName();
    }

    /**
     * Gets a locator for the license
     * shared by the resources contained.
     * @return not null
     */
    public String getURL() {
        return this.license.getURL();
    }

    /**
     * Gets license meta-data shared by the resources
     * contained.
     * @return not null
     */
    public License getLicense() {
        return this.license;
    }

    /**
     * Gets the license legalise shared by the resources
     * contained. Computed by applying the parameters
     * to the license template.
     * @return not null
     * @throws LicenseTemplateException when the license
     * text cannot be generated from the template
     */
    public String getText() throws LicenseTemplateException {
        return this.license.getText(this.parameters);
    }

    /**
     * Gets resources grouped by responsible organisation.
     * @return not null
     */
    public Collection<ByOrganisation> getOrganisations() {
        return this.organisations;
    }

    /**
     * Gets the parameters substituted into the license
     * template when generating the license legalise.
     * @return not null
     */
    public Map<String, String> getParameters() {
        return this.parameters;
    }

    /**
     * Based on license.
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     * @param other possibly null
     * @return license comparison
     */
    public int compareTo(final WithLicense other) {
        return this.license.compareTo(other.getLicense());
    }

    /**
     * Accepts a visit.
     * @param visitor possibly null
     */
    public void accept(final Visitor visitor) {
        if (visitor != null && visitor.traverseWithLicense()) {
            visitor.visit(this);
            for (final ByOrganisation organisation : getOrganisations()) {
                organisation.accept(visitor);
            }
        }
    }

    /**
     * Should information about the source distribution of
     * contained resources be included?
     * @return true when license asks that information
     * about the source distribution is included,
     * false otherwise
     */
    public boolean isSourceRequired() {
        return this.license.isSourceRequired();
    }
}
{'fraction_non_alphanumeric': 0.08139679383621225, 'fraction_numerical': 0.0009941593140300733, 'mean_word_length': 2.7190388170055453, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '6038380', 'n_tokens_mistral': 1988, 'n_tokens_neox': 1929, 'n_words': 712}