001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004// Code generated by protocol buffer compiler. Do not edit! 005package org.wpilib.math.proto; 006 007import java.io.IOException; 008import us.hebi.quickbuf.Descriptors; 009import us.hebi.quickbuf.FieldName; 010import us.hebi.quickbuf.InvalidProtocolBufferException; 011import us.hebi.quickbuf.JsonSink; 012import us.hebi.quickbuf.JsonSource; 013import us.hebi.quickbuf.MessageFactory; 014import us.hebi.quickbuf.ProtoMessage; 015import us.hebi.quickbuf.ProtoSink; 016import us.hebi.quickbuf.ProtoSource; 017import us.hebi.quickbuf.ProtoUtil; 018 019/** 020 * Protobuf type {@code ProtobufMecanumDriveWheelVelocities} 021 */ 022@SuppressWarnings("hiding") 023public final class ProtobufMecanumDriveWheelVelocities extends ProtoMessage<ProtobufMecanumDriveWheelVelocities> implements Cloneable { 024 private static final long serialVersionUID = 0L; 025 026 /** 027 * <code>optional double front_left = 1;</code> 028 */ 029 private double frontLeft; 030 031 /** 032 * <code>optional double front_right = 2;</code> 033 */ 034 private double frontRight; 035 036 /** 037 * <code>optional double rear_left = 3;</code> 038 */ 039 private double rearLeft; 040 041 /** 042 * <code>optional double rear_right = 4;</code> 043 */ 044 private double rearRight; 045 046 private ProtobufMecanumDriveWheelVelocities() { 047 } 048 049 /** 050 * @return a new empty instance of {@code ProtobufMecanumDriveWheelVelocities} 051 */ 052 public static ProtobufMecanumDriveWheelVelocities newInstance() { 053 return new ProtobufMecanumDriveWheelVelocities(); 054 } 055 056 /** 057 * <code>optional double front_left = 1;</code> 058 * @return whether the frontLeft field is set 059 */ 060 public boolean hasFrontLeft() { 061 return (bitField0_ & 0x00000001) != 0; 062 } 063 064 /** 065 * <code>optional double front_left = 1;</code> 066 * @return this 067 */ 068 public ProtobufMecanumDriveWheelVelocities clearFrontLeft() { 069 bitField0_ &= ~0x00000001; 070 frontLeft = 0D; 071 return this; 072 } 073 074 /** 075 * <code>optional double front_left = 1;</code> 076 * @return the frontLeft 077 */ 078 public double getFrontLeft() { 079 return frontLeft; 080 } 081 082 /** 083 * <code>optional double front_left = 1;</code> 084 * @param value the frontLeft to set 085 * @return this 086 */ 087 public ProtobufMecanumDriveWheelVelocities setFrontLeft(final double value) { 088 bitField0_ |= 0x00000001; 089 frontLeft = value; 090 return this; 091 } 092 093 /** 094 * <code>optional double front_right = 2;</code> 095 * @return whether the frontRight field is set 096 */ 097 public boolean hasFrontRight() { 098 return (bitField0_ & 0x00000002) != 0; 099 } 100 101 /** 102 * <code>optional double front_right = 2;</code> 103 * @return this 104 */ 105 public ProtobufMecanumDriveWheelVelocities clearFrontRight() { 106 bitField0_ &= ~0x00000002; 107 frontRight = 0D; 108 return this; 109 } 110 111 /** 112 * <code>optional double front_right = 2;</code> 113 * @return the frontRight 114 */ 115 public double getFrontRight() { 116 return frontRight; 117 } 118 119 /** 120 * <code>optional double front_right = 2;</code> 121 * @param value the frontRight to set 122 * @return this 123 */ 124 public ProtobufMecanumDriveWheelVelocities setFrontRight(final double value) { 125 bitField0_ |= 0x00000002; 126 frontRight = value; 127 return this; 128 } 129 130 /** 131 * <code>optional double rear_left = 3;</code> 132 * @return whether the rearLeft field is set 133 */ 134 public boolean hasRearLeft() { 135 return (bitField0_ & 0x00000004) != 0; 136 } 137 138 /** 139 * <code>optional double rear_left = 3;</code> 140 * @return this 141 */ 142 public ProtobufMecanumDriveWheelVelocities clearRearLeft() { 143 bitField0_ &= ~0x00000004; 144 rearLeft = 0D; 145 return this; 146 } 147 148 /** 149 * <code>optional double rear_left = 3;</code> 150 * @return the rearLeft 151 */ 152 public double getRearLeft() { 153 return rearLeft; 154 } 155 156 /** 157 * <code>optional double rear_left = 3;</code> 158 * @param value the rearLeft to set 159 * @return this 160 */ 161 public ProtobufMecanumDriveWheelVelocities setRearLeft(final double value) { 162 bitField0_ |= 0x00000004; 163 rearLeft = value; 164 return this; 165 } 166 167 /** 168 * <code>optional double rear_right = 4;</code> 169 * @return whether the rearRight field is set 170 */ 171 public boolean hasRearRight() { 172 return (bitField0_ & 0x00000008) != 0; 173 } 174 175 /** 176 * <code>optional double rear_right = 4;</code> 177 * @return this 178 */ 179 public ProtobufMecanumDriveWheelVelocities clearRearRight() { 180 bitField0_ &= ~0x00000008; 181 rearRight = 0D; 182 return this; 183 } 184 185 /** 186 * <code>optional double rear_right = 4;</code> 187 * @return the rearRight 188 */ 189 public double getRearRight() { 190 return rearRight; 191 } 192 193 /** 194 * <code>optional double rear_right = 4;</code> 195 * @param value the rearRight to set 196 * @return this 197 */ 198 public ProtobufMecanumDriveWheelVelocities setRearRight(final double value) { 199 bitField0_ |= 0x00000008; 200 rearRight = value; 201 return this; 202 } 203 204 @Override 205 public ProtobufMecanumDriveWheelVelocities copyFrom( 206 final ProtobufMecanumDriveWheelVelocities other) { 207 cachedSize = other.cachedSize; 208 if ((bitField0_ | other.bitField0_) != 0) { 209 bitField0_ = other.bitField0_; 210 frontLeft = other.frontLeft; 211 frontRight = other.frontRight; 212 rearLeft = other.rearLeft; 213 rearRight = other.rearRight; 214 } 215 return this; 216 } 217 218 @Override 219 public ProtobufMecanumDriveWheelVelocities mergeFrom( 220 final ProtobufMecanumDriveWheelVelocities other) { 221 if (other.isEmpty()) { 222 return this; 223 } 224 cachedSize = -1; 225 if (other.hasFrontLeft()) { 226 setFrontLeft(other.frontLeft); 227 } 228 if (other.hasFrontRight()) { 229 setFrontRight(other.frontRight); 230 } 231 if (other.hasRearLeft()) { 232 setRearLeft(other.rearLeft); 233 } 234 if (other.hasRearRight()) { 235 setRearRight(other.rearRight); 236 } 237 return this; 238 } 239 240 @Override 241 public ProtobufMecanumDriveWheelVelocities clear() { 242 if (isEmpty()) { 243 return this; 244 } 245 cachedSize = -1; 246 bitField0_ = 0; 247 frontLeft = 0D; 248 frontRight = 0D; 249 rearLeft = 0D; 250 rearRight = 0D; 251 return this; 252 } 253 254 @Override 255 public ProtobufMecanumDriveWheelVelocities clearQuick() { 256 if (isEmpty()) { 257 return this; 258 } 259 cachedSize = -1; 260 bitField0_ = 0; 261 return this; 262 } 263 264 @Override 265 public boolean equals(Object o) { 266 if (o == this) { 267 return true; 268 } 269 if (!(o instanceof ProtobufMecanumDriveWheelVelocities)) { 270 return false; 271 } 272 ProtobufMecanumDriveWheelVelocities other = (ProtobufMecanumDriveWheelVelocities) o; 273 return bitField0_ == other.bitField0_ 274 && (!hasFrontLeft() || ProtoUtil.isEqual(frontLeft, other.frontLeft)) 275 && (!hasFrontRight() || ProtoUtil.isEqual(frontRight, other.frontRight)) 276 && (!hasRearLeft() || ProtoUtil.isEqual(rearLeft, other.rearLeft)) 277 && (!hasRearRight() || ProtoUtil.isEqual(rearRight, other.rearRight)); 278 } 279 280 @Override 281 public void writeTo(final ProtoSink output) throws IOException { 282 if ((bitField0_ & 0x00000001) != 0) { 283 output.writeRawByte((byte) 9); 284 output.writeDoubleNoTag(frontLeft); 285 } 286 if ((bitField0_ & 0x00000002) != 0) { 287 output.writeRawByte((byte) 17); 288 output.writeDoubleNoTag(frontRight); 289 } 290 if ((bitField0_ & 0x00000004) != 0) { 291 output.writeRawByte((byte) 25); 292 output.writeDoubleNoTag(rearLeft); 293 } 294 if ((bitField0_ & 0x00000008) != 0) { 295 output.writeRawByte((byte) 33); 296 output.writeDoubleNoTag(rearRight); 297 } 298 } 299 300 @Override 301 protected int computeSerializedSize() { 302 int size = 0; 303 if ((bitField0_ & 0x00000001) != 0) { 304 size += 9; 305 } 306 if ((bitField0_ & 0x00000002) != 0) { 307 size += 9; 308 } 309 if ((bitField0_ & 0x00000004) != 0) { 310 size += 9; 311 } 312 if ((bitField0_ & 0x00000008) != 0) { 313 size += 9; 314 } 315 return size; 316 } 317 318 @Override 319 @SuppressWarnings("fallthrough") 320 public ProtobufMecanumDriveWheelVelocities mergeFrom(final ProtoSource input) throws IOException { 321 // Enabled Fall-Through Optimization (QuickBuffers) 322 int tag = input.readTag(); 323 while (true) { 324 switch (tag) { 325 case 9: { 326 // frontLeft 327 frontLeft = input.readDouble(); 328 bitField0_ |= 0x00000001; 329 tag = input.readTag(); 330 if (tag != 17) { 331 break; 332 } 333 } 334 case 17: { 335 // frontRight 336 frontRight = input.readDouble(); 337 bitField0_ |= 0x00000002; 338 tag = input.readTag(); 339 if (tag != 25) { 340 break; 341 } 342 } 343 case 25: { 344 // rearLeft 345 rearLeft = input.readDouble(); 346 bitField0_ |= 0x00000004; 347 tag = input.readTag(); 348 if (tag != 33) { 349 break; 350 } 351 } 352 case 33: { 353 // rearRight 354 rearRight = input.readDouble(); 355 bitField0_ |= 0x00000008; 356 tag = input.readTag(); 357 if (tag != 0) { 358 break; 359 } 360 } 361 case 0: { 362 return this; 363 } 364 default: { 365 if (!input.skipField(tag)) { 366 return this; 367 } 368 tag = input.readTag(); 369 break; 370 } 371 } 372 } 373 } 374 375 @Override 376 public void writeTo(final JsonSink output) throws IOException { 377 output.beginObject(); 378 if ((bitField0_ & 0x00000001) != 0) { 379 output.writeDouble(FieldNames.frontLeft, frontLeft); 380 } 381 if ((bitField0_ & 0x00000002) != 0) { 382 output.writeDouble(FieldNames.frontRight, frontRight); 383 } 384 if ((bitField0_ & 0x00000004) != 0) { 385 output.writeDouble(FieldNames.rearLeft, rearLeft); 386 } 387 if ((bitField0_ & 0x00000008) != 0) { 388 output.writeDouble(FieldNames.rearRight, rearRight); 389 } 390 output.endObject(); 391 } 392 393 @Override 394 public ProtobufMecanumDriveWheelVelocities mergeFrom(final JsonSource input) throws IOException { 395 if (!input.beginObject()) { 396 return this; 397 } 398 while (!input.isAtEnd()) { 399 switch (input.readFieldHash()) { 400 case 127514064: 401 case -324277155: { 402 if (input.isAtField(FieldNames.frontLeft)) { 403 if (!input.trySkipNullValue()) { 404 frontLeft = input.readDouble(); 405 bitField0_ |= 0x00000001; 406 } 407 } else { 408 input.skipUnknownField(); 409 } 410 break; 411 } 412 case -336370317: 413 case -1456996218: { 414 if (input.isAtField(FieldNames.frontRight)) { 415 if (!input.trySkipNullValue()) { 416 frontRight = input.readDouble(); 417 bitField0_ |= 0x00000002; 418 } 419 } else { 420 input.skipUnknownField(); 421 } 422 break; 423 } 424 case -854852661: 425 case -712874558: { 426 if (input.isAtField(FieldNames.rearLeft)) { 427 if (!input.trySkipNullValue()) { 428 rearLeft = input.readDouble(); 429 bitField0_ |= 0x00000004; 430 } 431 } else { 432 input.skipUnknownField(); 433 } 434 break; 435 } 436 case -724967720: 437 case -618613823: { 438 if (input.isAtField(FieldNames.rearRight)) { 439 if (!input.trySkipNullValue()) { 440 rearRight = input.readDouble(); 441 bitField0_ |= 0x00000008; 442 } 443 } else { 444 input.skipUnknownField(); 445 } 446 break; 447 } 448 default: { 449 input.skipUnknownField(); 450 break; 451 } 452 } 453 } 454 input.endObject(); 455 return this; 456 } 457 458 @Override 459 public ProtobufMecanumDriveWheelVelocities clone() { 460 return new ProtobufMecanumDriveWheelVelocities().copyFrom(this); 461 } 462 463 @Override 464 public boolean isEmpty() { 465 return ((bitField0_) == 0); 466 } 467 468 public static ProtobufMecanumDriveWheelVelocities parseFrom(final byte[] data) throws 469 InvalidProtocolBufferException { 470 return ProtoMessage.mergeFrom(new ProtobufMecanumDriveWheelVelocities(), data).checkInitialized(); 471 } 472 473 public static ProtobufMecanumDriveWheelVelocities parseFrom(final ProtoSource input) throws 474 IOException { 475 return ProtoMessage.mergeFrom(new ProtobufMecanumDriveWheelVelocities(), input).checkInitialized(); 476 } 477 478 public static ProtobufMecanumDriveWheelVelocities parseFrom(final JsonSource input) throws 479 IOException { 480 return ProtoMessage.mergeFrom(new ProtobufMecanumDriveWheelVelocities(), input).checkInitialized(); 481 } 482 483 /** 484 * @return factory for creating ProtobufMecanumDriveWheelVelocities messages 485 */ 486 public static MessageFactory<ProtobufMecanumDriveWheelVelocities> getFactory() { 487 return ProtobufMecanumDriveWheelVelocitiesFactory.INSTANCE; 488 } 489 490 /** 491 * @return this type's descriptor. 492 */ 493 public static Descriptors.Descriptor getDescriptor() { 494 return ProtobufKinematicsDescriptor.wpi_proto_ProtobufMecanumDriveWheelVelocities_descriptor; 495 } 496 497 private enum ProtobufMecanumDriveWheelVelocitiesFactory implements MessageFactory<ProtobufMecanumDriveWheelVelocities> { 498 INSTANCE; 499 500 @Override 501 public ProtobufMecanumDriveWheelVelocities create() { 502 return ProtobufMecanumDriveWheelVelocities.newInstance(); 503 } 504 } 505 506 /** 507 * Contains name constants used for serializing JSON 508 */ 509 static class FieldNames { 510 static final FieldName frontLeft = FieldName.forField("frontLeft", "front_left"); 511 512 static final FieldName frontRight = FieldName.forField("frontRight", "front_right"); 513 514 static final FieldName rearLeft = FieldName.forField("rearLeft", "rear_left"); 515 516 static final FieldName rearRight = FieldName.forField("rearRight", "rear_right"); 517 } 518}