Skip to content

Commit

Permalink
Rename Index::create_cursor() to Index::find(). (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yata committed Sep 16, 2014
1 parent 4ef81a2 commit cab7733
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/grnxx/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Index {
// On success, returns a pointer to the cursor.
// On failure, returns nullptr and stores error information into "*error" if
// "error" != nullptr.
virtual unique_ptr<Cursor> create_cursor(
virtual unique_ptr<Cursor> find(
Error *error,
const Datum &datum,
const CursorOptions &options = CursorOptions()) const;
Expand Down
10 changes: 5 additions & 5 deletions lib/grnxx/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace grnxx {

Index::~Index() {}

unique_ptr<Cursor> Index::create_cursor(
unique_ptr<Cursor> Index::find(
Error *error,
const Datum &,
const CursorOptions &) const {
Expand Down Expand Up @@ -384,7 +384,7 @@ unique_ptr<TreeIndex<Bool>> TreeIndex<Bool>::create(

TreeIndex<Bool>::~TreeIndex() {}

unique_ptr<Cursor> TreeIndex<Bool>::create_cursor(
unique_ptr<Cursor> TreeIndex<Bool>::find(
Error *error,
const Datum &datum,
const CursorOptions &options) const {
Expand Down Expand Up @@ -545,7 +545,7 @@ unique_ptr<TreeIndex<Int>> TreeIndex<Int>::create(

TreeIndex<Int>::~TreeIndex() {}

unique_ptr<Cursor> TreeIndex<Int>::create_cursor(
unique_ptr<Cursor> TreeIndex<Int>::find(
Error *error,
const Datum &datum,
const CursorOptions &options) const {
Expand Down Expand Up @@ -706,7 +706,7 @@ unique_ptr<TreeIndex<Float>> TreeIndex<Float>::create(

TreeIndex<Float>::~TreeIndex() {}

unique_ptr<Cursor> TreeIndex<Float>::create_cursor(
unique_ptr<Cursor> TreeIndex<Float>::find(
Error *error,
const Datum &datum,
const CursorOptions &options) const {
Expand Down Expand Up @@ -878,7 +878,7 @@ unique_ptr<TreeIndex<Text>> TreeIndex<Text>::create(

TreeIndex<Text>::~TreeIndex() {}

unique_ptr<Cursor> TreeIndex<Text>::create_cursor(
unique_ptr<Cursor> TreeIndex<Text>::find(
Error *error,
const Datum &datum,
const CursorOptions &options) const {
Expand Down
8 changes: 4 additions & 4 deletions lib/grnxx/tree_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TreeIndex<Bool> : public Index {

~TreeIndex();

unique_ptr<Cursor> create_cursor(
unique_ptr<Cursor> find(
Error *error,
const Datum &datum,
const CursorOptions &options = CursorOptions()) const;
Expand Down Expand Up @@ -61,7 +61,7 @@ class TreeIndex<Int> : public Index {

~TreeIndex();

unique_ptr<Cursor> create_cursor(
unique_ptr<Cursor> find(
Error *error,
const Datum &datum,
const CursorOptions &options = CursorOptions()) const;
Expand Down Expand Up @@ -107,7 +107,7 @@ class TreeIndex<Float> : public Index {

~TreeIndex();

unique_ptr<Cursor> create_cursor(
unique_ptr<Cursor> find(
Error *error,
const Datum &datum,
const CursorOptions &options = CursorOptions()) const;
Expand Down Expand Up @@ -141,7 +141,7 @@ class TreeIndex<Text> : public Index {

~TreeIndex();

unique_ptr<Cursor> create_cursor(
unique_ptr<Cursor> find(
Error *error,
const Datum &datum,
const CursorOptions &options = CursorOptions()) const;
Expand Down
8 changes: 4 additions & 4 deletions test/test_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void test_bool_exact_match() {
for (int possible_value_id = 0; possible_value_id < 2; ++possible_value_id) {
grnxx::Bool value = possible_values[possible_value_id];

auto cursor = index->create_cursor(&error, value);
auto cursor = index->find(&error, value);
assert(cursor);

grnxx::Array<grnxx::Record> records;
Expand Down Expand Up @@ -310,7 +310,7 @@ void test_int_exact_match() {

// Test cursors for each value.
for (grnxx::Int value = 0; value < 100; ++value) {
auto cursor = index->create_cursor(&error, value);
auto cursor = index->find(&error, value);
assert(cursor);

grnxx::Array<grnxx::Record> records;
Expand Down Expand Up @@ -371,7 +371,7 @@ void test_float_exact_match() {
for (grnxx::Int int_value = 0; int_value < 256; ++int_value) {
grnxx::Float value = int_value / 256.0;

auto cursor = index->create_cursor(&error, value);
auto cursor = index->find(&error, value);
assert(cursor);

grnxx::Array<grnxx::Record> records;
Expand Down Expand Up @@ -436,7 +436,7 @@ void test_text_exact_match() {
for (int int_value = 0; int_value < 100; ++int_value) {
grnxx::Text value = bodies[int_value];

auto cursor = index->create_cursor(&error, value);
auto cursor = index->find(&error, value);
assert(cursor);

grnxx::Array<grnxx::Record> records;
Expand Down

0 comments on commit cab7733

Please sign in to comment.