<commit_before>/*
 *
 * Copyright 2007 <NAME>
 *
 * Licensed 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.codehaus.groovy.tools.groovydoc;

import java.io.File;
import java.util.Arrays;
import java.util.Iterator;

import org.codehaus.groovy.groovydoc.GroovyClassDoc;
import org.codehaus.groovy.groovydoc.GroovyPackageDoc;
import org.codehaus.groovy.groovydoc.GroovyRootDoc;

/*
 * todo
 *  comma at the end of method parameters
 *  static modifier
 *  order methods alphabetically (implement compareTo enough?)
 *  provide links to other html files (e.g. return type of a method)
 */
public class GroovyDocWriter {
	private GroovyDocTool tool;
	private OutputTool output;
	private GroovyDocTemplateEngine templateEngine;
    private static final String FS = File.separator;

    public GroovyDocWriter(GroovyDocTool tool, OutputTool output, GroovyDocTemplateEngine templateEngine) {
		this.tool = tool;
		this.output = output;
		this.templateEngine = templateEngine;
	}

	public void writeClasses(GroovyRootDoc rootDoc, String destdir) throws Exception {
		Iterator classDocs = Arrays.asList(rootDoc.classes()).iterator();
		while (classDocs.hasNext()) {
			GroovyClassDoc classDoc = (GroovyClassDoc) classDocs.next();
			writeClassToOutput(classDoc, destdir);
		}
	}

	public void writeRoot(GroovyRootDoc rootDoc, String destdir) throws Exception {
		output.makeOutputArea(destdir);
		writeRootDocToOutput(rootDoc, destdir);
	}

	public void writeClassToOutput(GroovyClassDoc classDoc, String destdir) throws Exception {
		String destFileName = destdir + FS + classDoc.getFullPathName() + ".html";
		System.out.println("Generating " + destFileName);
<commit_msg>make groovydoc more cross-platform (at least in one spot)<commit_after>/*
 *
 * Copyright 2007 <NAME>
 *
 * Licensed 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.codehaus.groovy.tools.groovydoc;

import java.io.File;
import java.util.Arrays;
import java.util.Iterator;

import org.codehaus.groovy.groovydoc.GroovyClassDoc;
import org.codehaus.groovy.groovydoc.GroovyPackageDoc;
import org.codehaus.groovy.groovydoc.GroovyRootDoc;

/*
 * todo
 *  comma at the end of method parameters
 *  static modifier
 *  order methods alphabetically (implement compareTo enough?)
 *  provide links to other html files (e.g. return type of a method)
 */
public class GroovyDocWriter {
	private GroovyDocTool tool;
	private OutputTool output;
	private GroovyDocTemplateEngine templateEngine;
    private static final String FS = "/";

    public GroovyDocWriter(GroovyDocTool tool, OutputTool output, GroovyDocTemplateEngine templateEngine) {
		this.tool = tool;
		this.output = output;
		this.templateEngine = templateEngine;
	}

	public void writeClasses(GroovyRootDoc rootDoc, String destdir) throws Exception {
		Iterator classDocs = Arrays.asList(rootDoc.classes()).iterator();
		while (classDocs.hasNext()) {
			GroovyClassDoc classDoc = (GroovyClassDoc) classDocs.next();
			writeClassToOutput(classDoc, destdir);
		}
	}

	public void writeRoot(GroovyRootDoc rootDoc, String destdir) throws Exception {
		output.makeOutputArea(destdir);
		writeRootDocToOutput(rootDoc, destdir);
	}

	public void writeClassToOutput(GroovyClassDoc classDoc, String destdir) throws Exception {
		String destFileName = destdir + FS + classDoc.getFullPathName() + ".html";
		System.out.println("Generating " + destFileName);

{'fraction_non_alphanumeric': 0.08551881413911061, 'fraction_numerical': 0.0036488027366020524, 'mean_word_length': 4.755905511811024, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1088230', 'n_tokens_mistral': 1361, 'n_tokens_neox': 1247, 'n_words': 409}