本文整理汇总了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;
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}