Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: courgette/adjustment_method.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_view_host.cc ('k') | courgette/encoded_program.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "courgette/adjustment_method.h" 5 #include "courgette/adjustment_method.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 LabelInfo* in_edge_; // 142 LabelInfo* in_edge_; //
143 Node* prev_; // Node at shorter length. 143 Node* prev_; // Node at shorter length.
144 int count_; // Frequency of this path in Trie. 144 int count_; // Frequency of this path in Trie.
145 int length_; 145 int length_;
146 typedef std::map<LabelInfo*, Node*> Edges; 146 typedef std::map<LabelInfo*, Node*> Edges;
147 Edges edges_; 147 Edges edges_;
148 std::vector<int> places_; // Indexes into sequence of this item. 148 std::vector<int> places_; // Indexes into sequence of this item.
149 std::list<Node*> edges_in_frequency_order; 149 std::list<Node*> edges_in_frequency_order;
150 150
151 bool in_queue_; 151 bool in_queue_;
152 bool Extended() const { return edges_.size() > 0; } 152 bool Extended() const { return !edges_.empty(); }
153 153
154 uint32 Weight() const { 154 uint32 Weight() const {
155 return edges_in_frequency_order.front()->count_; 155 return edges_in_frequency_order.front()->count_;
156 } 156 }
157 }; 157 };
158 158
159 static std::string ToString(Node* node) { 159 static std::string ToString(Node* node) {
160 std::vector<std::string> prefix; 160 std::vector<std::string> prefix;
161 for (Node* n = node; n->prev_; n = n->prev_) 161 for (Node* n = node; n->prev_; n = n->prev_)
162 prefix.push_back(ToString(n->in_edge_)); 162 prefix.push_back(ToString(n->in_edge_));
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 AdjustmentMethod* method = AdjustmentMethod::MakeProductionAdjustmentMethod(); 686 AdjustmentMethod* method = AdjustmentMethod::MakeProductionAdjustmentMethod();
687 bool ok = method->Adjust(model, program); 687 bool ok = method->Adjust(model, program);
688 method->Destroy(); 688 method->Destroy();
689 if (ok) 689 if (ok)
690 return C_OK; 690 return C_OK;
691 else 691 else
692 return C_ADJUSTMENT_FAILED; 692 return C_ADJUSTMENT_FAILED;
693 } 693 }
694 694
695 } // namespace courgette 695 } // namespace courgette
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host.cc ('k') | courgette/encoded_program.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698