<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/aiplatform/v1/match_service.proto

namespace Google\Cloud\AIPlatform\V1\FindNeighborsResponse;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A neighbor of the query vector.
 *
 * Generated from protobuf message <code>google.cloud.aiplatform.v1.FindNeighborsResponse.Neighbor</code>
 */
class Neighbor extends \Google\Protobuf\Internal\Message
{
    /**
     * The datapoint of the neighbor.
     * Note that full datapoints are returned only when "return_full_datapoint"
     * is set to true. Otherwise, only the "datapoint_id" and "crowding_tag"
     * fields are populated.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.IndexDatapoint datapoint = 1;</code>
     */
    private $datapoint = null;
    /**
     * The distance between the neighbor and the dense embedding query.
     *
     * Generated from protobuf field <code>double distance = 2;</code>
     */
    private $distance = 0.0;
    /**
     * The distance between the neighbor and the query sparse_embedding.
     *
     * Generated from protobuf field <code>double sparse_distance = 3;</code>
     */
    private $sparse_distance = 0.0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\AIPlatform\V1\IndexDatapoint $datapoint
     *           The datapoint of the neighbor.
     *           Note that full datapoints are returned only when "return_full_datapoint"
     *           is set to true. Otherwise, only the "datapoint_id" and "crowding_tag"
     *           fields are populated.
     *     @type float $distance
     *           The distance between the neighbor and the dense embedding query.
     *     @type float $sparse_distance
     *           The distance between the neighbor and the query sparse_embedding.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Aiplatform\V1\MatchService::initOnce();
        parent::__construct($data);
    }

    /**
     * The datapoint of the neighbor.
     * Note that full datapoints are returned only when "return_full_datapoint"
     * is set to true. Otherwise, only the "datapoint_id" and "crowding_tag"
     * fields are populated.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.IndexDatapoint datapoint = 1;</code>
     * @return \Google\Cloud\AIPlatform\V1\IndexDatapoint|null
     */
    public function getDatapoint()
    {
        return $this->datapoint;
    }

    public function hasDatapoint()
    {
        return isset($this->datapoint);
    }

    public function clearDatapoint()
    {
        unset($this->datapoint);
    }

    /**
     * The datapoint of the neighbor.
     * Note that full datapoints are returned only when "return_full_datapoint"
     * is set to true. Otherwise, only the "datapoint_id" and "crowding_tag"
     * fields are populated.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.IndexDatapoint datapoint = 1;</code>
     * @param \Google\Cloud\AIPlatform\V1\IndexDatapoint $var
     * @return $this
     */
    public function setDatapoint($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\IndexDatapoint::class);
        $this->datapoint = $var;

        return $this;
    }

    /**
     * The distance between the neighbor and the dense embedding query.
     *
     * Generated from protobuf field <code>double distance = 2;</code>
     * @return float
     */
    public function getDistance()
    {
        return $this->distance;
    }

    /**
     * The distance between the neighbor and the dense embedding query.
     *
     * Generated from protobuf field <code>double distance = 2;</code>
     * @param float $var
     * @return $this
     */
    public function setDistance($var)
    {
        GPBUtil::checkDouble($var);
        $this->distance = $var;

        return $this;
    }

    /**
     * The distance between the neighbor and the query sparse_embedding.
     *
     * Generated from protobuf field <code>double sparse_distance = 3;</code>
     * @return float
     */
    public function getSparseDistance()
    {
        return $this->sparse_distance;
    }

    /**
     * The distance between the neighbor and the query sparse_embedding.
     *
     * Generated from protobuf field <code>double sparse_distance = 3;</code>
     * @param float $var
     * @return $this
     */
    public function setSparseDistance($var)
    {
        GPBUtil::checkDouble($var);
        $this->sparse_distance = $var;

        return $this;
    }

}


