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