3 // Cassowary Incremental Constraint Solver
4 // Original Smalltalk Implementation by Alan Borning
5 // This C++ Implementation by Greg J. Badros, <gjb@cs.washington.edu>
6 // http://www.cs.washington.edu/homes/gjb
7 // (C) 1998, 1999 Greg J. Badros and Alan Borning
8 // See ../LICENSE for legal details regarding this software
12 #include <cassowary/ClStrength.h>
16 #define CONFIG_H_INCLUDED
19 // Use the singleton pattern for the strength objects
20 const ClStrength &ClsRequired()
22 // required is distinct by equality to this static object,
23 // but I still use an especially high symbolic weight, just in case
25 static ClStrength required_strength("<Required>", 1000, 1000, 1000);
26 return required_strength;
29 const ClStrength &ClsStrong()
31 static ClStrength strong_strength("strong", 1.0, 0.0, 0.0);
32 return strong_strength;
35 const ClStrength &ClsMedium()
37 static ClStrength medium_strength("medium", 0.0, 1.0, 0.0);
38 return medium_strength;
42 const ClStrength &ClsWeak()
44 static ClStrength weak_strength("weak", 0.0, 0.0, 1.0);
48 // special case for when nLevels = 3, should assert nLevels() == 3
49 ClStrength::ClStrength(const string &Name, double w1, double w2, double w3) :
50 _name(Name), _symbolicWeight(w1, w2, w3)