<commit_before>package info.nightscout.android.utils;


import com.bugfender.sdk.a.a.k.a;

import java.util.Date;

import info.nightscout.android.model.medtronicNg.PumpStatusEvent;
import io.realm.Realm;

/**
 * Created by volker on 30.03.2017.
 */

public class DataStore {
    private static DataStore instance;

    private PumpStatusEvent lastPumpStatus;
    private int uplooaderBatteryLevel = 0;
    private int unavailableSGVCount = 0;
    private long activePumpMac = 0;

    private DataStore() {}

    public static DataStore getInstance() {
        if (DataStore.instance == null) {
            instance = new DataStore();

            // set some initial dummy values
            PumpStatusEvent dummyStatus = new PumpStatusEvent();
            dummyStatus.setEventDate(new Date(0));

            // bypass setter to avoid dealing with a real Realm object
            instance.lastPumpStatus = dummyStatus;
        }

        return instance;
    }

    public PumpStatusEvent getLastPumpStatus() {
        return lastPumpStatus;
    }

    public void setLastPumpStatus(PumpStatusEvent lastPumpStatus) {
        this.lastPumpStatus = Realm.getDefaultInstance().copyFromRealm(lastPumpStatus);
    }

    public int getUplooaderBatteryLevel() {
        return uplooaderBatteryLevel;
    }

    public void setUplooaderBatteryLevel(int uplooaderBatteryLevel) {
        this.uplooaderBatteryLevel = uplooaderBatteryLevel;
    }

    public int getUnavailableSGVCount() {<commit_msg>close Realm also after getInstance<commit_after>package info.nightscout.android.utils;


import com.bugfender.sdk.a.a.k.a;

import java.util.Date;

import info.nightscout.android.model.medtronicNg.PumpStatusEvent;
import io.realm.Realm;

/**
 * Created by volker on 30.03.2017.
 */

public class DataStore {
    private static DataStore instance;

    private PumpStatusEvent lastPumpStatus;
    private int uplooaderBatteryLevel = 0;
    private int unavailableSGVCount = 0;
    private long activePumpMac = 0;

    private DataStore() {}

    public static DataStore getInstance() {
        if (DataStore.instance == null) {
            instance = new DataStore();

            // set some initial dummy values
            PumpStatusEvent dummyStatus = new PumpStatusEvent();
            dummyStatus.setEventDate(new Date(0));

            // bypass setter to avoid dealing with a real Realm object
            instance.lastPumpStatus = dummyStatus;
        }

        return instance;
    }

    public PumpStatusEvent getLastPumpStatus() {
        return lastPumpStatus;
    }

    public void setLastPumpStatus(PumpStatusEvent lastPumpStatus) {
        Realm realm = Realm.getDefaultInstance();

        this.lastPumpStatus = realm.copyFromRealm(lastPumpStatus);
        if (!realm.isClosed()) realm.close();
    }

    public int getUplooaderBatteryLevel() {
        return uplooaderBatteryLevel;
    }

    public void setUplooaderBatteryLevel(int uplooaderBatteryLevel) {
        this.uplooaderBatteryLevel = uplooaderBatteryLevel;
    }

    public int getUnavailableSGVCount() {
{'fraction_non_alphanumeric': 0.07794738551477752, 'fraction_numerical': 0.007794738551477752, 'mean_word_length': 2.9335887611749683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7486341', 'n_tokens_mistral': 943, 'n_tokens_neox': 896, 'n_words': 208}