/* ******************************************************************************
 * 
 * This file is part of Optsicom
 * 
 * License:
 *   EPL: http://www.eclipse.org/legal/epl-v10.html
 *   LGPL 3.0: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
 *   See the LICENSE file in the project's top-level directory for details.
 *
 * **************************************************************************** */
package es.optsicom.lib.util;

public enum BestMode {
	MIN_IS_BEST {
		@Override
		public String toString() {
			return "min";
		}

		@Override
		public boolean isBetterThan(double newWeight, double oldWeight) {
			return newWeight < oldWeight;
		}

		@Override
		public boolean isImprovement(double increment) {
			return increment < 0;
		}
	},
	MAX_IS_BEST {
		@Override
		public String toString() {
			return "max";
		}

		@Override
		public boolean isBetterThan(double newWeight, double oldWeight) {
			return newWeight > oldWeight;
		}

		@Override
		public boolean isImprovement(double increment) {
			return increment > 0;
		}
	};

	public abstract boolean isBetterThan(double newWeight, double oldWeight);

	public abstract boolean isImprovement(double increment);
	
}
@@ -473,33 +473,32 @@
 %0D%0A%09MIN_IS_BEST %7B
-%0D
 %0A%09%09@Override%0D%0A%09%09
@@ -485,33 +485,32 @@
 ST %7B%0A%09%09@Override
-%0D
 %0A%09%09public String
@@ -514,33 +514,32 @@
 ing toString() %7B
-%0D
 %0A%09%09%09return %22min%22
@@ -539,17 +539,16 @@
 n %22min%22;
-%0D
 %0A%09%09%7D%0A%0A%09%09
@@ -758,14 +758,172 @@
 %0A%09%09%7D
-%0D
+%0A%0A%09%09@Override%0A%09%09public boolean isNoWorseThanPerc(double newWeight, double oldWeight, double percentage) %7B%0A%09%09%09return newWeight * (1-percentage) %3C oldWeight;%0A%09%09%7D%09
 %0A%09%7D,
-%0D
 %0A%09MA
@@ -933,17 +933,16 @@
 S_BEST %7B
-%0D
 %0A%09%09@Over
@@ -945,17 +945,16 @@
 Override
-%0D
 %0A%09%09publi
@@ -974,17 +974,16 @@
 ring() %7B
-%0D
 %0A%09%09%09retu
@@ -991,17 +991,16 @@
 n %22max%22;
-%0D
 %0A%09%09%7D%0A%0A%09%09
@@ -1210,90 +1210,353 @@
 %0A%09%09%7D
-%0D%0A%09%7D;%0A%0A%09public abstract boolean isBetterThan(double newWeight, double oldWeight);%0A
+%0A%09%09%0A%09%09@Override%0A%09%09public boolean isNoWorseThanPerc(double newWeight, double oldWeight, double percentage) %7B%0A%09%09%09return newWeight %3E oldWeight * (1-percentage);%0A%09%09%7D%09%0A%09%7D;%0A%0A%09public abstract boolean isBetterThan(double newWeight, double oldWeight);%0A%09%0A%09public abstract boolean isNoWorseThanPerc(double newWeight, double oldWeight, double percentage);%0A%09
 %0A%09pu

Add new ways to compare solutions to BestMode