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.commands3.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; 020import us.hebi.quickbuf.Utf8String; 021 022public final class ProtobufCommands { 023 private static final RepeatedByte descriptorData = ProtoUtil.decodeBase64(2543, 024 "Chdwcm90b2J1Zl9jb21tYW5kcy5wcm90bxIJd3BpLnByb3RvIicKEVByb3RvYnVmTWVjaGFuaXNtEhIK" + 025 "BG5hbWUYASABKAlSBG5hbWUitgIKD1Byb3RvYnVmQ29tbWFuZBIOCgJpZBgBIAEoDVICaWQSIAoJcGFy" + 026 "ZW50X2lkGAIgASgNSABSCHBhcmVudElkiAEBEhIKBG5hbWUYAyABKAlSBG5hbWUSGgoIcHJpb3JpdHkY" + 027 "BCABKAVSCHByaW9yaXR5EkAKDHJlcXVpcmVtZW50cxgFIAMoCzIcLndwaS5wcm90by5Qcm90b2J1Zk1l" + 028 "Y2hhbmlzbVIMcmVxdWlyZW1lbnRzEiUKDGxhc3RfdGltZV9tcxgGIAEoAUgBUgpsYXN0VGltZU1ziAEB" + 029 "EicKDXRvdGFsX3RpbWVfbXMYByABKAFIAlILdG90YWxUaW1lTXOIAQFCDAoKX3BhcmVudF9pZEIPCg1f" + 030 "bGFzdF90aW1lX21zQhAKDl90b3RhbF90aW1lX21zIsEBChFQcm90b2J1ZlNjaGVkdWxlchJDCg9xdWV1" + 031 "ZWRfY29tbWFuZHMYASADKAsyGi53cGkucHJvdG8uUHJvdG9idWZDb21tYW5kUg5xdWV1ZWRDb21tYW5k" + 032 "cxJFChBydW5uaW5nX2NvbW1hbmRzGAIgAygLMhoud3BpLnByb3RvLlByb3RvYnVmQ29tbWFuZFIPcnVu" + 033 "bmluZ0NvbW1hbmRzEiAKDGxhc3RfdGltZV9tcxgDIAEoAVIKbGFzdFRpbWVNc0IcChpvcmcud3BpbGli" + 034 "LmNvbW1hbmRzMy5wcm90b0r8DgoGEgQAADgBCggKAQwSAwAAEgoICgECEgMCABIKCAoBCBIDBAAzCgkK" + 035 "AggBEgMEADMK8QEKAgQAEgQQABIBMuQBCk9yIHVzZSB0aGUgZ2VuZXJhdGVfZmlsZXMucHkgc2NyaXB0" + 036 "OgoKIyBtYWNPUwphbGx3cGlsaWIgJCAuL2NvbW1hbmRzdjMvZ2VuZXJhdGVfZmlsZXMucHkgLS1wcm90" + 037 "b2M9cHJvdG9jLXF1aWNrYnVmCgojIExpbnV4CmFsbHdwaWxpYiAkIC4vY29tbWFuZHN2My9nZW5lcmF0" + 038 "ZV9maWxlcy5weSAtLXF1aWNrYnVmX3BsdWdpbiBwcm90b2MtZ2VuLXF1aWNrYnVmLTEuMy4zLWxpbnV4" + 039 "LXg4Nl82NC5leGUKCgoKAwQAARIDEAgZCgsKBAQAAgASAxECEgoMCgUEAAIABRIDEQIICgwKBQQAAgAB" + 040 "EgMRCQ0KDAoFBAACAAMSAxEQEQoKCgIEARIEFAAtAQoKCgMEAQESAxQIFwpxCgQEAQIAEgMXAhAaZCBB" + 041 "IHVuaXF1ZSBJRCBmb3IgdGhlIGNvbW1hbmQuCiBEaWZmZXJlbnQgaW52b2NhdGlvbnMgb2YgdGhlIHNh" + 042 "bWUgY29tbWFuZCBvYmplY3QgaGF2ZSBkaWZmZXJlbnQgSURzLgoKDAoFBAECAAUSAxcCCAoMCgUEAQIA" + 043 "ARIDFwkLCgwKBQQBAgADEgMXDg8KYQoEBAECARIDGwIgGlQgVGhlIElEIG9mIHRoZSBwYXJlbnQgY29t", 044 "bWFuZC4KIE5vdCBpbmNsdWRlZCBpbiB0aGUgbWVzc2FnZSBmb3IgdG9wLWxldmVsIGNvbW1hbmRzLgoK" + 045 "DAoFBAECAQQSAxsCCgoMCgUEAQIBBRIDGwsRCgwKBQQBAgEBEgMbEhsKDAoFBAECAQMSAxseHwonCgQE" + 046 "AQICEgMeAhIaGiBUaGUgbmFtZSBvZiB0aGUgY29tbWFuZC4KCgwKBQQBAgIFEgMeAggKDAoFBAECAgES" + 047 "Ax4JDQoMCgUEAQICAxIDHhARCjEKBAQBAgMSAyECFRokIFRoZSBwcmlvcml0eSBsZXZlbCBvZiB0aGUg" + 048 "Y29tbWFuZC4KCgwKBQQBAgMFEgMhAgcKDAoFBAECAwESAyEIEAoMCgUEAQIDAxIDIRMUCjYKBAQBAgQS" + 049 "AyQCLhopIFRoZSBtZWNoYW5pc21zIHJlcXVpcmVkIGJ5IHRoZSBjb21tYW5kLgoKDAoFBAECBAQSAyQC" + 050 "CgoMCgUEAQIEBhIDJAscCgwKBQQBAgQBEgMkHSkKDAoFBAECBAMSAyQsLQqOAQoEBAECBRIDKAIjGoAB" + 051 "IEhvdyBtdWNoIHRpbWUgdGhlIGNvbW1hbmQgdG9vayB0byBleGVjdXRlIGluIGl0cyBtb3N0IHJlY2Vu" + 052 "dCBydW4uCiBPbmx5IGluY2x1ZGVkIGluIGEgbWVzc2FnZSBmb3IgYW4gYWN0aXZlbHkgcnVubmluZyBj" + 053 "b21tYW5kLgoKDAoFBAECBQQSAygCCgoMCgUEAQIFBRIDKAsRCgwKBQQBAgUBEgMoEh4KDAoFBAECBQMS" + 054 "AyghIgqAAQoEBAECBhIDLAIkGnMgSG93IGxvbmcgdGhlIGNvbW1hbmQgaGFzIHRha2VuIHRvIHJ1biwg" + 055 "aW4gYWdncmVnYXRlLgogT25seSBpbmNsdWRlZCBpbiBhIG1lc3NhZ2UgZm9yIGFuIGFjdGl2ZWx5IHJ1" + 056 "bm5pbmcgY29tbWFuZC4KCgwKBQQBAgYEEgMsAgoKDAoFBAECBgUSAywLEQoMCgUEAQIGARIDLBIfCgwK" + 057 "BQQBAgYDEgMsIiMKCgoCBAISBC8AOAEKCgoDBAIBEgMvCBkKjQIKBAQCAgASAzMCLxr/ASBOb3RlOiBj" + 058 "b21tYW5kcyBhcmUgZ2VuZXJhbGx5IHF1ZXVlZCBieSB0cmlnZ2Vycywgd2hpY2ggb2NjdXJzIGltbWVk" + 059 "aWF0ZWx5IGJlZm9yZSB0aGV5IGFyZQogcHJvbW90ZWQgYW5kIHN0YXJ0IHJ1bm5pbmcuIEVudHJpZXMg" + 060 "d2lsbCBvbmx5IGFwcGVhciBoZXJlIHdoZW4gc2VyaWFsaXppbmcgYSBzY2hlZHVsZXIKIF9hZnRlcl8g" + 061 "bWFudWFsbHkgc2NoZWR1bGluZyBhIGNvbW1hbmQgYnV0IF9iZWZvcmVfIGNhbGxpbmcgc2NoZWR1bGVy" + 062 "LnJ1bigpCgoMCgUEAgIABBIDMwIKCgwKBQQCAgAGEgMzCxoKDAoFBAICAAESAzMbKgoMCgUEAgIAAxID" + 063 "My0uCgsKBAQCAgESAzQCMAoMCgUEAgIBBBIDNAIKCgwKBQQCAgEGEgM0CxoKDAoFBAICAQESAzQbKwoM", 064 "CgUEAgIBAxIDNC4vCk8KBAQCAgISAzcCGhpCIEhvdyBtdWNoIHRpbWUgdGhlIHNjaGVkdWxlciB0b29r" + 065 "IGluIGl0cyBsYXN0IGBydW4oKWAgaW52b2NhdGlvbi4KCgwKBQQCAgIFEgM3AggKDAoFBAICAgESAzcJ" + 066 "FQoMCgUEAgICAxIDNxgZYgZwcm90bzM="); 067 068 static final Descriptors.FileDescriptor descriptor = Descriptors.FileDescriptor.internalBuildGeneratedFileFrom("protobuf_commands.proto", "wpi.proto", descriptorData); 069 070 static final Descriptors.Descriptor wpi_proto_ProtobufMechanism_descriptor = descriptor.internalContainedType(38, 39, "ProtobufMechanism", "wpi.proto.ProtobufMechanism"); 071 072 static final Descriptors.Descriptor wpi_proto_ProtobufCommand_descriptor = descriptor.internalContainedType(80, 310, "ProtobufCommand", "wpi.proto.ProtobufCommand"); 073 074 static final Descriptors.Descriptor wpi_proto_ProtobufScheduler_descriptor = descriptor.internalContainedType(393, 193, "ProtobufScheduler", "wpi.proto.ProtobufScheduler"); 075 076 /** 077 * @return this proto file's descriptor. 078 */ 079 public static Descriptors.FileDescriptor getDescriptor() { 080 return descriptor; 081 } 082 083 /** 084 * Protobuf type {@code ProtobufMechanism} 085 */ 086 public static final class ProtobufMechanism extends ProtoMessage<ProtobufMechanism> implements Cloneable { 087 private static final long serialVersionUID = 0L; 088 089 /** 090 * <code>optional string name = 1;</code> 091 */ 092 private final Utf8String name = Utf8String.newEmptyInstance(); 093 094 private ProtobufMechanism() { 095 } 096 097 /** 098 * @return a new empty instance of {@code ProtobufMechanism} 099 */ 100 public static ProtobufMechanism newInstance() { 101 return new ProtobufMechanism(); 102 } 103 104 /** 105 * <code>optional string name = 1;</code> 106 * @return whether the name field is set 107 */ 108 public boolean hasName() { 109 return (bitField0_ & 0x00000001) != 0; 110 } 111 112 /** 113 * <code>optional string name = 1;</code> 114 * @return this 115 */ 116 public ProtobufMechanism clearName() { 117 bitField0_ &= ~0x00000001; 118 name.clear(); 119 return this; 120 } 121 122 /** 123 * <code>optional string name = 1;</code> 124 * @return the name 125 */ 126 public String getName() { 127 return name.getString(); 128 } 129 130 /** 131 * <code>optional string name = 1;</code> 132 * @return internal {@code Utf8String} representation of name for reading 133 */ 134 public Utf8String getNameBytes() { 135 return this.name; 136 } 137 138 /** 139 * <code>optional string name = 1;</code> 140 * @return internal {@code Utf8String} representation of name for modifications 141 */ 142 public Utf8String getMutableNameBytes() { 143 bitField0_ |= 0x00000001; 144 return this.name; 145 } 146 147 /** 148 * <code>optional string name = 1;</code> 149 * @param value the name to set 150 * @return this 151 */ 152 public ProtobufMechanism setName(final CharSequence value) { 153 bitField0_ |= 0x00000001; 154 name.copyFrom(value); 155 return this; 156 } 157 158 /** 159 * <code>optional string name = 1;</code> 160 * @param value the name to set 161 * @return this 162 */ 163 public ProtobufMechanism setName(final Utf8String value) { 164 bitField0_ |= 0x00000001; 165 name.copyFrom(value); 166 return this; 167 } 168 169 @Override 170 public ProtobufMechanism copyFrom(final ProtobufMechanism other) { 171 cachedSize = other.cachedSize; 172 if ((bitField0_ | other.bitField0_) != 0) { 173 bitField0_ = other.bitField0_; 174 name.copyFrom(other.name); 175 } 176 return this; 177 } 178 179 @Override 180 public ProtobufMechanism mergeFrom(final ProtobufMechanism other) { 181 if (other.isEmpty()) { 182 return this; 183 } 184 cachedSize = -1; 185 if (other.hasName()) { 186 getMutableNameBytes().copyFrom(other.name); 187 } 188 return this; 189 } 190 191 @Override 192 public ProtobufMechanism clear() { 193 if (isEmpty()) { 194 return this; 195 } 196 cachedSize = -1; 197 bitField0_ = 0; 198 name.clear(); 199 return this; 200 } 201 202 @Override 203 public ProtobufMechanism clearQuick() { 204 if (isEmpty()) { 205 return this; 206 } 207 cachedSize = -1; 208 bitField0_ = 0; 209 name.clear(); 210 return this; 211 } 212 213 @Override 214 public boolean equals(Object o) { 215 if (o == this) { 216 return true; 217 } 218 if (!(o instanceof ProtobufMechanism)) { 219 return false; 220 } 221 ProtobufMechanism other = (ProtobufMechanism) o; 222 return bitField0_ == other.bitField0_ 223 && (!hasName() || name.equals(other.name)); 224 } 225 226 @Override 227 public void writeTo(final ProtoSink output) throws IOException { 228 if ((bitField0_ & 0x00000001) != 0) { 229 output.writeRawByte((byte) 10); 230 output.writeStringNoTag(name); 231 } 232 } 233 234 @Override 235 protected int computeSerializedSize() { 236 int size = 0; 237 if ((bitField0_ & 0x00000001) != 0) { 238 size += 1 + ProtoSink.computeStringSizeNoTag(name); 239 } 240 return size; 241 } 242 243 @Override 244 @SuppressWarnings("fallthrough") 245 public ProtobufMechanism mergeFrom(final ProtoSource input) throws IOException { 246 // Enabled Fall-Through Optimization (QuickBuffers) 247 int tag = input.readTag(); 248 while (true) { 249 switch (tag) { 250 case 10: { 251 // name 252 input.readString(name); 253 bitField0_ |= 0x00000001; 254 tag = input.readTag(); 255 if (tag != 0) { 256 break; 257 } 258 } 259 case 0: { 260 return this; 261 } 262 default: { 263 if (!input.skipField(tag)) { 264 return this; 265 } 266 tag = input.readTag(); 267 break; 268 } 269 } 270 } 271 } 272 273 @Override 274 public void writeTo(final JsonSink output) throws IOException { 275 output.beginObject(); 276 if ((bitField0_ & 0x00000001) != 0) { 277 output.writeString(FieldNames.name, name); 278 } 279 output.endObject(); 280 } 281 282 @Override 283 public ProtobufMechanism mergeFrom(final JsonSource input) throws IOException { 284 if (!input.beginObject()) { 285 return this; 286 } 287 while (!input.isAtEnd()) { 288 switch (input.readFieldHash()) { 289 case 3373707: { 290 if (input.isAtField(FieldNames.name)) { 291 if (!input.trySkipNullValue()) { 292 input.readString(name); 293 bitField0_ |= 0x00000001; 294 } 295 } else { 296 input.skipUnknownField(); 297 } 298 break; 299 } 300 default: { 301 input.skipUnknownField(); 302 break; 303 } 304 } 305 } 306 input.endObject(); 307 return this; 308 } 309 310 @Override 311 public ProtobufMechanism clone() { 312 return new ProtobufMechanism().copyFrom(this); 313 } 314 315 @Override 316 public boolean isEmpty() { 317 return ((bitField0_) == 0); 318 } 319 320 public static ProtobufMechanism parseFrom(final byte[] data) throws 321 InvalidProtocolBufferException { 322 return ProtoMessage.mergeFrom(new ProtobufMechanism(), data).checkInitialized(); 323 } 324 325 public static ProtobufMechanism parseFrom(final ProtoSource input) throws IOException { 326 return ProtoMessage.mergeFrom(new ProtobufMechanism(), input).checkInitialized(); 327 } 328 329 public static ProtobufMechanism parseFrom(final JsonSource input) throws IOException { 330 return ProtoMessage.mergeFrom(new ProtobufMechanism(), input).checkInitialized(); 331 } 332 333 /** 334 * @return factory for creating ProtobufMechanism messages 335 */ 336 public static MessageFactory<ProtobufMechanism> getFactory() { 337 return ProtobufMechanismFactory.INSTANCE; 338 } 339 340 /** 341 * @return this type's descriptor. 342 */ 343 public static Descriptors.Descriptor getDescriptor() { 344 return ProtobufCommands.wpi_proto_ProtobufMechanism_descriptor; 345 } 346 347 private enum ProtobufMechanismFactory implements MessageFactory<ProtobufMechanism> { 348 INSTANCE; 349 350 @Override 351 public ProtobufMechanism create() { 352 return ProtobufMechanism.newInstance(); 353 } 354 } 355 356 /** 357 * Contains name constants used for serializing JSON 358 */ 359 static class FieldNames { 360 static final FieldName name = FieldName.forField("name"); 361 } 362 } 363 364 /** 365 * Protobuf type {@code ProtobufCommand} 366 */ 367 public static final class ProtobufCommand extends ProtoMessage<ProtobufCommand> implements Cloneable { 368 private static final long serialVersionUID = 0L; 369 370 /** 371 * <pre> 372 * How much time the command took to execute in its most recent run. 373 * Only included in a message for an actively running command. 374 * </pre> 375 * 376 * <code>optional double last_time_ms = 6;</code> 377 */ 378 private double lastTimeMs; 379 380 /** 381 * <pre> 382 * How long the command has taken to run, in aggregate. 383 * Only included in a message for an actively running command. 384 * </pre> 385 * 386 * <code>optional double total_time_ms = 7;</code> 387 */ 388 private double totalTimeMs; 389 390 /** 391 * <pre> 392 * The priority level of the command. 393 * </pre> 394 * 395 * <code>optional int32 priority = 4;</code> 396 */ 397 private int priority; 398 399 /** 400 * <pre> 401 * A unique ID for the command. 402 * Different invocations of the same command object have different IDs. 403 * </pre> 404 * 405 * <code>optional uint32 id = 1;</code> 406 */ 407 private int id; 408 409 /** 410 * <pre> 411 * The ID of the parent command. 412 * Not included in the message for top-level commands. 413 * </pre> 414 * 415 * <code>optional uint32 parent_id = 2;</code> 416 */ 417 private int parentId; 418 419 /** 420 * <pre> 421 * The name of the command. 422 * </pre> 423 * 424 * <code>optional string name = 3;</code> 425 */ 426 private final Utf8String name = Utf8String.newEmptyInstance(); 427 428 /** 429 * <pre> 430 * The mechanisms required by the command. 431 * </pre> 432 * 433 * <code>repeated .wpi.proto.ProtobufMechanism requirements = 5;</code> 434 */ 435 private final RepeatedMessage<ProtobufMechanism> requirements = RepeatedMessage.newEmptyInstance(ProtobufMechanism.getFactory()); 436 437 private ProtobufCommand() { 438 } 439 440 /** 441 * @return a new empty instance of {@code ProtobufCommand} 442 */ 443 public static ProtobufCommand newInstance() { 444 return new ProtobufCommand(); 445 } 446 447 /** 448 * <pre> 449 * How much time the command took to execute in its most recent run. 450 * Only included in a message for an actively running command. 451 * </pre> 452 * 453 * <code>optional double last_time_ms = 6;</code> 454 * @return whether the lastTimeMs field is set 455 */ 456 public boolean hasLastTimeMs() { 457 return (bitField0_ & 0x00000002) != 0; 458 } 459 460 /** 461 * <pre> 462 * How much time the command took to execute in its most recent run. 463 * Only included in a message for an actively running command. 464 * </pre> 465 * 466 * <code>optional double last_time_ms = 6;</code> 467 * @return this 468 */ 469 public ProtobufCommand clearLastTimeMs() { 470 bitField0_ &= ~0x00000002; 471 lastTimeMs = 0D; 472 return this; 473 } 474 475 /** 476 * <pre> 477 * How much time the command took to execute in its most recent run. 478 * Only included in a message for an actively running command. 479 * </pre> 480 * 481 * <code>optional double last_time_ms = 6;</code> 482 * @return the lastTimeMs 483 */ 484 public double getLastTimeMs() { 485 return lastTimeMs; 486 } 487 488 /** 489 * <pre> 490 * How much time the command took to execute in its most recent run. 491 * Only included in a message for an actively running command. 492 * </pre> 493 * 494 * <code>optional double last_time_ms = 6;</code> 495 * @param value the lastTimeMs to set 496 * @return this 497 */ 498 public ProtobufCommand setLastTimeMs(final double value) { 499 bitField0_ |= 0x00000002; 500 lastTimeMs = value; 501 return this; 502 } 503 504 /** 505 * <pre> 506 * How long the command has taken to run, in aggregate. 507 * Only included in a message for an actively running command. 508 * </pre> 509 * 510 * <code>optional double total_time_ms = 7;</code> 511 * @return whether the totalTimeMs field is set 512 */ 513 public boolean hasTotalTimeMs() { 514 return (bitField0_ & 0x00000001) != 0; 515 } 516 517 /** 518 * <pre> 519 * How long the command has taken to run, in aggregate. 520 * Only included in a message for an actively running command. 521 * </pre> 522 * 523 * <code>optional double total_time_ms = 7;</code> 524 * @return this 525 */ 526 public ProtobufCommand clearTotalTimeMs() { 527 bitField0_ &= ~0x00000001; 528 totalTimeMs = 0D; 529 return this; 530 } 531 532 /** 533 * <pre> 534 * How long the command has taken to run, in aggregate. 535 * Only included in a message for an actively running command. 536 * </pre> 537 * 538 * <code>optional double total_time_ms = 7;</code> 539 * @return the totalTimeMs 540 */ 541 public double getTotalTimeMs() { 542 return totalTimeMs; 543 } 544 545 /** 546 * <pre> 547 * How long the command has taken to run, in aggregate. 548 * Only included in a message for an actively running command. 549 * </pre> 550 * 551 * <code>optional double total_time_ms = 7;</code> 552 * @param value the totalTimeMs to set 553 * @return this 554 */ 555 public ProtobufCommand setTotalTimeMs(final double value) { 556 bitField0_ |= 0x00000001; 557 totalTimeMs = value; 558 return this; 559 } 560 561 /** 562 * <pre> 563 * The priority level of the command. 564 * </pre> 565 * 566 * <code>optional int32 priority = 4;</code> 567 * @return whether the priority field is set 568 */ 569 public boolean hasPriority() { 570 return (bitField0_ & 0x00000008) != 0; 571 } 572 573 /** 574 * <pre> 575 * The priority level of the command. 576 * </pre> 577 * 578 * <code>optional int32 priority = 4;</code> 579 * @return this 580 */ 581 public ProtobufCommand clearPriority() { 582 bitField0_ &= ~0x00000008; 583 priority = 0; 584 return this; 585 } 586 587 /** 588 * <pre> 589 * The priority level of the command. 590 * </pre> 591 * 592 * <code>optional int32 priority = 4;</code> 593 * @return the priority 594 */ 595 public int getPriority() { 596 return priority; 597 } 598 599 /** 600 * <pre> 601 * The priority level of the command. 602 * </pre> 603 * 604 * <code>optional int32 priority = 4;</code> 605 * @param value the priority to set 606 * @return this 607 */ 608 public ProtobufCommand setPriority(final int value) { 609 bitField0_ |= 0x00000008; 610 priority = value; 611 return this; 612 } 613 614 /** 615 * <pre> 616 * A unique ID for the command. 617 * Different invocations of the same command object have different IDs. 618 * </pre> 619 * 620 * <code>optional uint32 id = 1;</code> 621 * @return whether the id field is set 622 */ 623 public boolean hasId() { 624 return (bitField0_ & 0x00000010) != 0; 625 } 626 627 /** 628 * <pre> 629 * A unique ID for the command. 630 * Different invocations of the same command object have different IDs. 631 * </pre> 632 * 633 * <code>optional uint32 id = 1;</code> 634 * @return this 635 */ 636 public ProtobufCommand clearId() { 637 bitField0_ &= ~0x00000010; 638 id = 0; 639 return this; 640 } 641 642 /** 643 * <pre> 644 * A unique ID for the command. 645 * Different invocations of the same command object have different IDs. 646 * </pre> 647 * 648 * <code>optional uint32 id = 1;</code> 649 * @return the id 650 */ 651 public int getId() { 652 return id; 653 } 654 655 /** 656 * <pre> 657 * A unique ID for the command. 658 * Different invocations of the same command object have different IDs. 659 * </pre> 660 * 661 * <code>optional uint32 id = 1;</code> 662 * @param value the id to set 663 * @return this 664 */ 665 public ProtobufCommand setId(final int value) { 666 bitField0_ |= 0x00000010; 667 id = value; 668 return this; 669 } 670 671 /** 672 * <pre> 673 * The ID of the parent command. 674 * Not included in the message for top-level commands. 675 * </pre> 676 * 677 * <code>optional uint32 parent_id = 2;</code> 678 * @return whether the parentId field is set 679 */ 680 public boolean hasParentId() { 681 return (bitField0_ & 0x00000004) != 0; 682 } 683 684 /** 685 * <pre> 686 * The ID of the parent command. 687 * Not included in the message for top-level commands. 688 * </pre> 689 * 690 * <code>optional uint32 parent_id = 2;</code> 691 * @return this 692 */ 693 public ProtobufCommand clearParentId() { 694 bitField0_ &= ~0x00000004; 695 parentId = 0; 696 return this; 697 } 698 699 /** 700 * <pre> 701 * The ID of the parent command. 702 * Not included in the message for top-level commands. 703 * </pre> 704 * 705 * <code>optional uint32 parent_id = 2;</code> 706 * @return the parentId 707 */ 708 public int getParentId() { 709 return parentId; 710 } 711 712 /** 713 * <pre> 714 * The ID of the parent command. 715 * Not included in the message for top-level commands. 716 * </pre> 717 * 718 * <code>optional uint32 parent_id = 2;</code> 719 * @param value the parentId to set 720 * @return this 721 */ 722 public ProtobufCommand setParentId(final int value) { 723 bitField0_ |= 0x00000004; 724 parentId = value; 725 return this; 726 } 727 728 /** 729 * <pre> 730 * The name of the command. 731 * </pre> 732 * 733 * <code>optional string name = 3;</code> 734 * @return whether the name field is set 735 */ 736 public boolean hasName() { 737 return (bitField0_ & 0x00000020) != 0; 738 } 739 740 /** 741 * <pre> 742 * The name of the command. 743 * </pre> 744 * 745 * <code>optional string name = 3;</code> 746 * @return this 747 */ 748 public ProtobufCommand clearName() { 749 bitField0_ &= ~0x00000020; 750 name.clear(); 751 return this; 752 } 753 754 /** 755 * <pre> 756 * The name of the command. 757 * </pre> 758 * 759 * <code>optional string name = 3;</code> 760 * @return the name 761 */ 762 public String getName() { 763 return name.getString(); 764 } 765 766 /** 767 * <pre> 768 * The name of the command. 769 * </pre> 770 * 771 * <code>optional string name = 3;</code> 772 * @return internal {@code Utf8String} representation of name for reading 773 */ 774 public Utf8String getNameBytes() { 775 return this.name; 776 } 777 778 /** 779 * <pre> 780 * The name of the command. 781 * </pre> 782 * 783 * <code>optional string name = 3;</code> 784 * @return internal {@code Utf8String} representation of name for modifications 785 */ 786 public Utf8String getMutableNameBytes() { 787 bitField0_ |= 0x00000020; 788 return this.name; 789 } 790 791 /** 792 * <pre> 793 * The name of the command. 794 * </pre> 795 * 796 * <code>optional string name = 3;</code> 797 * @param value the name to set 798 * @return this 799 */ 800 public ProtobufCommand setName(final CharSequence value) { 801 bitField0_ |= 0x00000020; 802 name.copyFrom(value); 803 return this; 804 } 805 806 /** 807 * <pre> 808 * The name of the command. 809 * </pre> 810 * 811 * <code>optional string name = 3;</code> 812 * @param value the name to set 813 * @return this 814 */ 815 public ProtobufCommand setName(final Utf8String value) { 816 bitField0_ |= 0x00000020; 817 name.copyFrom(value); 818 return this; 819 } 820 821 /** 822 * <pre> 823 * The mechanisms required by the command. 824 * </pre> 825 * 826 * <code>repeated .wpi.proto.ProtobufMechanism requirements = 5;</code> 827 * @return whether the requirements field is set 828 */ 829 public boolean hasRequirements() { 830 return (bitField0_ & 0x00000040) != 0; 831 } 832 833 /** 834 * <pre> 835 * The mechanisms required by the command. 836 * </pre> 837 * 838 * <code>repeated .wpi.proto.ProtobufMechanism requirements = 5;</code> 839 * @return this 840 */ 841 public ProtobufCommand clearRequirements() { 842 bitField0_ &= ~0x00000040; 843 requirements.clear(); 844 return this; 845 } 846 847 /** 848 * <pre> 849 * The mechanisms required by the command. 850 * </pre> 851 * 852 * <code>repeated .wpi.proto.ProtobufMechanism requirements = 5;</code> 853 * 854 * This method returns the internal storage object without modifying any has state. 855 * The returned object should not be modified and be treated as read-only. 856 * 857 * Use {@link #getMutableRequirements()} if you want to modify it. 858 * 859 * @return internal storage object for reading 860 */ 861 public RepeatedMessage<ProtobufMechanism> getRequirements() { 862 return requirements; 863 } 864 865 /** 866 * <pre> 867 * The mechanisms required by the command. 868 * </pre> 869 * 870 * <code>repeated .wpi.proto.ProtobufMechanism requirements = 5;</code> 871 * 872 * This method returns the internal storage object and sets the corresponding 873 * has state. The returned object will become part of this message and its 874 * contents may be modified as long as the has state is not cleared. 875 * 876 * @return internal storage object for modifications 877 */ 878 public RepeatedMessage<ProtobufMechanism> getMutableRequirements() { 879 bitField0_ |= 0x00000040; 880 return requirements; 881 } 882 883 /** 884 * <pre> 885 * The mechanisms required by the command. 886 * </pre> 887 * 888 * <code>repeated .wpi.proto.ProtobufMechanism requirements = 5;</code> 889 * @param value the requirements to add 890 * @return this 891 */ 892 public ProtobufCommand addRequirements(final ProtobufMechanism value) { 893 bitField0_ |= 0x00000040; 894 requirements.add(value); 895 return this; 896 } 897 898 /** 899 * <pre> 900 * The mechanisms required by the command. 901 * </pre> 902 * 903 * <code>repeated .wpi.proto.ProtobufMechanism requirements = 5;</code> 904 * @param values the requirements to add 905 * @return this 906 */ 907 public ProtobufCommand addAllRequirements(final ProtobufMechanism... values) { 908 bitField0_ |= 0x00000040; 909 requirements.addAll(values); 910 return this; 911 } 912 913 @Override 914 public ProtobufCommand copyFrom(final ProtobufCommand other) { 915 cachedSize = other.cachedSize; 916 if ((bitField0_ | other.bitField0_) != 0) { 917 bitField0_ = other.bitField0_; 918 lastTimeMs = other.lastTimeMs; 919 totalTimeMs = other.totalTimeMs; 920 priority = other.priority; 921 id = other.id; 922 parentId = other.parentId; 923 name.copyFrom(other.name); 924 requirements.copyFrom(other.requirements); 925 } 926 return this; 927 } 928 929 @Override 930 public ProtobufCommand mergeFrom(final ProtobufCommand other) { 931 if (other.isEmpty()) { 932 return this; 933 } 934 cachedSize = -1; 935 if (other.hasLastTimeMs()) { 936 setLastTimeMs(other.lastTimeMs); 937 } 938 if (other.hasTotalTimeMs()) { 939 setTotalTimeMs(other.totalTimeMs); 940 } 941 if (other.hasPriority()) { 942 setPriority(other.priority); 943 } 944 if (other.hasId()) { 945 setId(other.id); 946 } 947 if (other.hasParentId()) { 948 setParentId(other.parentId); 949 } 950 if (other.hasName()) { 951 getMutableNameBytes().copyFrom(other.name); 952 } 953 if (other.hasRequirements()) { 954 getMutableRequirements().addAll(other.requirements); 955 } 956 return this; 957 } 958 959 @Override 960 public ProtobufCommand clear() { 961 if (isEmpty()) { 962 return this; 963 } 964 cachedSize = -1; 965 bitField0_ = 0; 966 lastTimeMs = 0D; 967 totalTimeMs = 0D; 968 priority = 0; 969 id = 0; 970 parentId = 0; 971 name.clear(); 972 requirements.clear(); 973 return this; 974 } 975 976 @Override 977 public ProtobufCommand clearQuick() { 978 if (isEmpty()) { 979 return this; 980 } 981 cachedSize = -1; 982 bitField0_ = 0; 983 name.clear(); 984 requirements.clearQuick(); 985 return this; 986 } 987 988 @Override 989 public boolean equals(Object o) { 990 if (o == this) { 991 return true; 992 } 993 if (!(o instanceof ProtobufCommand)) { 994 return false; 995 } 996 ProtobufCommand other = (ProtobufCommand) o; 997 return bitField0_ == other.bitField0_ 998 && (!hasLastTimeMs() || ProtoUtil.isEqual(lastTimeMs, other.lastTimeMs)) 999 && (!hasTotalTimeMs() || ProtoUtil.isEqual(totalTimeMs, other.totalTimeMs)) 1000 && (!hasPriority() || priority == other.priority) 1001 && (!hasId() || id == other.id) 1002 && (!hasParentId() || parentId == other.parentId) 1003 && (!hasName() || name.equals(other.name)) 1004 && (!hasRequirements() || requirements.equals(other.requirements)); 1005 } 1006 1007 @Override 1008 public void writeTo(final ProtoSink output) throws IOException { 1009 if ((bitField0_ & 0x00000002) != 0) { 1010 output.writeRawByte((byte) 49); 1011 output.writeDoubleNoTag(lastTimeMs); 1012 } 1013 if ((bitField0_ & 0x00000001) != 0) { 1014 output.writeRawByte((byte) 57); 1015 output.writeDoubleNoTag(totalTimeMs); 1016 } 1017 if ((bitField0_ & 0x00000008) != 0) { 1018 output.writeRawByte((byte) 32); 1019 output.writeInt32NoTag(priority); 1020 } 1021 if ((bitField0_ & 0x00000010) != 0) { 1022 output.writeRawByte((byte) 8); 1023 output.writeUInt32NoTag(id); 1024 } 1025 if ((bitField0_ & 0x00000004) != 0) { 1026 output.writeRawByte((byte) 16); 1027 output.writeUInt32NoTag(parentId); 1028 } 1029 if ((bitField0_ & 0x00000020) != 0) { 1030 output.writeRawByte((byte) 26); 1031 output.writeStringNoTag(name); 1032 } 1033 if ((bitField0_ & 0x00000040) != 0) { 1034 for (int i = 0; i < requirements.length(); i++) { 1035 output.writeRawByte((byte) 42); 1036 output.writeMessageNoTag(requirements.get(i)); 1037 } 1038 } 1039 } 1040 1041 @Override 1042 protected int computeSerializedSize() { 1043 int size = 0; 1044 if ((bitField0_ & 0x00000002) != 0) { 1045 size += 9; 1046 } 1047 if ((bitField0_ & 0x00000001) != 0) { 1048 size += 9; 1049 } 1050 if ((bitField0_ & 0x00000008) != 0) { 1051 size += 1 + ProtoSink.computeInt32SizeNoTag(priority); 1052 } 1053 if ((bitField0_ & 0x00000010) != 0) { 1054 size += 1 + ProtoSink.computeUInt32SizeNoTag(id); 1055 } 1056 if ((bitField0_ & 0x00000004) != 0) { 1057 size += 1 + ProtoSink.computeUInt32SizeNoTag(parentId); 1058 } 1059 if ((bitField0_ & 0x00000020) != 0) { 1060 size += 1 + ProtoSink.computeStringSizeNoTag(name); 1061 } 1062 if ((bitField0_ & 0x00000040) != 0) { 1063 size += (1 * requirements.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(requirements); 1064 } 1065 return size; 1066 } 1067 1068 @Override 1069 @SuppressWarnings("fallthrough") 1070 public ProtobufCommand mergeFrom(final ProtoSource input) throws IOException { 1071 // Enabled Fall-Through Optimization (QuickBuffers) 1072 int tag = input.readTag(); 1073 while (true) { 1074 switch (tag) { 1075 case 49: { 1076 // lastTimeMs 1077 lastTimeMs = input.readDouble(); 1078 bitField0_ |= 0x00000002; 1079 tag = input.readTag(); 1080 if (tag != 57) { 1081 break; 1082 } 1083 } 1084 case 57: { 1085 // totalTimeMs 1086 totalTimeMs = input.readDouble(); 1087 bitField0_ |= 0x00000001; 1088 tag = input.readTag(); 1089 if (tag != 32) { 1090 break; 1091 } 1092 } 1093 case 32: { 1094 // priority 1095 priority = input.readInt32(); 1096 bitField0_ |= 0x00000008; 1097 tag = input.readTag(); 1098 if (tag != 8) { 1099 break; 1100 } 1101 } 1102 case 8: { 1103 // id 1104 id = input.readUInt32(); 1105 bitField0_ |= 0x00000010; 1106 tag = input.readTag(); 1107 if (tag != 16) { 1108 break; 1109 } 1110 } 1111 case 16: { 1112 // parentId 1113 parentId = input.readUInt32(); 1114 bitField0_ |= 0x00000004; 1115 tag = input.readTag(); 1116 if (tag != 26) { 1117 break; 1118 } 1119 } 1120 case 26: { 1121 // name 1122 input.readString(name); 1123 bitField0_ |= 0x00000020; 1124 tag = input.readTag(); 1125 if (tag != 42) { 1126 break; 1127 } 1128 } 1129 case 42: { 1130 // requirements 1131 tag = input.readRepeatedMessage(requirements, tag); 1132 bitField0_ |= 0x00000040; 1133 if (tag != 0) { 1134 break; 1135 } 1136 } 1137 case 0: { 1138 return this; 1139 } 1140 default: { 1141 if (!input.skipField(tag)) { 1142 return this; 1143 } 1144 tag = input.readTag(); 1145 break; 1146 } 1147 } 1148 } 1149 } 1150 1151 @Override 1152 public void writeTo(final JsonSink output) throws IOException { 1153 output.beginObject(); 1154 if ((bitField0_ & 0x00000002) != 0) { 1155 output.writeDouble(FieldNames.lastTimeMs, lastTimeMs); 1156 } 1157 if ((bitField0_ & 0x00000001) != 0) { 1158 output.writeDouble(FieldNames.totalTimeMs, totalTimeMs); 1159 } 1160 if ((bitField0_ & 0x00000008) != 0) { 1161 output.writeInt32(FieldNames.priority, priority); 1162 } 1163 if ((bitField0_ & 0x00000010) != 0) { 1164 output.writeUInt32(FieldNames.id, id); 1165 } 1166 if ((bitField0_ & 0x00000004) != 0) { 1167 output.writeUInt32(FieldNames.parentId, parentId); 1168 } 1169 if ((bitField0_ & 0x00000020) != 0) { 1170 output.writeString(FieldNames.name, name); 1171 } 1172 if ((bitField0_ & 0x00000040) != 0) { 1173 output.writeRepeatedMessage(FieldNames.requirements, requirements); 1174 } 1175 output.endObject(); 1176 } 1177 1178 @Override 1179 public ProtobufCommand mergeFrom(final JsonSource input) throws IOException { 1180 if (!input.beginObject()) { 1181 return this; 1182 } 1183 while (!input.isAtEnd()) { 1184 switch (input.readFieldHash()) { 1185 case 1958056841: 1186 case -740797521: { 1187 if (input.isAtField(FieldNames.lastTimeMs)) { 1188 if (!input.trySkipNullValue()) { 1189 lastTimeMs = input.readDouble(); 1190 bitField0_ |= 0x00000002; 1191 } 1192 } else { 1193 input.skipUnknownField(); 1194 } 1195 break; 1196 } 1197 case -717217353: 1198 case 1006112349: { 1199 if (input.isAtField(FieldNames.totalTimeMs)) { 1200 if (!input.trySkipNullValue()) { 1201 totalTimeMs = input.readDouble(); 1202 bitField0_ |= 0x00000001; 1203 } 1204 } else { 1205 input.skipUnknownField(); 1206 } 1207 break; 1208 } 1209 case -1165461084: { 1210 if (input.isAtField(FieldNames.priority)) { 1211 if (!input.trySkipNullValue()) { 1212 priority = input.readInt32(); 1213 bitField0_ |= 0x00000008; 1214 } 1215 } else { 1216 input.skipUnknownField(); 1217 } 1218 break; 1219 } 1220 case 3355: { 1221 if (input.isAtField(FieldNames.id)) { 1222 if (!input.trySkipNullValue()) { 1223 id = input.readUInt32(); 1224 bitField0_ |= 0x00000010; 1225 } 1226 } else { 1227 input.skipUnknownField(); 1228 } 1229 break; 1230 } 1231 case 1175162725: 1232 case 2070327504: { 1233 if (input.isAtField(FieldNames.parentId)) { 1234 if (!input.trySkipNullValue()) { 1235 parentId = input.readUInt32(); 1236 bitField0_ |= 0x00000004; 1237 } 1238 } else { 1239 input.skipUnknownField(); 1240 } 1241 break; 1242 } 1243 case 3373707: { 1244 if (input.isAtField(FieldNames.name)) { 1245 if (!input.trySkipNullValue()) { 1246 input.readString(name); 1247 bitField0_ |= 0x00000020; 1248 } 1249 } else { 1250 input.skipUnknownField(); 1251 } 1252 break; 1253 } 1254 case -1619874672: { 1255 if (input.isAtField(FieldNames.requirements)) { 1256 if (!input.trySkipNullValue()) { 1257 input.readRepeatedMessage(requirements); 1258 bitField0_ |= 0x00000040; 1259 } 1260 } else { 1261 input.skipUnknownField(); 1262 } 1263 break; 1264 } 1265 default: { 1266 input.skipUnknownField(); 1267 break; 1268 } 1269 } 1270 } 1271 input.endObject(); 1272 return this; 1273 } 1274 1275 @Override 1276 public ProtobufCommand clone() { 1277 return new ProtobufCommand().copyFrom(this); 1278 } 1279 1280 @Override 1281 public boolean isEmpty() { 1282 return ((bitField0_) == 0); 1283 } 1284 1285 public static ProtobufCommand parseFrom(final byte[] data) throws 1286 InvalidProtocolBufferException { 1287 return ProtoMessage.mergeFrom(new ProtobufCommand(), data).checkInitialized(); 1288 } 1289 1290 public static ProtobufCommand parseFrom(final ProtoSource input) throws IOException { 1291 return ProtoMessage.mergeFrom(new ProtobufCommand(), input).checkInitialized(); 1292 } 1293 1294 public static ProtobufCommand parseFrom(final JsonSource input) throws IOException { 1295 return ProtoMessage.mergeFrom(new ProtobufCommand(), input).checkInitialized(); 1296 } 1297 1298 /** 1299 * @return factory for creating ProtobufCommand messages 1300 */ 1301 public static MessageFactory<ProtobufCommand> getFactory() { 1302 return ProtobufCommandFactory.INSTANCE; 1303 } 1304 1305 /** 1306 * @return this type's descriptor. 1307 */ 1308 public static Descriptors.Descriptor getDescriptor() { 1309 return ProtobufCommands.wpi_proto_ProtobufCommand_descriptor; 1310 } 1311 1312 private enum ProtobufCommandFactory implements MessageFactory<ProtobufCommand> { 1313 INSTANCE; 1314 1315 @Override 1316 public ProtobufCommand create() { 1317 return ProtobufCommand.newInstance(); 1318 } 1319 } 1320 1321 /** 1322 * Contains name constants used for serializing JSON 1323 */ 1324 static class FieldNames { 1325 static final FieldName lastTimeMs = FieldName.forField("lastTimeMs", "last_time_ms"); 1326 1327 static final FieldName totalTimeMs = FieldName.forField("totalTimeMs", "total_time_ms"); 1328 1329 static final FieldName priority = FieldName.forField("priority"); 1330 1331 static final FieldName id = FieldName.forField("id"); 1332 1333 static final FieldName parentId = FieldName.forField("parentId", "parent_id"); 1334 1335 static final FieldName name = FieldName.forField("name"); 1336 1337 static final FieldName requirements = FieldName.forField("requirements"); 1338 } 1339 } 1340 1341 /** 1342 * Protobuf type {@code ProtobufScheduler} 1343 */ 1344 public static final class ProtobufScheduler extends ProtoMessage<ProtobufScheduler> implements Cloneable { 1345 private static final long serialVersionUID = 0L; 1346 1347 /** 1348 * <pre> 1349 * How much time the scheduler took in its last `run()` invocation. 1350 * </pre> 1351 * 1352 * <code>optional double last_time_ms = 3;</code> 1353 */ 1354 private double lastTimeMs; 1355 1356 /** 1357 * <pre> 1358 * Note: commands are generally queued by triggers, which occurs immediately before they are 1359 * promoted and start running. Entries will only appear here when serializing a scheduler 1360 * _after_ manually scheduling a command but _before_ calling scheduler.run() 1361 * </pre> 1362 * 1363 * <code>repeated .wpi.proto.ProtobufCommand queued_commands = 1;</code> 1364 */ 1365 private final RepeatedMessage<ProtobufCommand> queuedCommands = RepeatedMessage.newEmptyInstance(ProtobufCommand.getFactory()); 1366 1367 /** 1368 * <code>repeated .wpi.proto.ProtobufCommand running_commands = 2;</code> 1369 */ 1370 private final RepeatedMessage<ProtobufCommand> runningCommands = RepeatedMessage.newEmptyInstance(ProtobufCommand.getFactory()); 1371 1372 private ProtobufScheduler() { 1373 } 1374 1375 /** 1376 * @return a new empty instance of {@code ProtobufScheduler} 1377 */ 1378 public static ProtobufScheduler newInstance() { 1379 return new ProtobufScheduler(); 1380 } 1381 1382 /** 1383 * <pre> 1384 * How much time the scheduler took in its last `run()` invocation. 1385 * </pre> 1386 * 1387 * <code>optional double last_time_ms = 3;</code> 1388 * @return whether the lastTimeMs field is set 1389 */ 1390 public boolean hasLastTimeMs() { 1391 return (bitField0_ & 0x00000001) != 0; 1392 } 1393 1394 /** 1395 * <pre> 1396 * How much time the scheduler took in its last `run()` invocation. 1397 * </pre> 1398 * 1399 * <code>optional double last_time_ms = 3;</code> 1400 * @return this 1401 */ 1402 public ProtobufScheduler clearLastTimeMs() { 1403 bitField0_ &= ~0x00000001; 1404 lastTimeMs = 0D; 1405 return this; 1406 } 1407 1408 /** 1409 * <pre> 1410 * How much time the scheduler took in its last `run()` invocation. 1411 * </pre> 1412 * 1413 * <code>optional double last_time_ms = 3;</code> 1414 * @return the lastTimeMs 1415 */ 1416 public double getLastTimeMs() { 1417 return lastTimeMs; 1418 } 1419 1420 /** 1421 * <pre> 1422 * How much time the scheduler took in its last `run()` invocation. 1423 * </pre> 1424 * 1425 * <code>optional double last_time_ms = 3;</code> 1426 * @param value the lastTimeMs to set 1427 * @return this 1428 */ 1429 public ProtobufScheduler setLastTimeMs(final double value) { 1430 bitField0_ |= 0x00000001; 1431 lastTimeMs = value; 1432 return this; 1433 } 1434 1435 /** 1436 * <pre> 1437 * Note: commands are generally queued by triggers, which occurs immediately before they are 1438 * promoted and start running. Entries will only appear here when serializing a scheduler 1439 * _after_ manually scheduling a command but _before_ calling scheduler.run() 1440 * </pre> 1441 * 1442 * <code>repeated .wpi.proto.ProtobufCommand queued_commands = 1;</code> 1443 * @return whether the queuedCommands field is set 1444 */ 1445 public boolean hasQueuedCommands() { 1446 return (bitField0_ & 0x00000002) != 0; 1447 } 1448 1449 /** 1450 * <pre> 1451 * Note: commands are generally queued by triggers, which occurs immediately before they are 1452 * promoted and start running. Entries will only appear here when serializing a scheduler 1453 * _after_ manually scheduling a command but _before_ calling scheduler.run() 1454 * </pre> 1455 * 1456 * <code>repeated .wpi.proto.ProtobufCommand queued_commands = 1;</code> 1457 * @return this 1458 */ 1459 public ProtobufScheduler clearQueuedCommands() { 1460 bitField0_ &= ~0x00000002; 1461 queuedCommands.clear(); 1462 return this; 1463 } 1464 1465 /** 1466 * <pre> 1467 * Note: commands are generally queued by triggers, which occurs immediately before they are 1468 * promoted and start running. Entries will only appear here when serializing a scheduler 1469 * _after_ manually scheduling a command but _before_ calling scheduler.run() 1470 * </pre> 1471 * 1472 * <code>repeated .wpi.proto.ProtobufCommand queued_commands = 1;</code> 1473 * 1474 * This method returns the internal storage object without modifying any has state. 1475 * The returned object should not be modified and be treated as read-only. 1476 * 1477 * Use {@link #getMutableQueuedCommands()} if you want to modify it. 1478 * 1479 * @return internal storage object for reading 1480 */ 1481 public RepeatedMessage<ProtobufCommand> getQueuedCommands() { 1482 return queuedCommands; 1483 } 1484 1485 /** 1486 * <pre> 1487 * Note: commands are generally queued by triggers, which occurs immediately before they are 1488 * promoted and start running. Entries will only appear here when serializing a scheduler 1489 * _after_ manually scheduling a command but _before_ calling scheduler.run() 1490 * </pre> 1491 * 1492 * <code>repeated .wpi.proto.ProtobufCommand queued_commands = 1;</code> 1493 * 1494 * This method returns the internal storage object and sets the corresponding 1495 * has state. The returned object will become part of this message and its 1496 * contents may be modified as long as the has state is not cleared. 1497 * 1498 * @return internal storage object for modifications 1499 */ 1500 public RepeatedMessage<ProtobufCommand> getMutableQueuedCommands() { 1501 bitField0_ |= 0x00000002; 1502 return queuedCommands; 1503 } 1504 1505 /** 1506 * <pre> 1507 * Note: commands are generally queued by triggers, which occurs immediately before they are 1508 * promoted and start running. Entries will only appear here when serializing a scheduler 1509 * _after_ manually scheduling a command but _before_ calling scheduler.run() 1510 * </pre> 1511 * 1512 * <code>repeated .wpi.proto.ProtobufCommand queued_commands = 1;</code> 1513 * @param value the queuedCommands to add 1514 * @return this 1515 */ 1516 public ProtobufScheduler addQueuedCommands(final ProtobufCommand value) { 1517 bitField0_ |= 0x00000002; 1518 queuedCommands.add(value); 1519 return this; 1520 } 1521 1522 /** 1523 * <pre> 1524 * Note: commands are generally queued by triggers, which occurs immediately before they are 1525 * promoted and start running. Entries will only appear here when serializing a scheduler 1526 * _after_ manually scheduling a command but _before_ calling scheduler.run() 1527 * </pre> 1528 * 1529 * <code>repeated .wpi.proto.ProtobufCommand queued_commands = 1;</code> 1530 * @param values the queuedCommands to add 1531 * @return this 1532 */ 1533 public ProtobufScheduler addAllQueuedCommands(final ProtobufCommand... values) { 1534 bitField0_ |= 0x00000002; 1535 queuedCommands.addAll(values); 1536 return this; 1537 } 1538 1539 /** 1540 * <code>repeated .wpi.proto.ProtobufCommand running_commands = 2;</code> 1541 * @return whether the runningCommands field is set 1542 */ 1543 public boolean hasRunningCommands() { 1544 return (bitField0_ & 0x00000004) != 0; 1545 } 1546 1547 /** 1548 * <code>repeated .wpi.proto.ProtobufCommand running_commands = 2;</code> 1549 * @return this 1550 */ 1551 public ProtobufScheduler clearRunningCommands() { 1552 bitField0_ &= ~0x00000004; 1553 runningCommands.clear(); 1554 return this; 1555 } 1556 1557 /** 1558 * <code>repeated .wpi.proto.ProtobufCommand running_commands = 2;</code> 1559 * 1560 * This method returns the internal storage object without modifying any has state. 1561 * The returned object should not be modified and be treated as read-only. 1562 * 1563 * Use {@link #getMutableRunningCommands()} if you want to modify it. 1564 * 1565 * @return internal storage object for reading 1566 */ 1567 public RepeatedMessage<ProtobufCommand> getRunningCommands() { 1568 return runningCommands; 1569 } 1570 1571 /** 1572 * <code>repeated .wpi.proto.ProtobufCommand running_commands = 2;</code> 1573 * 1574 * This method returns the internal storage object and sets the corresponding 1575 * has state. The returned object will become part of this message and its 1576 * contents may be modified as long as the has state is not cleared. 1577 * 1578 * @return internal storage object for modifications 1579 */ 1580 public RepeatedMessage<ProtobufCommand> getMutableRunningCommands() { 1581 bitField0_ |= 0x00000004; 1582 return runningCommands; 1583 } 1584 1585 /** 1586 * <code>repeated .wpi.proto.ProtobufCommand running_commands = 2;</code> 1587 * @param value the runningCommands to add 1588 * @return this 1589 */ 1590 public ProtobufScheduler addRunningCommands(final ProtobufCommand value) { 1591 bitField0_ |= 0x00000004; 1592 runningCommands.add(value); 1593 return this; 1594 } 1595 1596 /** 1597 * <code>repeated .wpi.proto.ProtobufCommand running_commands = 2;</code> 1598 * @param values the runningCommands to add 1599 * @return this 1600 */ 1601 public ProtobufScheduler addAllRunningCommands(final ProtobufCommand... values) { 1602 bitField0_ |= 0x00000004; 1603 runningCommands.addAll(values); 1604 return this; 1605 } 1606 1607 @Override 1608 public ProtobufScheduler copyFrom(final ProtobufScheduler other) { 1609 cachedSize = other.cachedSize; 1610 if ((bitField0_ | other.bitField0_) != 0) { 1611 bitField0_ = other.bitField0_; 1612 lastTimeMs = other.lastTimeMs; 1613 queuedCommands.copyFrom(other.queuedCommands); 1614 runningCommands.copyFrom(other.runningCommands); 1615 } 1616 return this; 1617 } 1618 1619 @Override 1620 public ProtobufScheduler mergeFrom(final ProtobufScheduler other) { 1621 if (other.isEmpty()) { 1622 return this; 1623 } 1624 cachedSize = -1; 1625 if (other.hasLastTimeMs()) { 1626 setLastTimeMs(other.lastTimeMs); 1627 } 1628 if (other.hasQueuedCommands()) { 1629 getMutableQueuedCommands().addAll(other.queuedCommands); 1630 } 1631 if (other.hasRunningCommands()) { 1632 getMutableRunningCommands().addAll(other.runningCommands); 1633 } 1634 return this; 1635 } 1636 1637 @Override 1638 public ProtobufScheduler clear() { 1639 if (isEmpty()) { 1640 return this; 1641 } 1642 cachedSize = -1; 1643 bitField0_ = 0; 1644 lastTimeMs = 0D; 1645 queuedCommands.clear(); 1646 runningCommands.clear(); 1647 return this; 1648 } 1649 1650 @Override 1651 public ProtobufScheduler clearQuick() { 1652 if (isEmpty()) { 1653 return this; 1654 } 1655 cachedSize = -1; 1656 bitField0_ = 0; 1657 queuedCommands.clearQuick(); 1658 runningCommands.clearQuick(); 1659 return this; 1660 } 1661 1662 @Override 1663 public boolean equals(Object o) { 1664 if (o == this) { 1665 return true; 1666 } 1667 if (!(o instanceof ProtobufScheduler)) { 1668 return false; 1669 } 1670 ProtobufScheduler other = (ProtobufScheduler) o; 1671 return bitField0_ == other.bitField0_ 1672 && (!hasLastTimeMs() || ProtoUtil.isEqual(lastTimeMs, other.lastTimeMs)) 1673 && (!hasQueuedCommands() || queuedCommands.equals(other.queuedCommands)) 1674 && (!hasRunningCommands() || runningCommands.equals(other.runningCommands)); 1675 } 1676 1677 @Override 1678 public void writeTo(final ProtoSink output) throws IOException { 1679 if ((bitField0_ & 0x00000001) != 0) { 1680 output.writeRawByte((byte) 25); 1681 output.writeDoubleNoTag(lastTimeMs); 1682 } 1683 if ((bitField0_ & 0x00000002) != 0) { 1684 for (int i = 0; i < queuedCommands.length(); i++) { 1685 output.writeRawByte((byte) 10); 1686 output.writeMessageNoTag(queuedCommands.get(i)); 1687 } 1688 } 1689 if ((bitField0_ & 0x00000004) != 0) { 1690 for (int i = 0; i < runningCommands.length(); i++) { 1691 output.writeRawByte((byte) 18); 1692 output.writeMessageNoTag(runningCommands.get(i)); 1693 } 1694 } 1695 } 1696 1697 @Override 1698 protected int computeSerializedSize() { 1699 int size = 0; 1700 if ((bitField0_ & 0x00000001) != 0) { 1701 size += 9; 1702 } 1703 if ((bitField0_ & 0x00000002) != 0) { 1704 size += (1 * queuedCommands.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(queuedCommands); 1705 } 1706 if ((bitField0_ & 0x00000004) != 0) { 1707 size += (1 * runningCommands.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(runningCommands); 1708 } 1709 return size; 1710 } 1711 1712 @Override 1713 @SuppressWarnings("fallthrough") 1714 public ProtobufScheduler mergeFrom(final ProtoSource input) throws IOException { 1715 // Enabled Fall-Through Optimization (QuickBuffers) 1716 int tag = input.readTag(); 1717 while (true) { 1718 switch (tag) { 1719 case 25: { 1720 // lastTimeMs 1721 lastTimeMs = input.readDouble(); 1722 bitField0_ |= 0x00000001; 1723 tag = input.readTag(); 1724 if (tag != 10) { 1725 break; 1726 } 1727 } 1728 case 10: { 1729 // queuedCommands 1730 tag = input.readRepeatedMessage(queuedCommands, tag); 1731 bitField0_ |= 0x00000002; 1732 if (tag != 18) { 1733 break; 1734 } 1735 } 1736 case 18: { 1737 // runningCommands 1738 tag = input.readRepeatedMessage(runningCommands, tag); 1739 bitField0_ |= 0x00000004; 1740 if (tag != 0) { 1741 break; 1742 } 1743 } 1744 case 0: { 1745 return this; 1746 } 1747 default: { 1748 if (!input.skipField(tag)) { 1749 return this; 1750 } 1751 tag = input.readTag(); 1752 break; 1753 } 1754 } 1755 } 1756 } 1757 1758 @Override 1759 public void writeTo(final JsonSink output) throws IOException { 1760 output.beginObject(); 1761 if ((bitField0_ & 0x00000001) != 0) { 1762 output.writeDouble(FieldNames.lastTimeMs, lastTimeMs); 1763 } 1764 if ((bitField0_ & 0x00000002) != 0) { 1765 output.writeRepeatedMessage(FieldNames.queuedCommands, queuedCommands); 1766 } 1767 if ((bitField0_ & 0x00000004) != 0) { 1768 output.writeRepeatedMessage(FieldNames.runningCommands, runningCommands); 1769 } 1770 output.endObject(); 1771 } 1772 1773 @Override 1774 public ProtobufScheduler mergeFrom(final JsonSource input) throws IOException { 1775 if (!input.beginObject()) { 1776 return this; 1777 } 1778 while (!input.isAtEnd()) { 1779 switch (input.readFieldHash()) { 1780 case 1958056841: 1781 case -740797521: { 1782 if (input.isAtField(FieldNames.lastTimeMs)) { 1783 if (!input.trySkipNullValue()) { 1784 lastTimeMs = input.readDouble(); 1785 bitField0_ |= 0x00000001; 1786 } 1787 } else { 1788 input.skipUnknownField(); 1789 } 1790 break; 1791 } 1792 case -167160549: 1793 case -1904270380: { 1794 if (input.isAtField(FieldNames.queuedCommands)) { 1795 if (!input.trySkipNullValue()) { 1796 input.readRepeatedMessage(queuedCommands); 1797 bitField0_ |= 0x00000002; 1798 } 1799 } else { 1800 input.skipUnknownField(); 1801 } 1802 break; 1803 } 1804 case -1719052953: 1805 case 1526672648: { 1806 if (input.isAtField(FieldNames.runningCommands)) { 1807 if (!input.trySkipNullValue()) { 1808 input.readRepeatedMessage(runningCommands); 1809 bitField0_ |= 0x00000004; 1810 } 1811 } else { 1812 input.skipUnknownField(); 1813 } 1814 break; 1815 } 1816 default: { 1817 input.skipUnknownField(); 1818 break; 1819 } 1820 } 1821 } 1822 input.endObject(); 1823 return this; 1824 } 1825 1826 @Override 1827 public ProtobufScheduler clone() { 1828 return new ProtobufScheduler().copyFrom(this); 1829 } 1830 1831 @Override 1832 public boolean isEmpty() { 1833 return ((bitField0_) == 0); 1834 } 1835 1836 public static ProtobufScheduler parseFrom(final byte[] data) throws 1837 InvalidProtocolBufferException { 1838 return ProtoMessage.mergeFrom(new ProtobufScheduler(), data).checkInitialized(); 1839 } 1840 1841 public static ProtobufScheduler parseFrom(final ProtoSource input) throws IOException { 1842 return ProtoMessage.mergeFrom(new ProtobufScheduler(), input).checkInitialized(); 1843 } 1844 1845 public static ProtobufScheduler parseFrom(final JsonSource input) throws IOException { 1846 return ProtoMessage.mergeFrom(new ProtobufScheduler(), input).checkInitialized(); 1847 } 1848 1849 /** 1850 * @return factory for creating ProtobufScheduler messages 1851 */ 1852 public static MessageFactory<ProtobufScheduler> getFactory() { 1853 return ProtobufSchedulerFactory.INSTANCE; 1854 } 1855 1856 /** 1857 * @return this type's descriptor. 1858 */ 1859 public static Descriptors.Descriptor getDescriptor() { 1860 return ProtobufCommands.wpi_proto_ProtobufScheduler_descriptor; 1861 } 1862 1863 private enum ProtobufSchedulerFactory implements MessageFactory<ProtobufScheduler> { 1864 INSTANCE; 1865 1866 @Override 1867 public ProtobufScheduler create() { 1868 return ProtobufScheduler.newInstance(); 1869 } 1870 } 1871 1872 /** 1873 * Contains name constants used for serializing JSON 1874 */ 1875 static class FieldNames { 1876 static final FieldName lastTimeMs = FieldName.forField("lastTimeMs", "last_time_ms"); 1877 1878 static final FieldName queuedCommands = FieldName.forField("queuedCommands", "queued_commands"); 1879 1880 static final FieldName runningCommands = FieldName.forField("runningCommands", "running_commands"); 1881 } 1882 } 1883}