susumu.yata
null+****@clear*****
Tue Dec 16 10:54:39 JST 2014
susumu.yata 2014-11-19 17:19:44 +0900 (Wed, 19 Nov 2014) New Revision: d62cdc8aeca2335c7414d1f24385e691526c3895 https://github.com/groonga/grnxx/commit/d62cdc8aeca2335c7414d1f24385e691526c3895 Message: Update Column to use match(). Modified files: lib/grnxx/impl/column/scalar/bool.cpp lib/grnxx/impl/column/scalar/float.cpp lib/grnxx/impl/column/scalar/geo_point.cpp lib/grnxx/impl/column/scalar/int.cpp lib/grnxx/impl/column/scalar/text.cpp lib/grnxx/impl/column/vector/bool.cpp lib/grnxx/impl/column/vector/float.cpp lib/grnxx/impl/column/vector/geo_point.cpp lib/grnxx/impl/column/vector/int.cpp lib/grnxx/impl/column/vector/text.cpp Modified: lib/grnxx/impl/column/scalar/bool.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/scalar/bool.cpp 2014-11-19 17:00:13 +0900 (bc815a6) +++ lib/grnxx/impl/column/scalar/bool.cpp 2014-11-19 17:19:44 +0900 (bc4b4ff) @@ -23,7 +23,7 @@ void Column<Bool>::set(Int row_id, const Datum &datum) { return; } Bool old_value = get(row_id); - if (old_value.value() == new_value.value()) { + if (old_value.match(new_value)) { return; } if (!old_value.is_na()) { @@ -68,7 +68,7 @@ bool Column<Bool>::contains(const Datum &datum) const { } } else { for (size_t i = 0; i < values_.size(); ++i) { - if (values_[i].value() == value.value()) { + if (values_[i].match(value)) { return true; } } @@ -87,7 +87,7 @@ Int Column<Bool>::find_one(const Datum &datum) const { } } else { for (size_t i = 0; i < values_.size(); ++i) { - if (values_[i].value() == value.value()) { + if (values_[i].match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/scalar/float.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/scalar/float.cpp 2014-11-19 17:00:13 +0900 (61d9e39) +++ lib/grnxx/impl/column/scalar/float.cpp 2014-11-19 17:19:44 +0900 (1ffa493) @@ -24,7 +24,7 @@ void Column<Float>::set(Int row_id, const Datum &datum) { return; } Float old_value = get(row_id); - if (old_value.value() == new_value.value()) { + if (old_value.match(new_value)) { return; } if (!old_value.is_na()) { @@ -69,7 +69,7 @@ bool Column<Float>::contains(const Datum &datum) const { } } else { for (size_t i = 0; i < values_.size(); ++i) { - if (values_[i].value() == value.value()) { + if (values_[i].match(value)) { return true; } } @@ -88,7 +88,7 @@ Int Column<Float>::find_one(const Datum &datum) const { } } else { for (size_t i = 0; i < values_.size(); ++i) { - if (values_[i].value() == value.value()) { + if (values_[i].match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/scalar/geo_point.cpp (+3 -6) =================================================================== --- lib/grnxx/impl/column/scalar/geo_point.cpp 2014-11-19 17:00:13 +0900 (272885f) +++ lib/grnxx/impl/column/scalar/geo_point.cpp 2014-11-19 17:19:44 +0900 (6297e5d) @@ -24,8 +24,7 @@ void Column<GeoPoint>::set(Int row_id, const Datum &datum) { return; } GeoPoint old_value = get(row_id); - if ((old_value.latitude() == new_value.latitude()) && - (old_value.longitude() == new_value.longitude())) { + if (old_value.match(new_value)) { return; } if (!old_value.is_na()) { @@ -70,8 +69,7 @@ bool Column<GeoPoint>::contains(const Datum &datum) const { } } else { for (size_t i = 0; i < values_.size(); ++i) { - if ((values_[i].latitude() == value.latitude()) && - (values_[i].longitude() == value.longitude())) { + if (values_[i].match(value)) { return true; } } @@ -90,8 +88,7 @@ Int Column<GeoPoint>::find_one(const Datum &datum) const { } } else { for (size_t i = 0; i < values_.size(); ++i) { - if ((values_[i].latitude() == value.latitude()) && - (values_[i].longitude() == value.longitude())) { + if (values_[i].match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/scalar/int.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/scalar/int.cpp 2014-11-19 17:00:13 +0900 (a5db400) +++ lib/grnxx/impl/column/scalar/int.cpp 2014-11-19 17:19:44 +0900 (9b5780b) @@ -44,7 +44,7 @@ void Column<Int>::set(Int row_id, const Datum &datum) { } } Int old_value = get(row_id); - if (old_value.value() == new_value.value()) { + if (old_value.match(new_value)) { return; } if (is_key_ && contains(datum)) { @@ -92,7 +92,7 @@ bool Column<Int>::contains(const Datum &datum) const { } } else { for (size_t i = 0; i < values_.size(); ++i) { - if (values_[i].value() == value.value()) { + if (values_[i].match(value)) { return true; } } @@ -111,7 +111,7 @@ Int Column<Int>::find_one(const Datum &datum) const { } } else { for (size_t i = 0; i < values_.size(); ++i) { - if (values_[i].value() == value.value()) { + if (values_[i].match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/scalar/text.cpp (+5 -5) =================================================================== --- lib/grnxx/impl/column/scalar/text.cpp 2014-11-19 17:00:13 +0900 (75e2b30) +++ lib/grnxx/impl/column/scalar/text.cpp 2014-11-19 17:19:44 +0900 (e773ef4) @@ -34,7 +34,7 @@ void Column<Text>::set(Int row_id, const Datum &datum) { return; } Text old_value = get(row_id); - if ((old_value == new_value).is_true()) { + if (old_value.match(new_value)) { return; } if (is_key_ && contains(datum)) { @@ -153,8 +153,8 @@ bool Column<Text>::contains(const Datum &datum) const { } } else { for (size_t i = 0; i < headers_.size(); ++i) { - // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + // TODO: Improve this (get() checks the range of its argument). + if (get(Int(i)).match(value)) { return true; } } @@ -173,8 +173,8 @@ Int Column<Text>::find_one(const Datum &datum) const { } } else { for (size_t i = 0; i < headers_.size(); ++i) { - // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + // TODO: Improve this (get() checks the range of its argument). + if (get(Int(i)).match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/vector/bool.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/bool.cpp 2014-11-19 17:00:13 +0900 (80ffd9f) +++ lib/grnxx/impl/column/vector/bool.cpp 2014-11-19 17:19:44 +0900 (a4da396) @@ -28,7 +28,7 @@ void Column<Vector<Bool>>::set(Int row_id, const Datum &datum) { return; } Vector<Bool> old_value = get(row_id); - if ((old_value == new_value).is_true()) { + if (old_value.match(new_value)) { return; } if (!old_value.is_na()) { @@ -93,7 +93,7 @@ bool Column<Vector<Bool>>::contains(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return true; } } @@ -113,7 +113,7 @@ Int Column<Vector<Bool>>::find_one(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/vector/float.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/float.cpp 2014-11-19 17:00:13 +0900 (a30a444) +++ lib/grnxx/impl/column/vector/float.cpp 2014-11-19 17:19:44 +0900 (a75c78f) @@ -28,7 +28,7 @@ void Column<Vector<Float>>::set(Int row_id, const Datum &datum) { return; } Vector<Float> old_value = get(row_id); - if ((old_value == new_value).is_true()) { + if (old_value.match(new_value)) { return; } if (!old_value.is_na()) { @@ -94,7 +94,7 @@ bool Column<Vector<Float>>::contains(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return true; } } @@ -114,7 +114,7 @@ Int Column<Vector<Float>>::find_one(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/vector/geo_point.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/geo_point.cpp 2014-11-19 17:00:13 +0900 (edcdd34) +++ lib/grnxx/impl/column/vector/geo_point.cpp 2014-11-19 17:19:44 +0900 (c32420c) @@ -28,7 +28,7 @@ void Column<Vector<GeoPoint>>::set(Int row_id, const Datum &datum) { return; } Vector<GeoPoint> old_value = get(row_id); - if ((old_value == new_value).is_true()) { + if (old_value.match(new_value)) { return; } if (!old_value.is_na()) { @@ -94,7 +94,7 @@ bool Column<Vector<GeoPoint>>::contains(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return true; } } @@ -114,7 +114,7 @@ Int Column<Vector<GeoPoint>>::find_one(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/vector/int.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/int.cpp 2014-11-19 17:00:13 +0900 (370cd73) +++ lib/grnxx/impl/column/vector/int.cpp 2014-11-19 17:19:44 +0900 (6201de5) @@ -43,7 +43,7 @@ void Column<Vector<Int>>::set(Int row_id, const Datum &datum) { } } Vector<Int> old_value = get(row_id); - if ((old_value == new_value).is_true()) { + if (old_value.match(new_value)) { return; } if (!old_value.is_na()) { @@ -109,7 +109,7 @@ bool Column<Vector<Int>>::contains(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return true; } } @@ -129,7 +129,7 @@ Int Column<Vector<Int>>::find_one(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return Int(i); } } Modified: lib/grnxx/impl/column/vector/text.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/text.cpp 2014-11-19 17:00:13 +0900 (7db175c) +++ lib/grnxx/impl/column/vector/text.cpp 2014-11-19 17:19:44 +0900 (b60929f) @@ -28,7 +28,7 @@ void Column<Vector<Text>>::set(Int row_id, const Datum &datum) { return; } Vector<Text> old_value = get(row_id); - if ((old_value == new_value).is_true()) { + if (old_value.match(new_value)) { return; } if (!old_value.is_na()) { @@ -96,7 +96,7 @@ bool Column<Vector<Text>>::contains(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return true; } } @@ -116,7 +116,7 @@ Int Column<Vector<Text>>::find_one(const Datum &datum) const { } else { for (size_t i = 0; i < headers_.size(); ++i) { // TODO: Improve this. - if ((get(Int(i)) == value).is_true()) { + if (get(Int(i)).match(value)) { return Int(i); } } -------------- next part -------------- HTML����������������������������... Descargar