// 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.content.ContentValues;
import android.database.Cursor;
import com.raizlabs.android.dbflow.sql.Query;
import com.raizlabs.android.dbflow.sql.language.NameAlias;
import com.raizlabs.android.dbflow.sql.language.OrderBy;
import com.raizlabs.android.dbflow.sql.language.SQLOperator;
import com.raizlabs.android.dbflow.sql.language.Set;
import com.raizlabs.android.dbflow.sql.language.Where;
import com.raizlabs.android.dbflow.sql.language.WhereBase;
import com.raizlabs.android.dbflow.sql.language.property.IProperty;
import com.raizlabs.android.dbflow.structure.database.DatabaseWrapper;
import com.raizlabs.android.dbflow.structure.BaseModel;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowExecuteCompletable;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowSingle;
    public RxWhere<TModel> offset(int offset) {
        Where<TModel> where = mRealSet.offset(offset);
        return new RxWhere<>(where);
    }


    @Override
    public RxWhere<TModel> having(SQLOperator... conditions) {
        Where<TModel> where = mRealSet.having(conditions);
        return new RxWhere<>(where);
    }


    @Override
    public String getQuery() {
        return mRealSet.getQuery();
    }

    @Override
    public Class<TModel> getTable() {
        return mRealSet.getTable();
    }

    @Override
    public Query getQueryBuilderBase() {
        return mRealSet.getQueryBuilderBase();
    }


    @Override
// 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/RxSet.java
import android.content.ContentValues;
import android.database.Cursor;
import com.raizlabs.android.dbflow.sql.Query;
import com.raizlabs.android.dbflow.sql.language.NameAlias;
import com.raizlabs.android.dbflow.sql.language.OrderBy;
import com.raizlabs.android.dbflow.sql.language.SQLOperator;
import com.raizlabs.android.dbflow.sql.language.Set;
import com.raizlabs.android.dbflow.sql.language.Where;
import com.raizlabs.android.dbflow.sql.language.WhereBase;
import com.raizlabs.android.dbflow.sql.language.property.IProperty;
import com.raizlabs.android.dbflow.structure.database.DatabaseWrapper;
import com.raizlabs.android.dbflow.structure.BaseModel;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowExecuteCompletable;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowSingle;

    public RxWhere<TModel> offset(int offset) {
        Where<TModel> where = mRealSet.offset(offset);
        return new RxWhere<>(where);
    }


    @Override
    public RxWhere<TModel> having(SQLOperator... conditions) {
        Where<TModel> where = mRealSet.having(conditions);
        return new RxWhere<>(where);
    }


    @Override
    public String getQuery() {
        return mRealSet.getQuery();
    }

    @Override
    public Class<TModel> getTable() {
        return mRealSet.getTable();
    }

    @Override
    public Query getQueryBuilderBase() {
        return mRealSet.getQueryBuilderBase();
    }


    @Override
    public DBFlowSingle<Long> asCountSingle() {