// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/observables/DBFlowCountSingle.java
// public class DBFlowCountSingle<TModel> extends DBFlowBaseSingle<TModel, Long>  {
// 
//     private final BaseQueriable mBaseModelQueriable;
//     private final DatabaseWrapper mDatabaseWrapper;
// 
//     /**
//      * Creates a new DBFlowCountSingle. Generally this constructor is not used directly, but used
//      * as part of a query statement. {@see au.com.roadhouse.rxdbflow.rx2.sql.language.RxSQLite}
//      * @param clazz The class of the table/view the query effects.
//      * @param baseModelQueriable The query to run when computing the count
//      * @param databaseWrapper The database wrapper that the target table/view belongs too.
//      */
//     public DBFlowCountSingle(@NonNull Class<TModel> clazz, final BaseQueriable baseModelQueriable,
//                              @Nullable DatabaseWrapper databaseWrapper) {
//         super(clazz);
//         mBaseModelQueriable = baseModelQueriable;
//         mDatabaseWrapper = databaseWrapper;
//     }
// 
// 
//     @Override
//     public Long run() {
//         if(mDatabaseWrapper != null){
//             return mBaseModelQueriable.count(mDatabaseWrapper);
//         } else {
//             return mBaseModelQueriable.count();
//         }
//     }
// }
// 
// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/observables/DBFlowCursorSingle.java
// public class DBFlowCursorSingle<TModel> extends DBFlowBaseSingle<TModel, Cursor> {
// 
//     private final Queriable mQueriable;
//     private final DatabaseWrapper mDatabaseWrapper;
// 
//     /**
//      * Creates a new observable which runs a query and emits the result as a Cursor
//      * @param clazz The table/view model in which the FlowCursorList will contain
//      * @param queriable The query to run
//      */
//     public DBFlowCursorSingle( Class<TModel> clazz, Queriable queriable, DatabaseWrapper databaseWrapper) {
//         super(clazz);
//         mQueriable = queriable;
//         mDatabaseWrapper = databaseWrapper;
//     }
// 
//     @Override
//     public Cursor run() {
//         if(mDatabaseWrapper != null){
//             return mQueriable.query(mDatabaseWrapper);
//         } else {
//             return mQueriable.query();
//         }
//     }
// }
// 
// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/observables/DBFlowExecuteCompletable.java
// public class DBFlowExecuteCompletable<TModel> extends DBFlowBaseCompletable<TModel>  {
// 
//     private final BaseQueriable mBaseQueriable;
//     private final DatabaseWrapper mDatabaseWrapper;
// 
//     /**
//      * Creates a new Observable which executes a sql statement against a table
//      * @param clazz The model class representing the table to execute against
//      * @param modelQueriable The query to execute
//      * @param databaseWrapper The database in which the target table resides
//      */
//     public DBFlowExecuteCompletable(Class<TModel> clazz, BaseQueriable modelQueriable, @Nullable DatabaseWrapper databaseWrapper) {
//         super(clazz);
//         mBaseQueriable = modelQueriable;
//         mDatabaseWrapper = databaseWrapper;
//     }
// 
// 
//     public Completable notifyOfUpdates(){
//         return new NotifyOfUpdate<>(this, mBaseQueriable.getQuery(), getPrimaryModelClass());
//     }
// 
//     @Override
//     public void run() {
//         if(mDatabaseWrapper != null) {
//             mBaseQueriable.execute(mDatabaseWrapper);
//         } else {
//             mBaseQueriable.execute();
//         }
//     }
// }
// 
// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/observables/DBFlowSingle.java
// public abstract class DBFlowSingle<T> extends Single<T> implements ValueAction<T> {
// 
//     /**
//      * Observes changes on the current table, restarting the query on change and emits the new count
//      * to any subscribers
//      * @return An observable which observes any changes in the current table
//      */
//     public final Observable<T> restartOnChange(){
//         return new DBFlowRestartOnChange<>(this.toObservable(), new Class[]{getPrimaryModelClass()}, this);
//     }
// 
//     /**
//      * Observes changes for specific tables, restarting the query on change and emits the new count
//      * to any subscribers
//      * @param tableToListen The tables to observe for changes
//      * @return An observable which observes any changes in the specified tables
//      */
//     public final Observable<T> restartOnChange(Class... tableToListen){
//         return new DBFlowRestartOnChange<>(this.toObservable(), tableToListen, this);
//     }
// 
//     /**
//      * Returns the class for the primary table model effected by this query
//      * @return The class for the primary table model
//      */
//     protected abstract Class getPrimaryModelClass();
// 
// }


import android.database.Cursor;
import com.raizlabs.android.dbflow.sql.language.BaseQueriable;
import com.raizlabs.android.dbflow.sql.queriable.Queriable;
import com.raizlabs.android.dbflow.structure.database.DatabaseWrapper;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowCountSingle;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowCursorSingle;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowExecuteCompletable;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowSingle;
package au.com.roadhouse.rxdbflow.rx2.sql.language;




public class BaseQueriableObservable<TModel> implements QueriableObservable {
    private BaseQueriable<TModel> mRealQueriable;

    public BaseQueriableObservable(BaseQueriable<TModel> queriable) {
        mRealQueriable = queriable;
    }

    /**
     * {@inheritDoc}
     */
    @Override
// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/observables/DBFlowCountSingle.java
// public class DBFlowCountSingle<TModel> extends DBFlowBaseSingle<TModel, Long>  {
// 
//     private final BaseQueriable mBaseModelQueriable;
//     private final DatabaseWrapper mDatabaseWrapper;
// 
//     /**
//      * Creates a new DBFlowCountSingle. Generally this constructor is not used directly, but used
//      * as part of a query statement. {@see au.com.roadhouse.rxdbflow.rx2.sql.language.RxSQLite}
//      * @param clazz The class of the table/view the query effects.
//      * @param baseModelQueriable The query to run when computing the count
//      * @param databaseWrapper The database wrapper that the target table/view belongs too.
//      */
//     public DBFlowCountSingle(@NonNull Class<TModel> clazz, final BaseQueriable baseModelQueriable,
//                              @Nullable DatabaseWrapper databaseWrapper) {
//         super(clazz);
//         mBaseModelQueriable = baseModelQueriable;
//         mDatabaseWrapper = databaseWrapper;
//     }
// 
// 
//     @Override
//     public Long run() {
//         if(mDatabaseWrapper != null){
//             return mBaseModelQueriable.count(mDatabaseWrapper);
//         } else {
//             return mBaseModelQueriable.count();
//         }
//     }
// }
// 
// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/observables/DBFlowCursorSingle.java
// public class DBFlowCursorSingle<TModel> extends DBFlowBaseSingle<TModel, Cursor> {
// 
//     private final Queriable mQueriable;
//     private final DatabaseWrapper mDatabaseWrapper;
// 
//     /**
//      * Creates a new observable which runs a query and emits the result as a Cursor
//      * @param clazz The table/view model in which the FlowCursorList will contain
//      * @param queriable The query to run
//      */
//     public DBFlowCursorSingle( Class<TModel> clazz, Queriable queriable, DatabaseWrapper databaseWrapper) {
//         super(clazz);
//         mQueriable = queriable;
//         mDatabaseWrapper = databaseWrapper;
//     }
// 
//     @Override
//     public Cursor run() {
//         if(mDatabaseWrapper != null){
//             return mQueriable.query(mDatabaseWrapper);
//         } else {
//             return mQueriable.query();
//         }
//     }
// }
// 
// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/observables/DBFlowExecuteCompletable.java
// public class DBFlowExecuteCompletable<TModel> extends DBFlowBaseCompletable<TModel>  {
// 
//     private final BaseQueriable mBaseQueriable;
//     private final DatabaseWrapper mDatabaseWrapper;
// 
//     /**
//      * Creates a new Observable which executes a sql statement against a table
//      * @param clazz The model class representing the table to execute against
//      * @param modelQueriable The query to execute
//      * @param databaseWrapper The database in which the target table resides
//      */
//     public DBFlowExecuteCompletable(Class<TModel> clazz, BaseQueriable modelQueriable, @Nullable DatabaseWrapper databaseWrapper) {
//         super(clazz);
//         mBaseQueriable = modelQueriable;
//         mDatabaseWrapper = databaseWrapper;
//     }
// 
// 
//     public Completable notifyOfUpdates(){
//         return new NotifyOfUpdate<>(this, mBaseQueriable.getQuery(), getPrimaryModelClass());
//     }
// 
//     @Override
//     public void run() {
//         if(mDatabaseWrapper != null) {
//             mBaseQueriable.execute(mDatabaseWrapper);
//         } else {
//             mBaseQueriable.execute();
//         }
//     }
// }
// 
// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/observables/DBFlowSingle.java
// public abstract class DBFlowSingle<T> extends Single<T> implements ValueAction<T> {
// 
//     /**
//      * Observes changes on the current table, restarting the query on change and emits the new count
//      * to any subscribers
//      * @return An observable which observes any changes in the current table
//      */
//     public final Observable<T> restartOnChange(){
//         return new DBFlowRestartOnChange<>(this.toObservable(), new Class[]{getPrimaryModelClass()}, this);
//     }
// 
//     /**
//      * Observes changes for specific tables, restarting the query on change and emits the new count
//      * to any subscribers
//      * @param tableToListen The tables to observe for changes
//      * @return An observable which observes any changes in the specified tables
//      */
//     public final Observable<T> restartOnChange(Class... tableToListen){
//         return new DBFlowRestartOnChange<>(this.toObservable(), tableToListen, this);
//     }
// 
//     /**
//      * Returns the class for the primary table model effected by this query
//      * @return The class for the primary table model
//      */
//     protected abstract Class getPrimaryModelClass();
// 
// }


// Path: RxDbFlow-Rx2/src/main/java/au/com/roadhouse/rxdbflow/rx2/sql/language/BaseQueriableObservable.java
import android.database.Cursor;
import com.raizlabs.android.dbflow.sql.language.BaseQueriable;
import com.raizlabs.android.dbflow.sql.queriable.Queriable;
import com.raizlabs.android.dbflow.structure.database.DatabaseWrapper;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowCountSingle;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowCursorSingle;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowExecuteCompletable;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowSingle;

package au.com.roadhouse.rxdbflow.rx2.sql.language;




public class BaseQueriableObservable<TModel> implements QueriableObservable {
    private BaseQueriable<TModel> mRealQueriable;

    public BaseQueriableObservable(BaseQueriable<TModel> queriable) {
        mRealQueriable = queriable;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DBFlowSingle<Long> asCountSingle() {