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

io.deepsense.neptune.clientlibrary.models.impl.channels.OnlineNumericChannel Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
/**
 * Copyright (c) 2016, CodiLime Inc.
 */

package io.deepsense.neptune.clientlibrary.models.impl.channels;

import io.deepsense.neptune.apiclient.model.InputChannelValues;
import io.deepsense.neptune.clientlibrary.models.ChannelParams;
import io.deepsense.neptune.clientlibrary.models.ChannelType;
import io.deepsense.neptune.clientlibrary.services.apimodelconverter.ApiModelConverter;
import io.deepsense.neptune.clientlibrary.services.channelvaluesender.ChannelValueSendingProxy;

import java.util.UUID;

public class OnlineNumericChannel extends OnlineChannel {

    private final boolean isMetric;

    public OnlineNumericChannel(
            ApiModelConverter apiModelConverter,
            ChannelValueSendingProxy channelValueSendingProxy,
            long maxChannelValueSize,
            UUID id,
            ChannelParams channelParams,
            boolean isMetric) {
        super(apiModelConverter,
                channelValueSendingProxy,
                maxChannelValueSize,
                id,
                channelParams.getName(),
                channelParams.isHistoryPersisted());
        this.isMetric = isMetric;
    }

    @Override
    protected void performRawValueValidations(double x, Double y) {
        super.performRawValueValidations(x, y);
        ChannelValueValidations.checkIsFinite(y);
    }

    @Override
    public ChannelType getType() {
        return ChannelType.NUMERIC;
    }

    @Override
    protected InputChannelValues convertValueToSwaggerModel(double x, Double y) {
        return getApiModelConverter().numericChannelValueToApiModel(getId(), x, y, isMetric);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy