// Path: grooves-api/src/main/java/com/github/rahulsom/grooves/queries/QuerySupport.java
// public interface QuerySupport<
//         AggregateT,
//         EventIdT,
//         EventT extends BaseEvent<AggregateT, EventIdT, EventT>,
//         SnapshotIdT,
//         SnapshotT extends Snapshot<AggregateT, SnapshotIdT, EventIdT, EventT>
//         >
//         extends
//         TemporalQuerySupport<AggregateT, EventIdT, EventT, SnapshotIdT, SnapshotT>,
//         VersionedQuerySupport<AggregateT, EventIdT, EventT, SnapshotIdT, SnapshotT> {
// 
//     @NotNull
//     @Override
//     default QueryExecutor<AggregateT, EventIdT, EventT, SnapshotIdT, SnapshotT, ?> getExecutor() {
//         return new QueryExecutor<>();
//     }
// 
//     @NotNull
//     @Override
//     default Publisher<EventT> findEventsBefore(@NotNull EventT event) {
//         return VersionedQuerySupport.super.findEventsBefore(event);
//     }
// }
// 
// Path: grooves-java/src/test/resources/domains/Account.java
// @Aggregate
// public class Account {
//     private Long id;
// 
//     public Long getId() {
//         return id;
//     }
// 
// }
// 
// Path: grooves-java/src/test/resources/domains/Balance.java
// public class Balance implements Snapshot<Account, String, Long, Transaction> {
//     private String id;
//     private long lastEventPosition;
//     private Date lastEventTimestamp;
//     private Account aggregate;
//     private Account deprecatedBy;
//     private Set<Account> deprecates;
// 
//     @Override
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     @Override
//     public String getId() {
//         return id;
//     }
// 
//     @Override
//     public void setLastEventPosition(long lastEventPosition) {
//         this.lastEventPosition = lastEventPosition;
//     }
// 
//     @Override
//     public void setLastEventTimestamp(Date lastEventTimestamp) {
//         this.lastEventTimestamp = lastEventTimestamp;
//     }
// 
//     @Override
//     public long getLastEventPosition() {
//         return lastEventPosition;
//     }
// 
//     @Override
//     public Date getLastEventTimestamp() {
//         return lastEventTimestamp;
//     }
// 
//     @Override
//     public void setAggregate(Account aggregate) {
//         this.aggregate = aggregate;
//     }
// 
//     @Override
//     public void setDeprecatedBy(Account deprecatedBy) {
//         this.deprecatedBy = deprecatedBy;
//     }
// 
//     @Override
//     public Publisher<Account> getAggregateObservable() {
//         return toPublisher(aggregate != null ? just(aggregate) : empty());
//     }
// 
//     @Override
//     public Publisher<Account> getDeprecatedByObservable() {
//         return toPublisher(deprecatedBy != null ? just(deprecatedBy) : empty());
//     }
// 
//     @Override
//     public Publisher<Account> getDeprecatesObservable() {
//         return toPublisher(from(new ArrayList(deprecates)));
//     }
// }
// 
// Path: grooves-java/src/test/resources/domains/CashWithdrawal.java
// @Event(Account.class)
// public class CashWithdrawal extends Transaction {
// 
// }
// 
// Path: grooves-java/src/test/resources/domains/Transaction.java
// public abstract class Transaction implements BaseEvent<Account, Long, Transaction> {
//     private Account aggregate;
//     private RevertEvent<Account, Long, Transaction> revertedBy;
//     private Long id;
//     private long position;
//     private Date timestamp;
// 
//     @Override
//     public void setPosition(long position) {
//         this.position = position;
//     }
// 
//     @Override
//     public long getPosition() {
//         return position;
//     }
// 
//     @Override
//     public Long getId() {
//         return id;
//     }
// 
//     @Override
//     public void setRevertedBy(RevertEvent<Account, Long, Transaction> revertedBy) {
//         this.revertedBy = revertedBy;
//     }
// 
//     @Override
//     public RevertEvent<Account, Long, Transaction> getRevertedBy() {
//         return revertedBy;
//     }
// 
//     @Override
//     public void setTimestamp(Date timestamp) {
//         this.timestamp = timestamp;
//     }
// 
//     @Override
//     public Date getTimestamp() {
//         return timestamp;
//     }
// 
//     @Override
//     public void setAggregate(Account aggregate) {
//         this.aggregate = aggregate;
//     }
// 
//     @Override
//     public Account getAggregate() {
//         return aggregate;
//     }
// 
//     public Publisher<Account> getAggregateObservable() {
//         return toPublisher(aggregate != null ? just(aggregate) : empty());
//     }
// }


import com.github.rahulsom.grooves.api.EventApplyOutcome;
import com.github.rahulsom.grooves.java.Query;
import com.github.rahulsom.grooves.queries.QuerySupport;
import domains.Account;
import domains.Balance;
import domains.CashWithdrawal;
import domains.Transaction;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Publisher;
import java.util.Date;
import static com.github.rahulsom.grooves.api.EventApplyOutcome.CONTINUE;
import static rx.Observable.empty;
import static rx.Observable.just;
import static rx.RxReactiveStreams.toPublisher;
            @NotNull Account aggregate, @NotNull Balance lastSnapshot, long version) {
        return empty();
    }

    @NotNull
    @Override
    public Publisher<Transaction> getUncomputedEvents(
            @NotNull Account aggregate, @NotNull Balance lastSnapshot, @NotNull Date snapshotTime) {
        return empty();
    }

    @NotNull
    @Override
    public boolean shouldEventsBeApplied(@NotNull Balance snapshot) {
        return true;
    }

    @NotNull
    @Override
    public void addToDeprecates(@NotNull Balance snapshot, @NotNull Account deprecatedAggregate) {
    }

    @NotNull
    @Override
    public Publisher<EventApplyOutcome> onException(
            @NotNull Exception e, @NotNull Balance snapshot, @NotNull Transaction event) {
        return toPublisher(just(CONTINUE));
    }

    @NotNull
// Path: grooves-api/src/main/java/com/github/rahulsom/grooves/queries/QuerySupport.java
// public interface QuerySupport<
//         AggregateT,
//         EventIdT,
//         EventT extends BaseEvent<AggregateT, EventIdT, EventT>,
//         SnapshotIdT,
//         SnapshotT extends Snapshot<AggregateT, SnapshotIdT, EventIdT, EventT>
//         >
//         extends
//         TemporalQuerySupport<AggregateT, EventIdT, EventT, SnapshotIdT, SnapshotT>,
//         VersionedQuerySupport<AggregateT, EventIdT, EventT, SnapshotIdT, SnapshotT> {
// 
//     @NotNull
//     @Override
//     default QueryExecutor<AggregateT, EventIdT, EventT, SnapshotIdT, SnapshotT, ?> getExecutor() {
//         return new QueryExecutor<>();
//     }
// 
//     @NotNull
//     @Override
//     default Publisher<EventT> findEventsBefore(@NotNull EventT event) {
//         return VersionedQuerySupport.super.findEventsBefore(event);
//     }
// }
// 
// Path: grooves-java/src/test/resources/domains/Account.java
// @Aggregate
// public class Account {
//     private Long id;
// 
//     public Long getId() {
//         return id;
//     }
// 
// }
// 
// Path: grooves-java/src/test/resources/domains/Balance.java
// public class Balance implements Snapshot<Account, String, Long, Transaction> {
//     private String id;
//     private long lastEventPosition;
//     private Date lastEventTimestamp;
//     private Account aggregate;
//     private Account deprecatedBy;
//     private Set<Account> deprecates;
// 
//     @Override
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     @Override
//     public String getId() {
//         return id;
//     }
// 
//     @Override
//     public void setLastEventPosition(long lastEventPosition) {
//         this.lastEventPosition = lastEventPosition;
//     }
// 
//     @Override
//     public void setLastEventTimestamp(Date lastEventTimestamp) {
//         this.lastEventTimestamp = lastEventTimestamp;
//     }
// 
//     @Override
//     public long getLastEventPosition() {
//         return lastEventPosition;
//     }
// 
//     @Override
//     public Date getLastEventTimestamp() {
//         return lastEventTimestamp;
//     }
// 
//     @Override
//     public void setAggregate(Account aggregate) {
//         this.aggregate = aggregate;
//     }
// 
//     @Override
//     public void setDeprecatedBy(Account deprecatedBy) {
//         this.deprecatedBy = deprecatedBy;
//     }
// 
//     @Override
//     public Publisher<Account> getAggregateObservable() {
//         return toPublisher(aggregate != null ? just(aggregate) : empty());
//     }
// 
//     @Override
//     public Publisher<Account> getDeprecatedByObservable() {
//         return toPublisher(deprecatedBy != null ? just(deprecatedBy) : empty());
//     }
// 
//     @Override
//     public Publisher<Account> getDeprecatesObservable() {
//         return toPublisher(from(new ArrayList(deprecates)));
//     }
// }
// 
// Path: grooves-java/src/test/resources/domains/CashWithdrawal.java
// @Event(Account.class)
// public class CashWithdrawal extends Transaction {
// 
// }
// 
// Path: grooves-java/src/test/resources/domains/Transaction.java
// public abstract class Transaction implements BaseEvent<Account, Long, Transaction> {
//     private Account aggregate;
//     private RevertEvent<Account, Long, Transaction> revertedBy;
//     private Long id;
//     private long position;
//     private Date timestamp;
// 
//     @Override
//     public void setPosition(long position) {
//         this.position = position;
//     }
// 
//     @Override
//     public long getPosition() {
//         return position;
//     }
// 
//     @Override
//     public Long getId() {
//         return id;
//     }
// 
//     @Override
//     public void setRevertedBy(RevertEvent<Account, Long, Transaction> revertedBy) {
//         this.revertedBy = revertedBy;
//     }
// 
//     @Override
//     public RevertEvent<Account, Long, Transaction> getRevertedBy() {
//         return revertedBy;
//     }
// 
//     @Override
//     public void setTimestamp(Date timestamp) {
//         this.timestamp = timestamp;
//     }
// 
//     @Override
//     public Date getTimestamp() {
//         return timestamp;
//     }
// 
//     @Override
//     public void setAggregate(Account aggregate) {
//         this.aggregate = aggregate;
//     }
// 
//     @Override
//     public Account getAggregate() {
//         return aggregate;
//     }
// 
//     public Publisher<Account> getAggregateObservable() {
//         return toPublisher(aggregate != null ? just(aggregate) : empty());
//     }
// }


// Path: grooves-java/src/test/resources/invalid/MethodMissing.java
import com.github.rahulsom.grooves.api.EventApplyOutcome;
import com.github.rahulsom.grooves.java.Query;
import com.github.rahulsom.grooves.queries.QuerySupport;
import domains.Account;
import domains.Balance;
import domains.CashWithdrawal;
import domains.Transaction;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Publisher;
import java.util.Date;
import static com.github.rahulsom.grooves.api.EventApplyOutcome.CONTINUE;
import static rx.Observable.empty;
import static rx.Observable.just;
import static rx.RxReactiveStreams.toPublisher;

            @NotNull Account aggregate, @NotNull Balance lastSnapshot, long version) {
        return empty();
    }

    @NotNull
    @Override
    public Publisher<Transaction> getUncomputedEvents(
            @NotNull Account aggregate, @NotNull Balance lastSnapshot, @NotNull Date snapshotTime) {
        return empty();
    }

    @NotNull
    @Override
    public boolean shouldEventsBeApplied(@NotNull Balance snapshot) {
        return true;
    }

    @NotNull
    @Override
    public void addToDeprecates(@NotNull Balance snapshot, @NotNull Account deprecatedAggregate) {
    }

    @NotNull
    @Override
    public Publisher<EventApplyOutcome> onException(
            @NotNull Exception e, @NotNull Balance snapshot, @NotNull Transaction event) {
        return toPublisher(just(CONTINUE));
    }

    @NotNull
    public Publisher<EventApplyOutcome> applyCashWithdrawal(