// Path: examples/javaee/src/main/java/grooves/example/javaee/Database.java
// @Singleton
// public class Database {
// 
//     private final List<PatientEvent> eventList = new ArrayList<>();
//     private final List<Patient> patientList = new ArrayList<>();
//     private final List snapshotList = new ArrayList();
// 
//     public Stream<PatientEvent> events() {
//         return eventList.stream();
//     }
// 
//     public Stream<Patient> patients() {
//         return patientList.stream();
//     }
// 
//     /**
//      * Finds snapshots of type.
//      *
//      * @param clazz The class representing the type
//      * @param <T>   The type
//      *
//      * @return A Stream of type
//      */
//     @NotNull
//     public <T extends Snapshot> Stream<T> snapshots(Class<T> clazz) {
//         return (Stream<T>) snapshotList
//                 .stream()
//                 .filter(it -> clazz.isAssignableFrom(it.getClass()));
//     }
// 
//     public void addPatient(Patient patient) {
//         patientList.add(patient);
//     }
// 
//     public void addEvent(PatientEvent event) {
//         eventList.add(event);
//     }
// 
//     public void addSnapshot(Object snapshot) {
//         snapshotList.add(snapshot);
//     }
// 
//     public static boolean isTimestampInRange(
//             Date lowerBoundExclusive, Date timestamp, Date upperBoundInclusive) {
//         return (lowerBoundExclusive == null || timestamp.compareTo(lowerBoundExclusive) > 0)
//                 && timestamp.compareTo(upperBoundInclusive) <= 0;
//     }
// 
// }


import com.github.rahulsom.grooves.api.EventApplyOutcome;
import com.github.rahulsom.grooves.java.Query;
import grooves.example.javaee.Database;
import grooves.example.javaee.domain.*;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Publisher;
import javax.inject.Inject;
import static com.github.rahulsom.grooves.api.EventApplyOutcome.CONTINUE;
import static rx.Observable.just;
import static rx.RxReactiveStreams.toPublisher;
package grooves.example.javaee.queries;




@Query(aggregate = Patient.class, snapshot = PatientHealth.class)
public class PatientHealthQuery implements CustomQuerySupport<PatientHealth> {

    @Inject
// Path: examples/javaee/src/main/java/grooves/example/javaee/Database.java
// @Singleton
// public class Database {
// 
//     private final List<PatientEvent> eventList = new ArrayList<>();
//     private final List<Patient> patientList = new ArrayList<>();
//     private final List snapshotList = new ArrayList();
// 
//     public Stream<PatientEvent> events() {
//         return eventList.stream();
//     }
// 
//     public Stream<Patient> patients() {
//         return patientList.stream();
//     }
// 
//     /**
//      * Finds snapshots of type.
//      *
//      * @param clazz The class representing the type
//      * @param <T>   The type
//      *
//      * @return A Stream of type
//      */
//     @NotNull
//     public <T extends Snapshot> Stream<T> snapshots(Class<T> clazz) {
//         return (Stream<T>) snapshotList
//                 .stream()
//                 .filter(it -> clazz.isAssignableFrom(it.getClass()));
//     }
// 
//     public void addPatient(Patient patient) {
//         patientList.add(patient);
//     }
// 
//     public void addEvent(PatientEvent event) {
//         eventList.add(event);
//     }
// 
//     public void addSnapshot(Object snapshot) {
//         snapshotList.add(snapshot);
//     }
// 
//     public static boolean isTimestampInRange(
//             Date lowerBoundExclusive, Date timestamp, Date upperBoundInclusive) {
//         return (lowerBoundExclusive == null || timestamp.compareTo(lowerBoundExclusive) > 0)
//                 && timestamp.compareTo(upperBoundInclusive) <= 0;
//     }
// 
// }


// Path: examples/javaee/src/main/java/grooves/example/javaee/queries/PatientHealthQuery.java
import com.github.rahulsom.grooves.api.EventApplyOutcome;
import com.github.rahulsom.grooves.java.Query;
import grooves.example.javaee.Database;
import grooves.example.javaee.domain.*;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Publisher;
import javax.inject.Inject;
import static com.github.rahulsom.grooves.api.EventApplyOutcome.CONTINUE;
import static rx.Observable.just;
import static rx.RxReactiveStreams.toPublisher;

package grooves.example.javaee.queries;




@Query(aggregate = Patient.class, snapshot = PatientHealth.class)
public class PatientHealthQuery implements CustomQuerySupport<PatientHealth> {

    @Inject
    private Database database;