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; 017 018/** 019 * Protobuf type {@code ProtobufMecanumDriveKinematics} 020 */ 021@SuppressWarnings("hiding") 022public final class ProtobufMecanumDriveKinematics extends ProtoMessage<ProtobufMecanumDriveKinematics> implements Cloneable { 023 private static final long serialVersionUID = 0L; 024 025 /** 026 * <code>optional .wpi.proto.ProtobufTranslation2d front_left = 1;</code> 027 */ 028 private final ProtobufTranslation2d frontLeft = ProtobufTranslation2d.newInstance(); 029 030 /** 031 * <code>optional .wpi.proto.ProtobufTranslation2d front_right = 2;</code> 032 */ 033 private final ProtobufTranslation2d frontRight = ProtobufTranslation2d.newInstance(); 034 035 /** 036 * <code>optional .wpi.proto.ProtobufTranslation2d rear_left = 3;</code> 037 */ 038 private final ProtobufTranslation2d rearLeft = ProtobufTranslation2d.newInstance(); 039 040 /** 041 * <code>optional .wpi.proto.ProtobufTranslation2d rear_right = 4;</code> 042 */ 043 private final ProtobufTranslation2d rearRight = ProtobufTranslation2d.newInstance(); 044 045 private ProtobufMecanumDriveKinematics() { 046 } 047 048 /** 049 * @return a new empty instance of {@code ProtobufMecanumDriveKinematics} 050 */ 051 public static ProtobufMecanumDriveKinematics newInstance() { 052 return new ProtobufMecanumDriveKinematics(); 053 } 054 055 /** 056 * <code>optional .wpi.proto.ProtobufTranslation2d front_left = 1;</code> 057 * @return whether the frontLeft field is set 058 */ 059 public boolean hasFrontLeft() { 060 return (bitField0_ & 0x00000001) != 0; 061 } 062 063 /** 064 * <code>optional .wpi.proto.ProtobufTranslation2d front_left = 1;</code> 065 * @return this 066 */ 067 public ProtobufMecanumDriveKinematics clearFrontLeft() { 068 bitField0_ &= ~0x00000001; 069 frontLeft.clear(); 070 return this; 071 } 072 073 /** 074 * <code>optional .wpi.proto.ProtobufTranslation2d front_left = 1;</code> 075 * 076 * This method returns the internal storage object without modifying any has state. 077 * The returned object should not be modified and be treated as read-only. 078 * 079 * Use {@link #getMutableFrontLeft()} if you want to modify it. 080 * 081 * @return internal storage object for reading 082 */ 083 public ProtobufTranslation2d getFrontLeft() { 084 return frontLeft; 085 } 086 087 /** 088 * <code>optional .wpi.proto.ProtobufTranslation2d front_left = 1;</code> 089 * 090 * This method returns the internal storage object and sets the corresponding 091 * has state. The returned object will become part of this message and its 092 * contents may be modified as long as the has state is not cleared. 093 * 094 * @return internal storage object for modifications 095 */ 096 public ProtobufTranslation2d getMutableFrontLeft() { 097 bitField0_ |= 0x00000001; 098 return frontLeft; 099 } 100 101 /** 102 * <code>optional .wpi.proto.ProtobufTranslation2d front_left = 1;</code> 103 * @param value the frontLeft to set 104 * @return this 105 */ 106 public ProtobufMecanumDriveKinematics setFrontLeft(final ProtobufTranslation2d value) { 107 bitField0_ |= 0x00000001; 108 frontLeft.copyFrom(value); 109 return this; 110 } 111 112 /** 113 * <code>optional .wpi.proto.ProtobufTranslation2d front_right = 2;</code> 114 * @return whether the frontRight field is set 115 */ 116 public boolean hasFrontRight() { 117 return (bitField0_ & 0x00000002) != 0; 118 } 119 120 /** 121 * <code>optional .wpi.proto.ProtobufTranslation2d front_right = 2;</code> 122 * @return this 123 */ 124 public ProtobufMecanumDriveKinematics clearFrontRight() { 125 bitField0_ &= ~0x00000002; 126 frontRight.clear(); 127 return this; 128 } 129 130 /** 131 * <code>optional .wpi.proto.ProtobufTranslation2d front_right = 2;</code> 132 * 133 * This method returns the internal storage object without modifying any has state. 134 * The returned object should not be modified and be treated as read-only. 135 * 136 * Use {@link #getMutableFrontRight()} if you want to modify it. 137 * 138 * @return internal storage object for reading 139 */ 140 public ProtobufTranslation2d getFrontRight() { 141 return frontRight; 142 } 143 144 /** 145 * <code>optional .wpi.proto.ProtobufTranslation2d front_right = 2;</code> 146 * 147 * This method returns the internal storage object and sets the corresponding 148 * has state. The returned object will become part of this message and its 149 * contents may be modified as long as the has state is not cleared. 150 * 151 * @return internal storage object for modifications 152 */ 153 public ProtobufTranslation2d getMutableFrontRight() { 154 bitField0_ |= 0x00000002; 155 return frontRight; 156 } 157 158 /** 159 * <code>optional .wpi.proto.ProtobufTranslation2d front_right = 2;</code> 160 * @param value the frontRight to set 161 * @return this 162 */ 163 public ProtobufMecanumDriveKinematics setFrontRight(final ProtobufTranslation2d value) { 164 bitField0_ |= 0x00000002; 165 frontRight.copyFrom(value); 166 return this; 167 } 168 169 /** 170 * <code>optional .wpi.proto.ProtobufTranslation2d rear_left = 3;</code> 171 * @return whether the rearLeft field is set 172 */ 173 public boolean hasRearLeft() { 174 return (bitField0_ & 0x00000004) != 0; 175 } 176 177 /** 178 * <code>optional .wpi.proto.ProtobufTranslation2d rear_left = 3;</code> 179 * @return this 180 */ 181 public ProtobufMecanumDriveKinematics clearRearLeft() { 182 bitField0_ &= ~0x00000004; 183 rearLeft.clear(); 184 return this; 185 } 186 187 /** 188 * <code>optional .wpi.proto.ProtobufTranslation2d rear_left = 3;</code> 189 * 190 * This method returns the internal storage object without modifying any has state. 191 * The returned object should not be modified and be treated as read-only. 192 * 193 * Use {@link #getMutableRearLeft()} if you want to modify it. 194 * 195 * @return internal storage object for reading 196 */ 197 public ProtobufTranslation2d getRearLeft() { 198 return rearLeft; 199 } 200 201 /** 202 * <code>optional .wpi.proto.ProtobufTranslation2d rear_left = 3;</code> 203 * 204 * This method returns the internal storage object and sets the corresponding 205 * has state. The returned object will become part of this message and its 206 * contents may be modified as long as the has state is not cleared. 207 * 208 * @return internal storage object for modifications 209 */ 210 public ProtobufTranslation2d getMutableRearLeft() { 211 bitField0_ |= 0x00000004; 212 return rearLeft; 213 } 214 215 /** 216 * <code>optional .wpi.proto.ProtobufTranslation2d rear_left = 3;</code> 217 * @param value the rearLeft to set 218 * @return this 219 */ 220 public ProtobufMecanumDriveKinematics setRearLeft(final ProtobufTranslation2d value) { 221 bitField0_ |= 0x00000004; 222 rearLeft.copyFrom(value); 223 return this; 224 } 225 226 /** 227 * <code>optional .wpi.proto.ProtobufTranslation2d rear_right = 4;</code> 228 * @return whether the rearRight field is set 229 */ 230 public boolean hasRearRight() { 231 return (bitField0_ & 0x00000008) != 0; 232 } 233 234 /** 235 * <code>optional .wpi.proto.ProtobufTranslation2d rear_right = 4;</code> 236 * @return this 237 */ 238 public ProtobufMecanumDriveKinematics clearRearRight() { 239 bitField0_ &= ~0x00000008; 240 rearRight.clear(); 241 return this; 242 } 243 244 /** 245 * <code>optional .wpi.proto.ProtobufTranslation2d rear_right = 4;</code> 246 * 247 * This method returns the internal storage object without modifying any has state. 248 * The returned object should not be modified and be treated as read-only. 249 * 250 * Use {@link #getMutableRearRight()} if you want to modify it. 251 * 252 * @return internal storage object for reading 253 */ 254 public ProtobufTranslation2d getRearRight() { 255 return rearRight; 256 } 257 258 /** 259 * <code>optional .wpi.proto.ProtobufTranslation2d rear_right = 4;</code> 260 * 261 * This method returns the internal storage object and sets the corresponding 262 * has state. The returned object will become part of this message and its 263 * contents may be modified as long as the has state is not cleared. 264 * 265 * @return internal storage object for modifications 266 */ 267 public ProtobufTranslation2d getMutableRearRight() { 268 bitField0_ |= 0x00000008; 269 return rearRight; 270 } 271 272 /** 273 * <code>optional .wpi.proto.ProtobufTranslation2d rear_right = 4;</code> 274 * @param value the rearRight to set 275 * @return this 276 */ 277 public ProtobufMecanumDriveKinematics setRearRight(final ProtobufTranslation2d value) { 278 bitField0_ |= 0x00000008; 279 rearRight.copyFrom(value); 280 return this; 281 } 282 283 @Override 284 public ProtobufMecanumDriveKinematics copyFrom(final ProtobufMecanumDriveKinematics other) { 285 cachedSize = other.cachedSize; 286 if ((bitField0_ | other.bitField0_) != 0) { 287 bitField0_ = other.bitField0_; 288 frontLeft.copyFrom(other.frontLeft); 289 frontRight.copyFrom(other.frontRight); 290 rearLeft.copyFrom(other.rearLeft); 291 rearRight.copyFrom(other.rearRight); 292 } 293 return this; 294 } 295 296 @Override 297 public ProtobufMecanumDriveKinematics mergeFrom(final ProtobufMecanumDriveKinematics other) { 298 if (other.isEmpty()) { 299 return this; 300 } 301 cachedSize = -1; 302 if (other.hasFrontLeft()) { 303 getMutableFrontLeft().mergeFrom(other.frontLeft); 304 } 305 if (other.hasFrontRight()) { 306 getMutableFrontRight().mergeFrom(other.frontRight); 307 } 308 if (other.hasRearLeft()) { 309 getMutableRearLeft().mergeFrom(other.rearLeft); 310 } 311 if (other.hasRearRight()) { 312 getMutableRearRight().mergeFrom(other.rearRight); 313 } 314 return this; 315 } 316 317 @Override 318 public ProtobufMecanumDriveKinematics clear() { 319 if (isEmpty()) { 320 return this; 321 } 322 cachedSize = -1; 323 bitField0_ = 0; 324 frontLeft.clear(); 325 frontRight.clear(); 326 rearLeft.clear(); 327 rearRight.clear(); 328 return this; 329 } 330 331 @Override 332 public ProtobufMecanumDriveKinematics clearQuick() { 333 if (isEmpty()) { 334 return this; 335 } 336 cachedSize = -1; 337 bitField0_ = 0; 338 frontLeft.clearQuick(); 339 frontRight.clearQuick(); 340 rearLeft.clearQuick(); 341 rearRight.clearQuick(); 342 return this; 343 } 344 345 @Override 346 public boolean equals(Object o) { 347 if (o == this) { 348 return true; 349 } 350 if (!(o instanceof ProtobufMecanumDriveKinematics)) { 351 return false; 352 } 353 ProtobufMecanumDriveKinematics other = (ProtobufMecanumDriveKinematics) o; 354 return bitField0_ == other.bitField0_ 355 && (!hasFrontLeft() || frontLeft.equals(other.frontLeft)) 356 && (!hasFrontRight() || frontRight.equals(other.frontRight)) 357 && (!hasRearLeft() || rearLeft.equals(other.rearLeft)) 358 && (!hasRearRight() || rearRight.equals(other.rearRight)); 359 } 360 361 @Override 362 public void writeTo(final ProtoSink output) throws IOException { 363 if ((bitField0_ & 0x00000001) != 0) { 364 output.writeRawByte((byte) 10); 365 output.writeMessageNoTag(frontLeft); 366 } 367 if ((bitField0_ & 0x00000002) != 0) { 368 output.writeRawByte((byte) 18); 369 output.writeMessageNoTag(frontRight); 370 } 371 if ((bitField0_ & 0x00000004) != 0) { 372 output.writeRawByte((byte) 26); 373 output.writeMessageNoTag(rearLeft); 374 } 375 if ((bitField0_ & 0x00000008) != 0) { 376 output.writeRawByte((byte) 34); 377 output.writeMessageNoTag(rearRight); 378 } 379 } 380 381 @Override 382 protected int computeSerializedSize() { 383 int size = 0; 384 if ((bitField0_ & 0x00000001) != 0) { 385 size += 1 + ProtoSink.computeMessageSizeNoTag(frontLeft); 386 } 387 if ((bitField0_ & 0x00000002) != 0) { 388 size += 1 + ProtoSink.computeMessageSizeNoTag(frontRight); 389 } 390 if ((bitField0_ & 0x00000004) != 0) { 391 size += 1 + ProtoSink.computeMessageSizeNoTag(rearLeft); 392 } 393 if ((bitField0_ & 0x00000008) != 0) { 394 size += 1 + ProtoSink.computeMessageSizeNoTag(rearRight); 395 } 396 return size; 397 } 398 399 @Override 400 @SuppressWarnings("fallthrough") 401 public ProtobufMecanumDriveKinematics mergeFrom(final ProtoSource input) throws IOException { 402 // Enabled Fall-Through Optimization (QuickBuffers) 403 int tag = input.readTag(); 404 while (true) { 405 switch (tag) { 406 case 10: { 407 // frontLeft 408 input.readMessage(frontLeft); 409 bitField0_ |= 0x00000001; 410 tag = input.readTag(); 411 if (tag != 18) { 412 break; 413 } 414 } 415 case 18: { 416 // frontRight 417 input.readMessage(frontRight); 418 bitField0_ |= 0x00000002; 419 tag = input.readTag(); 420 if (tag != 26) { 421 break; 422 } 423 } 424 case 26: { 425 // rearLeft 426 input.readMessage(rearLeft); 427 bitField0_ |= 0x00000004; 428 tag = input.readTag(); 429 if (tag != 34) { 430 break; 431 } 432 } 433 case 34: { 434 // rearRight 435 input.readMessage(rearRight); 436 bitField0_ |= 0x00000008; 437 tag = input.readTag(); 438 if (tag != 0) { 439 break; 440 } 441 } 442 case 0: { 443 return this; 444 } 445 default: { 446 if (!input.skipField(tag)) { 447 return this; 448 } 449 tag = input.readTag(); 450 break; 451 } 452 } 453 } 454 } 455 456 @Override 457 public void writeTo(final JsonSink output) throws IOException { 458 output.beginObject(); 459 if ((bitField0_ & 0x00000001) != 0) { 460 output.writeMessage(FieldNames.frontLeft, frontLeft); 461 } 462 if ((bitField0_ & 0x00000002) != 0) { 463 output.writeMessage(FieldNames.frontRight, frontRight); 464 } 465 if ((bitField0_ & 0x00000004) != 0) { 466 output.writeMessage(FieldNames.rearLeft, rearLeft); 467 } 468 if ((bitField0_ & 0x00000008) != 0) { 469 output.writeMessage(FieldNames.rearRight, rearRight); 470 } 471 output.endObject(); 472 } 473 474 @Override 475 public ProtobufMecanumDriveKinematics mergeFrom(final JsonSource input) throws IOException { 476 if (!input.beginObject()) { 477 return this; 478 } 479 while (!input.isAtEnd()) { 480 switch (input.readFieldHash()) { 481 case 127514064: 482 case -324277155: { 483 if (input.isAtField(FieldNames.frontLeft)) { 484 if (!input.trySkipNullValue()) { 485 input.readMessage(frontLeft); 486 bitField0_ |= 0x00000001; 487 } 488 } else { 489 input.skipUnknownField(); 490 } 491 break; 492 } 493 case -336370317: 494 case -1456996218: { 495 if (input.isAtField(FieldNames.frontRight)) { 496 if (!input.trySkipNullValue()) { 497 input.readMessage(frontRight); 498 bitField0_ |= 0x00000002; 499 } 500 } else { 501 input.skipUnknownField(); 502 } 503 break; 504 } 505 case -854852661: 506 case -712874558: { 507 if (input.isAtField(FieldNames.rearLeft)) { 508 if (!input.trySkipNullValue()) { 509 input.readMessage(rearLeft); 510 bitField0_ |= 0x00000004; 511 } 512 } else { 513 input.skipUnknownField(); 514 } 515 break; 516 } 517 case -724967720: 518 case -618613823: { 519 if (input.isAtField(FieldNames.rearRight)) { 520 if (!input.trySkipNullValue()) { 521 input.readMessage(rearRight); 522 bitField0_ |= 0x00000008; 523 } 524 } else { 525 input.skipUnknownField(); 526 } 527 break; 528 } 529 default: { 530 input.skipUnknownField(); 531 break; 532 } 533 } 534 } 535 input.endObject(); 536 return this; 537 } 538 539 @Override 540 public ProtobufMecanumDriveKinematics clone() { 541 return new ProtobufMecanumDriveKinematics().copyFrom(this); 542 } 543 544 @Override 545 public boolean isEmpty() { 546 return ((bitField0_) == 0); 547 } 548 549 public static ProtobufMecanumDriveKinematics parseFrom(final byte[] data) throws 550 InvalidProtocolBufferException { 551 return ProtoMessage.mergeFrom(new ProtobufMecanumDriveKinematics(), data).checkInitialized(); 552 } 553 554 public static ProtobufMecanumDriveKinematics parseFrom(final ProtoSource input) throws 555 IOException { 556 return ProtoMessage.mergeFrom(new ProtobufMecanumDriveKinematics(), input).checkInitialized(); 557 } 558 559 public static ProtobufMecanumDriveKinematics parseFrom(final JsonSource input) throws 560 IOException { 561 return ProtoMessage.mergeFrom(new ProtobufMecanumDriveKinematics(), input).checkInitialized(); 562 } 563 564 /** 565 * @return factory for creating ProtobufMecanumDriveKinematics messages 566 */ 567 public static MessageFactory<ProtobufMecanumDriveKinematics> getFactory() { 568 return ProtobufMecanumDriveKinematicsFactory.INSTANCE; 569 } 570 571 /** 572 * @return this type's descriptor. 573 */ 574 public static Descriptors.Descriptor getDescriptor() { 575 return ProtobufKinematicsDescriptor.wpi_proto_ProtobufMecanumDriveKinematics_descriptor; 576 } 577 578 private enum ProtobufMecanumDriveKinematicsFactory implements MessageFactory<ProtobufMecanumDriveKinematics> { 579 INSTANCE; 580 581 @Override 582 public ProtobufMecanumDriveKinematics create() { 583 return ProtobufMecanumDriveKinematics.newInstance(); 584 } 585 } 586 587 /** 588 * Contains name constants used for serializing JSON 589 */ 590 static class FieldNames { 591 static final FieldName frontLeft = FieldName.forField("frontLeft", "front_left"); 592 593 static final FieldName frontRight = FieldName.forField("frontRight", "front_right"); 594 595 static final FieldName rearLeft = FieldName.forField("rearLeft", "rear_left"); 596 597 static final FieldName rearRight = FieldName.forField("rearRight", "rear_right"); 598 } 599}