Example #1
0
 /**
  * Read all indexes that for the given event type that match the given constraint from the given
  * typed event repo This method will attempt to find the best possible way of retrieving index
  * data given the indexes that exists in this {@link Indexing}
  *
  * @param eventTypeId {@link Long} event type id
  * @param constraint {@link FieldConstraint}
  * @param typedEventRepo {@link TypedEventRepo} where event data can be read from
  * @return
  */
 public Iterable<EventId> readIndicies(
     EventTypeId eventTypeId, FieldConstraint constraint, TypedEventRepo typedEventRepo) {
   if (constraint.hasConstraint()) {
     EventFieldId eventFieldId = new EventFieldId(eventTypeId, constraint.getFieldName());
     if (eventFieldIndexing.isIndexing(eventFieldId)) {
       return eventFieldIndexing.getIterable(eventFieldId, constraint);
     } else {
       return new FallbackFilteringEventIdIterable(
           eventIndexing.getIndexEntryIterable(eventTypeId), constraint, typedEventRepo);
     }
   } else {
     return eventIndexing.getIndexEntryIterable(eventTypeId);
   }
 }
 @Override
 public boolean hasNext() {
   while (next == null && pos < entries.size()) {
     EventFieldEntry maybeNext = entries.get(pos++);
     if (fieldConstraint.accepts(maybeNext.getFieldValue())) {
       next = maybeNext;
     }
   }
   return next != null;
 }