// Path: app/src/main/java/de/dorianscholz/openlibre/OpenLibre.java
// public static boolean GLUCOSE_UNIT_IS_MMOL = false;


import android.support.annotation.NonNull;
import java.text.DecimalFormat;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
import static de.dorianscholz.openlibre.OpenLibre.GLUCOSE_UNIT_IS_MMOL;
        this(sensor, ageInSensorMinutes, timezoneOffsetInMinutes, glucoseLevelRaw, isTrendData, sensor.getStartDate() + TimeUnit.MINUTES.toMillis(ageInSensorMinutes));
    }

    public static String generateId(SensorData sensor, int ageInSensorMinutes, boolean isTrendData, int glucoseLevelRaw) {
        if (isTrendData) {
            // a trend data value for a specific time is not fixed in its value, but can change on the next reading
            // so the trend id also includes the glucose value itself, so the previous reading's data are not overwritten
            return String.format(Locale.US, "trend_%s_%05d_%03d", sensor.getId(), ageInSensorMinutes, glucoseLevelRaw);
        } else {
            return String.format(Locale.US, "history_%s_%05d", sensor.getId(), ageInSensorMinutes);
        }
    }

    public static float convertGlucoseMMOLToMGDL(float mmol) {
        return mmol * 18f;
    }

    public static float convertGlucoseMGDLToMMOL(float mgdl) {
        return mgdl / 18f;
    }

    private static float convertGlucoseRawToMGDL(float raw) {
        return raw / 10f;
    }

    private static float convertGlucoseRawToMMOL(float raw) {
        return convertGlucoseMGDLToMMOL(raw / 10f);
    }

    public static float convertGlucoseMGDLToDisplayUnit(float mgdl) {
// Path: app/src/main/java/de/dorianscholz/openlibre/OpenLibre.java
// public static boolean GLUCOSE_UNIT_IS_MMOL = false;


// Path: app/src/main/java/de/dorianscholz/openlibre/model/GlucoseData.java
import android.support.annotation.NonNull;
import java.text.DecimalFormat;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
import static de.dorianscholz.openlibre.OpenLibre.GLUCOSE_UNIT_IS_MMOL;

        this(sensor, ageInSensorMinutes, timezoneOffsetInMinutes, glucoseLevelRaw, isTrendData, sensor.getStartDate() + TimeUnit.MINUTES.toMillis(ageInSensorMinutes));
    }

    public static String generateId(SensorData sensor, int ageInSensorMinutes, boolean isTrendData, int glucoseLevelRaw) {
        if (isTrendData) {
            // a trend data value for a specific time is not fixed in its value, but can change on the next reading
            // so the trend id also includes the glucose value itself, so the previous reading's data are not overwritten
            return String.format(Locale.US, "trend_%s_%05d_%03d", sensor.getId(), ageInSensorMinutes, glucoseLevelRaw);
        } else {
            return String.format(Locale.US, "history_%s_%05d", sensor.getId(), ageInSensorMinutes);
        }
    }

    public static float convertGlucoseMMOLToMGDL(float mmol) {
        return mmol * 18f;
    }

    public static float convertGlucoseMGDLToMMOL(float mgdl) {
        return mgdl / 18f;
    }

    private static float convertGlucoseRawToMGDL(float raw) {
        return raw / 10f;
    }

    private static float convertGlucoseRawToMMOL(float raw) {
        return convertGlucoseMGDLToMMOL(raw / 10f);
    }

    public static float convertGlucoseMGDLToDisplayUnit(float mgdl) {
        return GLUCOSE_UNIT_IS_MMOL ? convertGlucoseMGDLToMMOL(mgdl) : mgdl;