test_class.declarator: TABLE_NAME = "cqtbl_features"
test_class.modifier: private static final
test_class.original_string: private static final String TABLE_NAME = "cqtbl_features";
test_class.type: String
test_class.var_name: TABLE_NAME
test_class.declarator: INDEX_NAME = "cqidx_features_value"
test_class.modifier: private static final
test_class.original_string: private static final String INDEX_NAME = "cqidx_features_value";
test_class.type: String
test_class.var_name: INDEX_NAME
test_class.declarator: OBJECT_TO_ID = Car.CAR_ID
test_class.modifier: public static final
test_class.original_string: public static final SimpleAttribute<Car, Integer> OBJECT_TO_ID = Car.CAR_ID;
test_class.type: SimpleAttribute<Car, Integer>
test_class.var_name: OBJECT_TO_ID
test_class.declarator: ID_TO_OBJECT = new SimpleAttribute<Integer, Car>("carFromId") {
          public Car getValue(Integer carId, QueryOptions queryOptions) { return null; }
      }
test_class.modifier: public static final
test_class.original_string: public static final SimpleAttribute<Integer, Car> ID_TO_OBJECT = new SimpleAttribute<Integer, Car>("carFromId") {
          public Car getValue(Integer carId, QueryOptions queryOptions) { return null; }
      };
test_class.type: SimpleAttribute<Integer, Car>
test_class.var_name: ID_TO_OBJECT
test_class.declarator: data = Arrays.asList(
              new Car(1, "Ford", "Focus", Car.Color.BLUE, 5, 9000.50, Arrays.asList("abs", "gps"), Collections.emptyList()),
              new Car(2, "Honda", "Civic", Car.Color.RED, 5, 5000.00, Arrays.asList("airbags"), Collections.emptyList()),
              new Car(3, "Toyota", "Prius", Car.Color.BLACK, 3, 9700.00, Arrays.asList("abs"), Collections.emptyList()),
              new Car(4, "Fiat", "Panda", Car.Color.BLUE, 5, 5600.00, Collections.<String>emptyList(), Collections.emptyList()),
              new Car(5, "Fiat", "Punto", Car.Color.BLUE, 5, 5600.00, Arrays.asList("gps"), Collections.emptyList())
      )
test_class.modifier: public static
test_class.original_string: public static List<Car> data = Arrays.asList(
              new Car(1, "Ford", "Focus", Car.Color.BLUE, 5, 9000.50, Arrays.asList("abs", "gps"), Collections.emptyList()),
              new Car(2, "Honda", "Civic", Car.Color.RED, 5, 5000.00, Arrays.asList("airbags"), Collections.emptyList()),
              new Car(3, "Toyota", "Prius", Car.Color.BLACK, 3, 9700.00, Arrays.asList("abs"), Collections.emptyList()),
              new Car(4, "Fiat", "Panda", Car.Color.BLUE, 5, 5600.00, Collections.<String>emptyList(), Collections.emptyList()),
              new Car(5, "Fiat", "Punto", Car.Color.BLUE, 5, 5600.00, Arrays.asList("gps"), Collections.emptyList())
      );
test_class.type: List<Car>
test_class.var_name: data
test_class.declarator: temporaryInMemoryDatabase = new TemporaryDatabase.TemporaryInMemoryDatabase()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public TemporaryDatabase.TemporaryInMemoryDatabase temporaryInMemoryDatabase = new TemporaryDatabase.TemporaryInMemoryDatabase();
test_class.type: TemporaryDatabase.TemporaryInMemoryDatabase
test_class.var_name: temporaryInMemoryDatabase
test_class.file: code/src/test/java/com/googlecode/cqengine/index/sqlite/SQLiteIndexTest.java
test_class.identifier: SQLiteIndexTest
test_case.body: @Test
      public void testNewResultSet_FilterQuery_GetMergeCost() throws Exception{
  
          // Mocks
          FilterQuery<Car, String> filterQuery = mockFilterQuery();
          ConnectionManager connectionManager = mock(ConnectionManager.class);
          Connection connection = mock(Connection.class);
          PreparedStatement preparedStatement = mock(PreparedStatement.class);
          java.sql.ResultSet resultSet = mock(java.sql.ResultSet.class);
  
          // Behaviour
          when(connectionManager.getConnection(any(SQLiteIndex.class), anyQueryOptions())).thenReturn(connection);
          when(connection.prepareStatement("SELECT COUNT(objectKey) FROM " + TABLE_NAME + " ;")).thenReturn(preparedStatement);
          when(preparedStatement.executeQuery()).thenReturn(resultSet);
          when(resultSet.getStatement()).thenReturn(preparedStatement);
          when(resultSet.next()).thenReturn(true);
          when(resultSet.getInt(1)).thenReturn(3);
  
          // Iterator
          ResultSet<Car> cars = new SQLiteIndex<String, Car, Integer>(
                  Car.FEATURES,
                  OBJECT_TO_ID,
                  ID_TO_OBJECT,
                  "")
  
                  .retrieve(filterQuery, createQueryOptions(connectionManager));
  
          assertNotNull(cars);
          int mergeCost = cars.getMergeCost();
  
          assertEquals(3, mergeCost);
          verify(connection, times(0)).close();
      }
test_case.class_method_signature: SQLiteIndexTest.testNewResultSet_FilterQuery_GetMergeCost()
test_case.full_signature: @Test public void testNewResultSet_FilterQuery_GetMergeCost()
test_case.identifier: testNewResultSet_FilterQuery_GetMergeCost
test_case.invocations: mockFilterQuery mock mock mock mock thenReturn when getConnection any anyQueryOptions thenReturn when prepareStatement thenReturn when executeQuery thenReturn when getStatement thenReturn when next thenReturn when getInt retrieve createQueryOptions assertNotNull getMergeCost assertEquals close verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNewResultSet_FilterQuery_GetMergeCost()
focal_class.declarator: INDEX_RETRIEVAL_COST = 80
focal_class.modifier: static final
focal_class.original_string: static final int INDEX_RETRIEVAL_COST = 80;
focal_class.type: int
focal_class.var_name: INDEX_RETRIEVAL_COST
focal_class.declarator: INDEX_RETRIEVAL_COST_FILTERING = INDEX_RETRIEVAL_COST + 1
focal_class.modifier: static final
focal_class.original_string: static final int INDEX_RETRIEVAL_COST_FILTERING = INDEX_RETRIEVAL_COST + 1;
focal_class.type: int
focal_class.var_name: INDEX_RETRIEVAL_COST_FILTERING
focal_class.declarator: FORCE_REINIT_OF_PREEXISTING_INDEXES = Boolean.getBoolean("cqengine.reinit.preexisting.indexes")
focal_class.modifier: static final
focal_class.original_string: static final boolean FORCE_REINIT_OF_PREEXISTING_INDEXES = Boolean.getBoolean("cqengine.reinit.preexisting.indexes");
focal_class.type: boolean
focal_class.var_name: FORCE_REINIT_OF_PREEXISTING_INDEXES
focal_class.declarator: tableName
focal_class.modifier: final
focal_class.original_string: final String tableName;
focal_class.type: String
focal_class.var_name: tableName
focal_class.declarator: primaryKeyAttribute
focal_class.modifier: final
focal_class.original_string: final SimpleAttribute<O, K> primaryKeyAttribute;
focal_class.type: SimpleAttribute<O, K>
focal_class.var_name: primaryKeyAttribute
focal_class.declarator: foreignKeyAttribute
focal_class.modifier: final
focal_class.original_string: final SimpleAttribute<K, O> foreignKeyAttribute;
focal_class.type: SimpleAttribute<K, O>
focal_class.var_name: foreignKeyAttribute
focal_class.declarator: pragmaSynchronous
focal_class.original_string: SQLiteConfig.SynchronousMode pragmaSynchronous;
focal_class.type: SQLiteConfig.SynchronousMode
focal_class.var_name: pragmaSynchronous
focal_class.declarator: pragmaJournalMode
focal_class.original_string: SQLiteConfig.JournalMode pragmaJournalMode;
focal_class.type: SQLiteConfig.JournalMode
focal_class.var_name: pragmaJournalMode
focal_class.declarator: canModifySyncAndJournaling
focal_class.original_string: boolean canModifySyncAndJournaling;
focal_class.type: boolean
focal_class.var_name: canModifySyncAndJournaling
focal_class.file: code/src/main/java/com/googlecode/cqengine/index/sqlite/SQLiteIndex.java
focal_class.identifier: SQLiteIndex
focal_class.interfaces: implements SortedKeyStatisticsAttributeIndex<A, O>, NonHeapTypeIndex
focal_class.class_method_signature: SQLiteIndex.SQLiteIndex(final Attribute<O, A> attribute,
                         final SimpleAttribute<O, K> primaryKeyAttribute,
                         final SimpleAttribute<K, O> foreignKeyAttribute,
                         final String tableNameSuffix)
focal_class.full_signature: public  SQLiteIndex(final Attribute<O, A> attribute,
                         final SimpleAttribute<O, K> primaryKeyAttribute,
                         final SimpleAttribute<K, O> foreignKeyAttribute,
                         final String tableNameSuffix)
focal_class.identifier: SQLiteIndex
focal_class.modifiers: public
focal_class.parameters: (final Attribute<O, A> attribute,
                         final SimpleAttribute<O, K> primaryKeyAttribute,
                         final SimpleAttribute<K, O> foreignKeyAttribute,
                         final String tableNameSuffix)
focal_class.signature:  SQLiteIndex(final Attribute<O, A> attribute,
                         final SimpleAttribute<O, K> primaryKeyAttribute,
                         final SimpleAttribute<K, O> foreignKeyAttribute,
                         final String tableNameSuffix)
focal_class.class_method_signature: SQLiteIndex.supportsQuery(Query<O> query, QueryOptions queryOptions)
focal_class.full_signature: @Override public boolean supportsQuery(Query<O> query, QueryOptions queryOptions)
focal_class.identifier: supportsQuery
focal_class.modifiers: @Override public
focal_class.parameters: (Query<O> query, QueryOptions queryOptions)
focal_class.return: boolean
focal_class.signature: boolean supportsQuery(Query<O> query, QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.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: SQLiteIndex.isQuantized()
focal_class.full_signature: @Override public boolean isQuantized()
focal_class.identifier: isQuantized
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isQuantized()
focal_class.class_method_signature: SQLiteIndex.getEffectiveIndex()
focal_class.full_signature: @Override public Index<O> getEffectiveIndex()
focal_class.identifier: getEffectiveIndex
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Index<O>
focal_class.signature: Index<O> getEffectiveIndex()
focal_class.class_method_signature: SQLiteIndex.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: SQLiteIndex.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: SQLiteIndex.doAddAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions, boolean isInit)
focal_class.full_signature:  boolean doAddAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions, boolean isInit)
focal_class.identifier: doAddAll
focal_class.parameters: (final ObjectSet<O> objectSet, final QueryOptions queryOptions, boolean isInit)
focal_class.return: boolean
focal_class.signature: boolean doAddAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions, boolean isInit)
focal_class.class_method_signature: SQLiteIndex.rowIterable(final Iterable<O> objects,
                                                        final SimpleAttribute<O, K> primaryKeyAttribute,
                                                        final Attribute<O, A> indexAttribute,
                                                        final QueryOptions queryOptions)
focal_class.full_signature: static Iterable<Row< K, A>> rowIterable(final Iterable<O> objects,
                                                        final SimpleAttribute<O, K> primaryKeyAttribute,
                                                        final Attribute<O, A> indexAttribute,
                                                        final QueryOptions queryOptions)
focal_class.identifier: rowIterable
focal_class.modifiers: static
focal_class.parameters: (final Iterable<O> objects,
                                                        final SimpleAttribute<O, K> primaryKeyAttribute,
                                                        final Attribute<O, A> indexAttribute,
                                                        final QueryOptions queryOptions)
focal_class.return: Iterable<Row< K, A>>
focal_class.signature: Iterable<Row< K, A>> rowIterable(final Iterable<O> objects,
                                                        final SimpleAttribute<O, K> primaryKeyAttribute,
                                                        final Attribute<O, A> indexAttribute,
                                                        final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.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: SQLiteIndex.objectKeyIterable(final Iterable<O> objects,
                                                  final SimpleAttribute<O, K> primaryKeyAttribute,
                                                  final QueryOptions queryOptions)
focal_class.full_signature: static Iterable<K> objectKeyIterable(final Iterable<O> objects,
                                                  final SimpleAttribute<O, K> primaryKeyAttribute,
                                                  final QueryOptions queryOptions)
focal_class.identifier: objectKeyIterable
focal_class.modifiers: static
focal_class.parameters: (final Iterable<O> objects,
                                                  final SimpleAttribute<O, K> primaryKeyAttribute,
                                                  final QueryOptions queryOptions)
focal_class.return: Iterable<K>
focal_class.signature: Iterable<K> objectKeyIterable(final Iterable<O> objects,
                                                  final SimpleAttribute<O, K> primaryKeyAttribute,
                                                  final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.clear(QueryOptions queryOptions)
focal_class.full_signature: @Override public void clear(QueryOptions queryOptions)
focal_class.identifier: clear
focal_class.modifiers: @Override public
focal_class.parameters: (QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void clear(QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.init(ObjectStore<O> objectStore, QueryOptions queryOptions)
focal_class.full_signature: @Override public void init(ObjectStore<O> objectStore, QueryOptions queryOptions)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (ObjectStore<O> objectStore, QueryOptions queryOptions)
focal_class.return: void
focal_class.signature: void init(ObjectStore<O> objectStore, QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.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: SQLiteIndex.createTableIndexIfNeeded(final Connection connection)
focal_class.full_signature:  void createTableIndexIfNeeded(final Connection connection)
focal_class.identifier: createTableIndexIfNeeded
focal_class.parameters: (final Connection connection)
focal_class.return: void
focal_class.signature: void createTableIndexIfNeeded(final Connection connection)
focal_class.class_method_signature: SQLiteIndex.getConnectionManager(final QueryOptions queryOptions)
focal_class.full_signature:  ConnectionManager getConnectionManager(final QueryOptions queryOptions)
focal_class.identifier: getConnectionManager
focal_class.parameters: (final QueryOptions queryOptions)
focal_class.return: ConnectionManager
focal_class.signature: ConnectionManager getConnectionManager(final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getDistinctKeys(final QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<A> getDistinctKeys(final QueryOptions queryOptions)
focal_class.identifier: getDistinctKeys
focal_class.modifiers: @Override public
focal_class.parameters: (final QueryOptions queryOptions)
focal_class.return: CloseableIterable<A>
focal_class.signature: CloseableIterable<A> getDistinctKeys(final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getDistinctKeys(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<A> getDistinctKeys(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final QueryOptions queryOptions)
focal_class.identifier: getDistinctKeys
focal_class.modifiers: @Override public
focal_class.parameters: (A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final QueryOptions queryOptions)
focal_class.return: CloseableIterable<A>
focal_class.signature: CloseableIterable<A> getDistinctKeys(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getDistinctKeysDescending(QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<A> getDistinctKeysDescending(QueryOptions queryOptions)
focal_class.identifier: getDistinctKeysDescending
focal_class.modifiers: @Override public
focal_class.parameters: (QueryOptions queryOptions)
focal_class.return: CloseableIterable<A>
focal_class.signature: CloseableIterable<A> getDistinctKeysDescending(QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getDistinctKeysDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<A> getDistinctKeysDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions)
focal_class.identifier: getDistinctKeysDescending
focal_class.modifiers: @Override public
focal_class.parameters: (A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions)
focal_class.return: CloseableIterable<A>
focal_class.signature: CloseableIterable<A> getDistinctKeysDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getCountOfDistinctKeys(QueryOptions queryOptions)
focal_class.full_signature: @Override public Integer getCountOfDistinctKeys(QueryOptions queryOptions)
focal_class.identifier: getCountOfDistinctKeys
focal_class.modifiers: @Override public
focal_class.parameters: (QueryOptions queryOptions)
focal_class.return: Integer
focal_class.signature: Integer getCountOfDistinctKeys(QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getStatisticsForDistinctKeysDescending(QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeysDescending(QueryOptions queryOptions)
focal_class.identifier: getStatisticsForDistinctKeysDescending
focal_class.modifiers: @Override public
focal_class.parameters: (QueryOptions queryOptions)
focal_class.return: CloseableIterable<KeyStatistics<A>>
focal_class.signature: CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeysDescending(QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getStatisticsForDistinctKeys(QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeys(QueryOptions queryOptions)
focal_class.identifier: getStatisticsForDistinctKeys
focal_class.modifiers: @Override public
focal_class.parameters: (QueryOptions queryOptions)
focal_class.return: CloseableIterable<KeyStatistics<A>>
focal_class.signature: CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeys(QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getStatisticsForDistinctKeys(final QueryOptions queryOptions, final boolean sortByKeyDescending)
focal_class.full_signature:  CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeys(final QueryOptions queryOptions, final boolean sortByKeyDescending)
focal_class.identifier: getStatisticsForDistinctKeys
focal_class.parameters: (final QueryOptions queryOptions, final boolean sortByKeyDescending)
focal_class.return: CloseableIterable<KeyStatistics<A>>
focal_class.signature: CloseableIterable<KeyStatistics<A>> getStatisticsForDistinctKeys(final QueryOptions queryOptions, final boolean sortByKeyDescending)
focal_class.class_method_signature: SQLiteIndex.getDistinctKeysInRange(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final boolean descending, final QueryOptions queryOptions)
focal_class.full_signature:  CloseableIterable<A> getDistinctKeysInRange(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final boolean descending, final QueryOptions queryOptions)
focal_class.identifier: getDistinctKeysInRange
focal_class.parameters: (A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final boolean descending, final QueryOptions queryOptions)
focal_class.return: CloseableIterable<A>
focal_class.signature: CloseableIterable<A> getDistinctKeysInRange(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final boolean descending, final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getKeysAndValues(final QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<KeyValue<A, O>> getKeysAndValues(final QueryOptions queryOptions)
focal_class.identifier: getKeysAndValues
focal_class.modifiers: @Override public
focal_class.parameters: (final QueryOptions queryOptions)
focal_class.return: CloseableIterable<KeyValue<A, O>>
focal_class.signature: CloseableIterable<KeyValue<A, O>> getKeysAndValues(final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getKeysAndValues(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<KeyValue<A, O>> getKeysAndValues(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final QueryOptions queryOptions)
focal_class.identifier: getKeysAndValues
focal_class.modifiers: @Override public
focal_class.parameters: (A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final QueryOptions queryOptions)
focal_class.return: CloseableIterable<KeyValue<A, O>>
focal_class.signature: CloseableIterable<KeyValue<A, O>> getKeysAndValues(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getKeysAndValuesDescending(QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<KeyValue<A, O>> getKeysAndValuesDescending(QueryOptions queryOptions)
focal_class.identifier: getKeysAndValuesDescending
focal_class.modifiers: @Override public
focal_class.parameters: (QueryOptions queryOptions)
focal_class.return: CloseableIterable<KeyValue<A, O>>
focal_class.signature: CloseableIterable<KeyValue<A, O>> getKeysAndValuesDescending(QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getKeysAndValuesDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions)
focal_class.full_signature: @Override public CloseableIterable<KeyValue<A, O>> getKeysAndValuesDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions)
focal_class.identifier: getKeysAndValuesDescending
focal_class.modifiers: @Override public
focal_class.parameters: (A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions)
focal_class.return: CloseableIterable<KeyValue<A, O>>
focal_class.signature: CloseableIterable<KeyValue<A, O>> getKeysAndValuesDescending(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getKeysAndValuesInRange(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final boolean descending, final QueryOptions queryOptions)
focal_class.full_signature:  CloseableIterable<KeyValue<A, O>> getKeysAndValuesInRange(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final boolean descending, final QueryOptions queryOptions)
focal_class.identifier: getKeysAndValuesInRange
focal_class.parameters: (A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final boolean descending, final QueryOptions queryOptions)
focal_class.return: CloseableIterable<KeyValue<A, O>>
focal_class.signature: CloseableIterable<KeyValue<A, O>> getKeysAndValuesInRange(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive, final boolean descending, final QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.getKeyRangeRestriction(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive)
focal_class.full_signature:  Query<O> getKeyRangeRestriction(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive)
focal_class.identifier: getKeyRangeRestriction
focal_class.parameters: (A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive)
focal_class.return: Query<O>
focal_class.signature: Query<O> getKeyRangeRestriction(A lowerBound, boolean lowerInclusive, A upperBound, boolean upperInclusive)
focal_class.class_method_signature: SQLiteIndex.getCountForKey(A key, QueryOptions queryOptions)
focal_class.full_signature: @Override public Integer getCountForKey(A key, QueryOptions queryOptions)
focal_class.identifier: getCountForKey
focal_class.modifiers: @Override public
focal_class.parameters: (A key, QueryOptions queryOptions)
focal_class.return: Integer
focal_class.signature: Integer getCountForKey(A key, QueryOptions queryOptions)
focal_class.class_method_signature: SQLiteIndex.equals(Object o)
focal_class.full_signature: @Override public boolean equals(Object o)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (Object o)
focal_class.return: boolean
focal_class.signature: boolean equals(Object o)
focal_class.class_method_signature: SQLiteIndex.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_class.class_method_signature: SQLiteIndex.onAttribute(final Attribute<O, A> attribute,
                                                                                     final SimpleAttribute<O, K> objectKeyAttribute,
                                                                                     final SimpleAttribute<K, O> foreignKeyAttribute)
focal_class.full_signature: public static SQLiteIndex<A, O, K> onAttribute(final Attribute<O, A> attribute,
                                                                                     final SimpleAttribute<O, K> objectKeyAttribute,
                                                                                     final SimpleAttribute<K, O> foreignKeyAttribute)
focal_class.identifier: onAttribute
focal_class.modifiers: public static
focal_class.parameters: (final Attribute<O, A> attribute,
                                                                                     final SimpleAttribute<O, K> objectKeyAttribute,
                                                                                     final SimpleAttribute<K, O> foreignKeyAttribute)
focal_class.return: SQLiteIndex<A, O, K>
focal_class.signature: SQLiteIndex<A, O, K> onAttribute(final Attribute<O, A> attribute,
                                                                                     final SimpleAttribute<O, K> objectKeyAttribute,
                                                                                     final SimpleAttribute<K, O> foreignKeyAttribute)
focal_class.superclass: extends AbstractAttributeIndex<A, O>
focal_method.body: @Override
      public ResultSet<O> retrieve(final Query<O> query, final QueryOptions queryOptions) {
          final ConnectionManager connectionManager = getConnectionManager(queryOptions);
  
          final CloseableResourceGroup closeableResourceGroup = CloseableRequestResources.forQueryOptions(queryOptions).addGroup();
  
          if (query instanceof FilterQuery){
              @SuppressWarnings("unchecked")
              final FilterQuery<O, A> filterQuery =  (FilterQuery<O, A>)query;
              return new ResultSet<O>() {
                  @Override
                  public Iterator<O> iterator() {
                      final Connection searchConnection = connectionManager.getConnection(SQLiteIndex.this, queryOptions);
  
                      final java.sql.ResultSet searchResultSet = DBQueries.getAllIndexEntries(tableName, searchConnection);
                      closeableResourceGroup.add(DBUtils.wrapAsCloseable(searchResultSet));
  
                      return new LazyIterator<O>() {
                          @Override
                          protected O computeNext() {
                              try {
                                  while (true) {
  
                                      if (!searchResultSet.next()) {
                                          close();
                                          return endOfData();
                                      }
  
                                      final K objectKey = DBUtils.getValueFromResultSet(1, searchResultSet, primaryKeyAttribute.getAttributeType());
                                      final A objectValue = DBUtils.getValueFromResultSet(2, searchResultSet, attribute.getAttributeType());
                                      if (filterQuery.matchesValue(objectValue, queryOptions)) {
                                          return foreignKeyAttribute.getValue(objectKey, queryOptions);
                                      }
                                  }
  
                              } catch (Exception e) {
                                  endOfData();
                                  close();
                                  throw new IllegalStateException("Unable to retrieve the ResultSet item.", e);
                              }
                          }
                      };
  
                  }
  
                  @Override
                  public boolean contains(O object) {
  
                      Connection connection = null;
                      java.sql.ResultSet searchResultSet = null;
                      try {
                          connection = connectionManager.getConnection(SQLiteIndex.this, queryOptions);
                          searchResultSet = DBQueries.getIndexEntryByObjectKey(primaryKeyAttribute.getValue(object, queryOptions), tableName, connection);
  
                          return lazyMatchingValuesIterable(searchResultSet).iterator().hasNext();
  
                      }finally {
                          DBUtils.closeQuietly(searchResultSet);
                      }
  
                  }
  
                  @Override
                  public boolean matches(O object) {
                      return query.matches(object, queryOptions);
                  }
  
                  @Override
                  public Query<O> getQuery() {
                      return query;
                  }
  
                  @Override
                  public QueryOptions getQueryOptions() {
                      return queryOptions;
                  }
  
                  @Override
                  public int getRetrievalCost() {
                      return INDEX_RETRIEVAL_COST_FILTERING;// choose between indexes
                  }
  
                  @Override
                  public int getMergeCost() {
                      //choose between branches.
                      final Connection connection = connectionManager.getConnection(SQLiteIndex.this, queryOptions);
                      return DBQueries.count(has(primaryKeyAttribute), tableName, connection); // no need to eliminate duplicates
                  }
  
                  @Override
                  public int size() {
                      Connection connection = null;
                      java.sql.ResultSet searchResultSet = null;
                      try {
                          connection = connectionManager.getConnection(SQLiteIndex.this, queryOptions);
                          searchResultSet = DBQueries.getAllIndexEntries(tableName, connection);
  
                          final Iterable<K> iterator = lazyMatchingValuesIterable(searchResultSet);
                          return IteratorUtil.countElements(iterator);
                      }finally {
                          DBUtils.closeQuietly(searchResultSet);
                      }
                  }
  
                  @Override
                  public void close() {
                      closeableResourceGroup.close();
                  }
  
                  // Method to retrieve all the distinct keys for the matching values from the index. Used in count and contains
                  Iterable<K> lazyMatchingValuesIterable(final java.sql.ResultSet searchResultSet) {
                      return new Iterable<K>() {
                          @Override
                          public Iterator<K> iterator() {
                              return new LazyIterator<K>() {
  
                                  K currentKey = null;
  
                                  @Override
                                  protected K computeNext() {
                                      try {
                                          while (true) {
  
                                              if (!searchResultSet.next()) {
                                                  close();
                                                  return endOfData();
                                              }
  
                                              final K objectKey = DBUtils.getValueFromResultSet(1, searchResultSet, primaryKeyAttribute.getAttributeType());
                                              if (currentKey == null || !currentKey.equals(objectKey)) {
                                                  final A objectValue = DBUtils.getValueFromResultSet(2, searchResultSet, attribute.getAttributeType());
                                                  if (filterQuery.matchesValue(objectValue, queryOptions)) {
                                                      currentKey = objectKey;
                                                      return objectKey;
                                                  }
                                              }
                                          }
  
                                      } catch (Exception e) {
                                          endOfData();
                                          close();
                                          throw new IllegalStateException("Unable to retrieve the ResultSet item.", e);
                                      }
                                  }
                              };
                          }
                      };
                  }
  
              };
          }else {
  
              return new ResultSet<O>() {
  
                  @Override
                  public Iterator<O> iterator() {
  
                      final Connection searchConnection = connectionManager.getConnection(SQLiteIndex.this, queryOptions);
  
                      final java.sql.ResultSet searchResultSet = DBQueries.search(query, tableName, searchConnection); // eliminates duplicates
                      closeableResourceGroup.add(DBUtils.wrapAsCloseable(searchResultSet));
  
                      return new LazyIterator<O>() {
                          @Override
                          protected O computeNext() {
                              try {
                                  if (!searchResultSet.next()) {
                                      close();
                                      return endOfData();
                                  }
                                  final K objectKey = DBUtils.getValueFromResultSet(1, searchResultSet, primaryKeyAttribute.getAttributeType());
                                  return foreignKeyAttribute.getValue(objectKey, queryOptions);
                              } catch (Exception e) {
                                  endOfData();
                                  close();
                                  throw new IllegalStateException("Unable to retrieve the ResultSet item.", e);
                              }
                          }
                      };
                  }
  
                  @Override
                  public int getRetrievalCost() {
                      return INDEX_RETRIEVAL_COST;
                  }
  
                  @Override
                  public int getMergeCost() {
                      final Connection connection = connectionManager.getConnection(SQLiteIndex.this, queryOptions);
                      return DBQueries.count(query, tableName, connection); // no need to eliminate duplicates
                  }
  
                  @Override
                  public boolean contains(O object) {
                      final K objectKey = primaryKeyAttribute.getValue(object, queryOptions);
                      final Connection connection = connectionManager.getConnection(SQLiteIndex.this, queryOptions);
                      return DBQueries.contains(objectKey, query, tableName, connection);
                  }
  
                  @Override
                  public boolean matches(O object) {
                      return query.matches(object, queryOptions);
                  }
  
                  @Override
                  public int size() {
                      final Connection connection = connectionManager.getConnection(SQLiteIndex.this, queryOptions);
  
                      boolean attributeHasAtMostOneValue = (attribute instanceof SimpleAttribute || attribute instanceof SimpleNullableAttribute);
                      boolean queryIsADisjointInQuery = query instanceof In && ((In) query).isDisjoint();
  
                      if (queryIsADisjointInQuery || attributeHasAtMostOneValue) {
                          return DBQueries.count(query, tableName, connection); // No need to eliminates duplicates
                      }else{
                          return DBQueries.countDistinct(query, tableName, connection); // eliminates duplicates
                      }
                  }
  
                  @Override
                  public void close() {
                      closeableResourceGroup.close();
                  }
  
                  @Override
                  public Query<O> getQuery() {
                      return query;
                  }
  
                  @Override
                  public QueryOptions getQueryOptions() {
                      return queryOptions;
                  }
              };
          }
      }
focal_method.class_method_signature: SQLiteIndex.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: getConnectionManager addGroup forQueryOptions getConnection getAllIndexEntries add wrapAsCloseable next close endOfData getValueFromResultSet getAttributeType getValueFromResultSet getAttributeType matchesValue getValue endOfData close getConnection getIndexEntryByObjectKey getValue hasNext iterator lazyMatchingValuesIterable closeQuietly matches getConnection count has getConnection getAllIndexEntries lazyMatchingValuesIterable countElements closeQuietly close next close endOfData getValueFromResultSet getAttributeType equals getValueFromResultSet getAttributeType matchesValue endOfData close getConnection search add wrapAsCloseable next close endOfData getValueFromResultSet getAttributeType getValue endOfData close getConnection count getValue getConnection contains matches getConnection isDisjoint count countDistinct close
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)