/** * {@inheritDoc} */ @Override public int hashCode() { int code = 0; code += ((int)this.getWindowStart()); code += ((int)this.getWindowEnd()); return code; }
/** * {@inheritDoc} * * @deprecated since 1.13. Use {@link #serialize(IValueSerializer)} with an array serializer instead. */ @Override @Deprecated public Object[] toArray() { return new Object[] { this.getWindowStart(), this.getWindowEnd() }; } /**
/** * {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (obj == null) return false; if (obj == this) return true; if (obj.getClass() != this.getClass()) return false; final AggregationWindow castedRecord = (AggregationWindow) obj; if (this.getLoggingTimestamp() != castedRecord.getLoggingTimestamp()) return false; if (this.getWindowStart() != castedRecord.getWindowStart()) return false; if (this.getWindowEnd() != castedRecord.getWindowEnd()) return false; return true; }
/** * {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != this.getClass()) { return false; } final AggregationWindow castedRecord = (AggregationWindow) obj; if (this.getLoggingTimestamp() != castedRecord.getLoggingTimestamp()) { return false; } if (this.getWindowStart() != castedRecord.getWindowStart()) { return false; } if (this.getWindowEnd() != castedRecord.getWindowEnd()) { return false; } return true; } /**
/** * {@inheritDoc} */ @Override public void serialize(final IValueSerializer serializer) throws BufferOverflowException { //super.serialize(serializer); serializer.putLong(this.getWindowStart()); serializer.putLong(this.getWindowEnd()); } /**
/** * {@inheritDoc} */ @Override public void serialize(final IValueSerializer serializer) throws BufferOverflowException { //super.serialize(serializer); serializer.putLong(this.getWindowStart()); serializer.putLong(this.getWindowEnd()); }
/** * Tests {@link AggregationWindow#TestAggregationWindow(long, long)}. */ @Test public void testParameterConstruction() { // NOPMD (assert missing) for (int i = 0; i < ARRAY_LENGTH; i++) { // initialize final AggregationWindow record = new AggregationWindow(LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size())); // check values Assert.assertEquals("AggregationWindow.windowStart values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getWindowStart()); Assert.assertEquals("AggregationWindow.windowEnd values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getWindowEnd()); } }
/** * Tests {@link AggregationWindow#TestAggregationWindow(long, long)}. */ @Test public void testBuffer() { // NOPMD (assert missing) for (int i = 0; i < ARRAY_LENGTH; i++) { // initialize final AggregationWindow record = new AggregationWindow(LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size())); // check values Assert.assertEquals("AggregationWindow.windowStart values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getWindowStart()); Assert.assertEquals("AggregationWindow.windowEnd values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getWindowEnd()); } }
final long endOfInputTimestampsInterval = this.computeLastTimestampInInterval(inputTimestamp, inputVariables); if (this.recentWindow.getWindowEnd() != endOfInputTimestampsInterval) { this.recentWindow = new AggregationWindow(startOfInputTimestampsInterval, endOfInputTimestampsInterval); super.deliver(OUTPUT_PORT_NAME_AGGREGATION_WINDOW, this.recentWindow);
final long endOfInputTimestampsInterval = this.computeLastTimestampInInterval(inputTimestamp, inputVariables); if (this.recentWindow.getWindowEnd() != endOfInputTimestampsInterval) { this.recentWindow = new AggregationWindow(startOfInputTimestampsInterval, endOfInputTimestampsInterval); super.deliver(OUTPUT_PORT_NAME_AGGREGATION_WINDOW, this.recentWindow);
private synchronized void processInputVariableScope(final NamedDoubleTimeSeriesPoint input) { // NOPMD (AvoidSynchronizedAtMethodLevel) final long currentTime = input.getTime(); final String appname = input.getName(); final AggregationVariableSet variables = this.aggregationVariables.get(appname); final long startOfTimestampsInterval = this.computeFirstTimestampInInterval(currentTime, variables); final long endOfTimestampsInterval = this.computeLastTimestampInInterval(currentTime, variables); if (this.recentWindow.getWindowEnd() != endOfTimestampsInterval) { this.recentWindow = new AggregationWindow(startOfTimestampsInterval, endOfTimestampsInterval); super.deliver(OUTPUT_PORT_NAME_AGGREGATION_WINDOW, this.recentWindow); } // check if interval is omitted if (endOfTimestampsInterval > variables.getLastTimestampInCurrentInterval()) { if (variables.getFirstTimestampInCurrentInterval() >= 0) { // don't do this for the first record (only used for initialization of variables) this.calculateAndDeliverAggregationValue(variables); long numIntervalsElapsed = 1; // refined below numIntervalsElapsed = (endOfTimestampsInterval - variables.getLastTimestampInCurrentInterval()) / this.aggregationSpan; if (numIntervalsElapsed > 1) { for (int i = 1; i < numIntervalsElapsed; i++) { super.deliver(OUTPUT_PORT_NAME_AGGREGATED_TSPOINT, new NamedDoubleTimeSeriesPoint(variables.getLastTimestampInCurrentInterval() + (i * this.aggregationSpan), Double.NaN, // Note: Count filter should use 0.0 appname)); } } } variables.setFirstTimestampInCurrentInterval(startOfTimestampsInterval); variables.setLastTimestampInCurrentInterval(endOfTimestampsInterval); variables.getAggregationList().clear(); } variables.getAggregationList().add(input); }
private synchronized void processInputVariableScope(final NamedDoubleTimeSeriesPoint input) { // NOPMD (AvoidSynchronizedAtMethodLevel) final long currentTime = input.getTime(); final String appname = input.getName(); final AggregationVariableSet variables = this.aggregationVariables.get(appname); final long startOfTimestampsInterval = this.computeFirstTimestampInInterval(currentTime, variables); final long endOfTimestampsInterval = this.computeLastTimestampInInterval(currentTime, variables); if (this.recentWindow.getWindowEnd() != endOfTimestampsInterval) { this.recentWindow = new AggregationWindow(startOfTimestampsInterval, endOfTimestampsInterval); super.deliver(OUTPUT_PORT_NAME_AGGREGATION_WINDOW, this.recentWindow); } // check if interval is omitted if (endOfTimestampsInterval > variables.getLastTimestampInCurrentInterval()) { if (variables.getFirstTimestampInCurrentInterval() >= 0) { // don't do this for the first record (only used for initialization of variables) this.calculateAndDeliverAggregationValue(variables); long numIntervalsElapsed = 1; // refined below numIntervalsElapsed = (endOfTimestampsInterval - variables.getLastTimestampInCurrentInterval()) / this.aggregationSpan; if (numIntervalsElapsed > 1) { for (int i = 1; i < numIntervalsElapsed; i++) { super.deliver(OUTPUT_PORT_NAME_AGGREGATED_TSPOINT, new NamedDoubleTimeSeriesPoint(variables.getLastTimestampInCurrentInterval() + (i * this.aggregationSpan), Double.NaN, // Note: Count filter should use 0.0 appname)); } } } variables.setFirstTimestampInCurrentInterval(startOfTimestampsInterval); variables.setLastTimestampInCurrentInterval(endOfTimestampsInterval); variables.getAggregationList().clear(); } variables.getAggregationList().add(input); }