當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。