-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClStrength.java
55 lines (39 loc) · 1.53 KB
/
ClStrength.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// $Id$
//
// Cassowary Incremental Constraint Solver
// Original Smalltalk Implementation by Alan Borning
// This Java Implementation by Greg J. Badros, <[email protected]>
// http://www.cs.washington.edu/homes/gjb
// (C) 1998, 1999 Greg J. Badros and Alan Borning
// See ../LICENSE for legal details regarding this software
//
// ClStrength
package EDU.Washington.grad.gjb.cassowary;
public class ClStrength
{
public ClStrength(String name, ClSymbolicWeight symbolicWeight)
{ _name = name; _symbolicWeight = symbolicWeight; }
public ClStrength(String name, double w1, double w2, double w3)
{
_name = name;
_symbolicWeight = new ClSymbolicWeight(w1,w2,w3);
}
public boolean isRequired()
{ return (this == required); }
public String toString()
{ return name () + (!isRequired()? (":" + symbolicWeight()) : ""); }
public ClSymbolicWeight symbolicWeight()
{ return _symbolicWeight; }
public String name()
{ return _name; }
public void set_name(String name)
{ _name = name; }
public void set_symbolicWeight(ClSymbolicWeight symbolicWeight)
{ _symbolicWeight = symbolicWeight; }
public static final ClStrength required = new ClStrength("<Required>", 1000, 1000, 1000);
public static final ClStrength strong = new ClStrength("strong", 1.0, 0.0, 0.0);
public static final ClStrength medium = new ClStrength("medium", 0.0, 1.0, 0.0);
public static final ClStrength weak = new ClStrength("weak", 0.0, 0.0, 1.0);
private String _name;
private ClSymbolicWeight _symbolicWeight;
}