<commit_before>/* *****************************************************************************
 * LibraryCompiler.java
* ****************************************************************************/

/* J_LZ_COPYRIGHT_BEGIN *******************************************************
* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
* Use is subject to license terms.                                            *
* J_LZ_COPYRIGHT_END *********************************************************/

package org.openlaszlo.compiler;
import java.io.*;
import java.util.*;
import org.jdom.Document;
import org.jdom.Element;
import org.openlaszlo.utils.ChainedException;
import org.apache.log4j.*;

/** Compiler for <code>library</code> elements.
 *
 * @author  <NAME>
 */
class LibraryCompiler extends ToplevelCompiler {
    final static String HREF_ANAME = "href";

    /** Logger
     */
    private static Logger mLogger  = Logger.getLogger(Compiler.class);


    LibraryCompiler(CompilationEnvironment env) {
        super(env);
    }

    static boolean isElement(Element element) {
        return element.getName().equals("library");
    }

    /** Return the library element and add the library to visited.  If
     * the library has already been visited, return null instead.
     */
    static Element resolveLibraryElement(File file,
                                         CompilationEnvironment env,
                                         Set visited,
                                         boolean validate)
    {
        try {
            File key = file.getCanonicalFile();<commit_msg>Change 20070222-ptw-K by <EMAIL> on 2007-02-22 15:53:31 PST     in /Users/ptw/OpenLaszlo/3.4.1<commit_after>/* *****************************************************************************
 * LibraryCompiler.java
* ****************************************************************************/

/* J_LZ_COPYRIGHT_BEGIN *******************************************************
* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
* Use is subject to license terms.                                            *
* J_LZ_COPYRIGHT_END *********************************************************/

package org.openlaszlo.compiler;
import java.io.*;
import java.util.*;
import org.jdom.Document;
import org.jdom.Element;
import org.openlaszlo.utils.ChainedException;
import org.apache.log4j.*;

/** Compiler for <code>library</code> elements.
 *
 * @author  <NAME>
 */
class LibraryCompiler extends ToplevelCompiler {
    final static String HREF_ANAME = "href";

    /** Logger
     */
    private static Logger mLogger  = Logger.getLogger(Compiler.class);


    LibraryCompiler(CompilationEnvironment env) {
        super(env);
    }

    static boolean isElement(Element element) {
        return element.getName().equals("library");
    }

    // TODO: [ows] this duplicates functionality in Parser
    static File resolveLibraryName(File file)
    {
        if (file.isDirectory()) {
            file = new File(file, "library.lzx");
        }
        return file;
    }

    /** Return the library element and add the library to visited.  If
     * the library has already been visited, return null instead.
     */
    static Element resolveLibraryElement(File file,
                                         CompilationEnvironment env,
                                         Set visited,
                                         boolean validate)
    {
        try {
            file = env.resolveLibrary(file.getCanonicalPath(), "");
            File key = file.getCanonicalFile();
{'fraction_non_alphanumeric': 0.2263215859030837, 'fraction_numerical': 0.01183920704845815, 'mean_word_length': 2.5340466926070038, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3872684', 'n_tokens_mistral': 898, 'n_tokens_neox': 824, 'n_words': 221}