<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.felix.scrplugin.tags.qdox;

import java.util.Map;

import org.apache.felix.scrplugin.tags.*;

import com.thoughtworks.qdox.model.DocletTag;

/**
 * <code>QDoxJavaTag.java</code>...
 *
 */
public class QDoxJavaTag implements JavaTag {

    protected final DocletTag docletTag;

    protected final JavaClassDescription description;

    protected final JavaField field;

    public QDoxJavaTag(DocletTag t, JavaClassDescription desc) {
        this(t, desc, null);
    }

    public QDoxJavaTag(DocletTag t, JavaClassDescription desc, JavaField field) {
        this.docletTag = t;
        this.description = desc;
        this.field = field;
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getName()
     */
    public String getName() {
        return this.docletTag.getName();
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getNamedParameter(java.lang.String)
     */
    public String getNamedParameter(String arg0) {
        return this.docletTag.getNamedParameter(arg0);
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getParameters()
     */
    public String[] getParameters() {
        return this.docletTag.getParameters();
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getSourceLocation()
     */
    public String getSourceLocation() {
        return String.valueOf(this.docletTag.getContext().getParent().getParentSource().getURL());
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getLineNumber()
     */
    public int getLineNumber() {
        return this.docletTag.getLineNumber();
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getJavaClassDescription()
     */
    public JavaClassDescription getJavaClassDescription() {
        return this.description;
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getNamedParameterMap()
     */
    @SuppressWarnings("unchecked")
    public Map<String, String> getNamedParameterMap() {<commit_msg>FELIX-2731 : NPE while scanning sources with QDox<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.felix.scrplugin.tags.qdox;

import java.util.Map;

import org.apache.felix.scrplugin.tags.*;

import com.thoughtworks.qdox.model.DocletTag;

/**
 * <code>QDoxJavaTag.java</code>...
 *
 */
public class QDoxJavaTag implements JavaTag {

    protected final DocletTag docletTag;

    protected final JavaClassDescription description;

    protected final JavaField field;

    public QDoxJavaTag(DocletTag t, JavaClassDescription desc) {
        this(t, desc, null);
    }

    public QDoxJavaTag(DocletTag t, JavaClassDescription desc, JavaField field) {
        this.docletTag = t;
        this.description = desc;
        this.field = field;
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getName()
     */
    public String getName() {
        return this.docletTag.getName();
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getNamedParameter(java.lang.String)
     */
    public String getNamedParameter(String arg0) {
        return this.docletTag.getNamedParameter(arg0);
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getParameters()
     */
    public String[] getParameters() {
        return this.docletTag.getParameters();
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getSourceLocation()
     */
    public String getSourceLocation() {
        if ( this.docletTag.getContext().getParent() != null ) {
            return String.valueOf(this.docletTag.getContext().getParent().getParentSource().getURL());
        }
        return String.valueOf(this.docletTag.getContext().getParentClass().getSource().getURL());
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getLineNumber()
     */
    public int getLineNumber() {
        return this.docletTag.getLineNumber();
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getJavaClassDescription()
     */
    public JavaClassDescription getJavaClassDescription() {
        return this.description;
    }

    /**
     * @see org.apache.felix.scrplugin.tags.JavaTag#getNamedParameterMap()
     */
    @SuppressWarnings("unchecked")
    public Map<String, String> getNamedParameterMap() {
{'fraction_non_alphanumeric': 0.10753785945210141, 'fraction_numerical': 0.00272247745448358, 'mean_word_length': 3.127808988764045, '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': '4559741', 'n_tokens_mistral': 1702, 'n_tokens_neox': 1678, 'n_words': 431}