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 ProtobufChassisAccelerations} 021 */ 022@SuppressWarnings("hiding") 023public final class ProtobufChassisAccelerations extends ProtoMessage<ProtobufChassisAccelerations> implements Cloneable { 024 private static final long serialVersionUID = 0L; 025 026 /** 027 * <code>optional double ax = 1;</code> 028 */ 029 private double ax; 030 031 /** 032 * <code>optional double ay = 2;</code> 033 */ 034 private double ay; 035 036 /** 037 * <code>optional double alpha = 3;</code> 038 */ 039 private double alpha; 040 041 private ProtobufChassisAccelerations() { 042 } 043 044 /** 045 * @return a new empty instance of {@code ProtobufChassisAccelerations} 046 */ 047 public static ProtobufChassisAccelerations newInstance() { 048 return new ProtobufChassisAccelerations(); 049 } 050 051 /** 052 * <code>optional double ax = 1;</code> 053 * @return whether the ax field is set 054 */ 055 public boolean hasAx() { 056 return (bitField0_ & 0x00000001) != 0; 057 } 058 059 /** 060 * <code>optional double ax = 1;</code> 061 * @return this 062 */ 063 public ProtobufChassisAccelerations clearAx() { 064 bitField0_ &= ~0x00000001; 065 ax = 0D; 066 return this; 067 } 068 069 /** 070 * <code>optional double ax = 1;</code> 071 * @return the ax 072 */ 073 public double getAx() { 074 return ax; 075 } 076 077 /** 078 * <code>optional double ax = 1;</code> 079 * @param value the ax to set 080 * @return this 081 */ 082 public ProtobufChassisAccelerations setAx(final double value) { 083 bitField0_ |= 0x00000001; 084 ax = value; 085 return this; 086 } 087 088 /** 089 * <code>optional double ay = 2;</code> 090 * @return whether the ay field is set 091 */ 092 public boolean hasAy() { 093 return (bitField0_ & 0x00000002) != 0; 094 } 095 096 /** 097 * <code>optional double ay = 2;</code> 098 * @return this 099 */ 100 public ProtobufChassisAccelerations clearAy() { 101 bitField0_ &= ~0x00000002; 102 ay = 0D; 103 return this; 104 } 105 106 /** 107 * <code>optional double ay = 2;</code> 108 * @return the ay 109 */ 110 public double getAy() { 111 return ay; 112 } 113 114 /** 115 * <code>optional double ay = 2;</code> 116 * @param value the ay to set 117 * @return this 118 */ 119 public ProtobufChassisAccelerations setAy(final double value) { 120 bitField0_ |= 0x00000002; 121 ay = value; 122 return this; 123 } 124 125 /** 126 * <code>optional double alpha = 3;</code> 127 * @return whether the alpha field is set 128 */ 129 public boolean hasAlpha() { 130 return (bitField0_ & 0x00000004) != 0; 131 } 132 133 /** 134 * <code>optional double alpha = 3;</code> 135 * @return this 136 */ 137 public ProtobufChassisAccelerations clearAlpha() { 138 bitField0_ &= ~0x00000004; 139 alpha = 0D; 140 return this; 141 } 142 143 /** 144 * <code>optional double alpha = 3;</code> 145 * @return the alpha 146 */ 147 public double getAlpha() { 148 return alpha; 149 } 150 151 /** 152 * <code>optional double alpha = 3;</code> 153 * @param value the alpha to set 154 * @return this 155 */ 156 public ProtobufChassisAccelerations setAlpha(final double value) { 157 bitField0_ |= 0x00000004; 158 alpha = value; 159 return this; 160 } 161 162 @Override 163 public ProtobufChassisAccelerations copyFrom(final ProtobufChassisAccelerations other) { 164 cachedSize = other.cachedSize; 165 if ((bitField0_ | other.bitField0_) != 0) { 166 bitField0_ = other.bitField0_; 167 ax = other.ax; 168 ay = other.ay; 169 alpha = other.alpha; 170 } 171 return this; 172 } 173 174 @Override 175 public ProtobufChassisAccelerations mergeFrom(final ProtobufChassisAccelerations other) { 176 if (other.isEmpty()) { 177 return this; 178 } 179 cachedSize = -1; 180 if (other.hasAx()) { 181 setAx(other.ax); 182 } 183 if (other.hasAy()) { 184 setAy(other.ay); 185 } 186 if (other.hasAlpha()) { 187 setAlpha(other.alpha); 188 } 189 return this; 190 } 191 192 @Override 193 public ProtobufChassisAccelerations clear() { 194 if (isEmpty()) { 195 return this; 196 } 197 cachedSize = -1; 198 bitField0_ = 0; 199 ax = 0D; 200 ay = 0D; 201 alpha = 0D; 202 return this; 203 } 204 205 @Override 206 public ProtobufChassisAccelerations clearQuick() { 207 if (isEmpty()) { 208 return this; 209 } 210 cachedSize = -1; 211 bitField0_ = 0; 212 return this; 213 } 214 215 @Override 216 public boolean equals(Object o) { 217 if (o == this) { 218 return true; 219 } 220 if (!(o instanceof ProtobufChassisAccelerations)) { 221 return false; 222 } 223 ProtobufChassisAccelerations other = (ProtobufChassisAccelerations) o; 224 return bitField0_ == other.bitField0_ 225 && (!hasAx() || ProtoUtil.isEqual(ax, other.ax)) 226 && (!hasAy() || ProtoUtil.isEqual(ay, other.ay)) 227 && (!hasAlpha() || ProtoUtil.isEqual(alpha, other.alpha)); 228 } 229 230 @Override 231 public void writeTo(final ProtoSink output) throws IOException { 232 if ((bitField0_ & 0x00000001) != 0) { 233 output.writeRawByte((byte) 9); 234 output.writeDoubleNoTag(ax); 235 } 236 if ((bitField0_ & 0x00000002) != 0) { 237 output.writeRawByte((byte) 17); 238 output.writeDoubleNoTag(ay); 239 } 240 if ((bitField0_ & 0x00000004) != 0) { 241 output.writeRawByte((byte) 25); 242 output.writeDoubleNoTag(alpha); 243 } 244 } 245 246 @Override 247 protected int computeSerializedSize() { 248 int size = 0; 249 if ((bitField0_ & 0x00000001) != 0) { 250 size += 9; 251 } 252 if ((bitField0_ & 0x00000002) != 0) { 253 size += 9; 254 } 255 if ((bitField0_ & 0x00000004) != 0) { 256 size += 9; 257 } 258 return size; 259 } 260 261 @Override 262 @SuppressWarnings("fallthrough") 263 public ProtobufChassisAccelerations mergeFrom(final ProtoSource input) throws IOException { 264 // Enabled Fall-Through Optimization (QuickBuffers) 265 int tag = input.readTag(); 266 while (true) { 267 switch (tag) { 268 case 9: { 269 // ax 270 ax = input.readDouble(); 271 bitField0_ |= 0x00000001; 272 tag = input.readTag(); 273 if (tag != 17) { 274 break; 275 } 276 } 277 case 17: { 278 // ay 279 ay = input.readDouble(); 280 bitField0_ |= 0x00000002; 281 tag = input.readTag(); 282 if (tag != 25) { 283 break; 284 } 285 } 286 case 25: { 287 // alpha 288 alpha = input.readDouble(); 289 bitField0_ |= 0x00000004; 290 tag = input.readTag(); 291 if (tag != 0) { 292 break; 293 } 294 } 295 case 0: { 296 return this; 297 } 298 default: { 299 if (!input.skipField(tag)) { 300 return this; 301 } 302 tag = input.readTag(); 303 break; 304 } 305 } 306 } 307 } 308 309 @Override 310 public void writeTo(final JsonSink output) throws IOException { 311 output.beginObject(); 312 if ((bitField0_ & 0x00000001) != 0) { 313 output.writeDouble(FieldNames.ax, ax); 314 } 315 if ((bitField0_ & 0x00000002) != 0) { 316 output.writeDouble(FieldNames.ay, ay); 317 } 318 if ((bitField0_ & 0x00000004) != 0) { 319 output.writeDouble(FieldNames.alpha, alpha); 320 } 321 output.endObject(); 322 } 323 324 @Override 325 public ProtobufChassisAccelerations mergeFrom(final JsonSource input) throws IOException { 326 if (!input.beginObject()) { 327 return this; 328 } 329 while (!input.isAtEnd()) { 330 switch (input.readFieldHash()) { 331 case 3127: { 332 if (input.isAtField(FieldNames.ax)) { 333 if (!input.trySkipNullValue()) { 334 ax = input.readDouble(); 335 bitField0_ |= 0x00000001; 336 } 337 } else { 338 input.skipUnknownField(); 339 } 340 break; 341 } 342 case 3128: { 343 if (input.isAtField(FieldNames.ay)) { 344 if (!input.trySkipNullValue()) { 345 ay = input.readDouble(); 346 bitField0_ |= 0x00000002; 347 } 348 } else { 349 input.skipUnknownField(); 350 } 351 break; 352 } 353 case 92909918: { 354 if (input.isAtField(FieldNames.alpha)) { 355 if (!input.trySkipNullValue()) { 356 alpha = input.readDouble(); 357 bitField0_ |= 0x00000004; 358 } 359 } else { 360 input.skipUnknownField(); 361 } 362 break; 363 } 364 default: { 365 input.skipUnknownField(); 366 break; 367 } 368 } 369 } 370 input.endObject(); 371 return this; 372 } 373 374 @Override 375 public ProtobufChassisAccelerations clone() { 376 return new ProtobufChassisAccelerations().copyFrom(this); 377 } 378 379 @Override 380 public boolean isEmpty() { 381 return ((bitField0_) == 0); 382 } 383 384 public static ProtobufChassisAccelerations parseFrom(final byte[] data) throws 385 InvalidProtocolBufferException { 386 return ProtoMessage.mergeFrom(new ProtobufChassisAccelerations(), data).checkInitialized(); 387 } 388 389 public static ProtobufChassisAccelerations parseFrom(final ProtoSource input) throws IOException { 390 return ProtoMessage.mergeFrom(new ProtobufChassisAccelerations(), input).checkInitialized(); 391 } 392 393 public static ProtobufChassisAccelerations parseFrom(final JsonSource input) throws IOException { 394 return ProtoMessage.mergeFrom(new ProtobufChassisAccelerations(), input).checkInitialized(); 395 } 396 397 /** 398 * @return factory for creating ProtobufChassisAccelerations messages 399 */ 400 public static MessageFactory<ProtobufChassisAccelerations> getFactory() { 401 return ProtobufChassisAccelerationsFactory.INSTANCE; 402 } 403 404 /** 405 * @return this type's descriptor. 406 */ 407 public static Descriptors.Descriptor getDescriptor() { 408 return ProtobufKinematicsDescriptor.wpi_proto_ProtobufChassisAccelerations_descriptor; 409 } 410 411 private enum ProtobufChassisAccelerationsFactory implements MessageFactory<ProtobufChassisAccelerations> { 412 INSTANCE; 413 414 @Override 415 public ProtobufChassisAccelerations create() { 416 return ProtobufChassisAccelerations.newInstance(); 417 } 418 } 419 420 /** 421 * Contains name constants used for serializing JSON 422 */ 423 static class FieldNames { 424 static final FieldName ax = FieldName.forField("ax"); 425 426 static final FieldName ay = FieldName.forField("ay"); 427 428 static final FieldName alpha = FieldName.forField("alpha"); 429 } 430}