// Path: databoundary/src/main/java/eu/rampsoftware/er/data/CurrencyData.java
// public class CurrencyData {
//     private final String mBaseCurrency;
//     private Date mDate;
//     private Map<String, Double> mCurrencies;
// 
//     public CurrencyData(final Date date, final Map<String, Double> currencies, final String baseCurrency) {
//         mDate = date;
//         mCurrencies = currencies;
//         mBaseCurrency = baseCurrency;
//     }
// 
//     public String getBaseCurrency() {
//         return mBaseCurrency;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public Map<String, Double> getCurrencies() {
//         return mCurrencies;
//     }
// }
// 
// Path: databoundary/src/main/java/eu/rampsoftware/er/data/SingleValue.java
// public class SingleValue {
//     private Date mDate;
//     private double mValue;
// 
//     public SingleValue(final Date date, final double value) {
//         mDate = date;
//         mValue = value;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public double getValue() {
//         return mValue;
//     }
// 
//     @Override
//     public String toString() {
//         return "SingleValue{" +
//                 "mDate=" + mDate +
//                 ", mValue=" + mValue +
//                 '}';
//     }
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/CurrencyDataSource.java
// public interface CurrencyDataSource {
// 
//     Observable<CurrencyData> getCurrencies(Date date);
// 
//     boolean containsCurrencyValue(Date date, String currencyCode);
// 
//     boolean containsCurrencyValues(Date date);
// 
//     Observable<SingleValue> getCurrencyValues(Date startDate, Date endDate, String currencyCode);
// 
//     void storeCurrencies(CurrencyData currencyData);
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/local/model/ValueEntity.java
// public class ValueEntity extends RealmObject {
// 
//     public static final String TIMESTAMP = "timestamp";
//     public static final String CODE = "code";
//     private Double value;
//     private long timestamp;
//     private String code;
// 
//     public ValueEntity(){}
//     public ValueEntity(final Double value, final long timestamp, final String currencyCode) {
//         this.value = value;
//         this.timestamp = timestamp;
//         this.code = currencyCode;
//     }
// 
//     public Double getValue() {
//         return value;
//     }
// 
//     public long getTimestamp() {
//         return timestamp;
//     }
// 
//     public String getCode() {
//         return code;
//     }
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/utils/DateUtils.java
// public static long midnight(final long timestamp) {
//     return (timestamp / DAY_MILLIS) * DAY_MILLIS;
// }


import android.text.TextUtils;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import eu.rampsoftware.er.data.CurrencyData;
import eu.rampsoftware.er.data.SingleValue;
import eu.rampsoftware.er.data.datasource.CurrencyDataSource;
import eu.rampsoftware.er.data.datasource.local.model.ValueEntity;
import io.reactivex.Observable;
import io.realm.RealmQuery;
import io.realm.RealmResults;
import static eu.rampsoftware.er.data.utils.DateUtils.midnight;
package eu.rampsoftware.er.data.datasource.local;






public class DatabaseCurrencyDataSource extends RealmManagerBase implements CurrencyDataSource {


    public DatabaseCurrencyDataSource() {
        super();
    }

    @Override
    public Observable<CurrencyData> getCurrencies(final Date date) {

// Path: databoundary/src/main/java/eu/rampsoftware/er/data/CurrencyData.java
// public class CurrencyData {
//     private final String mBaseCurrency;
//     private Date mDate;
//     private Map<String, Double> mCurrencies;
// 
//     public CurrencyData(final Date date, final Map<String, Double> currencies, final String baseCurrency) {
//         mDate = date;
//         mCurrencies = currencies;
//         mBaseCurrency = baseCurrency;
//     }
// 
//     public String getBaseCurrency() {
//         return mBaseCurrency;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public Map<String, Double> getCurrencies() {
//         return mCurrencies;
//     }
// }
// 
// Path: databoundary/src/main/java/eu/rampsoftware/er/data/SingleValue.java
// public class SingleValue {
//     private Date mDate;
//     private double mValue;
// 
//     public SingleValue(final Date date, final double value) {
//         mDate = date;
//         mValue = value;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public double getValue() {
//         return mValue;
//     }
// 
//     @Override
//     public String toString() {
//         return "SingleValue{" +
//                 "mDate=" + mDate +
//                 ", mValue=" + mValue +
//                 '}';
//     }
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/CurrencyDataSource.java
// public interface CurrencyDataSource {
// 
//     Observable<CurrencyData> getCurrencies(Date date);
// 
//     boolean containsCurrencyValue(Date date, String currencyCode);
// 
//     boolean containsCurrencyValues(Date date);
// 
//     Observable<SingleValue> getCurrencyValues(Date startDate, Date endDate, String currencyCode);
// 
//     void storeCurrencies(CurrencyData currencyData);
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/local/model/ValueEntity.java
// public class ValueEntity extends RealmObject {
// 
//     public static final String TIMESTAMP = "timestamp";
//     public static final String CODE = "code";
//     private Double value;
//     private long timestamp;
//     private String code;
// 
//     public ValueEntity(){}
//     public ValueEntity(final Double value, final long timestamp, final String currencyCode) {
//         this.value = value;
//         this.timestamp = timestamp;
//         this.code = currencyCode;
//     }
// 
//     public Double getValue() {
//         return value;
//     }
// 
//     public long getTimestamp() {
//         return timestamp;
//     }
// 
//     public String getCode() {
//         return code;
//     }
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/utils/DateUtils.java
// public static long midnight(final long timestamp) {
//     return (timestamp / DAY_MILLIS) * DAY_MILLIS;
// }


// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/local/DatabaseCurrencyDataSource.java
import android.text.TextUtils;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import eu.rampsoftware.er.data.CurrencyData;
import eu.rampsoftware.er.data.SingleValue;
import eu.rampsoftware.er.data.datasource.CurrencyDataSource;
import eu.rampsoftware.er.data.datasource.local.model.ValueEntity;
import io.reactivex.Observable;
import io.realm.RealmQuery;
import io.realm.RealmResults;
import static eu.rampsoftware.er.data.utils.DateUtils.midnight;

package eu.rampsoftware.er.data.datasource.local;






public class DatabaseCurrencyDataSource extends RealmManagerBase implements CurrencyDataSource {


    public DatabaseCurrencyDataSource() {
        super();
    }

    @Override
    public Observable<CurrencyData> getCurrencies(final Date date) {

        final long midnight = midnight(date.getTime());