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