All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.aguacate.function.spi.impl.FunctionGreaterThan Maven / Gradle / Ivy

There is a newer version: 0.10.9
Show newest version
package net.sf.aguacate.function.spi.impl;

import java.util.Collection;

import net.sf.aguacate.function.FunctionEvalResult;
import net.sf.aguacate.function.spi.AbstractFunction2;
import net.sf.aguacate.util.parameter.Parameter;

public class FunctionGreaterThan> extends AbstractFunction2 {

	public FunctionGreaterThan(Collection methods, String name, String message, Parameter parameter1,
			Parameter parameter2) {
		super(methods, name, message, parameter1, parameter2);
	}

	@SuppressWarnings("unchecked")
	@Override
	protected FunctionEvalResult evaluate(String msg, Object value1, Object value2) {
		if (compare((T) value1, (T) value2) > 0) {
			logSuccess(msg);
			return new FunctionEvalResult(null, null);
		} else {
			logFailure(msg);
			return new FunctionEvalResult("Not Greater Than", null);
		}
	}

	int compare(T value1, T value2) {
		return value1.compareTo(value2);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy