public Integer getOldestIndex(Long objId, double oldestTimeInMs) { // get index of oldestTimeInMs (or the next higher index, if oldestTimeInMs not in list) TimeList allTimes = timeSets.get(objId); if (allTimes == null) { return null; } int i = 0; for (; i < allTimes.size() && allTimes.get(i).getValue() < oldestTimeInMs; i++); return i; }
private StatisticValue newStatisticValue(long paramIdentityId, TimeList times, AttributeValueList values) { if (times == null || values == null) { // Nothing to do here... return null; } // Different list sizes or zero elements? if (times.size() != values.size() || values.size() == 0) { return null; } StatisticValue statValue = new StatisticValue(); statValue.setStartTime(times.get(0)); statValue.setEndTime(times.get(times.size() - 1)); // Last element statValue.setSampleCount(new UInteger(times.size())); long paramDefInstId = parameterManager.getDefinitionId(paramIdentityId); statValue.setParamDefInstId(paramDefInstId); return statValue; }
previousSetTimeStamp = new Time(currentTime.getValue() - (long) (updateInterval.getValue() * 1000)); } else { //otherwise its the time of the last value of the previous set previousSetTimeStamp = new Time(this.latestSampleTimeList.get(identityId).get(indexParameterSet - 1).getValue()); Time firstSampleTime = new Time(this.latestSampleTimeList.get(identityId).get(indexParameterSet).getValue() - (long) (sampleInterval.getValue() * 1000) * sampleCountList.get(identityId).get(indexParameterSet));
private StatisticValue generateStatisticValueMinimum(long paramIdentityId, TimeList times, AttributeValueList values) { StatisticValue statValue = this.newStatisticValue(paramIdentityId, times, values); if (statValue == null) { return null; } int minimum = 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; } // Comparison must be done here //requirement: 3.6.3.i report first occurance of min value if (HelperCOM.evaluateExpression(values.get(i).getValue(), ExpressionOperator.LESS, values.get(minimum).getValue())) { minimum = i; } } statValue.setValue(values.get(minimum).getValue()); statValue.setValueTime(times.get(minimum)); return statValue; }
private StatisticValue generateStatisticValueMaximum(long paramIdentityId, TimeList times, AttributeValueList values) { StatisticValue statValue = this.newStatisticValue(paramIdentityId, times, values); if (statValue == null) { return null; } int maximum = 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; } // Comparison must be done here //requirement: 3.6.3.h report first occurance of max value if (HelperCOM.evaluateExpression(values.get(i).getValue(), ExpressionOperator.GREATER, values.get(maximum).getValue())) { maximum = i; } } statValue.setValue(values.get(maximum).getValue()); statValue.setValueTime(times.get(maximum)); return statValue; }