All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.bitsensor.lib.entity.ErrorTranslation Maven / Gradle / Ivy

The newest version!
package io.bitsensor.lib.entity;

import io.bitsensor.lib.entity.proto.Detection;
import io.bitsensor.lib.entity.proto.Error;

import javax.validation.constraints.NotNull;

public class ErrorTranslation {

    @NotNull
    private Error error;

    @NotNull
    private Detection detection;

    private String dataPointIdentifier;

    public ErrorTranslation(Error error, Detection detection) {
        this.detection = detection;
        this.error = error;
    }

    public ErrorTranslation() {
    }

    /**
     * Checks if {@code errorToMatch} match the error translation.
     *
     * @param errorToMatch error to match the object
     * @return true if it matches the object, false otherwise.
     */
    public boolean match(Error errorToMatch) {
        return (this.error == errorToMatch)
                || errorToMatch.toBuilder().mergeFrom(this.error.toBuilder().clearHash().build()).build()
                .equals(errorToMatch);
    }

    public Detection getDetection() {
        return detection;
    }

    public void setDetection(Detection detection) {
        this.detection = detection;
    }

    public Error getError() {
        return error;
    }

    public void setError(Error error) {
        this.error = error;
    }

    /**
     * Get the DataPoint id that is used to build this ErrorTranslation
     */
    public String getDataPointIdentifier() {
        return dataPointIdentifier;
    }

    /**
     * @param dataPointIdentifier that is used to build this ErrorTranslation
     */
    public void setDataPointIdentifier(String dataPointIdentifier) {
        this.dataPointIdentifier = dataPointIdentifier;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy