If you think the Android project CalWatch listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
// $Id: ClStrength.java,v 1.11 1999/04/20 00:26:39 gjb Exp $
///*fromwww.java2s.com*/// Cassowary Incremental Constraint Solver
// Original Smalltalk Implementation by Alan Borning
// This Java Implementation by Greg J. Badros, <gjb@cs.washington.edu>
// 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;
publicclass 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);
}
publicboolean isRequired()
{ return (this == required); }
public String toString()
{ return name () + (!isRequired()? (":" + symbolicWeight()) : ""); }
public ClSymbolicWeight symbolicWeight()
{ return _symbolicWeight; }
public String name()
{ return _name; }
publicvoid set_name(String name)
{ _name = name; }
publicvoid set_symbolicWeight(ClSymbolicWeight symbolicWeight)
{ _symbolicWeight = symbolicWeight; }
publicstaticfinal ClStrength required = new ClStrength("<Required>", 1000, 1000, 1000);
publicstaticfinal ClStrength strong = new ClStrength("strong", 1.0, 0.0, 0.0);
publicstaticfinal ClStrength medium = new ClStrength("medium", 0.0, 1.0, 0.0);
publicstaticfinal ClStrength weak = new ClStrength("weak", 0.0, 0.0, 1.0);
private String _name;
private ClSymbolicWeight _symbolicWeight;
}