RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
ProtobufRotation2d.java
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4// Code generated by protocol buffer compiler. Do not edit!
5package org.wpilib.math.geometry.proto.detail;
6
7import java.io.IOException;
8import us.hebi.quickbuf.Descriptors;
9import us.hebi.quickbuf.FieldName;
10import us.hebi.quickbuf.InvalidProtocolBufferException;
11import us.hebi.quickbuf.JsonSink;
12import us.hebi.quickbuf.JsonSource;
13import us.hebi.quickbuf.MessageFactory;
14import us.hebi.quickbuf.ProtoMessage;
15import us.hebi.quickbuf.ProtoSink;
16import us.hebi.quickbuf.ProtoSource;
17import us.hebi.quickbuf.ProtoUtil;
18
22@SuppressWarnings("hiding")
23public final class ProtobufRotation2d extends ProtoMessage<ProtobufRotation2d> implements Cloneable {
24 private static final long serialVersionUID = 0L;
25
29 private double value_;
30
31 private ProtobufRotation2d() {
32 }
33
37 public static ProtobufRotation2d newInstance() {
38 return new ProtobufRotation2d();
39 }
40
45 public boolean hasValue() {
46 return (bitField0_ & 0x00000001) != 0;
47 }
48
53 public ProtobufRotation2d clearValue() {
54 bitField0_ &= ~0x00000001;
55 value_ = 0D;
56 return this;
57 }
58
63 public double getValue() {
64 return value_;
65 }
66
72 public ProtobufRotation2d setValue(final double value) {
73 bitField0_ |= 0x00000001;
74 value_ = value;
75 return this;
76 }
77
78 @Override
79 public ProtobufRotation2d copyFrom(final ProtobufRotation2d other) {
80 cachedSize = other.cachedSize;
81 if ((bitField0_ | other.bitField0_) != 0) {
82 bitField0_ = other.bitField0_;
83 value_ = other.value_;
84 }
85 return this;
86 }
87
88 @Override
89 public ProtobufRotation2d mergeFrom(final ProtobufRotation2d other) {
90 if (other.isEmpty()) {
91 return this;
92 }
93 cachedSize = -1;
94 if (other.hasValue()) {
95 setValue(other.value_);
96 }
97 return this;
98 }
99
100 @Override
101 public ProtobufRotation2d clear() {
102 if (isEmpty()) {
103 return this;
104 }
105 cachedSize = -1;
106 bitField0_ = 0;
107 value_ = 0D;
108 return this;
109 }
110
111 @Override
112 public ProtobufRotation2d clearQuick() {
113 if (isEmpty()) {
114 return this;
115 }
116 cachedSize = -1;
117 bitField0_ = 0;
118 return this;
119 }
120
121 @Override
122 public boolean equals(Object o) {
123 if (o == this) {
124 return true;
125 }
126 if (!(o instanceof ProtobufRotation2d)) {
127 return false;
128 }
130 return bitField0_ == other.bitField0_
131 && (!hasValue() || ProtoUtil.isEqual(value_, other.value_));
132 }
133
134 @Override
135 public void writeTo(final ProtoSink output) throws IOException {
136 if ((bitField0_ & 0x00000001) != 0) {
137 output.writeRawByte((byte) 9);
138 output.writeDoubleNoTag(value_);
139 }
140 }
141
142 @Override
143 protected int computeSerializedSize() {
144 int size = 0;
145 if ((bitField0_ & 0x00000001) != 0) {
146 size += 9;
147 }
148 return size;
149 }
150
151 @Override
152 @SuppressWarnings("fallthrough")
153 public ProtobufRotation2d mergeFrom(final ProtoSource input) throws IOException {
154 // Enabled Fall-Through Optimization (QuickBuffers)
155 int tag = input.readTag();
156 while (true) {
157 switch (tag) {
158 case 9: {
159 // value_
160 value_ = input.readDouble();
161 bitField0_ |= 0x00000001;
162 tag = input.readTag();
163 if (tag != 0) {
164 break;
165 }
166 }
167 case 0: {
168 return this;
169 }
170 default: {
171 if (!input.skipField(tag)) {
172 return this;
173 }
174 tag = input.readTag();
175 break;
176 }
177 }
178 }
179 }
180
181 @Override
182 public void writeTo(final JsonSink output) throws IOException {
183 output.beginObject();
184 if ((bitField0_ & 0x00000001) != 0) {
185 output.writeDouble(FieldNames.value_, value_);
186 }
187 output.endObject();
188 }
189
190 @Override
191 public ProtobufRotation2d mergeFrom(final JsonSource input) throws IOException {
192 if (!input.beginObject()) {
193 return this;
194 }
195 while (!input.isAtEnd()) {
196 switch (input.readFieldHash()) {
197 case 111972721: {
198 if (input.isAtField(FieldNames.value_)) {
199 if (!input.trySkipNullValue()) {
200 value_ = input.readDouble();
201 bitField0_ |= 0x00000001;
202 }
203 } else {
204 input.skipUnknownField();
205 }
206 break;
207 }
208 default: {
209 input.skipUnknownField();
210 break;
211 }
212 }
213 }
214 input.endObject();
215 return this;
216 }
217
218 @Override
219 public ProtobufRotation2d clone() {
220 return new ProtobufRotation2d().copyFrom(this);
221 }
222
223 @Override
224 public boolean isEmpty() {
225 return ((bitField0_) == 0);
226 }
227
228 public static ProtobufRotation2d parseFrom(final byte[] data) throws
229 InvalidProtocolBufferException {
230 return ProtoMessage.mergeFrom(new ProtobufRotation2d(), data).checkInitialized();
231 }
232
233 public static ProtobufRotation2d parseFrom(final ProtoSource input) throws IOException {
234 return ProtoMessage.mergeFrom(new ProtobufRotation2d(), input).checkInitialized();
235 }
236
237 public static ProtobufRotation2d parseFrom(final JsonSource input) throws IOException {
238 return ProtoMessage.mergeFrom(new ProtobufRotation2d(), input).checkInitialized();
239 }
240
244 public static MessageFactory<ProtobufRotation2d> getFactory() {
245 return ProtobufRotation2dFactory.INSTANCE;
246 }
247
251 public static Descriptors.Descriptor getDescriptor() {
252 return ProtobufGeometry2dDescriptor.wpi_proto_ProtobufRotation2d_descriptor;
253 }
254
255 private enum ProtobufRotation2dFactory implements MessageFactory<ProtobufRotation2d> {
256 INSTANCE;
257
258 @Override
259 public ProtobufRotation2d create() {
260 return ProtobufRotation2d.newInstance();
261 }
262 }
263
267 static class FieldNames {
268 static final FieldName value_ = FieldName.forField("value");
269 }
270}
static MessageFactory< ProtobufRotation2d > getFactory()