<commit_before>package com.github.privacystreams;

import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.HtmlDoclet;
import com.sun.tools.doclets.standard.Standard;
import com.sun.tools.javac.code.Attribute;

import java.util.Arrays;

/**
 * Generate API documentation for PrivacyStreams.
 */

public class DocGenerator extends HtmlDoclet {
    public static boolean start(RootDoc root) {
        ClassDoc[] classes = root.classes();
        for (int i = 0; i < classes.length; ++i) {
            System.out.println(classes[i]);
            ClassDoc classDoc = classes[i];
            System.out.println(Arrays.asList(classDoc.typeParameters()));
        }
        System.out.println("I'm printing something!");

        return true;
    }
}<commit_msg>slight change<commit_after>package com.github.privacystreams;

import com.sun.javadoc.AnnotationDesc;
import com.sun.javadoc.AnnotationTypeDoc;
import com.sun.javadoc.ClassDoc;
import com.sun.javadoc.FieldDoc;
import com.sun.javadoc.RootDoc;
import com.sun.tools.doclets.formats.html.HtmlDoclet;
import com.sun.tools.javac.code.Attribute;

import java.util.ArrayList;
import java.util.List;

/**
 * Generate API documentation for PrivacyStreams.
 */

public class DocGenerator extends HtmlDoclet {
    private static final String ITEM_ANNOTATION = "com.github.privacystreams.utils.annotations.PSItem";
    private static final String OPERATOR_WRAPPER_ANNOTATION = "com.github.privacystreams.utils.annotations.PSOperatorWrapper";
    private static final String ITEM_FIELD_ANNOTATION = "com.github.privacystreams.utils.annotations.PSItemField";

    public static boolean start(RootDoc root) {
        ClassDoc[] classes = root.classes();

        List<ClassDoc> itemClasses = new ArrayList<>();
        List<ClassDoc> operatorWrappers = new ArrayList<>();

        for (int i = 0; i < classes.length; ++i) {
            ClassDoc classDoc = classes[i];

            AnnotationDesc[] annotations = classDoc.annotations();
            for (AnnotationDesc annotation : annotations) {
                AnnotationTypeDoc annotationType = annotation.annotationType();
                if (ITEM_ANNOTATION.equals(annotationType.toString())) {
                    itemClasses.add(classDoc);
                    System.out.println(genItemDocs(classDoc));
                    break;
                }
                if (OPERATOR_WRAPPER_ANNOTATION.equals(annotationType.toString())) {
                    operatorWrappers.add(classDoc);
                    break;
                }
            }

        }

//        System.out.println(itemClasses);
//        System.out.println(operatorWrappers);

        return true;
    }

    public static String genItemDocs(ClassDoc itemClass) {
        String itemDoc = "";
        itemDoc += "Class: " + itemClass.name() + "\n";
        itemDoc += "Description: " + itemClass.commentText() + "\n";
        itemDoc += "Fields:\n";
        for (FieldDoc fieldDoc : itemClass.fields()) {
            AnnotationDesc[] annotations = fieldDoc.annotations();
            for (AnnotationDesc annotation : annotations) {
                AnnotationTypeDoc annotationType = annotation.annotationType();
                if (ITEM_FIELD_ANNOTATION.equals(annotationType.toString())) {
                    itemDoc += fieldDoc.name() + " " + fieldDoc.constantValue() + "\n";
                    for (AnnotationDesc.ElementValuePair elementValuePair : annotation.elementValues()) {
                        itemDoc += elementValuePair.element().name() + " " + elementValuePair.value() + "\n";
                    }

                    break;
                }
            }
        }
        return itemDoc;
    }
}
{'fraction_non_alphanumeric': 0.11201298701298701, 'fraction_numerical': 0.0005411255411255411, 'mean_word_length': 2.471361502347418, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3435843', 'n_tokens_mistral': 1032, 'n_tokens_neox': 977, 'n_words': 193}