RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
ProtobufTranslation3d.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 ProtobufTranslation3d extends ProtoMessage<ProtobufTranslation3d> implements Cloneable {
24 private static final long serialVersionUID = 0L;
25
29 private double x;
30
34 private double y;
35
39 private double z;
40
41 private ProtobufTranslation3d() {
42 }
43
47 public static ProtobufTranslation3d newInstance() {
48 return new ProtobufTranslation3d();
49 }
50
55 public boolean hasX() {
56 return (bitField0_ & 0x00000001) != 0;
57 }
58
63 public ProtobufTranslation3d clearX() {
64 bitField0_ &= ~0x00000001;
65 x = 0D;
66 return this;
67 }
68
73 public double getX() {
74 return x;
75 }
76
82 public ProtobufTranslation3d setX(final double value) {
83 bitField0_ |= 0x00000001;
84 x = value;
85 return this;
86 }
87
92 public boolean hasY() {
93 return (bitField0_ & 0x00000002) != 0;
94 }
95
100 public ProtobufTranslation3d clearY() {
101 bitField0_ &= ~0x00000002;
102 y = 0D;
103 return this;
104 }
105
110 public double getY() {
111 return y;
112 }
113
119 public ProtobufTranslation3d setY(final double value) {
120 bitField0_ |= 0x00000002;
121 y = value;
122 return this;
123 }
124
129 public boolean hasZ() {
130 return (bitField0_ & 0x00000004) != 0;
131 }
132
137 public ProtobufTranslation3d clearZ() {
138 bitField0_ &= ~0x00000004;
139 z = 0D;
140 return this;
141 }
142
147 public double getZ() {
148 return z;
149 }
150
156 public ProtobufTranslation3d setZ(final double value) {
157 bitField0_ |= 0x00000004;
158 z = value;
159 return this;
160 }
161
162 @Override
163 public ProtobufTranslation3d copyFrom(final ProtobufTranslation3d other) {
164 cachedSize = other.cachedSize;
165 if ((bitField0_ | other.bitField0_) != 0) {
166 bitField0_ = other.bitField0_;
167 x = other.x;
168 y = other.y;
169 z = other.z;
170 }
171 return this;
172 }
173
174 @Override
175 public ProtobufTranslation3d mergeFrom(final ProtobufTranslation3d other) {
176 if (other.isEmpty()) {
177 return this;
178 }
179 cachedSize = -1;
180 if (other.hasX()) {
181 setX(other.x);
182 }
183 if (other.hasY()) {
184 setY(other.y);
185 }
186 if (other.hasZ()) {
187 setZ(other.z);
188 }
189 return this;
190 }
191
192 @Override
193 public ProtobufTranslation3d clear() {
194 if (isEmpty()) {
195 return this;
196 }
197 cachedSize = -1;
198 bitField0_ = 0;
199 x = 0D;
200 y = 0D;
201 z = 0D;
202 return this;
203 }
204
205 @Override
206 public ProtobufTranslation3d clearQuick() {
207 if (isEmpty()) {
208 return this;
209 }
210 cachedSize = -1;
211 bitField0_ = 0;
212 return this;
213 }
214
215 @Override
216 public boolean equals(Object o) {
217 if (o == this) {
218 return true;
219 }
220 if (!(o instanceof ProtobufTranslation3d)) {
221 return false;
222 }
224 return bitField0_ == other.bitField0_
225 && (!hasX() || ProtoUtil.isEqual(x, other.x))
226 && (!hasY() || ProtoUtil.isEqual(y, other.y))
227 && (!hasZ() || ProtoUtil.isEqual(z, other.z));
228 }
229
230 @Override
231 public void writeTo(final ProtoSink output) throws IOException {
232 if ((bitField0_ & 0x00000001) != 0) {
233 output.writeRawByte((byte) 9);
234 output.writeDoubleNoTag(x);
235 }
236 if ((bitField0_ & 0x00000002) != 0) {
237 output.writeRawByte((byte) 17);
238 output.writeDoubleNoTag(y);
239 }
240 if ((bitField0_ & 0x00000004) != 0) {
241 output.writeRawByte((byte) 25);
242 output.writeDoubleNoTag(z);
243 }
244 }
245
246 @Override
247 protected int computeSerializedSize() {
248 int size = 0;
249 if ((bitField0_ & 0x00000001) != 0) {
250 size += 9;
251 }
252 if ((bitField0_ & 0x00000002) != 0) {
253 size += 9;
254 }
255 if ((bitField0_ & 0x00000004) != 0) {
256 size += 9;
257 }
258 return size;
259 }
260
261 @Override
262 @SuppressWarnings("fallthrough")
263 public ProtobufTranslation3d mergeFrom(final ProtoSource input) throws IOException {
264 // Enabled Fall-Through Optimization (QuickBuffers)
265 int tag = input.readTag();
266 while (true) {
267 switch (tag) {
268 case 9: {
269 // x
270 x = input.readDouble();
271 bitField0_ |= 0x00000001;
272 tag = input.readTag();
273 if (tag != 17) {
274 break;
275 }
276 }
277 case 17: {
278 // y
279 y = input.readDouble();
280 bitField0_ |= 0x00000002;
281 tag = input.readTag();
282 if (tag != 25) {
283 break;
284 }
285 }
286 case 25: {
287 // z
288 z = input.readDouble();
289 bitField0_ |= 0x00000004;
290 tag = input.readTag();
291 if (tag != 0) {
292 break;
293 }
294 }
295 case 0: {
296 return this;
297 }
298 default: {
299 if (!input.skipField(tag)) {
300 return this;
301 }
302 tag = input.readTag();
303 break;
304 }
305 }
306 }
307 }
308
309 @Override
310 public void writeTo(final JsonSink output) throws IOException {
311 output.beginObject();
312 if ((bitField0_ & 0x00000001) != 0) {
313 output.writeDouble(FieldNames.x, x);
314 }
315 if ((bitField0_ & 0x00000002) != 0) {
316 output.writeDouble(FieldNames.y, y);
317 }
318 if ((bitField0_ & 0x00000004) != 0) {
319 output.writeDouble(FieldNames.z, z);
320 }
321 output.endObject();
322 }
323
324 @Override
325 public ProtobufTranslation3d mergeFrom(final JsonSource input) throws IOException {
326 if (!input.beginObject()) {
327 return this;
328 }
329 while (!input.isAtEnd()) {
330 switch (input.readFieldHash()) {
331 case 120: {
332 if (input.isAtField(FieldNames.x)) {
333 if (!input.trySkipNullValue()) {
334 x = input.readDouble();
335 bitField0_ |= 0x00000001;
336 }
337 } else {
338 input.skipUnknownField();
339 }
340 break;
341 }
342 case 121: {
343 if (input.isAtField(FieldNames.y)) {
344 if (!input.trySkipNullValue()) {
345 y = input.readDouble();
346 bitField0_ |= 0x00000002;
347 }
348 } else {
349 input.skipUnknownField();
350 }
351 break;
352 }
353 case 122: {
354 if (input.isAtField(FieldNames.z)) {
355 if (!input.trySkipNullValue()) {
356 z = input.readDouble();
357 bitField0_ |= 0x00000004;
358 }
359 } else {
360 input.skipUnknownField();
361 }
362 break;
363 }
364 default: {
365 input.skipUnknownField();
366 break;
367 }
368 }
369 }
370 input.endObject();
371 return this;
372 }
373
374 @Override
375 public ProtobufTranslation3d clone() {
376 return new ProtobufTranslation3d().copyFrom(this);
377 }
378
379 @Override
380 public boolean isEmpty() {
381 return ((bitField0_) == 0);
382 }
383
384 public static ProtobufTranslation3d parseFrom(final byte[] data) throws
385 InvalidProtocolBufferException {
386 return ProtoMessage.mergeFrom(new ProtobufTranslation3d(), data).checkInitialized();
387 }
388
389 public static ProtobufTranslation3d parseFrom(final ProtoSource input) throws IOException {
390 return ProtoMessage.mergeFrom(new ProtobufTranslation3d(), input).checkInitialized();
391 }
392
393 public static ProtobufTranslation3d parseFrom(final JsonSource input) throws IOException {
394 return ProtoMessage.mergeFrom(new ProtobufTranslation3d(), input).checkInitialized();
395 }
396
400 public static MessageFactory<ProtobufTranslation3d> getFactory() {
401 return ProtobufTranslation3dFactory.INSTANCE;
402 }
403
407 public static Descriptors.Descriptor getDescriptor() {
408 return ProtobufGeometry3dDescriptor.wpi_proto_ProtobufTranslation3d_descriptor;
409 }
410
411 private enum ProtobufTranslation3dFactory implements MessageFactory<ProtobufTranslation3d> {
412 INSTANCE;
413
414 @Override
415 public ProtobufTranslation3d create() {
416 return ProtobufTranslation3d.newInstance();
417 }
418 }
419
423 static class FieldNames {
424 static final FieldName x = FieldName.forField("x");
425
426 static final FieldName y = FieldName.forField("y");
427
428 static final FieldName z = FieldName.forField("z");
429 }
430}
static MessageFactory< ProtobufTranslation3d > getFactory()