// 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 android.support.annotation.NonNull;
import com.raizlabs.android.dbflow.sql.Query;
import com.raizlabs.android.dbflow.sql.language.From;
import com.raizlabs.android.dbflow.sql.language.Join;
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.Where;
import com.raizlabs.android.dbflow.sql.language.WhereBase;
import com.raizlabs.android.dbflow.sql.language.property.IProperty;
import com.raizlabs.android.dbflow.sql.language.property.IndexProperty;
import com.raizlabs.android.dbflow.sql.queriable.ModelQueriable;
import com.raizlabs.android.dbflow.structure.BaseModel;
import com.raizlabs.android.dbflow.structure.Model;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowSingle;
    @Override
    public RxWhere<TModel> orderBy(OrderBy orderBy) {
        return where().orderBy(orderBy);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public RxWhere<TModel> limit(int count) {
        return where().limit(count);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public RxWhere<TModel> offset(int offset) {
        return where().offset(offset);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public RxWhere<TModel> having(SQLOperator... conditions) {
        return this.where().having(conditions);
    }

    @Override
// 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/RxFrom.java
import android.database.Cursor;
import android.support.annotation.NonNull;
import com.raizlabs.android.dbflow.sql.Query;
import com.raizlabs.android.dbflow.sql.language.From;
import com.raizlabs.android.dbflow.sql.language.Join;
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.Where;
import com.raizlabs.android.dbflow.sql.language.WhereBase;
import com.raizlabs.android.dbflow.sql.language.property.IProperty;
import com.raizlabs.android.dbflow.sql.language.property.IndexProperty;
import com.raizlabs.android.dbflow.sql.queriable.ModelQueriable;
import com.raizlabs.android.dbflow.structure.BaseModel;
import com.raizlabs.android.dbflow.structure.Model;
import au.com.roadhouse.rxdbflow.rx2.sql.observables.DBFlowSingle;

    @Override
    public RxWhere<TModel> orderBy(OrderBy orderBy) {
        return where().orderBy(orderBy);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public RxWhere<TModel> limit(int count) {
        return where().limit(count);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public RxWhere<TModel> offset(int offset) {
        return where().offset(offset);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public RxWhere<TModel> having(SQLOperator... conditions) {
        return this.where().having(conditions);
    }

    @Override
    public DBFlowSingle<Cursor> asQuerySingle() {