new widgets

This commit is contained in:
serso
2011-09-19 22:50:01 +04:00
parent 27c30bd966
commit 759b0eb1ee
14 changed files with 361 additions and 187 deletions

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
* For more information, please, contact se.solovyev@gmail.com
* or visit http://se.solovyev.org
*/
package org.solovyev.common.math;
/**
* User: serso
* Date: 9/19/11
* Time: 9:31 PM
*/
public class LinearNormalizer {
private final double min;
private final double max;
public LinearNormalizer(double min, double max) {
this.min = min;
this.max = max;
}
public double normalize(double value){
if ((max - min) != 0d) {
return (value - min) / (max - min);
} else {
return 1d;
}
}
public double denormalize(double value){
return min + value * (max - min);
}
}