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;
019import us.hebi.quickbuf.RepeatedMessage;
020
021public final class Trajectory {
022  private static final RepeatedByte descriptorData = ProtoUtil.decodeBase64(809,
023    "ChB0cmFqZWN0b3J5LnByb3RvEgl3cGkucHJvdG8aEGdlb21ldHJ5MmQucHJvdG8iugEKF1Byb3RvYnVm" + 
024    "VHJhamVjdG9yeVN0YXRlEhIKBHRpbWUYASABKAFSBHRpbWUSGgoIdmVsb2NpdHkYAiABKAFSCHZlbG9j" + 
025    "aXR5EiIKDGFjY2VsZXJhdGlvbhgDIAEoAVIMYWNjZWxlcmF0aW9uEi0KBHBvc2UYBCABKAsyGS53cGku" + 
026    "cHJvdG8uUHJvdG9idWZQb3NlMmRSBHBvc2USHAoJY3VydmF0dXJlGAUgASgBUgljdXJ2YXR1cmUiUAoS" + 
027    "UHJvdG9idWZUcmFqZWN0b3J5EjoKBnN0YXRlcxgCIAMoCzIiLndwaS5wcm90by5Qcm90b2J1ZlRyYWpl" + 
028    "Y3RvcnlTdGF0ZVIGc3RhdGVzQhoKGGVkdS53cGkuZmlyc3QubWF0aC5wcm90b0rEAwoGEgQAABIBCggK" + 
029    "AQwSAwAAEgoICgECEgMCABIKCQoCAwASAwQAGgoICgEIEgMGADEKCQoCCAESAwYAMQoKCgIEABIECAAO" + 
030    "AQoKCgMEAAESAwgIHwoLCgQEAAIAEgMJAhIKDAoFBAACAAUSAwkCCAoMCgUEAAIAARIDCQkNCgwKBQQA" + 
031    "AgADEgMJEBEKCwoEBAACARIDCgIWCgwKBQQAAgEFEgMKAggKDAoFBAACAQESAwoJEQoMCgUEAAIBAxID" + 
032    "ChQVCgsKBAQAAgISAwsCGgoMCgUEAAICBRIDCwIICgwKBQQAAgIBEgMLCRUKDAoFBAACAgMSAwsYGQoL" + 
033    "CgQEAAIDEgMMAhoKDAoFBAACAwYSAwwCEAoMCgUEAAIDARIDDBEVCgwKBQQAAgMDEgMMGBkKCwoEBAAC" + 
034    "BBIDDQIXCgwKBQQAAgQFEgMNAggKDAoFBAACBAESAw0JEgoMCgUEAAIEAxIDDRUWCgoKAgQBEgQQABIB" + 
035    "CgoKAwQBARIDEAgaCgsKBAQBAgASAxECLgoMCgUEAQIABBIDEQIKCgwKBQQBAgAGEgMRCyIKDAoFBAEC" + 
036    "AAESAxEjKQoMCgUEAQIAAxIDESwtYgZwcm90bzM=");
037
038  static final Descriptors.FileDescriptor descriptor = Descriptors.FileDescriptor.internalBuildGeneratedFileFrom("trajectory.proto", "wpi.proto", descriptorData, Geometry2D.getDescriptor());
039
040  static final Descriptors.Descriptor wpi_proto_ProtobufTrajectoryState_descriptor = descriptor.internalContainedType(50, 186, "ProtobufTrajectoryState", "wpi.proto.ProtobufTrajectoryState");
041
042  static final Descriptors.Descriptor wpi_proto_ProtobufTrajectory_descriptor = descriptor.internalContainedType(238, 80, "ProtobufTrajectory", "wpi.proto.ProtobufTrajectory");
043
044  /**
045   * @return this proto file's descriptor.
046   */
047  public static Descriptors.FileDescriptor getDescriptor() {
048    return descriptor;
049  }
050
051  /**
052   * Protobuf type {@code ProtobufTrajectoryState}
053   */
054  public static final class ProtobufTrajectoryState extends ProtoMessage<ProtobufTrajectoryState> implements Cloneable {
055    private static final long serialVersionUID = 0L;
056
057    /**
058     * <code>optional double time = 1;</code>
059     */
060    private double time;
061
062    /**
063     * <code>optional double velocity = 2;</code>
064     */
065    private double velocity;
066
067    /**
068     * <code>optional double acceleration = 3;</code>
069     */
070    private double acceleration;
071
072    /**
073     * <code>optional double curvature = 5;</code>
074     */
075    private double curvature;
076
077    /**
078     * <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
079     */
080    private final Geometry2D.ProtobufPose2d pose = Geometry2D.ProtobufPose2d.newInstance();
081
082    private ProtobufTrajectoryState() {
083    }
084
085    /**
086     * @return a new empty instance of {@code ProtobufTrajectoryState}
087     */
088    public static ProtobufTrajectoryState newInstance() {
089      return new ProtobufTrajectoryState();
090    }
091
092    /**
093     * <code>optional double time = 1;</code>
094     * @return whether the time field is set
095     */
096    public boolean hasTime() {
097      return (bitField0_ & 0x00000001) != 0;
098    }
099
100    /**
101     * <code>optional double time = 1;</code>
102     * @return this
103     */
104    public ProtobufTrajectoryState clearTime() {
105      bitField0_ &= ~0x00000001;
106      time = 0D;
107      return this;
108    }
109
110    /**
111     * <code>optional double time = 1;</code>
112     * @return the time
113     */
114    public double getTime() {
115      return time;
116    }
117
118    /**
119     * <code>optional double time = 1;</code>
120     * @param value the time to set
121     * @return this
122     */
123    public ProtobufTrajectoryState setTime(final double value) {
124      bitField0_ |= 0x00000001;
125      time = value;
126      return this;
127    }
128
129    /**
130     * <code>optional double velocity = 2;</code>
131     * @return whether the velocity field is set
132     */
133    public boolean hasVelocity() {
134      return (bitField0_ & 0x00000002) != 0;
135    }
136
137    /**
138     * <code>optional double velocity = 2;</code>
139     * @return this
140     */
141    public ProtobufTrajectoryState clearVelocity() {
142      bitField0_ &= ~0x00000002;
143      velocity = 0D;
144      return this;
145    }
146
147    /**
148     * <code>optional double velocity = 2;</code>
149     * @return the velocity
150     */
151    public double getVelocity() {
152      return velocity;
153    }
154
155    /**
156     * <code>optional double velocity = 2;</code>
157     * @param value the velocity to set
158     * @return this
159     */
160    public ProtobufTrajectoryState setVelocity(final double value) {
161      bitField0_ |= 0x00000002;
162      velocity = value;
163      return this;
164    }
165
166    /**
167     * <code>optional double acceleration = 3;</code>
168     * @return whether the acceleration field is set
169     */
170    public boolean hasAcceleration() {
171      return (bitField0_ & 0x00000004) != 0;
172    }
173
174    /**
175     * <code>optional double acceleration = 3;</code>
176     * @return this
177     */
178    public ProtobufTrajectoryState clearAcceleration() {
179      bitField0_ &= ~0x00000004;
180      acceleration = 0D;
181      return this;
182    }
183
184    /**
185     * <code>optional double acceleration = 3;</code>
186     * @return the acceleration
187     */
188    public double getAcceleration() {
189      return acceleration;
190    }
191
192    /**
193     * <code>optional double acceleration = 3;</code>
194     * @param value the acceleration to set
195     * @return this
196     */
197    public ProtobufTrajectoryState setAcceleration(final double value) {
198      bitField0_ |= 0x00000004;
199      acceleration = value;
200      return this;
201    }
202
203    /**
204     * <code>optional double curvature = 5;</code>
205     * @return whether the curvature field is set
206     */
207    public boolean hasCurvature() {
208      return (bitField0_ & 0x00000008) != 0;
209    }
210
211    /**
212     * <code>optional double curvature = 5;</code>
213     * @return this
214     */
215    public ProtobufTrajectoryState clearCurvature() {
216      bitField0_ &= ~0x00000008;
217      curvature = 0D;
218      return this;
219    }
220
221    /**
222     * <code>optional double curvature = 5;</code>
223     * @return the curvature
224     */
225    public double getCurvature() {
226      return curvature;
227    }
228
229    /**
230     * <code>optional double curvature = 5;</code>
231     * @param value the curvature to set
232     * @return this
233     */
234    public ProtobufTrajectoryState setCurvature(final double value) {
235      bitField0_ |= 0x00000008;
236      curvature = value;
237      return this;
238    }
239
240    /**
241     * <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
242     * @return whether the pose field is set
243     */
244    public boolean hasPose() {
245      return (bitField0_ & 0x00000010) != 0;
246    }
247
248    /**
249     * <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
250     * @return this
251     */
252    public ProtobufTrajectoryState clearPose() {
253      bitField0_ &= ~0x00000010;
254      pose.clear();
255      return this;
256    }
257
258    /**
259     * <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
260     *
261     * This method returns the internal storage object without modifying any has state.
262     * The returned object should not be modified and be treated as read-only.
263     *
264     * Use {@link #getMutablePose()} if you want to modify it.
265     *
266     * @return internal storage object for reading
267     */
268    public Geometry2D.ProtobufPose2d getPose() {
269      return pose;
270    }
271
272    /**
273     * <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
274     *
275     * This method returns the internal storage object and sets the corresponding
276     * has state. The returned object will become part of this message and its
277     * contents may be modified as long as the has state is not cleared.
278     *
279     * @return internal storage object for modifications
280     */
281    public Geometry2D.ProtobufPose2d getMutablePose() {
282      bitField0_ |= 0x00000010;
283      return pose;
284    }
285
286    /**
287     * <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
288     * @param value the pose to set
289     * @return this
290     */
291    public ProtobufTrajectoryState setPose(final Geometry2D.ProtobufPose2d value) {
292      bitField0_ |= 0x00000010;
293      pose.copyFrom(value);
294      return this;
295    }
296
297    @Override
298    public ProtobufTrajectoryState copyFrom(final ProtobufTrajectoryState other) {
299      cachedSize = other.cachedSize;
300      if ((bitField0_ | other.bitField0_) != 0) {
301        bitField0_ = other.bitField0_;
302        time = other.time;
303        velocity = other.velocity;
304        acceleration = other.acceleration;
305        curvature = other.curvature;
306        pose.copyFrom(other.pose);
307      }
308      return this;
309    }
310
311    @Override
312    public ProtobufTrajectoryState mergeFrom(final ProtobufTrajectoryState other) {
313      if (other.isEmpty()) {
314        return this;
315      }
316      cachedSize = -1;
317      if (other.hasTime()) {
318        setTime(other.time);
319      }
320      if (other.hasVelocity()) {
321        setVelocity(other.velocity);
322      }
323      if (other.hasAcceleration()) {
324        setAcceleration(other.acceleration);
325      }
326      if (other.hasCurvature()) {
327        setCurvature(other.curvature);
328      }
329      if (other.hasPose()) {
330        getMutablePose().mergeFrom(other.pose);
331      }
332      return this;
333    }
334
335    @Override
336    public ProtobufTrajectoryState clear() {
337      if (isEmpty()) {
338        return this;
339      }
340      cachedSize = -1;
341      bitField0_ = 0;
342      time = 0D;
343      velocity = 0D;
344      acceleration = 0D;
345      curvature = 0D;
346      pose.clear();
347      return this;
348    }
349
350    @Override
351    public ProtobufTrajectoryState clearQuick() {
352      if (isEmpty()) {
353        return this;
354      }
355      cachedSize = -1;
356      bitField0_ = 0;
357      pose.clearQuick();
358      return this;
359    }
360
361    @Override
362    public boolean equals(Object o) {
363      if (o == this) {
364        return true;
365      }
366      if (!(o instanceof ProtobufTrajectoryState)) {
367        return false;
368      }
369      ProtobufTrajectoryState other = (ProtobufTrajectoryState) o;
370      return bitField0_ == other.bitField0_
371        && (!hasTime() || ProtoUtil.isEqual(time, other.time))
372        && (!hasVelocity() || ProtoUtil.isEqual(velocity, other.velocity))
373        && (!hasAcceleration() || ProtoUtil.isEqual(acceleration, other.acceleration))
374        && (!hasCurvature() || ProtoUtil.isEqual(curvature, other.curvature))
375        && (!hasPose() || pose.equals(other.pose));
376    }
377
378    @Override
379    public void writeTo(final ProtoSink output) throws IOException {
380      if ((bitField0_ & 0x00000001) != 0) {
381        output.writeRawByte((byte) 9);
382        output.writeDoubleNoTag(time);
383      }
384      if ((bitField0_ & 0x00000002) != 0) {
385        output.writeRawByte((byte) 17);
386        output.writeDoubleNoTag(velocity);
387      }
388      if ((bitField0_ & 0x00000004) != 0) {
389        output.writeRawByte((byte) 25);
390        output.writeDoubleNoTag(acceleration);
391      }
392      if ((bitField0_ & 0x00000008) != 0) {
393        output.writeRawByte((byte) 41);
394        output.writeDoubleNoTag(curvature);
395      }
396      if ((bitField0_ & 0x00000010) != 0) {
397        output.writeRawByte((byte) 34);
398        output.writeMessageNoTag(pose);
399      }
400    }
401
402    @Override
403    protected int computeSerializedSize() {
404      int size = 0;
405      if ((bitField0_ & 0x00000001) != 0) {
406        size += 9;
407      }
408      if ((bitField0_ & 0x00000002) != 0) {
409        size += 9;
410      }
411      if ((bitField0_ & 0x00000004) != 0) {
412        size += 9;
413      }
414      if ((bitField0_ & 0x00000008) != 0) {
415        size += 9;
416      }
417      if ((bitField0_ & 0x00000010) != 0) {
418        size += 1 + ProtoSink.computeMessageSizeNoTag(pose);
419      }
420      return size;
421    }
422
423    @Override
424    @SuppressWarnings("fallthrough")
425    public ProtobufTrajectoryState mergeFrom(final ProtoSource input) throws IOException {
426      // Enabled Fall-Through Optimization (QuickBuffers)
427      int tag = input.readTag();
428      while (true) {
429        switch (tag) {
430          case 9: {
431            // time
432            time = input.readDouble();
433            bitField0_ |= 0x00000001;
434            tag = input.readTag();
435            if (tag != 17) {
436              break;
437            }
438          }
439          case 17: {
440            // velocity
441            velocity = input.readDouble();
442            bitField0_ |= 0x00000002;
443            tag = input.readTag();
444            if (tag != 25) {
445              break;
446            }
447          }
448          case 25: {
449            // acceleration
450            acceleration = input.readDouble();
451            bitField0_ |= 0x00000004;
452            tag = input.readTag();
453            if (tag != 41) {
454              break;
455            }
456          }
457          case 41: {
458            // curvature
459            curvature = input.readDouble();
460            bitField0_ |= 0x00000008;
461            tag = input.readTag();
462            if (tag != 34) {
463              break;
464            }
465          }
466          case 34: {
467            // pose
468            input.readMessage(pose);
469            bitField0_ |= 0x00000010;
470            tag = input.readTag();
471            if (tag != 0) {
472              break;
473            }
474          }
475          case 0: {
476            return this;
477          }
478          default: {
479            if (!input.skipField(tag)) {
480              return this;
481            }
482            tag = input.readTag();
483            break;
484          }
485        }
486      }
487    }
488
489    @Override
490    public void writeTo(final JsonSink output) throws IOException {
491      output.beginObject();
492      if ((bitField0_ & 0x00000001) != 0) {
493        output.writeDouble(FieldNames.time, time);
494      }
495      if ((bitField0_ & 0x00000002) != 0) {
496        output.writeDouble(FieldNames.velocity, velocity);
497      }
498      if ((bitField0_ & 0x00000004) != 0) {
499        output.writeDouble(FieldNames.acceleration, acceleration);
500      }
501      if ((bitField0_ & 0x00000008) != 0) {
502        output.writeDouble(FieldNames.curvature, curvature);
503      }
504      if ((bitField0_ & 0x00000010) != 0) {
505        output.writeMessage(FieldNames.pose, pose);
506      }
507      output.endObject();
508    }
509
510    @Override
511    public ProtobufTrajectoryState mergeFrom(final JsonSource input) throws IOException {
512      if (!input.beginObject()) {
513        return this;
514      }
515      while (!input.isAtEnd()) {
516        switch (input.readFieldHash()) {
517          case 3560141: {
518            if (input.isAtField(FieldNames.time)) {
519              if (!input.trySkipNullValue()) {
520                time = input.readDouble();
521                bitField0_ |= 0x00000001;
522              }
523            } else {
524              input.skipUnknownField();
525            }
526            break;
527          }
528          case 2134260957: {
529            if (input.isAtField(FieldNames.velocity)) {
530              if (!input.trySkipNullValue()) {
531                velocity = input.readDouble();
532                bitField0_ |= 0x00000002;
533              }
534            } else {
535              input.skipUnknownField();
536            }
537            break;
538          }
539          case -267299712: {
540            if (input.isAtField(FieldNames.acceleration)) {
541              if (!input.trySkipNullValue()) {
542                acceleration = input.readDouble();
543                bitField0_ |= 0x00000004;
544              }
545            } else {
546              input.skipUnknownField();
547            }
548            break;
549          }
550          case 768611295: {
551            if (input.isAtField(FieldNames.curvature)) {
552              if (!input.trySkipNullValue()) {
553                curvature = input.readDouble();
554                bitField0_ |= 0x00000008;
555              }
556            } else {
557              input.skipUnknownField();
558            }
559            break;
560          }
561          case 3446929: {
562            if (input.isAtField(FieldNames.pose)) {
563              if (!input.trySkipNullValue()) {
564                input.readMessage(pose);
565                bitField0_ |= 0x00000010;
566              }
567            } else {
568              input.skipUnknownField();
569            }
570            break;
571          }
572          default: {
573            input.skipUnknownField();
574            break;
575          }
576        }
577      }
578      input.endObject();
579      return this;
580    }
581
582    @Override
583    public ProtobufTrajectoryState clone() {
584      return new ProtobufTrajectoryState().copyFrom(this);
585    }
586
587    @Override
588    public boolean isEmpty() {
589      return ((bitField0_) == 0);
590    }
591
592    public static ProtobufTrajectoryState parseFrom(final byte[] data) throws
593        InvalidProtocolBufferException {
594      return ProtoMessage.mergeFrom(new ProtobufTrajectoryState(), data).checkInitialized();
595    }
596
597    public static ProtobufTrajectoryState parseFrom(final ProtoSource input) throws IOException {
598      return ProtoMessage.mergeFrom(new ProtobufTrajectoryState(), input).checkInitialized();
599    }
600
601    public static ProtobufTrajectoryState parseFrom(final JsonSource input) throws IOException {
602      return ProtoMessage.mergeFrom(new ProtobufTrajectoryState(), input).checkInitialized();
603    }
604
605    /**
606     * @return factory for creating ProtobufTrajectoryState messages
607     */
608    public static MessageFactory<ProtobufTrajectoryState> getFactory() {
609      return ProtobufTrajectoryStateFactory.INSTANCE;
610    }
611
612    /**
613     * @return this type's descriptor.
614     */
615    public static Descriptors.Descriptor getDescriptor() {
616      return Trajectory.wpi_proto_ProtobufTrajectoryState_descriptor;
617    }
618
619    private enum ProtobufTrajectoryStateFactory implements MessageFactory<ProtobufTrajectoryState> {
620      INSTANCE;
621
622      @Override
623      public ProtobufTrajectoryState create() {
624        return ProtobufTrajectoryState.newInstance();
625      }
626    }
627
628    /**
629     * Contains name constants used for serializing JSON
630     */
631    static class FieldNames {
632      static final FieldName time = FieldName.forField("time");
633
634      static final FieldName velocity = FieldName.forField("velocity");
635
636      static final FieldName acceleration = FieldName.forField("acceleration");
637
638      static final FieldName curvature = FieldName.forField("curvature");
639
640      static final FieldName pose = FieldName.forField("pose");
641    }
642  }
643
644  /**
645   * Protobuf type {@code ProtobufTrajectory}
646   */
647  public static final class ProtobufTrajectory extends ProtoMessage<ProtobufTrajectory> implements Cloneable {
648    private static final long serialVersionUID = 0L;
649
650    /**
651     * <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
652     */
653    private final RepeatedMessage<ProtobufTrajectoryState> states = RepeatedMessage.newEmptyInstance(ProtobufTrajectoryState.getFactory());
654
655    private ProtobufTrajectory() {
656    }
657
658    /**
659     * @return a new empty instance of {@code ProtobufTrajectory}
660     */
661    public static ProtobufTrajectory newInstance() {
662      return new ProtobufTrajectory();
663    }
664
665    /**
666     * <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
667     * @return whether the states field is set
668     */
669    public boolean hasStates() {
670      return (bitField0_ & 0x00000001) != 0;
671    }
672
673    /**
674     * <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
675     * @return this
676     */
677    public ProtobufTrajectory clearStates() {
678      bitField0_ &= ~0x00000001;
679      states.clear();
680      return this;
681    }
682
683    /**
684     * <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
685     *
686     * This method returns the internal storage object without modifying any has state.
687     * The returned object should not be modified and be treated as read-only.
688     *
689     * Use {@link #getMutableStates()} if you want to modify it.
690     *
691     * @return internal storage object for reading
692     */
693    public RepeatedMessage<ProtobufTrajectoryState> getStates() {
694      return states;
695    }
696
697    /**
698     * <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
699     *
700     * This method returns the internal storage object and sets the corresponding
701     * has state. The returned object will become part of this message and its
702     * contents may be modified as long as the has state is not cleared.
703     *
704     * @return internal storage object for modifications
705     */
706    public RepeatedMessage<ProtobufTrajectoryState> getMutableStates() {
707      bitField0_ |= 0x00000001;
708      return states;
709    }
710
711    /**
712     * <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
713     * @param value the states to add
714     * @return this
715     */
716    public ProtobufTrajectory addStates(final ProtobufTrajectoryState value) {
717      bitField0_ |= 0x00000001;
718      states.add(value);
719      return this;
720    }
721
722    /**
723     * <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
724     * @param values the states to add
725     * @return this
726     */
727    public ProtobufTrajectory addAllStates(final ProtobufTrajectoryState... values) {
728      bitField0_ |= 0x00000001;
729      states.addAll(values);
730      return this;
731    }
732
733    @Override
734    public ProtobufTrajectory copyFrom(final ProtobufTrajectory other) {
735      cachedSize = other.cachedSize;
736      if ((bitField0_ | other.bitField0_) != 0) {
737        bitField0_ = other.bitField0_;
738        states.copyFrom(other.states);
739      }
740      return this;
741    }
742
743    @Override
744    public ProtobufTrajectory mergeFrom(final ProtobufTrajectory other) {
745      if (other.isEmpty()) {
746        return this;
747      }
748      cachedSize = -1;
749      if (other.hasStates()) {
750        getMutableStates().addAll(other.states);
751      }
752      return this;
753    }
754
755    @Override
756    public ProtobufTrajectory clear() {
757      if (isEmpty()) {
758        return this;
759      }
760      cachedSize = -1;
761      bitField0_ = 0;
762      states.clear();
763      return this;
764    }
765
766    @Override
767    public ProtobufTrajectory clearQuick() {
768      if (isEmpty()) {
769        return this;
770      }
771      cachedSize = -1;
772      bitField0_ = 0;
773      states.clearQuick();
774      return this;
775    }
776
777    @Override
778    public boolean equals(Object o) {
779      if (o == this) {
780        return true;
781      }
782      if (!(o instanceof ProtobufTrajectory)) {
783        return false;
784      }
785      ProtobufTrajectory other = (ProtobufTrajectory) o;
786      return bitField0_ == other.bitField0_
787        && (!hasStates() || states.equals(other.states));
788    }
789
790    @Override
791    public void writeTo(final ProtoSink output) throws IOException {
792      if ((bitField0_ & 0x00000001) != 0) {
793        for (int i = 0; i < states.length(); i++) {
794          output.writeRawByte((byte) 18);
795          output.writeMessageNoTag(states.get(i));
796        }
797      }
798    }
799
800    @Override
801    protected int computeSerializedSize() {
802      int size = 0;
803      if ((bitField0_ & 0x00000001) != 0) {
804        size += (1 * states.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(states);
805      }
806      return size;
807    }
808
809    @Override
810    @SuppressWarnings("fallthrough")
811    public ProtobufTrajectory mergeFrom(final ProtoSource input) throws IOException {
812      // Enabled Fall-Through Optimization (QuickBuffers)
813      int tag = input.readTag();
814      while (true) {
815        switch (tag) {
816          case 18: {
817            // states
818            tag = input.readRepeatedMessage(states, tag);
819            bitField0_ |= 0x00000001;
820            if (tag != 0) {
821              break;
822            }
823          }
824          case 0: {
825            return this;
826          }
827          default: {
828            if (!input.skipField(tag)) {
829              return this;
830            }
831            tag = input.readTag();
832            break;
833          }
834        }
835      }
836    }
837
838    @Override
839    public void writeTo(final JsonSink output) throws IOException {
840      output.beginObject();
841      if ((bitField0_ & 0x00000001) != 0) {
842        output.writeRepeatedMessage(FieldNames.states, states);
843      }
844      output.endObject();
845    }
846
847    @Override
848    public ProtobufTrajectory mergeFrom(final JsonSource input) throws IOException {
849      if (!input.beginObject()) {
850        return this;
851      }
852      while (!input.isAtEnd()) {
853        switch (input.readFieldHash()) {
854          case -892482046: {
855            if (input.isAtField(FieldNames.states)) {
856              if (!input.trySkipNullValue()) {
857                input.readRepeatedMessage(states);
858                bitField0_ |= 0x00000001;
859              }
860            } else {
861              input.skipUnknownField();
862            }
863            break;
864          }
865          default: {
866            input.skipUnknownField();
867            break;
868          }
869        }
870      }
871      input.endObject();
872      return this;
873    }
874
875    @Override
876    public ProtobufTrajectory clone() {
877      return new ProtobufTrajectory().copyFrom(this);
878    }
879
880    @Override
881    public boolean isEmpty() {
882      return ((bitField0_) == 0);
883    }
884
885    public static ProtobufTrajectory parseFrom(final byte[] data) throws
886        InvalidProtocolBufferException {
887      return ProtoMessage.mergeFrom(new ProtobufTrajectory(), data).checkInitialized();
888    }
889
890    public static ProtobufTrajectory parseFrom(final ProtoSource input) throws IOException {
891      return ProtoMessage.mergeFrom(new ProtobufTrajectory(), input).checkInitialized();
892    }
893
894    public static ProtobufTrajectory parseFrom(final JsonSource input) throws IOException {
895      return ProtoMessage.mergeFrom(new ProtobufTrajectory(), input).checkInitialized();
896    }
897
898    /**
899     * @return factory for creating ProtobufTrajectory messages
900     */
901    public static MessageFactory<ProtobufTrajectory> getFactory() {
902      return ProtobufTrajectoryFactory.INSTANCE;
903    }
904
905    /**
906     * @return this type's descriptor.
907     */
908    public static Descriptors.Descriptor getDescriptor() {
909      return Trajectory.wpi_proto_ProtobufTrajectory_descriptor;
910    }
911
912    private enum ProtobufTrajectoryFactory implements MessageFactory<ProtobufTrajectory> {
913      INSTANCE;
914
915      @Override
916      public ProtobufTrajectory create() {
917        return ProtobufTrajectory.newInstance();
918      }
919    }
920
921    /**
922     * Contains name constants used for serializing JSON
923     */
924    static class FieldNames {
925      static final FieldName states = FieldName.forField("states");
926    }
927  }
928}