/** * {@inheritDoc} */ @Override public void registerStrings(final IRegistry<String> stringRegistry) { // NOPMD (generated code) stringRegistry.get(this.getApplicationName()); } /**
/** * {@inheritDoc} */ @Override public int hashCode() { int code = 0; code += this.getApplicationName().hashCode(); code += ((int)this.getValue()); code += ((int)this.getTimestamp()); code += ((int)this.getForecast()); code += ((int)this.getScore()); code += ((int)this.getAnomalyThreshold()); 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.getApplicationName(), this.getValue(), this.getTimestamp(), this.getForecast(), this.getScore(), this.getAnomalyThreshold() }; } /**
/** * {@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 ExtendedStorableDetectionResult castedRecord = (ExtendedStorableDetectionResult) obj; if (this.getLoggingTimestamp() != castedRecord.getLoggingTimestamp()) return false; if (!this.getApplicationName().equals(castedRecord.getApplicationName())) return false; if (isNotEqual(this.getValue(), castedRecord.getValue())) return false; if (this.getTimestamp() != castedRecord.getTimestamp()) return false; if (isNotEqual(this.getForecast(), castedRecord.getForecast())) return false; if (isNotEqual(this.getScore(), castedRecord.getScore())) return false; if (isNotEqual(this.getAnomalyThreshold(), castedRecord.getAnomalyThreshold())) return false; return true; }
/** * Tests {@link ExtendedStorableDetectionResult#TestExtendedStorableDetectionResult(string, double, long, double, double, double)}. */ @Test public void testParameterConstruction() { // NOPMD (assert missing) for (int i = 0; i < ARRAY_LENGTH; i++) { // initialize final ExtendedStorableDetectionResult record = new ExtendedStorableDetectionResult(STRING_VALUES.get(i % STRING_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); // check values Assert.assertEquals("ExtendedStorableDetectionResult.applicationName values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null ? "" : STRING_VALUES.get(i % STRING_VALUES.size()), record.getApplicationName()); Assert.assertEquals("ExtendedStorableDetectionResult.value values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getValue(), 0.0000001); Assert.assertEquals("ExtendedStorableDetectionResult.timestamp values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals("ExtendedStorableDetectionResult.forecast values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getForecast(), 0.0000001); Assert.assertEquals("ExtendedStorableDetectionResult.score values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getScore(), 0.0000001); Assert.assertEquals("ExtendedStorableDetectionResult.anomalyThreshold values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getAnomalyThreshold(), 0.0000001); } }
/** * Tests {@link ExtendedStorableDetectionResult#TestExtendedStorableDetectionResult(string, double, long, double, double, double)}. */ @Test public void testBuffer() { // NOPMD (assert missing) for (int i = 0; i < ARRAY_LENGTH; i++) { // initialize final ExtendedStorableDetectionResult record = new ExtendedStorableDetectionResult(STRING_VALUES.get(i % STRING_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), DOUBLE_VALUES.get(i % DOUBLE_VALUES.size())); // check values Assert.assertEquals("ExtendedStorableDetectionResult.applicationName values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null ? "" : STRING_VALUES.get(i % STRING_VALUES.size()), record.getApplicationName()); Assert.assertEquals("ExtendedStorableDetectionResult.value values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getValue(), 0.0000001); Assert.assertEquals("ExtendedStorableDetectionResult.timestamp values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals("ExtendedStorableDetectionResult.forecast values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getForecast(), 0.0000001); Assert.assertEquals("ExtendedStorableDetectionResult.score values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getScore(), 0.0000001); Assert.assertEquals("ExtendedStorableDetectionResult.anomalyThreshold values are not equal.", DOUBLE_VALUES.get(i % DOUBLE_VALUES.size()), record.getAnomalyThreshold(), 0.0000001); } }
return false; if (!this.getApplicationName().equals(castedRecord.getApplicationName())) { return false;
/** * {@inheritDoc} */ @Override public void serialize(final IValueSerializer serializer) throws BufferOverflowException { //super.serialize(serializer); serializer.putString(this.getApplicationName()); serializer.putDouble(this.getValue()); serializer.putLong(this.getTimestamp()); serializer.putDouble(this.getForecast()); serializer.putDouble(this.getScore()); serializer.putDouble(this.getAnomalyThreshold()); }
/** * {@inheritDoc} */ @Override public void serialize(final IValueSerializer serializer) throws BufferOverflowException { //super.serialize(serializer); serializer.putString(this.getApplicationName()); serializer.putDouble(this.getValue()); serializer.putLong(this.getTimestamp()); serializer.putDouble(this.getForecast()); serializer.putDouble(this.getScore()); serializer.putDouble(this.getAnomalyThreshold()); } /**