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

org.opensearch.ml.common.dataframe.FloatValue Maven / Gradle / Ivy

The newest version!
/*
 * Copyright OpenSearch Contributors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.opensearch.ml.common.dataframe;

import java.io.IOException;

import org.opensearch.core.common.io.stream.StreamOutput;

import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import lombok.experimental.FieldDefaults;

@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
@ToString
public class FloatValue implements ColumnValue {
    float value;

    @Override
    public ColumnType columnType() {
        return ColumnType.FLOAT;
    }

    @Override
    public Object getValue() {
        return value;
    }

    @Override
    public double doubleValue() {
        return Float.valueOf(value).doubleValue();
    }

    @Override
    public float floatValue() {
        return value;
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        out.writeEnum(columnType());
        out.writeFloat(value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy