test_class.file: code/src/test/java/com/googlecode/cqengine/engine/CollectionQueryEngineTest.java
test_class.identifier: CollectionQueryEngineTest
test_case.body: @Test
      @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection", "StatementWithEmptyBody"})
      public void testOrQueryCollectionScan() {
          IterationCountingSet<Car> iterationCountingSet = new IterationCountingSet<Car>(CarFactory.createCollectionOfCars(10));
          IndexedCollection<Car> collection = new ConcurrentIndexedCollection<Car>(WrappingPersistence.aroundCollection(iterationCountingSet));
  
          Query<Car> query = or(equal(Car.COLOR, Car.Color.BLUE), equal(Car.MANUFACTURER, "Honda"));
          ResultSet<Car> resultSet = collection.retrieve(query);
  
          for (Car car : resultSet) {
              // No op
          }
  
          // The two-branch or() query should have been evaluated by scanning the collection only once...
          Assert.assertEquals(iterationCountingSet.size(), iterationCountingSet.getItemsIteratedCount());
      }
test_case.class_method_signature: CollectionQueryEngineTest.testOrQueryCollectionScan()
test_case.full_signature: @Test @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection", "StatementWithEmptyBody"}) public void testOrQueryCollectionScan()
test_case.identifier: testOrQueryCollectionScan
test_case.invocations: createCollectionOfCars aroundCollection or equal equal retrieve assertEquals size getItemsIteratedCount
test_case.modifiers: @Test @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection", "StatementWithEmptyBody"}) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testOrQueryCollectionScan()
focal_class.declarator: ROOT_QUERY = "ROOT_QUERY"
focal_class.modifier: public static final
focal_class.original_string: public static final String ROOT_QUERY = "ROOT_QUERY";
focal_class.type: String
focal_class.var_name: ROOT_QUERY
focal_class.declarator: persistence
focal_class.modifier: private volatile
focal_class.original_string: private volatile Persistence<O, ? extends Comparable> persistence;
focal_class.type: Persistence<O, ? extends Comparable>
focal_class.var_name: persistence
focal_class.declarator: objectStore
focal_class.modifier: private volatile
focal_class.original_string: private volatile ObjectStore<O> objectStore;
focal_class.type: ObjectStore<O>
focal_class.var_name: objectStore
focal_class.declarator: attributeIndexes = new ConcurrentHashMap<Attribute<O, ?>, Set<Index<O>>>()
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<Attribute<O, ?>, Set<Index<O>>> attributeIndexes = new ConcurrentHashMap<Attribute<O, ?>, Set<Index<O>>>();
focal_class.type: ConcurrentMap<Attribute<O, ?>, Set<Index<O>>>
focal_class.var_name: attributeIndexes
focal_class.declarator: uniqueIndexes = new ConcurrentHashMap<Attribute<O, ?>, Index<O>>()
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<Attribute<O, ?>, Index<O>> uniqueIndexes = new ConcurrentHashMap<Attribute<O, ?>, Index<O>>();
focal_class.type: ConcurrentMap<Attribute<O, ?>, Index<O>>
focal_class.var_name: uniqueIndexes
focal_class.declarator: compoundIndexes = new ConcurrentHashMap<CompoundAttribute<O>, CompoundIndex<O>>()
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<CompoundAttribute<O>, CompoundIndex<O>> compoundIndexes = new ConcurrentHashMap<CompoundAttribute<O>, CompoundIndex<O>>();
focal_class.type: ConcurrentMap<CompoundAttribute<O>, CompoundIndex<O>>
focal_class.var_name: compoundIndexes
focal_class.declarator: standingQueryIndexes = new ConcurrentHashMap<Query<O>, Index<O>>()
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<Query<O>, Index<O>> standingQueryIndexes = new ConcurrentHashMap<Query<O>, Index<O>>();
focal_class.type: ConcurrentMap<Query<O>, Index<O>>
focal_class.var_name: standingQueryIndexes
focal_class.declarator: fallbackIndex = new FallbackIndex<O>()
focal_class.modifier: private final
focal_class.original_string: private final FallbackIndex<O> fallbackIndex = new FallbackIndex<O>();
focal_class.type: FallbackIndex<O>
focal_class.var_name: fallbackIndex
focal_class.declarator: immutableIndexes = Collections.newSetFromMap(new ConcurrentHashMap<>())
focal_class.modifier: private final
focal_class.original_string: private final Set<Index<O>> immutableIndexes = Collections.newSetFromMap(new ConcurrentHashMap<>());
focal_class.type: Set<Index<O>>
focal_class.var_name: immutableIndexes
focal_class.file: code/src/main/java/com/googlecode/cqengine/engine/CollectionQueryEngine.java
focal_class.identifier: CollectionQueryEngine
focal_class.interfaces: implements QueryEngineInternal<O>
focal_class.class_method_signature: CollectionQueryEngine.CollectionQueryEngine()
focal_class.full_signature: public  CollectionQueryEngine()
focal_class.identifier: CollectionQueryEngine
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  CollectionQueryEngine()
focal_class.class_method_signature: CollectionQueryEngine.init(final ObjectStore<O> objectStore, final QueryOptions queryOptions)
focal_class.full_signature: @Override public void init(final ObjectStore<O> objectStore, final QueryOptions queryOptions)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (final ObjectStore<O> objectStore, final QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void init(final ObjectStore<O> objectStore, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.destroy(QueryOptions queryOptions)
focal_class.full_signature: @Override public void destroy(QueryOptions queryOptions)
focal_class.identifier: destroy
focal_class.modifiers: @Override public
focal_class.parameters: (QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void destroy(QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.addIndex(Index<O> index, QueryOptions queryOptions)
focal_class.full_signature: @Override public void addIndex(Index<O> index, QueryOptions queryOptions)
focal_class.identifier: addIndex
focal_class.modifiers: @Override public
focal_class.parameters: (Index<O> index, QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void addIndex(Index<O> index, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.addAttributeIndex(AttributeIndex<A, O> attributeIndex, QueryOptions queryOptions)
focal_class.full_signature:  void addAttributeIndex(AttributeIndex<A, O> attributeIndex, QueryOptions queryOptions)
focal_class.identifier: addAttributeIndex
focal_class.parameters: (AttributeIndex<A, O> attributeIndex, QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void addAttributeIndex(AttributeIndex<A, O> attributeIndex, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.addStandingQueryIndex(Index<O> standingQueryIndex, Query<O> standingQuery, QueryOptions queryOptions)
focal_class.full_signature:  void addStandingQueryIndex(Index<O> standingQueryIndex, Query<O> standingQuery, QueryOptions queryOptions)
focal_class.identifier: addStandingQueryIndex
focal_class.parameters: (Index<O> standingQueryIndex, Query<O> standingQuery, QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void addStandingQueryIndex(Index<O> standingQueryIndex, Query<O> standingQuery, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.addCompoundIndex(CompoundIndex<O> compoundIndex, CompoundAttribute<O> compoundAttribute, QueryOptions queryOptions)
focal_class.full_signature:  void addCompoundIndex(CompoundIndex<O> compoundIndex, CompoundAttribute<O> compoundAttribute, QueryOptions queryOptions)
focal_class.identifier: addCompoundIndex
focal_class.parameters: (CompoundIndex<O> compoundIndex, CompoundAttribute<O> compoundAttribute, QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void addCompoundIndex(CompoundIndex<O> compoundIndex, CompoundAttribute<O> compoundAttribute, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.removeIndex(Index<O> index, QueryOptions queryOptions)
focal_class.full_signature: @Override public void removeIndex(Index<O> index, QueryOptions queryOptions)
focal_class.identifier: removeIndex
focal_class.modifiers: @Override public
focal_class.parameters: (Index<O> index, QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void removeIndex(Index<O> index, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.getIndexes()
focal_class.full_signature: @Override public Iterable<Index<O>> getIndexes()
focal_class.identifier: getIndexes
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Iterable<Index<O>>
focal_class.signature: Iterable<Index<O>> getIndexes()
focal_class.class_method_signature: CollectionQueryEngine.getIndexesOnAttribute(Attribute<O, ?> attribute)
focal_class.full_signature:  Iterable<Index<O>> getIndexesOnAttribute(Attribute<O, ?> attribute)
focal_class.identifier: getIndexesOnAttribute
focal_class.parameters: (Attribute<O, ?> attribute)
focal_class.return: Iterable<Index<O>>
focal_class.signature: Iterable<Index<O>> getIndexesOnAttribute(Attribute<O, ?> attribute)
focal_class.class_method_signature: CollectionQueryEngine.getEntireCollectionAsResultSet(final Query<O> query, final QueryOptions queryOptions)
focal_class.full_signature:  ResultSet<O> getEntireCollectionAsResultSet(final Query<O> query, final QueryOptions queryOptions)
focal_class.identifier: getEntireCollectionAsResultSet
focal_class.parameters: (final Query<O> query, final QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> getEntireCollectionAsResultSet(final Query<O> query, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.retrieveSimpleQuery(SimpleQuery<O, A> query, QueryOptions queryOptions)
focal_class.full_signature:  ResultSet<O> retrieveSimpleQuery(SimpleQuery<O, A> query, QueryOptions queryOptions)
focal_class.identifier: retrieveSimpleQuery
focal_class.parameters: (SimpleQuery<O, A> query, QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveSimpleQuery(SimpleQuery<O, A> query, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.retrieveComparativeQuery(ComparativeQuery<O, A> query, QueryOptions queryOptions)
focal_class.full_signature:  ResultSet<O> retrieveComparativeQuery(ComparativeQuery<O, A> query, QueryOptions queryOptions)
focal_class.identifier: retrieveComparativeQuery
focal_class.parameters: (ComparativeQuery<O, A> query, QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveComparativeQuery(ComparativeQuery<O, A> query, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.retrieve(final Query<O> query, final QueryOptions queryOptions)
focal_class.full_signature: @Override public ResultSet<O> retrieve(final Query<O> query, final QueryOptions queryOptions)
focal_class.identifier: retrieve
focal_class.modifiers: @Override public
focal_class.parameters: (final Query<O> query, final QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieve(final Query<O> query, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.retrieveWithoutIndexOrdering(Query<O> query, QueryOptions queryOptions, OrderByOption<O> orderByOption)
focal_class.full_signature:  ResultSet<O> retrieveWithoutIndexOrdering(Query<O> query, QueryOptions queryOptions, OrderByOption<O> orderByOption)
focal_class.identifier: retrieveWithoutIndexOrdering
focal_class.parameters: (Query<O> query, QueryOptions queryOptions, OrderByOption<O> orderByOption)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveWithoutIndexOrdering(Query<O> query, QueryOptions queryOptions, OrderByOption<O> orderByOption)
focal_class.class_method_signature: CollectionQueryEngine.retrieveWithIndexOrdering(final Query<O> query, final QueryOptions queryOptions, final OrderByOption<O> orderByOption, final SortedKeyStatisticsIndex<?, O> indexForOrdering)
focal_class.full_signature:  ResultSet<O> retrieveWithIndexOrdering(final Query<O> query, final QueryOptions queryOptions, final OrderByOption<O> orderByOption, final SortedKeyStatisticsIndex<?, O> indexForOrdering)
focal_class.identifier: retrieveWithIndexOrdering
focal_class.parameters: (final Query<O> query, final QueryOptions queryOptions, final OrderByOption<O> orderByOption, final SortedKeyStatisticsIndex<?, O> indexForOrdering)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveWithIndexOrdering(final Query<O> query, final QueryOptions queryOptions, final OrderByOption<O> orderByOption, final SortedKeyStatisticsIndex<?, O> indexForOrdering)
focal_class.class_method_signature: CollectionQueryEngine.retrieveWithIndexOrderingMainResults(final Query<O> query, QueryOptions queryOptions, SortedKeyStatisticsIndex<?, O> indexForOrdering, List<AttributeOrder<O>> allSortOrders, RangeBounds<?> rangeBoundsFromQuery, boolean attributeCanHaveMoreThanOneValue, boolean primarySortDescending)
focal_class.full_signature:  Iterator<O> retrieveWithIndexOrderingMainResults(final Query<O> query, QueryOptions queryOptions, SortedKeyStatisticsIndex<?, O> indexForOrdering, List<AttributeOrder<O>> allSortOrders, RangeBounds<?> rangeBoundsFromQuery, boolean attributeCanHaveMoreThanOneValue, boolean primarySortDescending)
focal_class.identifier: retrieveWithIndexOrderingMainResults
focal_class.parameters: (final Query<O> query, QueryOptions queryOptions, SortedKeyStatisticsIndex<?, O> indexForOrdering, List<AttributeOrder<O>> allSortOrders, RangeBounds<?> rangeBoundsFromQuery, boolean attributeCanHaveMoreThanOneValue, boolean primarySortDescending)
focal_class.return: Iterator<O>
focal_class.signature: Iterator<O> retrieveWithIndexOrderingMainResults(final Query<O> query, QueryOptions queryOptions, SortedKeyStatisticsIndex<?, O> indexForOrdering, List<AttributeOrder<O>> allSortOrders, RangeBounds<?> rangeBoundsFromQuery, boolean attributeCanHaveMoreThanOneValue, boolean primarySortDescending)
focal_class.class_method_signature: CollectionQueryEngine.retrieveWithIndexOrderingMissingResults(final Query<O> query, QueryOptions queryOptions, Attribute<O, Comparable> primarySortAttribute, List<AttributeOrder<O>> allSortOrders, boolean attributeCanHaveMoreThanOneValue)
focal_class.full_signature:  Iterator<O> retrieveWithIndexOrderingMissingResults(final Query<O> query, QueryOptions queryOptions, Attribute<O, Comparable> primarySortAttribute, List<AttributeOrder<O>> allSortOrders, boolean attributeCanHaveMoreThanOneValue)
focal_class.identifier: retrieveWithIndexOrderingMissingResults
focal_class.parameters: (final Query<O> query, QueryOptions queryOptions, Attribute<O, Comparable> primarySortAttribute, List<AttributeOrder<O>> allSortOrders, boolean attributeCanHaveMoreThanOneValue)
focal_class.return: Iterator<O>
focal_class.signature: Iterator<O> retrieveWithIndexOrderingMissingResults(final Query<O> query, QueryOptions queryOptions, Attribute<O, Comparable> primarySortAttribute, List<AttributeOrder<O>> allSortOrders, boolean attributeCanHaveMoreThanOneValue)
focal_class.class_method_signature: CollectionQueryEngine.filterIndexOrderingCandidateResults(final Iterator<O> sortedCandidateResults, final Query<O> query, final QueryOptions queryOptions)
focal_class.full_signature:  Iterator<O> filterIndexOrderingCandidateResults(final Iterator<O> sortedCandidateResults, final Query<O> query, final QueryOptions queryOptions)
focal_class.identifier: filterIndexOrderingCandidateResults
focal_class.parameters: (final Iterator<O> sortedCandidateResults, final Query<O> query, final QueryOptions queryOptions)
focal_class.return: Iterator<O>
focal_class.signature: Iterator<O> filterIndexOrderingCandidateResults(final Iterator<O> sortedCandidateResults, final Query<O> query, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.getPersistenceFromQueryOptions(QueryOptions queryOptions)
focal_class.full_signature: static Persistence<O, A> getPersistenceFromQueryOptions(QueryOptions queryOptions)
focal_class.identifier: getPersistenceFromQueryOptions
focal_class.modifiers: static
focal_class.parameters: (QueryOptions queryOptions)
focal_class.return: Persistence<O, A>
focal_class.signature: Persistence<O, A> getPersistenceFromQueryOptions(QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.determineAdditionalSortOrdersForIndexOrdering(List<AttributeOrder<O>> allSortOrders, boolean attributeCanHaveMoreThanOneValue, Index<O> index, QueryOptions queryOptions)
focal_class.full_signature: static List<AttributeOrder<O>> determineAdditionalSortOrdersForIndexOrdering(List<AttributeOrder<O>> allSortOrders, boolean attributeCanHaveMoreThanOneValue, Index<O> index, QueryOptions queryOptions)
focal_class.identifier: determineAdditionalSortOrdersForIndexOrdering
focal_class.modifiers: static
focal_class.parameters: (List<AttributeOrder<O>> allSortOrders, boolean attributeCanHaveMoreThanOneValue, Index<O> index, QueryOptions queryOptions)
focal_class.return: List<AttributeOrder<O>>
focal_class.signature: List<AttributeOrder<O>> determineAdditionalSortOrdersForIndexOrdering(List<AttributeOrder<O>> allSortOrders, boolean attributeCanHaveMoreThanOneValue, Index<O> index, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.getKeysAndValuesInRange(SortedKeyStatisticsIndex<A, O> index, RangeBounds<?> queryBounds, boolean descending, QueryOptions queryOptions)
focal_class.full_signature: static CloseableIterator<KeyValue<A, O>> getKeysAndValuesInRange(SortedKeyStatisticsIndex<A, O> index, RangeBounds<?> queryBounds, boolean descending, QueryOptions queryOptions)
focal_class.identifier: getKeysAndValuesInRange
focal_class.modifiers: static
focal_class.parameters: (SortedKeyStatisticsIndex<A, O> index, RangeBounds<?> queryBounds, boolean descending, QueryOptions queryOptions)
focal_class.return: CloseableIterator<KeyValue<A, O>>
focal_class.signature: CloseableIterator<KeyValue<A, O>> getKeysAndValuesInRange(SortedKeyStatisticsIndex<A, O> index, RangeBounds<?> queryBounds, boolean descending, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.getBoundsFromQuery(Query<O> query, Attribute<O, A> attribute)
focal_class.full_signature: static RangeBounds getBoundsFromQuery(Query<O> query, Attribute<O, A> attribute)
focal_class.identifier: getBoundsFromQuery
focal_class.modifiers: static
focal_class.parameters: (Query<O> query, Attribute<O, A> attribute)
focal_class.return: RangeBounds
focal_class.signature: RangeBounds getBoundsFromQuery(Query<O> query, Attribute<O, A> attribute)
focal_class.class_method_signature: CollectionQueryEngine.retrieveRecursive(Query<O> query, final QueryOptions queryOptions)
focal_class.full_signature:  ResultSet<O> retrieveRecursive(Query<O> query, final QueryOptions queryOptions)
focal_class.identifier: retrieveRecursive
focal_class.parameters: (Query<O> query, final QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveRecursive(Query<O> query, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.retrieveIntersectionOfSimpleQueries(Collection<SimpleQuery<O, ?>> queries, QueryOptions queryOptions, boolean indexMergeStrategyEnabled)
focal_class.full_signature:  ResultSet<O> retrieveIntersectionOfSimpleQueries(Collection<SimpleQuery<O, ?>> queries, QueryOptions queryOptions, boolean indexMergeStrategyEnabled)
focal_class.identifier: retrieveIntersectionOfSimpleQueries
focal_class.parameters: (Collection<SimpleQuery<O, ?>> queries, QueryOptions queryOptions, boolean indexMergeStrategyEnabled)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveIntersectionOfSimpleQueries(Collection<SimpleQuery<O, ?>> queries, QueryOptions queryOptions, boolean indexMergeStrategyEnabled)
focal_class.class_method_signature: CollectionQueryEngine.retrieveIntersectionOfComparativeQueries(Collection<ComparativeQuery<O, ?>> queries, QueryOptions queryOptions)
focal_class.full_signature:  ResultSet<O> retrieveIntersectionOfComparativeQueries(Collection<ComparativeQuery<O, ?>> queries, QueryOptions queryOptions)
focal_class.identifier: retrieveIntersectionOfComparativeQueries
focal_class.parameters: (Collection<ComparativeQuery<O, ?>> queries, QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveIntersectionOfComparativeQueries(Collection<ComparativeQuery<O, ?>> queries, QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.retrieveUnionOfSimpleQueries(final Collection<SimpleQuery<O, ?>> queries, final QueryOptions queryOptions)
focal_class.full_signature:  ResultSet<O> retrieveUnionOfSimpleQueries(final Collection<SimpleQuery<O, ?>> queries, final QueryOptions queryOptions)
focal_class.identifier: retrieveUnionOfSimpleQueries
focal_class.parameters: (final Collection<SimpleQuery<O, ?>> queries, final QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveUnionOfSimpleQueries(final Collection<SimpleQuery<O, ?>> queries, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.retrieveUnionOfComparativeQueries(final Collection<ComparativeQuery<O, ?>> queries, final QueryOptions queryOptions)
focal_class.full_signature:  ResultSet<O> retrieveUnionOfComparativeQueries(final Collection<ComparativeQuery<O, ?>> queries, final QueryOptions queryOptions)
focal_class.identifier: retrieveUnionOfComparativeQueries
focal_class.parameters: (final Collection<ComparativeQuery<O, ?>> queries, final QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveUnionOfComparativeQueries(final Collection<ComparativeQuery<O, ?>> queries, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.retrieveFromStandingQueryIndexIfAvailable(Query<O> query, final QueryOptions queryOptions)
focal_class.full_signature:  ResultSet<O> retrieveFromStandingQueryIndexIfAvailable(Query<O> query, final QueryOptions queryOptions)
focal_class.identifier: retrieveFromStandingQueryIndexIfAvailable
focal_class.parameters: (Query<O> query, final QueryOptions queryOptions)
focal_class.return: ResultSet<O>
focal_class.signature: ResultSet<O> retrieveFromStandingQueryIndexIfAvailable(Query<O> query, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.addAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions)
focal_class.full_signature: @Override public boolean addAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions)
focal_class.identifier: addAll
focal_class.modifiers: @Override public
focal_class.parameters: (final ObjectSet<O> objectSet, final QueryOptions queryOptions)
focal_class.return: boolean
focal_class.signature: boolean addAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.removeAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions)
focal_class.full_signature: @Override public boolean removeAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions)
focal_class.identifier: removeAll
focal_class.modifiers: @Override public
focal_class.parameters: (final ObjectSet<O> objectSet, final QueryOptions queryOptions)
focal_class.return: boolean
focal_class.signature: boolean removeAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.clear(final QueryOptions queryOptions)
focal_class.full_signature: @Override public void clear(final QueryOptions queryOptions)
focal_class.identifier: clear
focal_class.modifiers: @Override public
focal_class.parameters: (final QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void clear(final QueryOptions queryOptions)
focal_class.class_method_signature: CollectionQueryEngine.isMutable()
focal_class.full_signature: @Override public boolean isMutable()
focal_class.identifier: isMutable
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isMutable()
focal_class.class_method_signature: CollectionQueryEngine.ensureMutable()
focal_class.full_signature:  void ensureMutable()
focal_class.identifier: ensureMutable
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void ensureMutable()
focal_class.class_method_signature: CollectionQueryEngine.forEachIndexDo(IndexOperation<O> indexOperation)
focal_class.full_signature:  boolean forEachIndexDo(IndexOperation<O> indexOperation)
focal_class.identifier: forEachIndexDo
focal_class.parameters: (IndexOperation<O> indexOperation)
focal_class.return: boolean
focal_class.signature: boolean forEachIndexDo(IndexOperation<O> indexOperation)
focal_class.class_method_signature: CollectionQueryEngine.getClassNameNullSafe(Object object)
focal_class.full_signature: static String getClassNameNullSafe(Object object)
focal_class.identifier: getClassNameNullSafe
focal_class.modifiers: static
focal_class.parameters: (Object object)
focal_class.return: String
focal_class.signature: String getClassNameNullSafe(Object object)
focal_class.class_method_signature: CollectionQueryEngine.shouldUseIndexMergeStrategy(boolean strategyRequested, boolean comparativeQueriesPresent, Iterable<ResultSet<O>> resultSetsToMerge)
focal_class.full_signature: static boolean shouldUseIndexMergeStrategy(boolean strategyRequested, boolean comparativeQueriesPresent, Iterable<ResultSet<O>> resultSetsToMerge)
focal_class.identifier: shouldUseIndexMergeStrategy
focal_class.modifiers: static
focal_class.parameters: (boolean strategyRequested, boolean comparativeQueriesPresent, Iterable<ResultSet<O>> resultSetsToMerge)
focal_class.return: boolean
focal_class.signature: boolean shouldUseIndexMergeStrategy(boolean strategyRequested, boolean comparativeQueriesPresent, Iterable<ResultSet<O>> resultSetsToMerge)
focal_class.class_method_signature: CollectionQueryEngine.indexesAvailableForAllResultSets(Iterable<ResultSet<O>> resultSetsToMerge)
focal_class.full_signature: static boolean indexesAvailableForAllResultSets(Iterable<ResultSet<O>> resultSetsToMerge)
focal_class.identifier: indexesAvailableForAllResultSets
focal_class.modifiers: static
focal_class.parameters: (Iterable<ResultSet<O>> resultSetsToMerge)
focal_class.return: boolean
focal_class.signature: boolean indexesAvailableForAllResultSets(Iterable<ResultSet<O>> resultSetsToMerge)
focal_method.body: @Override
      public ResultSet<O> retrieve(final Query<O> query, final QueryOptions queryOptions) {
          @SuppressWarnings("unchecked")
          OrderByOption<O> orderByOption = (OrderByOption<O>) queryOptions.get(OrderByOption.class);
  
          // Store the root query in the queryOptions, so that when retrieveRecursive() examines child branches, that
          // both the branch query and the root query will be available to PartialIndexes so they may determine if they
          // can be used to accelerate the overall query...
          queryOptions.put(ROOT_QUERY, query);
  
          // Log decisions made to the query log, if provided...
          final QueryLog queryLog = queryOptions.get(QueryLog.class); // might be null
  
          SortedKeyStatisticsAttributeIndex<?, O> indexForOrdering = null;
          if (orderByOption != null) {
              // Results must be ordered. Determine the ordering strategy to use: i.e. if we should use an index to order
              // results, or if we should retrieve results and sort them afterwards instead.
  
              Double selectivityThreshold = Thresholds.getThreshold(queryOptions, EngineThresholds.INDEX_ORDERING_SELECTIVITY);
              if (selectivityThreshold == null) {
                  selectivityThreshold = EngineThresholds.INDEX_ORDERING_SELECTIVITY.getThresholdDefault();
              }
              final List<AttributeOrder<O>> allSortOrders = orderByOption.getAttributeOrders();
              if (selectivityThreshold != 0.0) {
                  // Index ordering can be used.
                  // Check if an index is actually available to support it...
                  AttributeOrder<O> firstOrder = allSortOrders.iterator().next();
                  @SuppressWarnings("unchecked")
                  Attribute<O, Comparable> firstAttribute = (Attribute<O, Comparable>)firstOrder.getAttribute();
                  if (firstAttribute instanceof OrderControlAttribute) {
                      @SuppressWarnings("unchecked")
                      Attribute<O, Comparable> firstAttributeDelegate = ((OrderControlAttribute)firstAttribute).getDelegateAttribute();
                      firstAttribute = firstAttributeDelegate;
                  }
  
                  // Before we check if an index is available to support index ordering, we need to account for the fact
                  // that even if such an index is available, it might not contain all objects in the collection.
                  //
                  // An index built on a SimpleAttribute, is guaranteed to contain all objects in the collection, because
                  // SimpleAttribute is guaranteed to return a value for every object.
                  // OTOH an index built on a non-SimpleAttribute, is not guaranteed to contain all objects in the
                  // collection, because non-SimpleAttributes are permitted to return *zero* or more values for any
                  // object. Objects for which non-SimpleAttributes return zero values, will be omitted from the index.
                  //
                  // Therefore, if we will use an index to order results, we must ensure that the collection also has a
                  // suitable index to allow the objects which are not in the index to be retrieved as well. When
                  // ordering results, we must return those objects either before or after the objects which are found in
                  // the index. Here we proceed to locate a suitable index to use for ordering results, only if we will
                  // also be able to retrieve the objects missing from that index efficiently as well...
                  if (firstAttribute instanceof SimpleAttribute || standingQueryIndexes.get(not(has(firstAttribute))) != null) {
                      // Either we are sorting by a SimpleAttribute, or we are sorting by a non-SimpleAttribute and we
                      // also will be able to retrieve objects which do not have values for the non-SimpleAttribute
                      // efficiently. Now check if an index exists which would allow index ordering...
                      for (Index<O> index : this.getIndexesOnAttribute(firstAttribute)) {
                          if (index instanceof SortedKeyStatisticsAttributeIndex && !index.isQuantized()) {
                              indexForOrdering = (SortedKeyStatisticsAttributeIndex<?, O>)index;
                              break;
                          }
                      }
                  }
  
  
                  if (queryLog != null) {
                      queryLog.log("indexForOrdering: " + (indexForOrdering == null ? null : indexForOrdering.getClass().getSimpleName()));
                  }
                  // At this point we might have found an appropriate indexForOrdering, or it might still be null.
                  if (indexForOrdering != null) {
                      // We found an appropriate index.
                      // Determine if the selectivity of the query is below the selectivity threshold to use index ordering...
                      final double querySelectivity;
                      if (selectivityThreshold == 1.0) {
                          // Index ordering has been requested explicitly.
                          // Don't bother calculating query selectivity, assign low selectivity so we will use the index...
                          querySelectivity = 0.0;
                      }
                      else if (!indexForOrdering.supportsQuery(has(firstAttribute), queryOptions)) {
                          // Index ordering was not requested explicitly, and we cannot calculate the selectivity.
                          // In this case even though we have an index which supports index ordering,
                          // we don't have enough information to say that it would be beneficial.
                          // Assign high selectivity so that the materialize strategy will be used instead...
                          querySelectivity = 1.0;
                      }
                      else {
                          // The index supports has() queries, which allows us to calculate selectivity.
                          // Calculate query selectivity, based on the query cardinality and index cardinality...
                          final int queryCardinality = retrieveRecursive(query, queryOptions).getMergeCost();
                          final int indexCardinality = indexForOrdering.retrieve(has(firstAttribute), queryOptions).getMergeCost();
                          if (queryLog != null) {
                              queryLog.log("queryCardinality: " + queryCardinality);
                              queryLog.log("indexCardinality: " + indexCardinality);
                          }
                          if (indexCardinality == 0) {
                              // Handle edge case where the index is empty.
                              querySelectivity = 1.0; // treat is as if the query has high selectivity (tend to use materialize).
                          }
                          else if (queryCardinality > indexCardinality) {
                              // Handle edge case where query cardinality is greater than index cardinality.
                              querySelectivity = 0.0; // treat is as if the query has low selectivity (tend to use index ordering).
                          }
                          else {
                              querySelectivity = 1.0 - queryCardinality / (double)indexCardinality;
                          }
                      }
  
                      if (queryLog != null) {
                          queryLog.log("querySelectivity: " + querySelectivity);
                          queryLog.log("selectivityThreshold: " + selectivityThreshold);
                      }
                      if (querySelectivity > selectivityThreshold) {
                          // Selectivity is too high for index ordering strategy.
                          // Use the materialize ordering strategy instead.
                          indexForOrdering = null;
                      }
                      // else: querySelectivity <= selectivityThreshold, so we use the index ordering strategy.
                  }
              }
          }
          ResultSet<O> resultSet;
          if (indexForOrdering != null) {
              // Retrieve results, using an index to accelerate ordering...
              resultSet = retrieveWithIndexOrdering(query, queryOptions, orderByOption, indexForOrdering);
              if (queryLog != null) {
                  queryLog.log("orderingStrategy: index");
              }
          }
          else {
              // Retrieve results, without using an index to accelerate ordering...
              resultSet = retrieveWithoutIndexOrdering(query, queryOptions, orderByOption);
              if (queryLog != null) {
                  queryLog.log("orderingStrategy: materialize");
              }
          }
  
          // Return the results, ensuring that the close() method will close any resources which were opened...
          // TODO: possibly not necessary to wrap here, as the IndexedCollections also ensure close() is called...
          return new CloseableResultSet<O>(resultSet, query, queryOptions) {
              @Override
              public void close() {
                  super.close();
                  CloseableRequestResources.closeForQueryOptions(queryOptions);
              }
          };
      }
focal_method.class_method_signature: CollectionQueryEngine.retrieve(final Query<O> query, final QueryOptions queryOptions)
focal_method.full_signature: @Override public ResultSet<O> retrieve(final Query<O> query, final QueryOptions queryOptions)
focal_method.identifier: retrieve
focal_method.invocations: get put get getThreshold getThresholdDefault getAttributeOrders next iterator getAttribute getDelegateAttribute get not has getIndexesOnAttribute isQuantized log getSimpleName getClass supportsQuery has getMergeCost retrieveRecursive getMergeCost retrieve has log log log log retrieveWithIndexOrdering log retrieveWithoutIndexOrdering log close closeForQueryOptions
focal_method.modifiers: @Override public
focal_method.parameters: (final Query<O> query, final QueryOptions queryOptions)
focal_method.return: ResultSet<O>
focal_method.signature: ResultSet<O> retrieve(final Query<O> query, final QueryOptions queryOptions)