<commit_before>package se.acoder.autohub.products.Trip;

import android.location.Location;

/**
 * Created by <NAME> on 2017-03-16.
 */

public class TripManager {
    private boolean ongoing;
    private float distance;
    private long time;
    private Location lastLocation;
    private Location lastSignificantLocation;
    private Location start;

    private final int STATIONARY_DELTA = 20*1000*60;

    public TripManager(){
        resetValues();
    }

    public void computeLocation(Location location){
        if(!ongoing && lastSignificantLocation != null &&
                lastSignificantLocation.distanceTo(location) > 50)
            ongoing = true;

        if(ongoing) {
            if(lastSignificantLocation.distanceTo(location) > 50){
                lastSignificantLocation = location;
            }
            if(location.getTime() - lastSignificantLocation.getTime() > STATIONARY_DELTA){
                endTrip();
                return;
            }
            distance += lastLocation.distanceTo(location);
            time += location.getTime() - lastLocation.getTime();
        } else {
            start = location;
            lastSignificantLocation = location;
        }
        lastLocation = location;
    }

    public void endTrip(){
        if(ongoing) {<commit_msg>Hopefully reparing trip-meter<commit_after>package se.acoder.autohub.products.Trip;

import android.location.Location;

/**
 * Created by <NAME> on 2017-03-16.
 */

public class TripManager {
    private boolean ongoing;
    private float distance;
    private long time;
    private Location lastLocation;
    private Location lastSignificantLocation;
    private Location start;

    private final int STATIONARY_DELTA = 20*1000*60;

    public TripManager(){
        resetValues();
    }

    public void computeLocation(Location location){
        if(!ongoing && lastSignificantLocation != null &&
                lastSignificantLocation.distanceTo(location) > 50)
            ongoing = true;

        if(ongoing) {
            if(lastSignificantLocation.distanceTo(location) > 50){
                lastSignificantLocation = location;
            }
            if(location.getTime() - lastSignificantLocation.getTime() > STATIONARY_DELTA){
                endTrip();
                return;
            }
            distance += lastLocation.distanceTo(location);
            time += location.getTime() - lastLocation.getTime();
        } else if(lastSignificantLocation != null){
            if(lastSignificantLocation.distanceTo(location) > 50){
                start = lastSignificantLocation;
                ongoing = true;
            } else if (lastSignificantLocation.getTime() > 10*1000){
                lastSignificantLocation = null;
            } else {
                lastSignificantLocation = location;
            }
        }
        lastLocation = location;
    }

    public void endTrip(){
        if(ongoing) {
{'fraction_non_alphanumeric': 0.09032258064516129, 'fraction_numerical': 0.01629881154499151, 'mean_word_length': 2.157556270096463, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4230204', 'n_tokens_mistral': 824, 'n_tokens_neox': 735, 'n_words': 165}