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;
017
018/**
019 * Protobuf type {@code ProtobufLinearSystem}
020 */
021@SuppressWarnings("hiding")
022public final class ProtobufLinearSystem extends ProtoMessage<ProtobufLinearSystem> implements Cloneable {
023  private static final long serialVersionUID = 0L;
024
025  /**
026   * <code>optional uint32 num_states = 1;</code>
027   */
028  private int numStates;
029
030  /**
031   * <code>optional uint32 num_inputs = 2;</code>
032   */
033  private int numInputs;
034
035  /**
036   * <code>optional uint32 num_outputs = 3;</code>
037   */
038  private int numOutputs;
039
040  /**
041   * <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
042   */
043  private final ProtobufMatrix a = ProtobufMatrix.newInstance();
044
045  /**
046   * <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
047   */
048  private final ProtobufMatrix b = ProtobufMatrix.newInstance();
049
050  /**
051   * <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
052   */
053  private final ProtobufMatrix c = ProtobufMatrix.newInstance();
054
055  /**
056   * <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
057   */
058  private final ProtobufMatrix d = ProtobufMatrix.newInstance();
059
060  private ProtobufLinearSystem() {
061  }
062
063  /**
064   * @return a new empty instance of {@code ProtobufLinearSystem}
065   */
066  public static ProtobufLinearSystem newInstance() {
067    return new ProtobufLinearSystem();
068  }
069
070  /**
071   * <code>optional uint32 num_states = 1;</code>
072   * @return whether the numStates field is set
073   */
074  public boolean hasNumStates() {
075    return (bitField0_ & 0x00000001) != 0;
076  }
077
078  /**
079   * <code>optional uint32 num_states = 1;</code>
080   * @return this
081   */
082  public ProtobufLinearSystem clearNumStates() {
083    bitField0_ &= ~0x00000001;
084    numStates = 0;
085    return this;
086  }
087
088  /**
089   * <code>optional uint32 num_states = 1;</code>
090   * @return the numStates
091   */
092  public int getNumStates() {
093    return numStates;
094  }
095
096  /**
097   * <code>optional uint32 num_states = 1;</code>
098   * @param value the numStates to set
099   * @return this
100   */
101  public ProtobufLinearSystem setNumStates(final int value) {
102    bitField0_ |= 0x00000001;
103    numStates = value;
104    return this;
105  }
106
107  /**
108   * <code>optional uint32 num_inputs = 2;</code>
109   * @return whether the numInputs field is set
110   */
111  public boolean hasNumInputs() {
112    return (bitField0_ & 0x00000002) != 0;
113  }
114
115  /**
116   * <code>optional uint32 num_inputs = 2;</code>
117   * @return this
118   */
119  public ProtobufLinearSystem clearNumInputs() {
120    bitField0_ &= ~0x00000002;
121    numInputs = 0;
122    return this;
123  }
124
125  /**
126   * <code>optional uint32 num_inputs = 2;</code>
127   * @return the numInputs
128   */
129  public int getNumInputs() {
130    return numInputs;
131  }
132
133  /**
134   * <code>optional uint32 num_inputs = 2;</code>
135   * @param value the numInputs to set
136   * @return this
137   */
138  public ProtobufLinearSystem setNumInputs(final int value) {
139    bitField0_ |= 0x00000002;
140    numInputs = value;
141    return this;
142  }
143
144  /**
145   * <code>optional uint32 num_outputs = 3;</code>
146   * @return whether the numOutputs field is set
147   */
148  public boolean hasNumOutputs() {
149    return (bitField0_ & 0x00000004) != 0;
150  }
151
152  /**
153   * <code>optional uint32 num_outputs = 3;</code>
154   * @return this
155   */
156  public ProtobufLinearSystem clearNumOutputs() {
157    bitField0_ &= ~0x00000004;
158    numOutputs = 0;
159    return this;
160  }
161
162  /**
163   * <code>optional uint32 num_outputs = 3;</code>
164   * @return the numOutputs
165   */
166  public int getNumOutputs() {
167    return numOutputs;
168  }
169
170  /**
171   * <code>optional uint32 num_outputs = 3;</code>
172   * @param value the numOutputs to set
173   * @return this
174   */
175  public ProtobufLinearSystem setNumOutputs(final int value) {
176    bitField0_ |= 0x00000004;
177    numOutputs = value;
178    return this;
179  }
180
181  /**
182   * <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
183   * @return whether the a field is set
184   */
185  public boolean hasA() {
186    return (bitField0_ & 0x00000008) != 0;
187  }
188
189  /**
190   * <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
191   * @return this
192   */
193  public ProtobufLinearSystem clearA() {
194    bitField0_ &= ~0x00000008;
195    a.clear();
196    return this;
197  }
198
199  /**
200   * <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
201   *
202   * This method returns the internal storage object without modifying any has state.
203   * The returned object should not be modified and be treated as read-only.
204   *
205   * Use {@link #getMutableA()} if you want to modify it.
206   *
207   * @return internal storage object for reading
208   */
209  public ProtobufMatrix getA() {
210    return a;
211  }
212
213  /**
214   * <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
215   *
216   * This method returns the internal storage object and sets the corresponding
217   * has state. The returned object will become part of this message and its
218   * contents may be modified as long as the has state is not cleared.
219   *
220   * @return internal storage object for modifications
221   */
222  public ProtobufMatrix getMutableA() {
223    bitField0_ |= 0x00000008;
224    return a;
225  }
226
227  /**
228   * <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
229   * @param value the a to set
230   * @return this
231   */
232  public ProtobufLinearSystem setA(final ProtobufMatrix value) {
233    bitField0_ |= 0x00000008;
234    a.copyFrom(value);
235    return this;
236  }
237
238  /**
239   * <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
240   * @return whether the b field is set
241   */
242  public boolean hasB() {
243    return (bitField0_ & 0x00000010) != 0;
244  }
245
246  /**
247   * <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
248   * @return this
249   */
250  public ProtobufLinearSystem clearB() {
251    bitField0_ &= ~0x00000010;
252    b.clear();
253    return this;
254  }
255
256  /**
257   * <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
258   *
259   * This method returns the internal storage object without modifying any has state.
260   * The returned object should not be modified and be treated as read-only.
261   *
262   * Use {@link #getMutableB()} if you want to modify it.
263   *
264   * @return internal storage object for reading
265   */
266  public ProtobufMatrix getB() {
267    return b;
268  }
269
270  /**
271   * <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
272   *
273   * This method returns the internal storage object and sets the corresponding
274   * has state. The returned object will become part of this message and its
275   * contents may be modified as long as the has state is not cleared.
276   *
277   * @return internal storage object for modifications
278   */
279  public ProtobufMatrix getMutableB() {
280    bitField0_ |= 0x00000010;
281    return b;
282  }
283
284  /**
285   * <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
286   * @param value the b to set
287   * @return this
288   */
289  public ProtobufLinearSystem setB(final ProtobufMatrix value) {
290    bitField0_ |= 0x00000010;
291    b.copyFrom(value);
292    return this;
293  }
294
295  /**
296   * <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
297   * @return whether the c field is set
298   */
299  public boolean hasC() {
300    return (bitField0_ & 0x00000020) != 0;
301  }
302
303  /**
304   * <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
305   * @return this
306   */
307  public ProtobufLinearSystem clearC() {
308    bitField0_ &= ~0x00000020;
309    c.clear();
310    return this;
311  }
312
313  /**
314   * <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
315   *
316   * This method returns the internal storage object without modifying any has state.
317   * The returned object should not be modified and be treated as read-only.
318   *
319   * Use {@link #getMutableC()} if you want to modify it.
320   *
321   * @return internal storage object for reading
322   */
323  public ProtobufMatrix getC() {
324    return c;
325  }
326
327  /**
328   * <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
329   *
330   * This method returns the internal storage object and sets the corresponding
331   * has state. The returned object will become part of this message and its
332   * contents may be modified as long as the has state is not cleared.
333   *
334   * @return internal storage object for modifications
335   */
336  public ProtobufMatrix getMutableC() {
337    bitField0_ |= 0x00000020;
338    return c;
339  }
340
341  /**
342   * <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
343   * @param value the c to set
344   * @return this
345   */
346  public ProtobufLinearSystem setC(final ProtobufMatrix value) {
347    bitField0_ |= 0x00000020;
348    c.copyFrom(value);
349    return this;
350  }
351
352  /**
353   * <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
354   * @return whether the d field is set
355   */
356  public boolean hasD() {
357    return (bitField0_ & 0x00000040) != 0;
358  }
359
360  /**
361   * <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
362   * @return this
363   */
364  public ProtobufLinearSystem clearD() {
365    bitField0_ &= ~0x00000040;
366    d.clear();
367    return this;
368  }
369
370  /**
371   * <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
372   *
373   * This method returns the internal storage object without modifying any has state.
374   * The returned object should not be modified and be treated as read-only.
375   *
376   * Use {@link #getMutableD()} if you want to modify it.
377   *
378   * @return internal storage object for reading
379   */
380  public ProtobufMatrix getD() {
381    return d;
382  }
383
384  /**
385   * <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
386   *
387   * This method returns the internal storage object and sets the corresponding
388   * has state. The returned object will become part of this message and its
389   * contents may be modified as long as the has state is not cleared.
390   *
391   * @return internal storage object for modifications
392   */
393  public ProtobufMatrix getMutableD() {
394    bitField0_ |= 0x00000040;
395    return d;
396  }
397
398  /**
399   * <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
400   * @param value the d to set
401   * @return this
402   */
403  public ProtobufLinearSystem setD(final ProtobufMatrix value) {
404    bitField0_ |= 0x00000040;
405    d.copyFrom(value);
406    return this;
407  }
408
409  @Override
410  public ProtobufLinearSystem copyFrom(final ProtobufLinearSystem other) {
411    cachedSize = other.cachedSize;
412    if ((bitField0_ | other.bitField0_) != 0) {
413      bitField0_ = other.bitField0_;
414      numStates = other.numStates;
415      numInputs = other.numInputs;
416      numOutputs = other.numOutputs;
417      a.copyFrom(other.a);
418      b.copyFrom(other.b);
419      c.copyFrom(other.c);
420      d.copyFrom(other.d);
421    }
422    return this;
423  }
424
425  @Override
426  public ProtobufLinearSystem mergeFrom(final ProtobufLinearSystem other) {
427    if (other.isEmpty()) {
428      return this;
429    }
430    cachedSize = -1;
431    if (other.hasNumStates()) {
432      setNumStates(other.numStates);
433    }
434    if (other.hasNumInputs()) {
435      setNumInputs(other.numInputs);
436    }
437    if (other.hasNumOutputs()) {
438      setNumOutputs(other.numOutputs);
439    }
440    if (other.hasA()) {
441      getMutableA().mergeFrom(other.a);
442    }
443    if (other.hasB()) {
444      getMutableB().mergeFrom(other.b);
445    }
446    if (other.hasC()) {
447      getMutableC().mergeFrom(other.c);
448    }
449    if (other.hasD()) {
450      getMutableD().mergeFrom(other.d);
451    }
452    return this;
453  }
454
455  @Override
456  public ProtobufLinearSystem clear() {
457    if (isEmpty()) {
458      return this;
459    }
460    cachedSize = -1;
461    bitField0_ = 0;
462    numStates = 0;
463    numInputs = 0;
464    numOutputs = 0;
465    a.clear();
466    b.clear();
467    c.clear();
468    d.clear();
469    return this;
470  }
471
472  @Override
473  public ProtobufLinearSystem clearQuick() {
474    if (isEmpty()) {
475      return this;
476    }
477    cachedSize = -1;
478    bitField0_ = 0;
479    a.clearQuick();
480    b.clearQuick();
481    c.clearQuick();
482    d.clearQuick();
483    return this;
484  }
485
486  @Override
487  public boolean equals(Object o) {
488    if (o == this) {
489      return true;
490    }
491    if (!(o instanceof ProtobufLinearSystem)) {
492      return false;
493    }
494    ProtobufLinearSystem other = (ProtobufLinearSystem) o;
495    return bitField0_ == other.bitField0_
496      && (!hasNumStates() || numStates == other.numStates)
497      && (!hasNumInputs() || numInputs == other.numInputs)
498      && (!hasNumOutputs() || numOutputs == other.numOutputs)
499      && (!hasA() || a.equals(other.a))
500      && (!hasB() || b.equals(other.b))
501      && (!hasC() || c.equals(other.c))
502      && (!hasD() || d.equals(other.d));
503  }
504
505  @Override
506  public void writeTo(final ProtoSink output) throws IOException {
507    if ((bitField0_ & 0x00000001) != 0) {
508      output.writeRawByte((byte) 8);
509      output.writeUInt32NoTag(numStates);
510    }
511    if ((bitField0_ & 0x00000002) != 0) {
512      output.writeRawByte((byte) 16);
513      output.writeUInt32NoTag(numInputs);
514    }
515    if ((bitField0_ & 0x00000004) != 0) {
516      output.writeRawByte((byte) 24);
517      output.writeUInt32NoTag(numOutputs);
518    }
519    if ((bitField0_ & 0x00000008) != 0) {
520      output.writeRawByte((byte) 34);
521      output.writeMessageNoTag(a);
522    }
523    if ((bitField0_ & 0x00000010) != 0) {
524      output.writeRawByte((byte) 42);
525      output.writeMessageNoTag(b);
526    }
527    if ((bitField0_ & 0x00000020) != 0) {
528      output.writeRawByte((byte) 50);
529      output.writeMessageNoTag(c);
530    }
531    if ((bitField0_ & 0x00000040) != 0) {
532      output.writeRawByte((byte) 58);
533      output.writeMessageNoTag(d);
534    }
535  }
536
537  @Override
538  protected int computeSerializedSize() {
539    int size = 0;
540    if ((bitField0_ & 0x00000001) != 0) {
541      size += 1 + ProtoSink.computeUInt32SizeNoTag(numStates);
542    }
543    if ((bitField0_ & 0x00000002) != 0) {
544      size += 1 + ProtoSink.computeUInt32SizeNoTag(numInputs);
545    }
546    if ((bitField0_ & 0x00000004) != 0) {
547      size += 1 + ProtoSink.computeUInt32SizeNoTag(numOutputs);
548    }
549    if ((bitField0_ & 0x00000008) != 0) {
550      size += 1 + ProtoSink.computeMessageSizeNoTag(a);
551    }
552    if ((bitField0_ & 0x00000010) != 0) {
553      size += 1 + ProtoSink.computeMessageSizeNoTag(b);
554    }
555    if ((bitField0_ & 0x00000020) != 0) {
556      size += 1 + ProtoSink.computeMessageSizeNoTag(c);
557    }
558    if ((bitField0_ & 0x00000040) != 0) {
559      size += 1 + ProtoSink.computeMessageSizeNoTag(d);
560    }
561    return size;
562  }
563
564  @Override
565  @SuppressWarnings("fallthrough")
566  public ProtobufLinearSystem mergeFrom(final ProtoSource input) throws IOException {
567    // Enabled Fall-Through Optimization (QuickBuffers)
568    int tag = input.readTag();
569    while (true) {
570      switch (tag) {
571        case 8: {
572          // numStates
573          numStates = input.readUInt32();
574          bitField0_ |= 0x00000001;
575          tag = input.readTag();
576          if (tag != 16) {
577            break;
578          }
579        }
580        case 16: {
581          // numInputs
582          numInputs = input.readUInt32();
583          bitField0_ |= 0x00000002;
584          tag = input.readTag();
585          if (tag != 24) {
586            break;
587          }
588        }
589        case 24: {
590          // numOutputs
591          numOutputs = input.readUInt32();
592          bitField0_ |= 0x00000004;
593          tag = input.readTag();
594          if (tag != 34) {
595            break;
596          }
597        }
598        case 34: {
599          // a
600          input.readMessage(a);
601          bitField0_ |= 0x00000008;
602          tag = input.readTag();
603          if (tag != 42) {
604            break;
605          }
606        }
607        case 42: {
608          // b
609          input.readMessage(b);
610          bitField0_ |= 0x00000010;
611          tag = input.readTag();
612          if (tag != 50) {
613            break;
614          }
615        }
616        case 50: {
617          // c
618          input.readMessage(c);
619          bitField0_ |= 0x00000020;
620          tag = input.readTag();
621          if (tag != 58) {
622            break;
623          }
624        }
625        case 58: {
626          // d
627          input.readMessage(d);
628          bitField0_ |= 0x00000040;
629          tag = input.readTag();
630          if (tag != 0) {
631            break;
632          }
633        }
634        case 0: {
635          return this;
636        }
637        default: {
638          if (!input.skipField(tag)) {
639            return this;
640          }
641          tag = input.readTag();
642          break;
643        }
644      }
645    }
646  }
647
648  @Override
649  public void writeTo(final JsonSink output) throws IOException {
650    output.beginObject();
651    if ((bitField0_ & 0x00000001) != 0) {
652      output.writeUInt32(FieldNames.numStates, numStates);
653    }
654    if ((bitField0_ & 0x00000002) != 0) {
655      output.writeUInt32(FieldNames.numInputs, numInputs);
656    }
657    if ((bitField0_ & 0x00000004) != 0) {
658      output.writeUInt32(FieldNames.numOutputs, numOutputs);
659    }
660    if ((bitField0_ & 0x00000008) != 0) {
661      output.writeMessage(FieldNames.a, a);
662    }
663    if ((bitField0_ & 0x00000010) != 0) {
664      output.writeMessage(FieldNames.b, b);
665    }
666    if ((bitField0_ & 0x00000020) != 0) {
667      output.writeMessage(FieldNames.c, c);
668    }
669    if ((bitField0_ & 0x00000040) != 0) {
670      output.writeMessage(FieldNames.d, d);
671    }
672    output.endObject();
673  }
674
675  @Override
676  public ProtobufLinearSystem mergeFrom(final JsonSource input) throws IOException {
677    if (!input.beginObject()) {
678      return this;
679    }
680    while (!input.isAtEnd()) {
681      switch (input.readFieldHash()) {
682        case 1233856808:
683        case 1643330779: {
684          if (input.isAtField(FieldNames.numStates)) {
685            if (!input.trySkipNullValue()) {
686              numStates = input.readUInt32();
687              bitField0_ |= 0x00000001;
688            }
689          } else {
690            input.skipUnknownField();
691          }
692          break;
693        }
694        case 942472463:
695        case 1351946434: {
696          if (input.isAtField(FieldNames.numInputs)) {
697            if (!input.trySkipNullValue()) {
698              numInputs = input.readUInt32();
699              bitField0_ |= 0x00000002;
700            }
701          } else {
702            input.skipUnknownField();
703          }
704          break;
705        }
706        case 385880364:
707        case 194671577: {
708          if (input.isAtField(FieldNames.numOutputs)) {
709            if (!input.trySkipNullValue()) {
710              numOutputs = input.readUInt32();
711              bitField0_ |= 0x00000004;
712            }
713          } else {
714            input.skipUnknownField();
715          }
716          break;
717        }
718        case 97: {
719          if (input.isAtField(FieldNames.a)) {
720            if (!input.trySkipNullValue()) {
721              input.readMessage(a);
722              bitField0_ |= 0x00000008;
723            }
724          } else {
725            input.skipUnknownField();
726          }
727          break;
728        }
729        case 98: {
730          if (input.isAtField(FieldNames.b)) {
731            if (!input.trySkipNullValue()) {
732              input.readMessage(b);
733              bitField0_ |= 0x00000010;
734            }
735          } else {
736            input.skipUnknownField();
737          }
738          break;
739        }
740        case 99: {
741          if (input.isAtField(FieldNames.c)) {
742            if (!input.trySkipNullValue()) {
743              input.readMessage(c);
744              bitField0_ |= 0x00000020;
745            }
746          } else {
747            input.skipUnknownField();
748          }
749          break;
750        }
751        case 100: {
752          if (input.isAtField(FieldNames.d)) {
753            if (!input.trySkipNullValue()) {
754              input.readMessage(d);
755              bitField0_ |= 0x00000040;
756            }
757          } else {
758            input.skipUnknownField();
759          }
760          break;
761        }
762        default: {
763          input.skipUnknownField();
764          break;
765        }
766      }
767    }
768    input.endObject();
769    return this;
770  }
771
772  @Override
773  public ProtobufLinearSystem clone() {
774    return new ProtobufLinearSystem().copyFrom(this);
775  }
776
777  @Override
778  public boolean isEmpty() {
779    return ((bitField0_) == 0);
780  }
781
782  public static ProtobufLinearSystem parseFrom(final byte[] data) throws
783      InvalidProtocolBufferException {
784    return ProtoMessage.mergeFrom(new ProtobufLinearSystem(), data).checkInitialized();
785  }
786
787  public static ProtobufLinearSystem parseFrom(final ProtoSource input) throws IOException {
788    return ProtoMessage.mergeFrom(new ProtobufLinearSystem(), input).checkInitialized();
789  }
790
791  public static ProtobufLinearSystem parseFrom(final JsonSource input) throws IOException {
792    return ProtoMessage.mergeFrom(new ProtobufLinearSystem(), input).checkInitialized();
793  }
794
795  /**
796   * @return factory for creating ProtobufLinearSystem messages
797   */
798  public static MessageFactory<ProtobufLinearSystem> getFactory() {
799    return ProtobufLinearSystemFactory.INSTANCE;
800  }
801
802  /**
803   * @return this type's descriptor.
804   */
805  public static Descriptors.Descriptor getDescriptor() {
806    return ProtobufSystemDescriptor.wpi_proto_ProtobufLinearSystem_descriptor;
807  }
808
809  private enum ProtobufLinearSystemFactory implements MessageFactory<ProtobufLinearSystem> {
810    INSTANCE;
811
812    @Override
813    public ProtobufLinearSystem create() {
814      return ProtobufLinearSystem.newInstance();
815    }
816  }
817
818  /**
819   * Contains name constants used for serializing JSON
820   */
821  static class FieldNames {
822    static final FieldName numStates = FieldName.forField("numStates", "num_states");
823
824    static final FieldName numInputs = FieldName.forField("numInputs", "num_inputs");
825
826    static final FieldName numOutputs = FieldName.forField("numOutputs", "num_outputs");
827
828    static final FieldName a = FieldName.forField("a");
829
830    static final FieldName b = FieldName.forField("b");
831
832    static final FieldName c = FieldName.forField("c");
833
834    static final FieldName d = FieldName.forField("d");
835  }
836}