RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
ProtobufQuaternion.java
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4// Code generated by protocol buffer compiler. Do not edit!
5package org.wpilib.math.geometry.proto.detail;
6
7import java.io.IOException;
8import us.hebi.quickbuf.Descriptors;
9import us.hebi.quickbuf.FieldName;
10import us.hebi.quickbuf.InvalidProtocolBufferException;
11import us.hebi.quickbuf.JsonSink;
12import us.hebi.quickbuf.JsonSource;
13import us.hebi.quickbuf.MessageFactory;
14import us.hebi.quickbuf.ProtoMessage;
15import us.hebi.quickbuf.ProtoSink;
16import us.hebi.quickbuf.ProtoSource;
17import us.hebi.quickbuf.ProtoUtil;
18
22@SuppressWarnings("hiding")
23public final class ProtobufQuaternion extends ProtoMessage<ProtobufQuaternion> implements Cloneable {
24 private static final long serialVersionUID = 0L;
25
29 private double w;
30
34 private double x;
35
39 private double y;
40
44 private double z;
45
46 private ProtobufQuaternion() {
47 }
48
52 public static ProtobufQuaternion newInstance() {
53 return new ProtobufQuaternion();
54 }
55
60 public boolean hasW() {
61 return (bitField0_ & 0x00000001) != 0;
62 }
63
68 public ProtobufQuaternion clearW() {
69 bitField0_ &= ~0x00000001;
70 w = 0D;
71 return this;
72 }
73
78 public double getW() {
79 return w;
80 }
81
87 public ProtobufQuaternion setW(final double value) {
88 bitField0_ |= 0x00000001;
89 w = value;
90 return this;
91 }
92
97 public boolean hasX() {
98 return (bitField0_ & 0x00000002) != 0;
99 }
100
105 public ProtobufQuaternion clearX() {
106 bitField0_ &= ~0x00000002;
107 x = 0D;
108 return this;
109 }
110
115 public double getX() {
116 return x;
117 }
118
124 public ProtobufQuaternion setX(final double value) {
125 bitField0_ |= 0x00000002;
126 x = value;
127 return this;
128 }
129
134 public boolean hasY() {
135 return (bitField0_ & 0x00000004) != 0;
136 }
137
142 public ProtobufQuaternion clearY() {
143 bitField0_ &= ~0x00000004;
144 y = 0D;
145 return this;
146 }
147
152 public double getY() {
153 return y;
154 }
155
161 public ProtobufQuaternion setY(final double value) {
162 bitField0_ |= 0x00000004;
163 y = value;
164 return this;
165 }
166
171 public boolean hasZ() {
172 return (bitField0_ & 0x00000008) != 0;
173 }
174
179 public ProtobufQuaternion clearZ() {
180 bitField0_ &= ~0x00000008;
181 z = 0D;
182 return this;
183 }
184
189 public double getZ() {
190 return z;
191 }
192
198 public ProtobufQuaternion setZ(final double value) {
199 bitField0_ |= 0x00000008;
200 z = value;
201 return this;
202 }
203
204 @Override
205 public ProtobufQuaternion copyFrom(final ProtobufQuaternion other) {
206 cachedSize = other.cachedSize;
207 if ((bitField0_ | other.bitField0_) != 0) {
208 bitField0_ = other.bitField0_;
209 w = other.w;
210 x = other.x;
211 y = other.y;
212 z = other.z;
213 }
214 return this;
215 }
216
217 @Override
218 public ProtobufQuaternion mergeFrom(final ProtobufQuaternion other) {
219 if (other.isEmpty()) {
220 return this;
221 }
222 cachedSize = -1;
223 if (other.hasW()) {
224 setW(other.w);
225 }
226 if (other.hasX()) {
227 setX(other.x);
228 }
229 if (other.hasY()) {
230 setY(other.y);
231 }
232 if (other.hasZ()) {
233 setZ(other.z);
234 }
235 return this;
236 }
237
238 @Override
239 public ProtobufQuaternion clear() {
240 if (isEmpty()) {
241 return this;
242 }
243 cachedSize = -1;
244 bitField0_ = 0;
245 w = 0D;
246 x = 0D;
247 y = 0D;
248 z = 0D;
249 return this;
250 }
251
252 @Override
253 public ProtobufQuaternion clearQuick() {
254 if (isEmpty()) {
255 return this;
256 }
257 cachedSize = -1;
258 bitField0_ = 0;
259 return this;
260 }
261
262 @Override
263 public boolean equals(Object o) {
264 if (o == this) {
265 return true;
266 }
267 if (!(o instanceof ProtobufQuaternion)) {
268 return false;
269 }
271 return bitField0_ == other.bitField0_
272 && (!hasW() || ProtoUtil.isEqual(w, other.w))
273 && (!hasX() || ProtoUtil.isEqual(x, other.x))
274 && (!hasY() || ProtoUtil.isEqual(y, other.y))
275 && (!hasZ() || ProtoUtil.isEqual(z, other.z));
276 }
277
278 @Override
279 public void writeTo(final ProtoSink output) throws IOException {
280 if ((bitField0_ & 0x00000001) != 0) {
281 output.writeRawByte((byte) 9);
282 output.writeDoubleNoTag(w);
283 }
284 if ((bitField0_ & 0x00000002) != 0) {
285 output.writeRawByte((byte) 17);
286 output.writeDoubleNoTag(x);
287 }
288 if ((bitField0_ & 0x00000004) != 0) {
289 output.writeRawByte((byte) 25);
290 output.writeDoubleNoTag(y);
291 }
292 if ((bitField0_ & 0x00000008) != 0) {
293 output.writeRawByte((byte) 33);
294 output.writeDoubleNoTag(z);
295 }
296 }
297
298 @Override
299 protected int computeSerializedSize() {
300 int size = 0;
301 if ((bitField0_ & 0x00000001) != 0) {
302 size += 9;
303 }
304 if ((bitField0_ & 0x00000002) != 0) {
305 size += 9;
306 }
307 if ((bitField0_ & 0x00000004) != 0) {
308 size += 9;
309 }
310 if ((bitField0_ & 0x00000008) != 0) {
311 size += 9;
312 }
313 return size;
314 }
315
316 @Override
317 @SuppressWarnings("fallthrough")
318 public ProtobufQuaternion mergeFrom(final ProtoSource input) throws IOException {
319 // Enabled Fall-Through Optimization (QuickBuffers)
320 int tag = input.readTag();
321 while (true) {
322 switch (tag) {
323 case 9: {
324 // w
325 w = input.readDouble();
326 bitField0_ |= 0x00000001;
327 tag = input.readTag();
328 if (tag != 17) {
329 break;
330 }
331 }
332 case 17: {
333 // x
334 x = input.readDouble();
335 bitField0_ |= 0x00000002;
336 tag = input.readTag();
337 if (tag != 25) {
338 break;
339 }
340 }
341 case 25: {
342 // y
343 y = input.readDouble();
344 bitField0_ |= 0x00000004;
345 tag = input.readTag();
346 if (tag != 33) {
347 break;
348 }
349 }
350 case 33: {
351 // z
352 z = input.readDouble();
353 bitField0_ |= 0x00000008;
354 tag = input.readTag();
355 if (tag != 0) {
356 break;
357 }
358 }
359 case 0: {
360 return this;
361 }
362 default: {
363 if (!input.skipField(tag)) {
364 return this;
365 }
366 tag = input.readTag();
367 break;
368 }
369 }
370 }
371 }
372
373 @Override
374 public void writeTo(final JsonSink output) throws IOException {
375 output.beginObject();
376 if ((bitField0_ & 0x00000001) != 0) {
377 output.writeDouble(FieldNames.w, w);
378 }
379 if ((bitField0_ & 0x00000002) != 0) {
380 output.writeDouble(FieldNames.x, x);
381 }
382 if ((bitField0_ & 0x00000004) != 0) {
383 output.writeDouble(FieldNames.y, y);
384 }
385 if ((bitField0_ & 0x00000008) != 0) {
386 output.writeDouble(FieldNames.z, z);
387 }
388 output.endObject();
389 }
390
391 @Override
392 public ProtobufQuaternion mergeFrom(final JsonSource input) throws IOException {
393 if (!input.beginObject()) {
394 return this;
395 }
396 while (!input.isAtEnd()) {
397 switch (input.readFieldHash()) {
398 case 119: {
399 if (input.isAtField(FieldNames.w)) {
400 if (!input.trySkipNullValue()) {
401 w = input.readDouble();
402 bitField0_ |= 0x00000001;
403 }
404 } else {
405 input.skipUnknownField();
406 }
407 break;
408 }
409 case 120: {
410 if (input.isAtField(FieldNames.x)) {
411 if (!input.trySkipNullValue()) {
412 x = input.readDouble();
413 bitField0_ |= 0x00000002;
414 }
415 } else {
416 input.skipUnknownField();
417 }
418 break;
419 }
420 case 121: {
421 if (input.isAtField(FieldNames.y)) {
422 if (!input.trySkipNullValue()) {
423 y = input.readDouble();
424 bitField0_ |= 0x00000004;
425 }
426 } else {
427 input.skipUnknownField();
428 }
429 break;
430 }
431 case 122: {
432 if (input.isAtField(FieldNames.z)) {
433 if (!input.trySkipNullValue()) {
434 z = input.readDouble();
435 bitField0_ |= 0x00000008;
436 }
437 } else {
438 input.skipUnknownField();
439 }
440 break;
441 }
442 default: {
443 input.skipUnknownField();
444 break;
445 }
446 }
447 }
448 input.endObject();
449 return this;
450 }
451
452 @Override
453 public ProtobufQuaternion clone() {
454 return new ProtobufQuaternion().copyFrom(this);
455 }
456
457 @Override
458 public boolean isEmpty() {
459 return ((bitField0_) == 0);
460 }
461
462 public static ProtobufQuaternion parseFrom(final byte[] data) throws
463 InvalidProtocolBufferException {
464 return ProtoMessage.mergeFrom(new ProtobufQuaternion(), data).checkInitialized();
465 }
466
467 public static ProtobufQuaternion parseFrom(final ProtoSource input) throws IOException {
468 return ProtoMessage.mergeFrom(new ProtobufQuaternion(), input).checkInitialized();
469 }
470
471 public static ProtobufQuaternion parseFrom(final JsonSource input) throws IOException {
472 return ProtoMessage.mergeFrom(new ProtobufQuaternion(), input).checkInitialized();
473 }
474
478 public static MessageFactory<ProtobufQuaternion> getFactory() {
479 return ProtobufQuaternionFactory.INSTANCE;
480 }
481
485 public static Descriptors.Descriptor getDescriptor() {
486 return ProtobufGeometry3dDescriptor.wpi_proto_ProtobufQuaternion_descriptor;
487 }
488
489 private enum ProtobufQuaternionFactory implements MessageFactory<ProtobufQuaternion> {
490 INSTANCE;
491
492 @Override
493 public ProtobufQuaternion create() {
494 return ProtobufQuaternion.newInstance();
495 }
496 }
497
501 static class FieldNames {
502 static final FieldName w = FieldName.forField("w");
503
504 static final FieldName x = FieldName.forField("x");
505
506 static final FieldName y = FieldName.forField("y");
507
508 static final FieldName z = FieldName.forField("z");
509 }
510}
static MessageFactory< ProtobufQuaternion > getFactory()