autopilotrpc.SetScoresRequest.scala Maven / Gradle / Ivy
The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package autopilotrpc
/** @param heuristic
* The name of the heuristic to provide scores to.
* @param scores
*
* A map from hex-encoded public keys to scores. Scores must be in the range
* [0.0, 1.0].
*/
@SerialVersionUID(0L)
final case class SetScoresRequest(
heuristic: _root_.scala.Predef.String = "",
scores: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Double] = _root_.scala.collection.immutable.Map.empty,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[SetScoresRequest] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
{
val __value = heuristic
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
}
};
scores.foreach { __item =>
val __value = autopilotrpc.SetScoresRequest._typemapper_scores.toBase(__item)
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
__size += unknownFields.serializedSize
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
__size - 1
}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
{
val __v = heuristic
if (!__v.isEmpty) {
_output__.writeString(1, __v)
}
};
scores.foreach { __v =>
val __m = autopilotrpc.SetScoresRequest._typemapper_scores.toBase(__v)
_output__.writeTag(2, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def withHeuristic(__v: _root_.scala.Predef.String): SetScoresRequest = copy(heuristic = __v)
def clearScores = copy(scores = _root_.scala.collection.immutable.Map.empty)
def addScores(__vs: (_root_.scala.Predef.String, _root_.scala.Double) *): SetScoresRequest = addAllScores(__vs)
def addAllScores(__vs: Iterable[(_root_.scala.Predef.String, _root_.scala.Double)]): SetScoresRequest = copy(scores = scores ++ __vs)
def withScores(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Double]): SetScoresRequest = copy(scores = __v)
def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 1 => {
val __t = heuristic
if (__t != "") __t else null
}
case 2 => scores.iterator.map(autopilotrpc.SetScoresRequest._typemapper_scores.toBase(_)).toSeq
}
}
def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
_root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
(__field.number: @_root_.scala.unchecked) match {
case 1 => _root_.scalapb.descriptors.PString(heuristic)
case 2 => _root_.scalapb.descriptors.PRepeated(scores.iterator.map(autopilotrpc.SetScoresRequest._typemapper_scores.toBase(_).toPMessage).toVector)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: autopilotrpc.SetScoresRequest.type = autopilotrpc.SetScoresRequest
// @@protoc_insertion_point(GeneratedMessage[autopilotrpc.SetScoresRequest])
}
object SetScoresRequest extends scalapb.GeneratedMessageCompanion[autopilotrpc.SetScoresRequest] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[autopilotrpc.SetScoresRequest] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): autopilotrpc.SetScoresRequest = {
var __heuristic: _root_.scala.Predef.String = ""
val __scores: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Double), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Double]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Double]
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__heuristic = _input__.readStringRequireUtf8()
case 18 =>
__scores += autopilotrpc.SetScoresRequest._typemapper_scores.toCustom(_root_.scalapb.LiteParser.readMessage[autopilotrpc.SetScoresRequest.ScoresEntry](_input__))
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
autopilotrpc.SetScoresRequest(
heuristic = __heuristic,
scores = __scores.result(),
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[autopilotrpc.SetScoresRequest] = _root_.scalapb.descriptors.Reads{
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
autopilotrpc.SetScoresRequest(
heuristic = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
scores = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Seq[autopilotrpc.SetScoresRequest.ScoresEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(autopilotrpc.SetScoresRequest._typemapper_scores.toCustom(_)).toMap
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = AutopilotProto.javaDescriptor.getMessageTypes().get(6)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = AutopilotProto.scalaDescriptor.messages(6)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 2 => __out = autopilotrpc.SetScoresRequest.ScoresEntry
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
_root_.autopilotrpc.SetScoresRequest.ScoresEntry
)
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = autopilotrpc.SetScoresRequest(
heuristic = "",
scores = _root_.scala.collection.immutable.Map.empty
)
@SerialVersionUID(0L)
final case class ScoresEntry(
key: _root_.scala.Predef.String = "",
value: _root_.scala.Double = 0.0,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ScoresEntry] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
{
val __value = key
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
}
};
{
val __value = value
if (__value != 0.0) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeDoubleSize(2, __value)
}
};
__size += unknownFields.serializedSize
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
__size - 1
}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
{
val __v = key
if (!__v.isEmpty) {
_output__.writeString(1, __v)
}
};
{
val __v = value
if (__v != 0.0) {
_output__.writeDouble(2, __v)
}
};
unknownFields.writeTo(_output__)
}
def withKey(__v: _root_.scala.Predef.String): ScoresEntry = copy(key = __v)
def withValue(__v: _root_.scala.Double): ScoresEntry = copy(value = __v)
def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 1 => {
val __t = key
if (__t != "") __t else null
}
case 2 => {
val __t = value
if (__t != 0.0) __t else null
}
}
}
def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
_root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
(__field.number: @_root_.scala.unchecked) match {
case 1 => _root_.scalapb.descriptors.PString(key)
case 2 => _root_.scalapb.descriptors.PDouble(value)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: autopilotrpc.SetScoresRequest.ScoresEntry.type = autopilotrpc.SetScoresRequest.ScoresEntry
// @@protoc_insertion_point(GeneratedMessage[autopilotrpc.SetScoresRequest.ScoresEntry])
}
object ScoresEntry extends scalapb.GeneratedMessageCompanion[autopilotrpc.SetScoresRequest.ScoresEntry] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[autopilotrpc.SetScoresRequest.ScoresEntry] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): autopilotrpc.SetScoresRequest.ScoresEntry = {
var __key: _root_.scala.Predef.String = ""
var __value: _root_.scala.Double = 0.0
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__key = _input__.readStringRequireUtf8()
case 17 =>
__value = _input__.readDouble()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
autopilotrpc.SetScoresRequest.ScoresEntry(
key = __key,
value = __value,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[autopilotrpc.SetScoresRequest.ScoresEntry] = _root_.scalapb.descriptors.Reads{
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
autopilotrpc.SetScoresRequest.ScoresEntry(
key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Double]).getOrElse(0.0)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = autopilotrpc.SetScoresRequest.javaDescriptor.getNestedTypes().get(0)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = autopilotrpc.SetScoresRequest.scalaDescriptor.nestedMessages(0)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = autopilotrpc.SetScoresRequest.ScoresEntry(
key = "",
value = 0.0
)
implicit class ScoresEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, autopilotrpc.SetScoresRequest.ScoresEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, autopilotrpc.SetScoresRequest.ScoresEntry](_l) {
def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_))
def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Double] = field(_.value)((c_, f_) => c_.copy(value = f_))
}
final val KEY_FIELD_NUMBER = 1
final val VALUE_FIELD_NUMBER = 2
@transient
implicit val keyValueMapper: _root_.scalapb.TypeMapper[autopilotrpc.SetScoresRequest.ScoresEntry, (_root_.scala.Predef.String, _root_.scala.Double)] =
_root_.scalapb.TypeMapper[autopilotrpc.SetScoresRequest.ScoresEntry, (_root_.scala.Predef.String, _root_.scala.Double)](__m => (__m.key, __m.value))(__p => autopilotrpc.SetScoresRequest.ScoresEntry(__p._1, __p._2))
def of(
key: _root_.scala.Predef.String,
value: _root_.scala.Double
): _root_.autopilotrpc.SetScoresRequest.ScoresEntry = _root_.autopilotrpc.SetScoresRequest.ScoresEntry(
key,
value
)
// @@protoc_insertion_point(GeneratedMessageCompanion[autopilotrpc.SetScoresRequest.ScoresEntry])
}
implicit class SetScoresRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, autopilotrpc.SetScoresRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, autopilotrpc.SetScoresRequest](_l) {
def heuristic: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.heuristic)((c_, f_) => c_.copy(heuristic = f_))
def scores: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Double]] = field(_.scores)((c_, f_) => c_.copy(scores = f_))
}
final val HEURISTIC_FIELD_NUMBER = 1
final val SCORES_FIELD_NUMBER = 2
@transient
private[autopilotrpc] val _typemapper_scores: _root_.scalapb.TypeMapper[autopilotrpc.SetScoresRequest.ScoresEntry, (_root_.scala.Predef.String, _root_.scala.Double)] = implicitly[_root_.scalapb.TypeMapper[autopilotrpc.SetScoresRequest.ScoresEntry, (_root_.scala.Predef.String, _root_.scala.Double)]]
def of(
heuristic: _root_.scala.Predef.String,
scores: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Double]
): _root_.autopilotrpc.SetScoresRequest = _root_.autopilotrpc.SetScoresRequest(
heuristic,
scores
)
// @@protoc_insertion_point(GeneratedMessageCompanion[autopilotrpc.SetScoresRequest])
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy