Remove ConnectorInterface as its subclass is Connector only.
Benefits:
- Virtual method call is removed
- Reduce the number of files to be maintained
This is just a code cleanup. Hence no behavior change should occur.
BUG=none
TEST=unittest
diff --git a/src/converter/connector.cc b/src/converter/connector.cc
index 4b81c0a..780ae09 100644
--- a/src/converter/connector.cc
+++ b/src/converter/connector.cc
@@ -91,7 +91,7 @@
if (use_1byte_value_) {
*value = values_[value_position];
if (*value == kInvalid1ByteCostValue) {
- *value = ConnectorInterface::kInvalidCost;
+ *value = kInvalidCost;
}
} else {
*value = reinterpret_cast<const uint16 *>(values_)[value_position];
diff --git a/src/converter/connector.h b/src/converter/connector.h
index 83fc594..3c6645c 100644
--- a/src/converter/connector.h
+++ b/src/converter/connector.h
@@ -34,23 +34,24 @@
#include "base/port.h"
#include "base/scoped_ptr.h"
-#include "converter/connector_interface.h"
namespace mozc {
class DataManagerInterface;
-class Connector : public ConnectorInterface {
+class Connector {
public:
+ static const int16 kInvalidCost = 30000;
+
static Connector *CreateFromDataManager(
const DataManagerInterface &data_manager);
Connector(const char *connection_data, size_t connection_size,
int cache_size);
- virtual ~Connector();
+ ~Connector();
- virtual int GetTransitionCost(uint16 rid, uint16 lid) const;
- virtual int GetResolution() const;
+ int GetTransitionCost(uint16 rid, uint16 lid) const;
+ int GetResolution() const;
void ClearCache();
diff --git a/src/converter/connector_interface.h b/src/converter/connector_interface.h
deleted file mode 100644
index 22f2223..0000000
--- a/src/converter/connector_interface.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2010-2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef MOZC_CONVERTER_CONNECTOR_INTERFACE_H_
-#define MOZC_CONVERTER_CONNECTOR_INTERFACE_H_
-
-#include "base/port.h"
-
-namespace mozc {
-
-class ConnectorInterface {
- public:
- virtual ~ConnectorInterface() {}
-
- virtual int GetTransitionCost(uint16 rid, uint16 lid) const = 0;
-
- // Test code can use this method to get acceptable error.
- virtual int GetResolution() const = 0;
-
- static const int16 kInvalidCost = 30000;
-
- protected:
- ConnectorInterface() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ConnectorInterface);
-};
-
-} // namespace mozc
-
-#endif // MOZC_CONVERTER_CONNECTOR_INTERFACE_H_
diff --git a/src/converter/converter.cc b/src/converter/converter.cc
index 9c57194..9995fc5 100644
--- a/src/converter/converter.cc
+++ b/src/converter/converter.cc
@@ -39,7 +39,6 @@
#include "base/port.h"
#include "base/util.h"
#include "composer/composer.h"
-#include "converter/connector_interface.h"
#include "converter/conversion_request.h"
#include "converter/immutable_converter_interface.h"
#include "converter/segments.h"
diff --git a/src/converter/converter_base.gyp b/src/converter/converter_base.gyp
index 33fefe9..25fdecd 100644
--- a/src/converter/converter_base.gyp
+++ b/src/converter/converter_base.gyp
@@ -84,6 +84,7 @@
'../dictionary/dictionary_base.gyp:pos_matcher',
'../prediction/prediction_base.gyp:suggestion_filter',
'../transliteration/transliteration.gyp:transliteration',
+ 'connector',
'lattice',
],
},
@@ -124,6 +125,7 @@
'../dictionary/dictionary_base.gyp:suppression_dictionary',
'../rewriter/rewriter_base.gyp:gen_rewriter_files#host',
'../session/session_base.gyp:session_protocol',
+ 'connector',
'immutable_converter_interface',
'segments',
],
diff --git a/src/converter/converter_test.cc b/src/converter/converter_test.cc
index fae3a0a..9443536 100644
--- a/src/converter/converter_test.cc
+++ b/src/converter/converter_test.cc
@@ -42,7 +42,6 @@
#include "config/config.pb.h"
#include "config/config_handler.h"
#include "converter/connector.h"
-#include "converter/connector_interface.h"
#include "converter/conversion_request.h"
#include "converter/converter_interface.h"
#include "converter/immutable_converter.h"
@@ -177,7 +176,7 @@
scoped_ptr<DictionaryInterface> user_dictionary;
scoped_ptr<SuppressionDictionary> suppression_dictionary;
scoped_ptr<DictionaryInterface> suffix_dictionary;
- scoped_ptr<const ConnectorInterface> connector;
+ scoped_ptr<const Connector> connector;
scoped_ptr<const SegmenterInterface> segmenter;
scoped_ptr<DictionaryInterface> dictionary;
scoped_ptr<const PosGroup> pos_group;
@@ -1243,7 +1242,7 @@
new PosGroup(data_manager.GetPosGroupData()));
scoped_ptr<const DictionaryInterface> suffix_dictionary(
CreateSuffixDictionaryFromDataManager(data_manager));
- scoped_ptr<const ConnectorInterface> connector(
+ scoped_ptr<const Connector> connector(
Connector::CreateFromDataManager(data_manager));
scoped_ptr<const SegmenterInterface> segmenter(
SegmenterBase::CreateFromDataManager(data_manager));
diff --git a/src/converter/immutable_converter.cc b/src/converter/immutable_converter.cc
index 24a0ee2..cbf469c 100644
--- a/src/converter/immutable_converter.cc
+++ b/src/converter/immutable_converter.cc
@@ -44,7 +44,7 @@
#include "base/util.h"
#include "config/config.pb.h"
#include "config/config_handler.h"
-#include "converter/connector_interface.h"
+#include "converter/connector.h"
#include "converter/conversion_request.h"
#include "converter/key_corrector.h"
#include "converter/lattice.h"
@@ -274,7 +274,7 @@
const DictionaryInterface *dictionary,
const DictionaryInterface *suffix_dictionary,
const SuppressionDictionary *suppression_dictionary,
- const ConnectorInterface *connector,
+ const Connector *connector,
const SegmenterInterface *segmenter,
const POSMatcher *pos_matcher,
const PosGroup *pos_group,
@@ -885,7 +885,7 @@
// left_boundary should be the previous one, and right_boundary should be
// the next).
inline void ViterbiInternal(
- const ConnectorInterface &connector, size_t pos, size_t right_boundary,
+ const Connector &connector, size_t pos, size_t right_boundary,
Lattice *lattice) {
for (Node *rnode = lattice->begin_nodes(pos);
rnode != NULL; rnode = rnode->bnext) {
diff --git a/src/converter/immutable_converter.h b/src/converter/immutable_converter.h
index 959a110..3ee1fc5 100644
--- a/src/converter/immutable_converter.h
+++ b/src/converter/immutable_converter.h
@@ -34,7 +34,7 @@
#include <vector>
#include "base/port.h"
-#include "converter/connector_interface.h"
+#include "converter/connector.h"
#include "converter/immutable_converter_interface.h"
#include "converter/node.h"
#include "converter/segments.h"
@@ -60,7 +60,7 @@
const DictionaryInterface *dictionary,
const DictionaryInterface *suffix_dictionary,
const dictionary::SuppressionDictionary *suppression_dictionary,
- const ConnectorInterface *connector,
+ const Connector *connector,
const SegmenterInterface *segmenter,
const POSMatcher *pos_matcher,
const PosGroup *pos_group,
@@ -183,7 +183,7 @@
const DictionaryInterface *dictionary_;
const DictionaryInterface *suffix_dictionary_;
const dictionary::SuppressionDictionary *suppression_dictionary_;
- const ConnectorInterface *connector_;
+ const Connector *connector_;
const SegmenterInterface *segmenter_;
const POSMatcher *pos_matcher_;
const PosGroup *pos_group_;
diff --git a/src/converter/immutable_converter_test.cc b/src/converter/immutable_converter_test.cc
index 3a5d7b4..fe9a149 100644
--- a/src/converter/immutable_converter_test.cc
+++ b/src/converter/immutable_converter_test.cc
@@ -42,7 +42,6 @@
#include "config/config.pb.h"
#include "config/config_handler.h"
#include "converter/connector.h"
-#include "converter/connector_interface.h"
#include "converter/conversion_request.h"
#include "converter/lattice.h"
#include "converter/segmenter_base.h"
@@ -163,7 +162,7 @@
private:
scoped_ptr<const DataManagerInterface> data_manager_;
scoped_ptr<const SuppressionDictionary> suppression_dictionary_;
- scoped_ptr<const ConnectorInterface> connector_;
+ scoped_ptr<const Connector> connector_;
scoped_ptr<const SegmenterInterface> segmenter_;
scoped_ptr<const DictionaryInterface> suffix_dictionary_;
scoped_ptr<const DictionaryInterface> dictionary_;
diff --git a/src/converter/nbest_generator.cc b/src/converter/nbest_generator.cc
index fdc0864..98f11bc 100644
--- a/src/converter/nbest_generator.cc
+++ b/src/converter/nbest_generator.cc
@@ -36,7 +36,7 @@
#include "base/logging.h"
#include "base/util.h"
#include "converter/candidate_filter.h"
-#include "converter/connector_interface.h"
+#include "converter/connector.h"
#include "converter/lattice.h"
#include "converter/node.h"
#include "converter/segmenter_interface.h"
@@ -107,7 +107,7 @@
NBestGenerator::NBestGenerator(const SuppressionDictionary *suppression_dic,
const SegmenterInterface *segmenter,
- const ConnectorInterface *connector,
+ const Connector *connector,
const POSMatcher *pos_matcher,
const Lattice *lattice,
const SuggestionFilter *suggestion_filter)
diff --git a/src/converter/nbest_generator.h b/src/converter/nbest_generator.h
index 20ea5fa..259a91f 100644
--- a/src/converter/nbest_generator.h
+++ b/src/converter/nbest_generator.h
@@ -42,7 +42,7 @@
namespace mozc {
-class ConnectorInterface;
+class Connector;
class Lattice;
class POSMatcher;
class SegmenterInterface;
@@ -83,7 +83,7 @@
NBestGenerator(
const dictionary::SuppressionDictionary *suppression_dictionary,
const SegmenterInterface *segmenter,
- const ConnectorInterface *connector,
+ const Connector *connector,
const POSMatcher *pos_matcher,
const Lattice *lattice,
const SuggestionFilter *suggestion_filter);
@@ -172,7 +172,7 @@
// References to relevant modules.
const dictionary::SuppressionDictionary *suppression_dictionary_;
const SegmenterInterface *segmenter_;
- const ConnectorInterface *connector_;
+ const Connector *connector_;
const POSMatcher *pos_matcher_;
const Lattice *lattice_;
diff --git a/src/converter/nbest_generator_test.cc b/src/converter/nbest_generator_test.cc
index 1f74b7a..816856d 100644
--- a/src/converter/nbest_generator_test.cc
+++ b/src/converter/nbest_generator_test.cc
@@ -38,7 +38,6 @@
#include "config/config.pb.h"
#include "config/config_handler.h"
#include "converter/connector.h"
-#include "converter/connector_interface.h"
#include "converter/conversion_request.h"
#include "converter/immutable_converter.h"
#include "converter/segmenter_base.h"
@@ -145,7 +144,7 @@
private:
scoped_ptr<const DataManagerInterface> data_manager_;
scoped_ptr<const SuppressionDictionary> suppression_dictionary_;
- scoped_ptr<const ConnectorInterface> connector_;
+ scoped_ptr<const Connector> connector_;
scoped_ptr<const SegmenterInterface> segmenter_;
scoped_ptr<const DictionaryInterface> suffix_dictionary_;
scoped_ptr<const DictionaryInterface> dictionary_;
diff --git a/src/data_manager/data_manager_test_base.cc b/src/data_manager/data_manager_test_base.cc
index d6c4f89..75ed4c7 100644
--- a/src/data_manager/data_manager_test_base.cc
+++ b/src/data_manager/data_manager_test_base.cc
@@ -39,7 +39,6 @@
#include "base/logging.h"
#include "base/util.h"
#include "converter/connector.h"
-#include "converter/connector_interface.h"
#include "converter/node.h"
#include "converter/segmenter_base.h"
#include "converter/segmenter_interface.h"
@@ -170,7 +169,7 @@
}
void DataManagerTestBase::ConnectorTest_RandomValueCheck() {
- scoped_ptr<const ConnectorInterface> connector(
+ scoped_ptr<const Connector> connector(
Connector::CreateFromDataManager(*data_manager_));
ASSERT_TRUE(connector.get() != NULL);
@@ -187,7 +186,7 @@
const int actual_cost =
connector->GetTransitionCost(reader.rid_of_left_node(),
reader.lid_of_right_node());
- if (cost == ConnectorInterface::kInvalidCost) {
+ if (cost == Connector::kInvalidCost) {
EXPECT_EQ(cost, actual_cost);
} else {
EXPECT_TRUE(cost == actual_cost ||
diff --git a/src/engine/engine.h b/src/engine/engine.h
index 0ccf245..b606abd 100644
--- a/src/engine/engine.h
+++ b/src/engine/engine.h
@@ -38,7 +38,7 @@
namespace mozc {
-class ConnectorInterface;
+class Connector;
class ConverterInterface;
class DataManagerInterface;
class DictionaryInterface;
@@ -77,7 +77,7 @@
private:
scoped_ptr<dictionary::SuppressionDictionary> suppression_dictionary_;
- scoped_ptr<const ConnectorInterface> connector_;
+ scoped_ptr<const Connector> connector_;
scoped_ptr<const SegmenterInterface> segmenter_;
scoped_ptr<dictionary::UserDictionary> user_dictionary_;
scoped_ptr<DictionaryInterface> suffix_dictionary_;
diff --git a/src/mozc_version_template.txt b/src/mozc_version_template.txt
index 8d59907..143bb8e 100644
--- a/src/mozc_version_template.txt
+++ b/src/mozc_version_template.txt
@@ -1,6 +1,6 @@
MAJOR=2
MINOR=17
-BUILD=2082
+BUILD=2083
REVISION=102
# NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
# downloaded by NaCl Mozc.
diff --git a/src/prediction/dictionary_predictor.cc b/src/prediction/dictionary_predictor.cc
index 75dffe5..f09e533 100644
--- a/src/prediction/dictionary_predictor.cc
+++ b/src/prediction/dictionary_predictor.cc
@@ -47,7 +47,7 @@
#include "composer/composer.h"
#include "config/config.pb.h"
#include "config/config_handler.h"
-#include "converter/connector_interface.h"
+#include "converter/connector.h"
#include "converter/conversion_request.h"
#include "converter/converter_interface.h"
#include "converter/immutable_converter_interface.h"
@@ -293,7 +293,7 @@
const ImmutableConverterInterface *immutable_converter,
const DictionaryInterface *dictionary,
const DictionaryInterface *suffix_dictionary,
- const ConnectorInterface *connector,
+ const Connector *connector,
const SegmenterInterface *segmenter,
const POSMatcher *pos_matcher,
const SuggestionFilter *suggestion_filter)
diff --git a/src/prediction/dictionary_predictor.h b/src/prediction/dictionary_predictor.h
index 8c7ae69..99ab695 100644
--- a/src/prediction/dictionary_predictor.h
+++ b/src/prediction/dictionary_predictor.h
@@ -42,7 +42,7 @@
namespace mozc {
-class ConnectorInterface;
+class Connector;
class ConversionRequest;
class ConverterInterface;
class DictionaryInterface;
@@ -61,7 +61,7 @@
const ImmutableConverterInterface *immutable_converter,
const DictionaryInterface *dictionary,
const DictionaryInterface *suffix_dictionary,
- const ConnectorInterface *connector,
+ const Connector *connector,
const SegmenterInterface *segmenter,
const POSMatcher *pos_matcher,
const SuggestionFilter *suggestion_filter);
@@ -423,7 +423,7 @@
const ImmutableConverterInterface *immutable_converter_;
const DictionaryInterface *dictionary_;
const DictionaryInterface *suffix_dictionary_;
- const ConnectorInterface *connector_;
+ const Connector *connector_;
const SegmenterInterface *segmenter_;
const SuggestionFilter *suggestion_filter_;
const uint16 counter_suffix_word_id_;
diff --git a/src/prediction/dictionary_predictor_test.cc b/src/prediction/dictionary_predictor_test.cc
index 995a8e1..41d0f1c 100644
--- a/src/prediction/dictionary_predictor_test.cc
+++ b/src/prediction/dictionary_predictor_test.cc
@@ -46,7 +46,6 @@
#include "config/config.pb.h"
#include "config/config_handler.h"
#include "converter/connector.h"
-#include "converter/connector_interface.h"
#include "converter/conversion_request.h"
#include "converter/converter_interface.h"
#include "converter/converter_mock.h"
@@ -155,7 +154,7 @@
const ImmutableConverterInterface *immutable_converter,
const DictionaryInterface *dictionary,
const DictionaryInterface *suffix_dictionary,
- const ConnectorInterface *connector,
+ const Connector *connector,
const SegmenterInterface *segmenter,
const POSMatcher *pos_matcher,
const SuggestionFilter *suggestion_filter)
@@ -267,7 +266,7 @@
private:
const POSMatcher *pos_matcher_;
scoped_ptr<SuppressionDictionary> suppression_dictionary_;
- scoped_ptr<const ConnectorInterface> connector_;
+ scoped_ptr<const Connector> connector_;
scoped_ptr<const SegmenterInterface> segmenter_;
scoped_ptr<const DictionaryInterface> suffix_dictionary_;
scoped_ptr<const DictionaryInterface> dictionary_;
@@ -1558,7 +1557,7 @@
new ImmutableConverterMock);
scoped_ptr<const DictionaryInterface> suffix_dictionary(
CreateSuffixDictionaryFromDataManager(data_manager));
- scoped_ptr<const ConnectorInterface> connector(
+ scoped_ptr<const Connector> connector(
Connector::CreateFromDataManager(data_manager));
scoped_ptr<const SegmenterInterface> segmenter(
SegmenterBase::CreateFromDataManager(data_manager));
@@ -3130,7 +3129,7 @@
new ImmutableConverterMock);
scoped_ptr<const DictionaryInterface> suffix_dictionary(
CreateSuffixDictionaryFromDataManager(data_manager));
- scoped_ptr<const ConnectorInterface> connector(
+ scoped_ptr<const Connector> connector(
Connector::CreateFromDataManager(data_manager));
scoped_ptr<const SegmenterInterface> segmenter(
SegmenterBase::CreateFromDataManager(data_manager));