当前位置: 首页>>代码示例>>Java>>正文


Java Evaluator类代码示例

本文整理汇总了Java中net.sourceforge.jeval.Evaluator的典型用法代码示例。如果您正苦于以下问题:Java Evaluator类的具体用法?Java Evaluator怎么用?Java Evaluator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Evaluator类属于net.sourceforge.jeval包,在下文中一共展示了Evaluator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: classifyInstance

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
@Override
public double classifyInstance(Instance instance) throws Exception {
	//System.out.println(instance);
	Evaluator evaluator = new Evaluator();
	Double res=0.0;
	int index = model.getInputSpace().size();
   	for( String outVar : model.getOutputSpace().keySet()){
   		String tempFunction = new String(functions.get(outVar));;
   		int inputIndex=0;
   		for(String inVar: model.getInputSpace().keySet()){
   			//System.out.println(inVar+" "+instance.value(inputIndex));
   			tempFunction=tempFunction.replace(inVar, instance.value(inputIndex)+"");
   			inputIndex++;
   		}
   		res = Double.parseDouble(evaluator.evaluate(tempFunction));
   		//System.out.println("adding: "+outVar + " " +tempFunction+" "+res);
   		instance.setValue(new Attribute(outVar,index++), res);
   	}
	//System.out.println(instance);
	//System.out.println(res);
	return res;
}
 
开发者ID:project-asap,项目名称:IReS-Platform,代码行数:23,代码来源:UserFunctionClassifier.java

示例2: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return The ceiling of the argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.ceil(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:Ceil.java

示例3: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return The cosine of the argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.cos(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:Cos.java

示例4: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return The arc sine of the argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.asin(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:Asin.java

示例5: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return A long value that is closest to the argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Long result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Long(Math.round(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:Round.java

示例6: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return The absolute value of the argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.abs(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:Abs.java

示例7: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return A measurement of the argument in degrees.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(Evaluator evaluator, String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.toDegrees(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:ToDegrees.java

示例8: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return The arc cosine value of the argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.acos(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:Acos.java

示例9: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted into two double
 *            values and evaluated.
 * 
 * @return The smaller of two values.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;

	ArrayList numbers = FunctionHelper.getDoubles(arguments, 
			EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR);

	if (numbers.size() != 2) {
		throw new FunctionException("Two numeric arguments are required.");
	}

	try {
		double argumentOne = ((Double) numbers.get(0)).doubleValue();
		double argumentTwo = ((Double) numbers.get(1)).doubleValue();
		result = new Double(Math.min(argumentOne, argumentTwo));
	} catch (Exception e) {
		throw new FunctionException("Two numeric arguments are required.", e);
	}

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:38,代码来源:Min.java

示例10: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted into two double
 *            values and evaluated.
 * 
 * @return The arc tangent2 value of the argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;

	ArrayList numbers = FunctionHelper.getDoubles(arguments, 
			EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR);

	if (numbers.size() != 2) {
		throw new FunctionException("Two numeric arguments are required.");
	}

	try {
		double argumentOne = ((Double) numbers.get(0)).doubleValue();
		double argumentTwo = ((Double) numbers.get(1)).doubleValue();
		result = new Double(Math.atan2(argumentOne, argumentTwo));
	} catch (Exception e) {
		throw new FunctionException("Two numeric arguments are required.", e);
	}

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:38,代码来源:Atan2.java

示例11: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return The floor of the argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.floor(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:Floor.java

示例12: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return The the value e to the argument power, where e is the base of the
 *         natural logarithms
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.exp(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:33,代码来源:Exp.java

示例13: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted to a double value and
 *            evaluated.
 * 
 * @return A trigonometric tangent of an angle.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(Evaluator evaluator, String arguments)
		throws FunctionException {
	Double result = null;
	Double number = null;

	try {
		number = new Double(arguments);
	} catch (Exception e) {
		throw new FunctionException("Invalid argument.", e);
	}

	result = new Double(Math.tan(number.doubleValue()));

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:32,代码来源:Tan.java

示例14: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted into two double
 *            values and evaluated.
 * 
 * @return The value of the first argument raised to the second power of the
 *         second argument.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;

	ArrayList numbers = FunctionHelper.getDoubles(arguments, 
			EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR);

	if (numbers.size() != 2) {
		throw new FunctionException("Two numeric arguments are required.");
	}

	try {
		double argumentOne = ((Double) numbers.get(0)).doubleValue();
		double argumentTwo = ((Double) numbers.get(1)).doubleValue();
		result = new Double(Math.pow(argumentOne, argumentTwo));
	} catch (Exception e) {
		throw new FunctionException("Two numeric arguments are required.", e);
	}

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:39,代码来源:Pow.java

示例15: execute

import net.sourceforge.jeval.Evaluator; //导入依赖的package包/类
/**
 * Executes the function for the specified argument. This method is called
 * internally by Evaluator.
 * 
 * @param evaluator
 *            An instance of Evaluator.
 * @param arguments
 *            A string argument that will be converted into two double
 *            values and evaluated.
 * 
 * @return The the remainder operation on two arguments as prescribed by the
 *         IEEE 754 standard.
 * 
 * @exception FunctionException
 *                Thrown if the argument(s) are not valid for this function.
 */
public FunctionResult execute(final Evaluator evaluator, final String arguments)
		throws FunctionException {
	Double result = null;

	ArrayList numbers = FunctionHelper.getDoubles(arguments, 
			EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR);

	if (numbers.size() != 2) {
		throw new FunctionException("Two numeric arguments are required.");
	}

	try {
		double argumentOne = ((Double) numbers.get(0)).doubleValue();
		double argumentTwo = ((Double) numbers.get(1)).doubleValue();
		result = new Double(Math.IEEEremainder(argumentOne, argumentTwo));
	} catch (Exception e) {
		throw new FunctionException("Two numeric arguments are required.", e);
	}

	return new FunctionResult(result.toString(), 
			FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC);
}
 
开发者ID:yvbbrjdr,项目名称:yv3A-android,代码行数:39,代码来源:IEEEremainder.java


注:本文中的net.sourceforge.jeval.Evaluator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。