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