| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 std::string s; | 162 std::string s; |
| 163 s += "{"; | 163 s += "{"; |
| 164 const char* sep = ""; | 164 const char* sep = ""; |
| 165 while (!prefix.empty()) { | 165 while (!prefix.empty()) { |
| 166 s += sep; | 166 s += sep; |
| 167 sep = ","; | 167 sep = ","; |
| 168 s += prefix.back(); | 168 s += prefix.back(); |
| 169 prefix.pop_back(); | 169 prefix.pop_back(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 s += StringPrintf("%u", node->count_); | 172 s += base::StringPrintf("%u", node->count_); |
| 173 s += " @"; | 173 s += " @"; |
| 174 s += base::Uint64ToString(node->edges_in_frequency_order.size()); | 174 s += base::Uint64ToString(node->edges_in_frequency_order.size()); |
| 175 s += "}"; | 175 s += "}"; |
| 176 return s; | 176 return s; |
| 177 } | 177 } |
| 178 | 178 |
| 179 typedef std::vector<LabelInfo*> Trace; | 179 typedef std::vector<LabelInfo*> Trace; |
| 180 | 180 |
| 181 struct OrderNodeByCountDecreasing { | 181 struct OrderNodeByCountDecreasing { |
| 182 bool operator()(Node* a, Node* b) const { | 182 bool operator()(Node* a, Node* b) const { |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 AdjustmentMethod* method = AdjustmentMethod::MakeProductionAdjustmentMethod(); | 684 AdjustmentMethod* method = AdjustmentMethod::MakeProductionAdjustmentMethod(); |
| 685 bool ok = method->Adjust(model, program); | 685 bool ok = method->Adjust(model, program); |
| 686 method->Destroy(); | 686 method->Destroy(); |
| 687 if (ok) | 687 if (ok) |
| 688 return C_OK; | 688 return C_OK; |
| 689 else | 689 else |
| 690 return C_ADJUSTMENT_FAILED; | 690 return C_ADJUSTMENT_FAILED; |
| 691 } | 691 } |
| 692 | 692 |
| 693 } // namespace courgette | 693 } // namespace courgette |
| OLD | NEW |