private Union linearInterpolation(final Attribute value, final Pair top, final Pair bottom) { double x = HelperAttributes.attribute2double(value); double x_0 = HelperAttributes.attribute2double(bottom.getFirst()); double y_0 = HelperAttributes.attribute2double(bottom.getSecond()); double x_1 = HelperAttributes.attribute2double(top.getFirst()); double y_1 = HelperAttributes.attribute2double(top.getSecond()); return new Union(this.linearInterpolation(x, x_0, y_0, x_1, y_1)); }
private Attribute applyPolyConversion(final PolyConversionDetails conversionDetails, final Attribute value) { //requirement: 3.8.3.e => no entry in the points-list returns null final PairList points = conversionDetails.getPoints(); if (points.size() == 0) { return null; } double convertedValue = 0; for (Pair point : points) { double midStep = Math.pow(HelperAttributes.attribute2double(value), ((Union) point.getFirst()).getIntegerValue()); convertedValue += HelperAttributes.attribute2double(point.getSecond()) * midStep; } return new Union(convertedValue); }
return ((String) c1).compareToIgnoreCase((String) c2); } else { c1 = HelperAttributes.attribute2double((Attribute) c1); c2 = HelperAttributes.attribute2double((Attribute) c2); double diff = (((Double) c1) - ((Double) c2));
private StatisticValue generateStatisticValueStandardDeviation(long paramIdentityId, TimeList times, AttributeValueList values) { StatisticValue statValue = this.newStatisticValue(paramIdentityId, times, values); if (statValue == null) { return null; } //----------------------Mean Calculation-------------------------- double mean = 0; // Go through all the data sets and find the maximum value... for (int i = 0; i < values.size(); i++) { if (values.get(i) == null) { continue; } mean += HelperAttributes.attribute2double(values.get(i).getValue()); } mean = mean / ((double) values.size()); //---------------------------------------------------------------- double variance = 0; // Go through all the data sets and find the maximum value... for (int i = 0; i < values.size(); i++) { double tmp = HelperAttributes.attribute2double(values.get(i).getValue()) - mean; variance += Math.pow(tmp, 2); } variance = variance / ((double) (values.size() - 1)); variance = Math.sqrt(variance); //requirement: 3.6.3.k report double value statValue.setValue((Attribute) HelperAttributes.javaType2Attribute(new Double(variance))); statValue.setValueTime(null); // StatisticValue structure: "Shall be NULL if not applicable for cases such as 'mean average'." return statValue; }
Double delta = HelperAttributes.attribute2double(value) - HelperAttributes.attribute2double(refValue); if (HelperAttributes.attribute2double(refValue) == 0) { upperThreshold = new Union(Float.NEGATIVE_INFINITY); lowerThreshold = new Union(Float.POSITIVE_INFINITY); } else { upperThreshold = new Union(HelperAttributes.attribute2double(deltaCheckDefinition.getUpperThreshold()) * HelperAttributes.attribute2double(refValue)); lowerThreshold = new Union(HelperAttributes.attribute2double(deltaCheckDefinition.getLowerThreshold()) * HelperAttributes.attribute2double(refValue));
leftHandSideString = HelperAttributes.attribute2string(leftHandSide); } else { rightHandSideDouble = HelperAttributes.attribute2double(rightHandSide); leftHandSideDouble = HelperAttributes.attribute2double((Attribute) leftHandSide);
private StatisticValue generateStatisticValueMeanAverage(long paramIdentityId, TimeList times, AttributeValueList values) { StatisticValue statValue = this.newStatisticValue(paramIdentityId, times, values); if (statValue == null) { return null; } //----------------------Mean Calculation-------------------------- double mean = 0; // Go through all the data sets and find the maximum value... for (int i = 0; i < values.size(); i++) { if (values.get(i) == null) { continue; } mean += HelperAttributes.attribute2double(values.get(i).getValue()); } mean = mean / ((double) values.size()); //---------------------------------------------------------------- //requirement: 3.6.3.j report double value statValue.setValue((Attribute) HelperAttributes.javaType2Attribute(new Double(mean))); statValue.setValueTime(null); // StatisticValue structure: "Shall be NULL if not applicable for cases such as 'mean average'." return statValue; }