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


Java Distribution.setValues方法代码示例

本文整理汇总了Java中eu.riscoss.reasoner.Distribution.setValues方法的典型用法代码示例。如果您正苦于以下问题:Java Distribution.setValues方法的具体用法?Java Distribution.setValues怎么用?Java Distribution.setValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eu.riscoss.reasoner.Distribution的用法示例。


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

示例1: invalidCountOfDistributionLevels

import eu.riscoss.reasoner.Distribution; //导入方法依赖的package包/类
@Test
public void invalidCountOfDistributionLevels() {
	
	engine = new KPARiskAnalysisTool();
	engine.loadModel(convertStreamToString(
			KPAUnitTesting.class.getResourceAsStream("resources/valid/Timeliness.xdsl")));
	for (Chunk c : engine.queryModel(ModelSlice.INPUT_DATA)) {
		if ("VAverage_bug_fix_time__days_".equals(c.getId())) {
			Field f = engine.getField(c, FieldType.INPUT_VALUE);
			System.out.println("Read default distribution: " + f.getValue());
			List<Double> values = new ArrayList<Double>();
			values.add(0.42);
			values.add(0.22);
			Distribution distribution = new Distribution();
			distribution.setValues(values);
			f.setValue(distribution);
			this.exception.expect(ReasonerException.class);
			engine.setField(c, FieldType.INPUT_VALUE, f);
			break;
		}
	}
}
 
开发者ID:RISCOSS,项目名称:riscoss-analyser,代码行数:23,代码来源:KPAUnitTesting.java

示例2: distributionSumNotEqualTo1

import eu.riscoss.reasoner.Distribution; //导入方法依赖的package包/类
/**
 * Test checks whether the exception is thrown for distribution sum > 1.0.
 */
@Test
public void distributionSumNotEqualTo1() {
	
	engine.loadModel(convertStreamToString(KPAUnitTesting.class.getResourceAsStream("resources/valid/Timeliness.xdsl")));
	
	Chunk chunk = new Chunk("VHour__When_the_commit_was_made", "Timeliness");
	Distribution distribution = new Distribution();
	List<Double> values = new ArrayList<>(0);
	values.add(0.5);
	values.add(0.4);
	values.add(0.3);
	distribution.setValues(values);
	Field field = new Field(DataType.DISTRIBUTION, distribution);
	
	this.exception.expect(ReasonerException.class);
	
	this.engine.setField(chunk, FieldType.INPUT_VALUE, field);
}
 
开发者ID:RISCOSS,项目名称:riscoss-analyser,代码行数:22,代码来源:KPAUnitTesting.java

示例3: getDistributionFromDoubleArray

import eu.riscoss.reasoner.Distribution; //导入方法依赖的package包/类
public static Distribution getDistributionFromDoubleArray(double[] array) {
	
	List<Double> values = new ArrayList<>();
	for (int i = 0; i < array.length; i++) {
		values.add(array[i]);
	}
	Distribution result = new Distribution();
	result.setValues(values);
	return result;
}
 
开发者ID:RISCOSS,项目名称:riscoss-analyser,代码行数:11,代码来源:KPAExample.java

示例4: getDistributionFromDoubleArray

import eu.riscoss.reasoner.Distribution; //导入方法依赖的package包/类
/**
 * Converts the <code>double[]</code> array to <code>Distribution</code> object.
 * @param array
 * @return <code>Distribution</code>
 */
private Distribution getDistributionFromDoubleArray(double[] array) {
	
	List<Double> values = new ArrayList<>();
	for (int i = 0; i < array.length; i++) {
		values.add(array[i]);
	}
	Distribution result = new Distribution();
	result.setValues(values);
	return result;
}
 
开发者ID:RISCOSS,项目名称:riscoss-analyser,代码行数:16,代码来源:KPARiskAnalysisTool.java

示例5: confirmEvidenceIsSet

import eu.riscoss.reasoner.Distribution; //导入方法依赖的package包/类
@Test
public void confirmEvidenceIsSet() {
	
	boolean result = false;
	engine = new KPARiskAnalysisTool();
	engine.loadModel(convertStreamToString(
			KPAUnitTesting.class.getResourceAsStream("resources/valid/Timeliness.xdsl")));
	for (Chunk c : engine.queryModel(ModelSlice.INPUT_DATA)) {
		if ("VAverage_bug_fix_time__days_".equals(c.getId())) {
			Field f = engine.getField(c, FieldType.INPUT_VALUE);
			System.out.println("Read default distribution: " + f.getValue());
			List<Double> values = new ArrayList<Double>();
			values.add(0.42);
			values.add(0.22);
			values.add(0.16);
			values.add(0.11);
			values.add(0.09);
			Distribution distribution = new Distribution();
			distribution.setValues(values);
			f.setValue(distribution);
			engine.setField(c, FieldType.INPUT_VALUE, f);
			Field f2 = engine.getField(c, FieldType.INPUT_VALUE);
			System.out.println("Compared distributions before and after setting the evidence: " + 
					f.getValue() + " - " + f2.getValue() + "\n");
			result = compareDistributions((Distribution)f.getValue(), (Distribution)f2.getValue());
			break;
		}
	}
	Assert.assertTrue(result);
}
 
开发者ID:RISCOSS,项目名称:riscoss-analyser,代码行数:31,代码来源:KPAUnitTesting.java


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