<commit_before>package com.bylak.android.motion.recognize;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import com.bylak.android.motion.recognize.listener.OnRecognizedListener;
import com.bylak.network.neural.NeuralNetwork;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: Artur.Bylak
 * Date: 30.09.13
 * Time: 13:26
 * To change this template use File | Settings | File Templates.
 */
public final class MotionProcessor implements SensorEventListener {
    private final OnRecognizedListener onRecognizedListener;
    private final Sensor sensor;
    private final NeuralNetworkSimulator simulator;
    private final MotionResolver motionResolver;

    public MotionProcessor(final Sensor sensor, final OnRecognizedListener onRecognizedListener, final Map<MotionType, NeuralNetwork> networks, double thresholdValue) {
        this.onRecognizedListener = onRecognizedListener;
        this.sensor = sensor;
        this.simulator = new NeuralNetworkSimulator(networks);
        this.motionResolver = new DefaultMotionResolver(thresholdValue);
    }

    @Override
    public void onSensorChanged(SensorEvent sensorEvent) {
        float[] values = sensorEvent.values;

        Map<MotionType, Double[]> simulationOutput = simulator.invokeAll(values);

    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int i) {

    }


}
<commit_msg>Refactor<commit_after>package com.bylak.android.motion.recognize;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import com.bylak.android.motion.recognize.listener.OnRecognizedListener;
import com.bylak.network.neural.NeuralNetwork;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: Artur.Bylak
 * Date: 30.09.13
 * Time: 13:26
 * To change this template use File | Settings | File Templates.
 */
public final class MotionProcessor implements SensorEventListener {
    private final OnRecognizedListener onRecognizedListener;
    private final Sensor sensor;
    private final NeuralNetworkSimulator simulator;
    private final MotionResolver motionResolver;

    public static final int MOTION_UNKNOWN = -1;

    public MotionProcessor(final Sensor sensor, final OnRecognizedListener onRecognizedListener, final Map<MotionType, NeuralNetwork> networks, double thresholdValue) {
        this.onRecognizedListener = onRecognizedListener;
        this.sensor = sensor;
        this.simulator = new NeuralNetworkSimulator(networks);
        this.motionResolver = new DefaultMotionResolver(thresholdValue);
    }

    @Override
    public void onSensorChanged(SensorEvent sensorEvent) {
        float[] values = sensorEvent.values;

        Map<MotionType, Double[]> simulationOutput = simulator.invokeAll(values);
        MotionType motionType = motionResolver.resolve(simulationOutput);

        if (motionType.getId() != -MOTION_UNKNOWN) {
            onRecognizedListener.onRecognize(motionType);
        }
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int i) {

    }


}

{'fraction_non_alphanumeric': 0.07800511508951406, 'fraction_numerical': 0.006713554987212276, 'mean_word_length': 4.206322795341098, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1094580', 'n_tokens_mistral': 906, 'n_tokens_neox': 839, 'n_words': 207}