<commit_before>/*
 * Copyright (C) 2010-2013 by PhonyTive LLC (http://phonytive.com)
 * http://astivetoolkit.org
 *
 * This file is part of Astive Toolkit(ATK)
 *
 * 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.astivetoolkit.server;

import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.astivetoolkit.astivlet.Astivlet;
import org.astivetoolkit.server.monitor.SimpleConnectionMonitor;

/**
 * Simple and convenient {@link AstiveServer}, useful for testing.
 *
 * @since 1.0.0
 * @see Service
 * @see AbstractAstiveServer
 * @see AstiveServer
 */
public class SimpleAstiveServer extends AbstractAstiveServer {

    private Astivlet astivlet;
    private ExecutorService executorService;
    private int port;

    public SimpleAstiveServer(Astivlet astivlet) throws SystemException, IOException {
        super();
        this.port = DEFAULT_AGI_SERVER_PORT;
        this.astivlet = astivlet;
    }

    public SimpleAstiveServer(Astivlet astivlet, int port)
            throws SystemException, IOException {
        super(port);
        this.port = port;
        this.astivlet = astivlet;
    }

    public Astivlet getAstivlet() {
        return astivlet;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getPort() {
        return port;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void launchConnectionMonitor() {
        SimpleConnectionMonitor monitor = new SimpleConnectionMonitor(this, astivlet);
        monitor.run();
    }<commit_msg>SimpleAstiveServer was updated to accept the bindAddr parameter.<commit_after>/*
 * Copyright (C) 2010-2013 by PhonyTive LLC (http://phonytive.com)
 * http://astivetoolkit.org
 *
 * This file is part of Astive Toolkit(ATK)
 *
 * 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.astivetoolkit.server;

import java.io.IOException;
import java.net.InetAddress;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.astivetoolkit.astivlet.Astivlet;
import org.astivetoolkit.server.monitor.SimpleConnectionMonitor;

/**
 * Simple and convenient {@link AstiveServer}, useful for testing.
 *
 * @since 1.0.0
 * @see Service
 * @see AbstractAstiveServer
 * @see AstiveServer
 */
public class SimpleAstiveServer extends AbstractAstiveServer {

    private Astivlet astivlet;
    private ExecutorService executorService;
    private int port;
    private int backlog;
    private InetAddress bindAddr;

    public SimpleAstiveServer(Astivlet astivlet) throws SystemException, IOException {
        super();
        this.port = DEFAULT_AGI_SERVER_PORT;
        this.astivlet = astivlet;
    }

    public SimpleAstiveServer(Astivlet astivlet, int port)
            throws SystemException, IOException {
        super(port);
        this.port = port;
        this.astivlet = astivlet;
    }

    public SimpleAstiveServer(Astivlet astivlet, int port, int backlog) throws SystemException, IOException {
        super(port, backlog);
        this.port = port;
        this.backlog = backlog;
        this.astivlet = astivlet;
    }

    public SimpleAstiveServer(Astivlet astivlet, int port, int backlog, InetAddress bindAddr)
            throws SystemException, IOException {
        super(port, backlog, bindAddr);
        this.port = port;
        this.backlog = backlog;
        this.bindAddr = bindAddr;
        this.astivlet = astivlet;
    }

    public Astivlet getAstivlet() {
        return astivlet;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getPort() {
        return port;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getBacklog() {
        return backlog;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public InetAddress getBindAddr() {
        return bindAddr;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void launchConnectionMonitor() {
        SimpleConnectionMonitor monitor = new SimpleConnectionMonitor(this, astivlet);
        monitor.run();
    }
{'fraction_non_alphanumeric': 0.0875269238300372, 'fraction_numerical': 0.005874290189935382, 'mean_word_length': 2.984399375975039, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '21401', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1431, 'n_words': 436}