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 ProtobufTwist3d} 021 */ 022@SuppressWarnings("hiding") 023public final class ProtobufTwist3d extends ProtoMessage<ProtobufTwist3d> implements Cloneable { 024 private static final long serialVersionUID = 0L; 025 026 /** 027 * <code>optional double dx = 1;</code> 028 */ 029 private double dx; 030 031 /** 032 * <code>optional double dy = 2;</code> 033 */ 034 private double dy; 035 036 /** 037 * <code>optional double dz = 3;</code> 038 */ 039 private double dz; 040 041 /** 042 * <code>optional double rx = 4;</code> 043 */ 044 private double rx; 045 046 /** 047 * <code>optional double ry = 5;</code> 048 */ 049 private double ry; 050 051 /** 052 * <code>optional double rz = 6;</code> 053 */ 054 private double rz; 055 056 private ProtobufTwist3d() { 057 } 058 059 /** 060 * @return a new empty instance of {@code ProtobufTwist3d} 061 */ 062 public static ProtobufTwist3d newInstance() { 063 return new ProtobufTwist3d(); 064 } 065 066 /** 067 * <code>optional double dx = 1;</code> 068 * @return whether the dx field is set 069 */ 070 public boolean hasDx() { 071 return (bitField0_ & 0x00000001) != 0; 072 } 073 074 /** 075 * <code>optional double dx = 1;</code> 076 * @return this 077 */ 078 public ProtobufTwist3d clearDx() { 079 bitField0_ &= ~0x00000001; 080 dx = 0D; 081 return this; 082 } 083 084 /** 085 * <code>optional double dx = 1;</code> 086 * @return the dx 087 */ 088 public double getDx() { 089 return dx; 090 } 091 092 /** 093 * <code>optional double dx = 1;</code> 094 * @param value the dx to set 095 * @return this 096 */ 097 public ProtobufTwist3d setDx(final double value) { 098 bitField0_ |= 0x00000001; 099 dx = value; 100 return this; 101 } 102 103 /** 104 * <code>optional double dy = 2;</code> 105 * @return whether the dy field is set 106 */ 107 public boolean hasDy() { 108 return (bitField0_ & 0x00000002) != 0; 109 } 110 111 /** 112 * <code>optional double dy = 2;</code> 113 * @return this 114 */ 115 public ProtobufTwist3d clearDy() { 116 bitField0_ &= ~0x00000002; 117 dy = 0D; 118 return this; 119 } 120 121 /** 122 * <code>optional double dy = 2;</code> 123 * @return the dy 124 */ 125 public double getDy() { 126 return dy; 127 } 128 129 /** 130 * <code>optional double dy = 2;</code> 131 * @param value the dy to set 132 * @return this 133 */ 134 public ProtobufTwist3d setDy(final double value) { 135 bitField0_ |= 0x00000002; 136 dy = value; 137 return this; 138 } 139 140 /** 141 * <code>optional double dz = 3;</code> 142 * @return whether the dz field is set 143 */ 144 public boolean hasDz() { 145 return (bitField0_ & 0x00000004) != 0; 146 } 147 148 /** 149 * <code>optional double dz = 3;</code> 150 * @return this 151 */ 152 public ProtobufTwist3d clearDz() { 153 bitField0_ &= ~0x00000004; 154 dz = 0D; 155 return this; 156 } 157 158 /** 159 * <code>optional double dz = 3;</code> 160 * @return the dz 161 */ 162 public double getDz() { 163 return dz; 164 } 165 166 /** 167 * <code>optional double dz = 3;</code> 168 * @param value the dz to set 169 * @return this 170 */ 171 public ProtobufTwist3d setDz(final double value) { 172 bitField0_ |= 0x00000004; 173 dz = value; 174 return this; 175 } 176 177 /** 178 * <code>optional double rx = 4;</code> 179 * @return whether the rx field is set 180 */ 181 public boolean hasRx() { 182 return (bitField0_ & 0x00000008) != 0; 183 } 184 185 /** 186 * <code>optional double rx = 4;</code> 187 * @return this 188 */ 189 public ProtobufTwist3d clearRx() { 190 bitField0_ &= ~0x00000008; 191 rx = 0D; 192 return this; 193 } 194 195 /** 196 * <code>optional double rx = 4;</code> 197 * @return the rx 198 */ 199 public double getRx() { 200 return rx; 201 } 202 203 /** 204 * <code>optional double rx = 4;</code> 205 * @param value the rx to set 206 * @return this 207 */ 208 public ProtobufTwist3d setRx(final double value) { 209 bitField0_ |= 0x00000008; 210 rx = value; 211 return this; 212 } 213 214 /** 215 * <code>optional double ry = 5;</code> 216 * @return whether the ry field is set 217 */ 218 public boolean hasRy() { 219 return (bitField0_ & 0x00000010) != 0; 220 } 221 222 /** 223 * <code>optional double ry = 5;</code> 224 * @return this 225 */ 226 public ProtobufTwist3d clearRy() { 227 bitField0_ &= ~0x00000010; 228 ry = 0D; 229 return this; 230 } 231 232 /** 233 * <code>optional double ry = 5;</code> 234 * @return the ry 235 */ 236 public double getRy() { 237 return ry; 238 } 239 240 /** 241 * <code>optional double ry = 5;</code> 242 * @param value the ry to set 243 * @return this 244 */ 245 public ProtobufTwist3d setRy(final double value) { 246 bitField0_ |= 0x00000010; 247 ry = value; 248 return this; 249 } 250 251 /** 252 * <code>optional double rz = 6;</code> 253 * @return whether the rz field is set 254 */ 255 public boolean hasRz() { 256 return (bitField0_ & 0x00000020) != 0; 257 } 258 259 /** 260 * <code>optional double rz = 6;</code> 261 * @return this 262 */ 263 public ProtobufTwist3d clearRz() { 264 bitField0_ &= ~0x00000020; 265 rz = 0D; 266 return this; 267 } 268 269 /** 270 * <code>optional double rz = 6;</code> 271 * @return the rz 272 */ 273 public double getRz() { 274 return rz; 275 } 276 277 /** 278 * <code>optional double rz = 6;</code> 279 * @param value the rz to set 280 * @return this 281 */ 282 public ProtobufTwist3d setRz(final double value) { 283 bitField0_ |= 0x00000020; 284 rz = value; 285 return this; 286 } 287 288 @Override 289 public ProtobufTwist3d copyFrom(final ProtobufTwist3d other) { 290 cachedSize = other.cachedSize; 291 if ((bitField0_ | other.bitField0_) != 0) { 292 bitField0_ = other.bitField0_; 293 dx = other.dx; 294 dy = other.dy; 295 dz = other.dz; 296 rx = other.rx; 297 ry = other.ry; 298 rz = other.rz; 299 } 300 return this; 301 } 302 303 @Override 304 public ProtobufTwist3d mergeFrom(final ProtobufTwist3d other) { 305 if (other.isEmpty()) { 306 return this; 307 } 308 cachedSize = -1; 309 if (other.hasDx()) { 310 setDx(other.dx); 311 } 312 if (other.hasDy()) { 313 setDy(other.dy); 314 } 315 if (other.hasDz()) { 316 setDz(other.dz); 317 } 318 if (other.hasRx()) { 319 setRx(other.rx); 320 } 321 if (other.hasRy()) { 322 setRy(other.ry); 323 } 324 if (other.hasRz()) { 325 setRz(other.rz); 326 } 327 return this; 328 } 329 330 @Override 331 public ProtobufTwist3d clear() { 332 if (isEmpty()) { 333 return this; 334 } 335 cachedSize = -1; 336 bitField0_ = 0; 337 dx = 0D; 338 dy = 0D; 339 dz = 0D; 340 rx = 0D; 341 ry = 0D; 342 rz = 0D; 343 return this; 344 } 345 346 @Override 347 public ProtobufTwist3d clearQuick() { 348 if (isEmpty()) { 349 return this; 350 } 351 cachedSize = -1; 352 bitField0_ = 0; 353 return this; 354 } 355 356 @Override 357 public boolean equals(Object o) { 358 if (o == this) { 359 return true; 360 } 361 if (!(o instanceof ProtobufTwist3d)) { 362 return false; 363 } 364 ProtobufTwist3d other = (ProtobufTwist3d) o; 365 return bitField0_ == other.bitField0_ 366 && (!hasDx() || ProtoUtil.isEqual(dx, other.dx)) 367 && (!hasDy() || ProtoUtil.isEqual(dy, other.dy)) 368 && (!hasDz() || ProtoUtil.isEqual(dz, other.dz)) 369 && (!hasRx() || ProtoUtil.isEqual(rx, other.rx)) 370 && (!hasRy() || ProtoUtil.isEqual(ry, other.ry)) 371 && (!hasRz() || ProtoUtil.isEqual(rz, other.rz)); 372 } 373 374 @Override 375 public void writeTo(final ProtoSink output) throws IOException { 376 if ((bitField0_ & 0x00000001) != 0) { 377 output.writeRawByte((byte) 9); 378 output.writeDoubleNoTag(dx); 379 } 380 if ((bitField0_ & 0x00000002) != 0) { 381 output.writeRawByte((byte) 17); 382 output.writeDoubleNoTag(dy); 383 } 384 if ((bitField0_ & 0x00000004) != 0) { 385 output.writeRawByte((byte) 25); 386 output.writeDoubleNoTag(dz); 387 } 388 if ((bitField0_ & 0x00000008) != 0) { 389 output.writeRawByte((byte) 33); 390 output.writeDoubleNoTag(rx); 391 } 392 if ((bitField0_ & 0x00000010) != 0) { 393 output.writeRawByte((byte) 41); 394 output.writeDoubleNoTag(ry); 395 } 396 if ((bitField0_ & 0x00000020) != 0) { 397 output.writeRawByte((byte) 49); 398 output.writeDoubleNoTag(rz); 399 } 400 } 401 402 @Override 403 protected int computeSerializedSize() { 404 int size = 0; 405 if ((bitField0_ & 0x00000001) != 0) { 406 size += 9; 407 } 408 if ((bitField0_ & 0x00000002) != 0) { 409 size += 9; 410 } 411 if ((bitField0_ & 0x00000004) != 0) { 412 size += 9; 413 } 414 if ((bitField0_ & 0x00000008) != 0) { 415 size += 9; 416 } 417 if ((bitField0_ & 0x00000010) != 0) { 418 size += 9; 419 } 420 if ((bitField0_ & 0x00000020) != 0) { 421 size += 9; 422 } 423 return size; 424 } 425 426 @Override 427 @SuppressWarnings("fallthrough") 428 public ProtobufTwist3d mergeFrom(final ProtoSource input) throws IOException { 429 // Enabled Fall-Through Optimization (QuickBuffers) 430 int tag = input.readTag(); 431 while (true) { 432 switch (tag) { 433 case 9: { 434 // dx 435 dx = input.readDouble(); 436 bitField0_ |= 0x00000001; 437 tag = input.readTag(); 438 if (tag != 17) { 439 break; 440 } 441 } 442 case 17: { 443 // dy 444 dy = input.readDouble(); 445 bitField0_ |= 0x00000002; 446 tag = input.readTag(); 447 if (tag != 25) { 448 break; 449 } 450 } 451 case 25: { 452 // dz 453 dz = input.readDouble(); 454 bitField0_ |= 0x00000004; 455 tag = input.readTag(); 456 if (tag != 33) { 457 break; 458 } 459 } 460 case 33: { 461 // rx 462 rx = input.readDouble(); 463 bitField0_ |= 0x00000008; 464 tag = input.readTag(); 465 if (tag != 41) { 466 break; 467 } 468 } 469 case 41: { 470 // ry 471 ry = input.readDouble(); 472 bitField0_ |= 0x00000010; 473 tag = input.readTag(); 474 if (tag != 49) { 475 break; 476 } 477 } 478 case 49: { 479 // rz 480 rz = input.readDouble(); 481 bitField0_ |= 0x00000020; 482 tag = input.readTag(); 483 if (tag != 0) { 484 break; 485 } 486 } 487 case 0: { 488 return this; 489 } 490 default: { 491 if (!input.skipField(tag)) { 492 return this; 493 } 494 tag = input.readTag(); 495 break; 496 } 497 } 498 } 499 } 500 501 @Override 502 public void writeTo(final JsonSink output) throws IOException { 503 output.beginObject(); 504 if ((bitField0_ & 0x00000001) != 0) { 505 output.writeDouble(FieldNames.dx, dx); 506 } 507 if ((bitField0_ & 0x00000002) != 0) { 508 output.writeDouble(FieldNames.dy, dy); 509 } 510 if ((bitField0_ & 0x00000004) != 0) { 511 output.writeDouble(FieldNames.dz, dz); 512 } 513 if ((bitField0_ & 0x00000008) != 0) { 514 output.writeDouble(FieldNames.rx, rx); 515 } 516 if ((bitField0_ & 0x00000010) != 0) { 517 output.writeDouble(FieldNames.ry, ry); 518 } 519 if ((bitField0_ & 0x00000020) != 0) { 520 output.writeDouble(FieldNames.rz, rz); 521 } 522 output.endObject(); 523 } 524 525 @Override 526 public ProtobufTwist3d mergeFrom(final JsonSource input) throws IOException { 527 if (!input.beginObject()) { 528 return this; 529 } 530 while (!input.isAtEnd()) { 531 switch (input.readFieldHash()) { 532 case 3220: { 533 if (input.isAtField(FieldNames.dx)) { 534 if (!input.trySkipNullValue()) { 535 dx = input.readDouble(); 536 bitField0_ |= 0x00000001; 537 } 538 } else { 539 input.skipUnknownField(); 540 } 541 break; 542 } 543 case 3221: { 544 if (input.isAtField(FieldNames.dy)) { 545 if (!input.trySkipNullValue()) { 546 dy = input.readDouble(); 547 bitField0_ |= 0x00000002; 548 } 549 } else { 550 input.skipUnknownField(); 551 } 552 break; 553 } 554 case 3222: { 555 if (input.isAtField(FieldNames.dz)) { 556 if (!input.trySkipNullValue()) { 557 dz = input.readDouble(); 558 bitField0_ |= 0x00000004; 559 } 560 } else { 561 input.skipUnknownField(); 562 } 563 break; 564 } 565 case 3654: { 566 if (input.isAtField(FieldNames.rx)) { 567 if (!input.trySkipNullValue()) { 568 rx = input.readDouble(); 569 bitField0_ |= 0x00000008; 570 } 571 } else { 572 input.skipUnknownField(); 573 } 574 break; 575 } 576 case 3655: { 577 if (input.isAtField(FieldNames.ry)) { 578 if (!input.trySkipNullValue()) { 579 ry = input.readDouble(); 580 bitField0_ |= 0x00000010; 581 } 582 } else { 583 input.skipUnknownField(); 584 } 585 break; 586 } 587 case 3656: { 588 if (input.isAtField(FieldNames.rz)) { 589 if (!input.trySkipNullValue()) { 590 rz = input.readDouble(); 591 bitField0_ |= 0x00000020; 592 } 593 } else { 594 input.skipUnknownField(); 595 } 596 break; 597 } 598 default: { 599 input.skipUnknownField(); 600 break; 601 } 602 } 603 } 604 input.endObject(); 605 return this; 606 } 607 608 @Override 609 public ProtobufTwist3d clone() { 610 return new ProtobufTwist3d().copyFrom(this); 611 } 612 613 @Override 614 public boolean isEmpty() { 615 return ((bitField0_) == 0); 616 } 617 618 public static ProtobufTwist3d parseFrom(final byte[] data) throws InvalidProtocolBufferException { 619 return ProtoMessage.mergeFrom(new ProtobufTwist3d(), data).checkInitialized(); 620 } 621 622 public static ProtobufTwist3d parseFrom(final ProtoSource input) throws IOException { 623 return ProtoMessage.mergeFrom(new ProtobufTwist3d(), input).checkInitialized(); 624 } 625 626 public static ProtobufTwist3d parseFrom(final JsonSource input) throws IOException { 627 return ProtoMessage.mergeFrom(new ProtobufTwist3d(), input).checkInitialized(); 628 } 629 630 /** 631 * @return factory for creating ProtobufTwist3d messages 632 */ 633 public static MessageFactory<ProtobufTwist3d> getFactory() { 634 return ProtobufTwist3dFactory.INSTANCE; 635 } 636 637 /** 638 * @return this type's descriptor. 639 */ 640 public static Descriptors.Descriptor getDescriptor() { 641 return ProtobufGeometry3dDescriptor.wpi_proto_ProtobufTwist3d_descriptor; 642 } 643 644 private enum ProtobufTwist3dFactory implements MessageFactory<ProtobufTwist3d> { 645 INSTANCE; 646 647 @Override 648 public ProtobufTwist3d create() { 649 return ProtobufTwist3d.newInstance(); 650 } 651 } 652 653 /** 654 * Contains name constants used for serializing JSON 655 */ 656 static class FieldNames { 657 static final FieldName dx = FieldName.forField("dx"); 658 659 static final FieldName dy = FieldName.forField("dy"); 660 661 static final FieldName dz = FieldName.forField("dz"); 662 663 static final FieldName rx = FieldName.forField("rx"); 664 665 static final FieldName ry = FieldName.forField("ry"); 666 667 static final FieldName rz = FieldName.forField("rz"); 668 } 669}