<commit_before>/*
 * Polyglotter (http://polyglotter.org)
 * See the COPYRIGHT.txt file distributed with this work for information
 * regarding copyright ownership.  Some portions may be licensed
 * to Red Hat, Inc. under one or more contributor license agreements.
 * See the AUTHORS.txt file in the distribution for a full listing of 
 * individual contributors.
 *
 * Polyglotter is free software. Unless otherwise indicated, all code in Polyglotter
 * is licensed to you under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * Polyglotter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.polyglotter;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;

import org.modeshape.modeler.ModeShapeModeler;
import org.modeshape.modeler.Model;
import org.modeshape.modeler.ModelObject;
import org.modeshape.modeler.ModelType;
import org.modeshape.modeler.ModelTypeManager;
import org.modeshape.modeler.Modeler;
import org.modeshape.modeler.ModelerException;
import org.polyglotter.common.CheckArg;
import org.polyglotter.common.PolyglotterException;
import org.polyglotter.internal.CloneOperation;
import org.polyglotter.internal.ModelTransformImpl;
import org.polyglotter.internal.TransformImpl;

/**
 * 
 */
public final class Polyglotter implements Modeler {

    private final Modeler modeler;

    /**
     * Uses a default ModeShape configuration.
     * 
     * @param repositoryStoreParentPath
     *        the file path to the folder that should contain the ModeShape repository store
     */
    public Polyglotter( final String repositoryStoreParentPath ) {
        modeler = new ModeShapeModeler( repositoryStoreParentPath );
    }

    /**
     * @param repositoryStoreParentPath
     *        the file path to the folder that should contain the ModeShape repository store
     * @param modeShapeConfigurationPath
     *        the file path to a ModeShape configuration file
     */
    public Polyglotter( final String repositoryStoreParentPath,
                        final String modeShapeConfigurationPath ) {
        modeler = new ModeShapeModeler( repositoryStoreParentPath, modeShapeConfigurationPath );
    }

    /**
     * {@inheritDoc}
     * 
     * @see AutoCloseable#close()
     */
    @Override
    public void close() throws Exception {
        modeler.close();
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.modeshape.modeler.Modeler#export(org.modeshape.modeler.Model, java.io.File)
     */
    @Override
    public void export( final Model model,
                        final File file ) throws ModelerException {
        modeler.export( model, file );
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.modeshape.modeler.Modeler#export(org.modeshape.modeler.Model, java.io.OutputStream)
     */
    @Override
    public void export( final Model model,
                        final OutputStream stream ) throws ModelerException {
        modeler.export( model, stream );
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.modeshape.modeler.Modeler#export(org.modeshape.modeler.Model, java.net.URL)
     */
    @Override
    public void export( final Model model,
                        final URL url ) throws ModelerException {
        modeler.export( model, url );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateDefaultModel(String, String)
     */
    @Override
    public Model generateDefaultModel( final String artifactPath,
                                       final String modelPath ) throws ModelerException {
        return modeler.generateDefaultModel( artifactPath, modelPath );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(File, String, ModelType)
     */
    @Override
    public Model generateModel( final File file,
                                final String modelFolder,
                                final ModelType modelType ) throws ModelerException {
        return modeler.generateModel( file, modelFolder, modelType );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(File, String, String, ModelType)
     */
    @Override
    public Model generateModel( final File file,
                                final String modelFolder,
                                final String modelName,
                                final ModelType modelType ) throws ModelerException {
        return modeler.generateModel( file, modelFolder, modelName, modelType );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(InputStream, String, ModelType)
     */
    @Override
    public Model generateModel( final InputStream stream,
                                final String modelPath,
                                final ModelType modelType ) throws ModelerException {
        return modeler.generateModel( stream, modelPath, modelType );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(java.lang.String, java.lang.String, org.modeshape.modeler.ModelType, boolean)
     */
    @Override
    public Model generateModel( final String artifactPath,
                                final String modelPath,
                                final ModelType modelType,
                                final boolean persistArtifacts ) throws ModelerException {
        return modeler.generateModel( artifactPath, modelPath, modelType, persistArtifacts );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(URL, String, ModelType)
     */
    @Override
    public Model generateModel( final URL artifactUrl,
                                final String modelFolder,
                                final ModelType modelType ) throws ModelerException {
        return modeler.generateModel( artifactUrl, modelFolder, modelType );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(URL, String, String, ModelType)
     */
    @Override
    public Model generateModel( final URL artifactUrl,
                                final String modelFolder,<commit_msg>Fixed bug in Polyglotter.java<commit_after>/*
 * Polyglotter (http://polyglotter.org)
 * See the COPYRIGHT.txt file distributed with this work for information
 * regarding copyright ownership.  Some portions may be licensed
 * to Red Hat, Inc. under one or more contributor license agreements.
 * See the AUTHORS.txt file in the distribution for a full listing of 
 * individual contributors.
 *
 * Polyglotter is free software. Unless otherwise indicated, all code in Polyglotter
 * is licensed to you under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * Polyglotter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.polyglotter;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;

import org.modeshape.modeler.ModeShapeModeler;
import org.modeshape.modeler.Model;
import org.modeshape.modeler.ModelObject;
import org.modeshape.modeler.ModelType;
import org.modeshape.modeler.ModelTypeManager;
import org.modeshape.modeler.Modeler;
import org.modeshape.modeler.ModelerException;
import org.polyglotter.common.CheckArg;
import org.polyglotter.common.PolyglotterException;
import org.polyglotter.internal.CloneOperation;
import org.polyglotter.internal.ModelTransformImpl;
import org.polyglotter.internal.TransformImpl;

/**
 * 
 */
public final class Polyglotter implements Modeler {

    private final Modeler modeler;

    /**
     * Uses a default ModeShape configuration.
     * 
     * @param repositoryStoreParentPath
     *        the file path to the folder that should contain the ModeShape repository store
     */
    public Polyglotter( final String repositoryStoreParentPath ) {
        modeler = new ModeShapeModeler( repositoryStoreParentPath );
    }

    /**
     * @param repositoryStoreParentPath
     *        the file path to the folder that should contain the ModeShape repository store
     * @param modeShapeConfigurationPath
     *        the file path to a ModeShape configuration file
     */
    public Polyglotter( final String repositoryStoreParentPath,
                        final String modeShapeConfigurationPath ) {
        modeler = new ModeShapeModeler( repositoryStoreParentPath, modeShapeConfigurationPath );
    }

    /**
     * {@inheritDoc}
     * 
     * @see AutoCloseable#close()
     */
    @Override
    public void close() throws Exception {
        modeler.close();
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.modeshape.modeler.Modeler#export(org.modeshape.modeler.Model, java.io.File)
     */
    @Override
    public void export( final Model model,
                        final File file ) throws ModelerException {
        modeler.export( model, file );
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.modeshape.modeler.Modeler#export(org.modeshape.modeler.Model, java.io.OutputStream)
     */
    @Override
    public void export( final Model model,
                        final OutputStream stream ) throws ModelerException {
        modeler.export( model, stream );
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.modeshape.modeler.Modeler#export(org.modeshape.modeler.Model, java.net.URL)
     */
    @Override
    public void export( final Model model,
                        final URL url ) throws ModelerException {
        modeler.export( model, url );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateDefaultModel(String, String)
     */
    @Override
    public Model generateDefaultModel( final String artifactPath,
                                       final String modelPath ) throws ModelerException {
        return modeler.generateDefaultModel( artifactPath, modelPath );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(File, String, ModelType)
     */
    @Override
    public Model generateModel( final File file,
                                final String modelFolder,
                                final ModelType modelType ) throws ModelerException {
        return modeler.generateModel( file, modelFolder, modelType );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(File, String, String, ModelType)
     */
    @Override
    public Model generateModel( final File file,
                                final String modelFolder,
                                final String modelName,
                                final ModelType modelType ) throws ModelerException {
        return modeler.generateModel( file, modelFolder, modelName, modelType );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(InputStream, String, ModelType)
     */
    @Override
    public Model generateModel( final InputStream stream,
                                final String modelPath,
                                final ModelType modelType ) throws ModelerException {
        return modeler.generateModel( stream, modelPath, modelType );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(String, String, ModelType, boolean)
     */
    @Override
    public Model generateModel( final String artifactPath,
                                final String modelPath,
                                final ModelType modelType,
                                final boolean persistArtifact ) throws ModelerException {
        return modeler.generateModel( artifactPath, modelPath, modelType, persistArtifact );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(URL, String, ModelType)
     */
    @Override
    public Model generateModel( final URL artifactUrl,
                                final String modelFolder,
                                final ModelType modelType ) throws ModelerException {
        return modeler.generateModel( artifactUrl, modelFolder, modelType );
    }

    /**
     * {@inheritDoc}
     * 
     * @see Modeler#generateModel(URL, String, String, ModelType)
     */
    @Override
    public Model generateModel( final URL artifactUrl,
                                final String modelFolder,
{'fraction_non_alphanumeric': 0.07773109243697479, 'fraction_numerical': 0.0019507803121248499, 'mean_word_length': 2.3489949748743717, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3956086', 'n_tokens_mistral': 3502, 'n_tokens_neox': 3373, 'n_words': 1040}