• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Evaluator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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 tangent 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.atan(number.doubleValue()));

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


示例17: 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 radians.
 * 
 * @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.toRadians(number.doubleValue()));

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


示例18: 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 double value that is closest in value to the argument and is
 *         equal to a mathematical integer.
 * 
 * @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.rint(number.doubleValue()));

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


示例19: 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 square root 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.sqrt(number.doubleValue()));

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


示例20: 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 greater 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.max(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,代码来源:Max.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientOperationHeaderProto类代码示例发布时间:2022-05-22
下一篇:
Java Instruction10x类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap