1 // Copyright 2009 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COURGETTE_ADJUSTMENT_METHOD_H_
6 #define COURGETTE_ADJUSTMENT_METHOD_H_
10 class AssemblyProgram;
12 class AdjustmentMethod {
14 // Factory methods for making adjusters.
16 // Returns the adjustment method used in production.
17 static AdjustmentMethod* MakeProductionAdjustmentMethod() {
18 return MakeShingleAdjustmentMethod();
21 // Returns and adjustement method that makes no adjustments.
22 static AdjustmentMethod* MakeNullAdjustmentMethod();
24 // Returns the original adjustment method.
25 static AdjustmentMethod* MakeTrieAdjustmentMethod();
27 // Returns the new shingle tiling adjustment method.
28 static AdjustmentMethod* MakeShingleAdjustmentMethod();
30 AdjustmentMethod(const AdjustmentMethod&) = delete;
31 AdjustmentMethod& operator=(const AdjustmentMethod&) = delete;
33 // AdjustmentMethod interface:
35 // Adjusts |program| to increase similarity to |model|. |program| can be
36 // changed in any way provided that it still produces the same output when
38 virtual bool Adjust(const AssemblyProgram& model,
39 AssemblyProgram* program) = 0;
41 // Deletes 'this' adjustment method.
42 virtual void Destroy();
46 virtual ~AdjustmentMethod() {}
49 } // namespace courgette
50 #endif // COURGETTE_ADJUSTMENT_METHOD_H_