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 ProtobufMecanumDriveWheelAccelerations}
021 */
022@SuppressWarnings("hiding")
023public final class ProtobufMecanumDriveWheelAccelerations extends ProtoMessage<ProtobufMecanumDriveWheelAccelerations> 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 ProtobufMecanumDriveWheelAccelerations() {
047  }
048
049  /**
050   * @return a new empty instance of {@code ProtobufMecanumDriveWheelAccelerations}
051   */
052  public static ProtobufMecanumDriveWheelAccelerations newInstance() {
053    return new ProtobufMecanumDriveWheelAccelerations();
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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations setRearRight(final double value) {
199    bitField0_ |= 0x00000008;
200    rearRight = value;
201    return this;
202  }
203
204  @Override
205  public ProtobufMecanumDriveWheelAccelerations copyFrom(
206      final ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations mergeFrom(
220      final ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations 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 ProtobufMecanumDriveWheelAccelerations)) {
270      return false;
271    }
272    ProtobufMecanumDriveWheelAccelerations other = (ProtobufMecanumDriveWheelAccelerations) 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 ProtobufMecanumDriveWheelAccelerations mergeFrom(final ProtoSource input) throws
321      IOException {
322    // Enabled Fall-Through Optimization (QuickBuffers)
323    int tag = input.readTag();
324    while (true) {
325      switch (tag) {
326        case 9: {
327          // frontLeft
328          frontLeft = input.readDouble();
329          bitField0_ |= 0x00000001;
330          tag = input.readTag();
331          if (tag != 17) {
332            break;
333          }
334        }
335        case 17: {
336          // frontRight
337          frontRight = input.readDouble();
338          bitField0_ |= 0x00000002;
339          tag = input.readTag();
340          if (tag != 25) {
341            break;
342          }
343        }
344        case 25: {
345          // rearLeft
346          rearLeft = input.readDouble();
347          bitField0_ |= 0x00000004;
348          tag = input.readTag();
349          if (tag != 33) {
350            break;
351          }
352        }
353        case 33: {
354          // rearRight
355          rearRight = input.readDouble();
356          bitField0_ |= 0x00000008;
357          tag = input.readTag();
358          if (tag != 0) {
359            break;
360          }
361        }
362        case 0: {
363          return this;
364        }
365        default: {
366          if (!input.skipField(tag)) {
367            return this;
368          }
369          tag = input.readTag();
370          break;
371        }
372      }
373    }
374  }
375
376  @Override
377  public void writeTo(final JsonSink output) throws IOException {
378    output.beginObject();
379    if ((bitField0_ & 0x00000001) != 0) {
380      output.writeDouble(FieldNames.frontLeft, frontLeft);
381    }
382    if ((bitField0_ & 0x00000002) != 0) {
383      output.writeDouble(FieldNames.frontRight, frontRight);
384    }
385    if ((bitField0_ & 0x00000004) != 0) {
386      output.writeDouble(FieldNames.rearLeft, rearLeft);
387    }
388    if ((bitField0_ & 0x00000008) != 0) {
389      output.writeDouble(FieldNames.rearRight, rearRight);
390    }
391    output.endObject();
392  }
393
394  @Override
395  public ProtobufMecanumDriveWheelAccelerations mergeFrom(final JsonSource input) throws
396      IOException {
397    if (!input.beginObject()) {
398      return this;
399    }
400    while (!input.isAtEnd()) {
401      switch (input.readFieldHash()) {
402        case 127514064:
403        case -324277155: {
404          if (input.isAtField(FieldNames.frontLeft)) {
405            if (!input.trySkipNullValue()) {
406              frontLeft = input.readDouble();
407              bitField0_ |= 0x00000001;
408            }
409          } else {
410            input.skipUnknownField();
411          }
412          break;
413        }
414        case -336370317:
415        case -1456996218: {
416          if (input.isAtField(FieldNames.frontRight)) {
417            if (!input.trySkipNullValue()) {
418              frontRight = input.readDouble();
419              bitField0_ |= 0x00000002;
420            }
421          } else {
422            input.skipUnknownField();
423          }
424          break;
425        }
426        case -854852661:
427        case -712874558: {
428          if (input.isAtField(FieldNames.rearLeft)) {
429            if (!input.trySkipNullValue()) {
430              rearLeft = input.readDouble();
431              bitField0_ |= 0x00000004;
432            }
433          } else {
434            input.skipUnknownField();
435          }
436          break;
437        }
438        case -724967720:
439        case -618613823: {
440          if (input.isAtField(FieldNames.rearRight)) {
441            if (!input.trySkipNullValue()) {
442              rearRight = input.readDouble();
443              bitField0_ |= 0x00000008;
444            }
445          } else {
446            input.skipUnknownField();
447          }
448          break;
449        }
450        default: {
451          input.skipUnknownField();
452          break;
453        }
454      }
455    }
456    input.endObject();
457    return this;
458  }
459
460  @Override
461  public ProtobufMecanumDriveWheelAccelerations clone() {
462    return new ProtobufMecanumDriveWheelAccelerations().copyFrom(this);
463  }
464
465  @Override
466  public boolean isEmpty() {
467    return ((bitField0_) == 0);
468  }
469
470  public static ProtobufMecanumDriveWheelAccelerations parseFrom(final byte[] data) throws
471      InvalidProtocolBufferException {
472    return ProtoMessage.mergeFrom(new ProtobufMecanumDriveWheelAccelerations(), data).checkInitialized();
473  }
474
475  public static ProtobufMecanumDriveWheelAccelerations parseFrom(final ProtoSource input) throws
476      IOException {
477    return ProtoMessage.mergeFrom(new ProtobufMecanumDriveWheelAccelerations(), input).checkInitialized();
478  }
479
480  public static ProtobufMecanumDriveWheelAccelerations parseFrom(final JsonSource input) throws
481      IOException {
482    return ProtoMessage.mergeFrom(new ProtobufMecanumDriveWheelAccelerations(), input).checkInitialized();
483  }
484
485  /**
486   * @return factory for creating ProtobufMecanumDriveWheelAccelerations messages
487   */
488  public static MessageFactory<ProtobufMecanumDriveWheelAccelerations> getFactory() {
489    return ProtobufMecanumDriveWheelAccelerationsFactory.INSTANCE;
490  }
491
492  /**
493   * @return this type's descriptor.
494   */
495  public static Descriptors.Descriptor getDescriptor() {
496    return ProtobufKinematicsDescriptor.wpi_proto_ProtobufMecanumDriveWheelAccelerations_descriptor;
497  }
498
499  private enum ProtobufMecanumDriveWheelAccelerationsFactory implements MessageFactory<ProtobufMecanumDriveWheelAccelerations> {
500    INSTANCE;
501
502    @Override
503    public ProtobufMecanumDriveWheelAccelerations create() {
504      return ProtobufMecanumDriveWheelAccelerations.newInstance();
505    }
506  }
507
508  /**
509   * Contains name constants used for serializing JSON
510   */
511  static class FieldNames {
512    static final FieldName frontLeft = FieldName.forField("frontLeft", "front_left");
513
514    static final FieldName frontRight = FieldName.forField("frontRight", "front_right");
515
516    static final FieldName rearLeft = FieldName.forField("rearLeft", "rear_left");
517
518    static final FieldName rearRight = FieldName.forField("rearRight", "rear_right");
519  }
520}