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)); }
public Object getObject() { Element elem = null; if (this.obj != null) { try { final BinaryDecoder binDec = new BinaryDecoder(this.obj); final MALElementFactory eleFact = MALContextFactory.getElementFactoryRegistry().lookupElementFactory(binDec.decodeLong()); elem = binDec.decodeNullableElement((Element) eleFact.createElement()); } catch (MALException ex) { Logger.getLogger(COMObjectEntity.class.getName()).log(Level.SEVERE, "The object body could not be decoded! Usually happens when there's " + "an update in the APIs. (1) " + this.toString(), ex); } catch (IllegalArgumentException ex) { Logger.getLogger(COMObjectEntity.class.getName()).log(Level.SEVERE, "The object body could not be decoded! Usually happens when there's " + "an update in the APIs. (2) " + this.toString(), ex); } catch (Exception ex) { Logger.getLogger(COMObjectEntity.class.getName()).log(Level.SEVERE, "The object body could not be decoded! Usually happens when there's " + "an update in the APIs. (3) " + this.toString(), ex); } } return HelperAttributes.attribute2JavaType(elem); }
/** * Generates the corresponding MAL Element List from a certain MAL Element * * @param obj The MAL Element * @return The MAL Element List * @throws java.lang.Exception */ public static ElementList element2elementList(Object obj) throws Exception { if (obj == null) { return null; } if (obj instanceof Element) { long l = ((Element) obj).getShortForm(); long ll = (-((l) & 0xFFFFFFL)) & 0xFFFFFFL + (l & 0xFFFFFFFFFF000000L); MALElementFactory eleFact = MALContextFactory.getElementFactoryRegistry().lookupElementFactory(ll); if (eleFact == null) { Logger.getLogger(HelperMisc.class.getName()).log(Level.SEVERE, "The element could not be found in the MAL ElementFactory! The object type is: '" + obj.getClass().getSimpleName() + "'. Maybe the service Helper for this object was not initialized. " + "Try initializing the Service Helper of this object."); } return (ElementList) eleFact.createElement(); } else { return HelperAttributes.generateElementListFromJavaType(obj); } }
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; }
c1 = HelperAttributes.attribute2string(c1); c2 = HelperAttributes.attribute2string(c2); return ((String) c1).compareToIgnoreCase((String) c2); } else { c1 = HelperAttributes.attribute2double((Attribute) c1); c2 = HelperAttributes.attribute2double((Attribute) c2); double diff = (((Double) c1) - ((Double) c2));
final Element ele = (Element) HelperAttributes.javaType2Attribute(object);
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; }
rightHandSideString = HelperAttributes.attribute2string(rightHandSide); leftHandSideString = HelperAttributes.attribute2string(leftHandSide); } else { rightHandSideDouble = HelperAttributes.attribute2double(rightHandSide); leftHandSideDouble = HelperAttributes.attribute2double((Attribute) leftHandSide);
Element leftHandSide = (Element) HelperAttributes.javaType2Attribute(obj); Boolean evaluation = HelperCOM.evaluateExpression(leftHandSide, compositeFilter.getType(), compositeFilter.getFieldValue());
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); }
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));