[wpimath] Commit generated quickbuf Java files (#5994)

This removes a build dependency on the quickbuf generator being available for the build platform.

It's safe to generate Java because the quickbuf version is defined by the project.

C++ protobufs can't be committed because the protoc version must
match the library version (this is a particular issue for cmake builds).
This commit is contained in:
Gold856
2023-12-05 20:02:29 -05:00
committed by GitHub
parent c2971c0bb3
commit 28deba20f5
16 changed files with 15621 additions and 108 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,621 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// Code generated by protocol buffer compiler. Do not edit!
package edu.wpi.first.math.proto;
import java.io.IOException;
import us.hebi.quickbuf.Descriptors;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.RepeatedByte;
public final class Plant {
private static final RepeatedByte descriptorData = ProtoUtil.decodeBase64(610,
"CgtwbGFudC5wcm90bxIJd3BpLnByb3RvIsQBCg9Qcm90b2J1ZkRDTW90b3ISJwoPbm9taW5hbF92b2x0" +
"YWdlGAEgASgBUg5ub21pbmFsVm9sdGFnZRIhCgxzdGFsbF90b3JxdWUYAiABKAFSC3N0YWxsVG9ycXVl" +
"EiMKDXN0YWxsX2N1cnJlbnQYAyABKAFSDHN0YWxsQ3VycmVudBIhCgxmcmVlX2N1cnJlbnQYBCABKAFS" +
"C2ZyZWVDdXJyZW50Eh0KCmZyZWVfc3BlZWQYBSABKAFSCWZyZWVTcGVlZEIaChhlZHUud3BpLmZpcnN0" +
"Lm1hdGgucHJvdG9K3AIKBhIEAAAMAQoICgEMEgMAABIKCAoBAhIDAgASCggKAQgSAwQAMQoJCgIIARID" +
"BAAxCgoKAgQAEgQGAAwBCgoKAwQAARIDBggXCgsKBAQAAgASAwcCHQoMCgUEAAIABRIDBwIICgwKBQQA" +
"AgABEgMHCRgKDAoFBAACAAMSAwcbHAoLCgQEAAIBEgMIAhoKDAoFBAACAQUSAwgCCAoMCgUEAAIBARID" +
"CAkVCgwKBQQAAgEDEgMIGBkKCwoEBAACAhIDCQIbCgwKBQQAAgIFEgMJAggKDAoFBAACAgESAwkJFgoM" +
"CgUEAAICAxIDCRkaCgsKBAQAAgMSAwoCGgoMCgUEAAIDBRIDCgIICgwKBQQAAgMBEgMKCRUKDAoFBAAC" +
"AwMSAwoYGQoLCgQEAAIEEgMLAhgKDAoFBAACBAUSAwsCCAoMCgUEAAIEARIDCwkTCgwKBQQAAgQDEgML" +
"FhdiBnByb3RvMw==");
static final Descriptors.FileDescriptor descriptor = Descriptors.FileDescriptor.internalBuildGeneratedFileFrom("plant.proto", "wpi.proto", descriptorData);
static final Descriptors.Descriptor wpi_proto_ProtobufDCMotor_descriptor = descriptor.internalContainedType(27, 196, "ProtobufDCMotor", "wpi.proto.ProtobufDCMotor");
/**
* @return this proto file's descriptor.
*/
public static Descriptors.FileDescriptor getDescriptor() {
return descriptor;
}
/**
* Protobuf type {@code ProtobufDCMotor}
*/
public static final class ProtobufDCMotor extends ProtoMessage<ProtobufDCMotor> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional double nominal_voltage = 1;</code>
*/
private double nominalVoltage;
/**
* <code>optional double stall_torque = 2;</code>
*/
private double stallTorque;
/**
* <code>optional double stall_current = 3;</code>
*/
private double stallCurrent;
/**
* <code>optional double free_current = 4;</code>
*/
private double freeCurrent;
/**
* <code>optional double free_speed = 5;</code>
*/
private double freeSpeed;
private ProtobufDCMotor() {
}
/**
* @return a new empty instance of {@code ProtobufDCMotor}
*/
public static ProtobufDCMotor newInstance() {
return new ProtobufDCMotor();
}
/**
* <code>optional double nominal_voltage = 1;</code>
* @return whether the nominalVoltage field is set
*/
public boolean hasNominalVoltage() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional double nominal_voltage = 1;</code>
* @return this
*/
public ProtobufDCMotor clearNominalVoltage() {
bitField0_ &= ~0x00000001;
nominalVoltage = 0D;
return this;
}
/**
* <code>optional double nominal_voltage = 1;</code>
* @return the nominalVoltage
*/
public double getNominalVoltage() {
return nominalVoltage;
}
/**
* <code>optional double nominal_voltage = 1;</code>
* @param value the nominalVoltage to set
* @return this
*/
public ProtobufDCMotor setNominalVoltage(final double value) {
bitField0_ |= 0x00000001;
nominalVoltage = value;
return this;
}
/**
* <code>optional double stall_torque = 2;</code>
* @return whether the stallTorque field is set
*/
public boolean hasStallTorque() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional double stall_torque = 2;</code>
* @return this
*/
public ProtobufDCMotor clearStallTorque() {
bitField0_ &= ~0x00000002;
stallTorque = 0D;
return this;
}
/**
* <code>optional double stall_torque = 2;</code>
* @return the stallTorque
*/
public double getStallTorque() {
return stallTorque;
}
/**
* <code>optional double stall_torque = 2;</code>
* @param value the stallTorque to set
* @return this
*/
public ProtobufDCMotor setStallTorque(final double value) {
bitField0_ |= 0x00000002;
stallTorque = value;
return this;
}
/**
* <code>optional double stall_current = 3;</code>
* @return whether the stallCurrent field is set
*/
public boolean hasStallCurrent() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional double stall_current = 3;</code>
* @return this
*/
public ProtobufDCMotor clearStallCurrent() {
bitField0_ &= ~0x00000004;
stallCurrent = 0D;
return this;
}
/**
* <code>optional double stall_current = 3;</code>
* @return the stallCurrent
*/
public double getStallCurrent() {
return stallCurrent;
}
/**
* <code>optional double stall_current = 3;</code>
* @param value the stallCurrent to set
* @return this
*/
public ProtobufDCMotor setStallCurrent(final double value) {
bitField0_ |= 0x00000004;
stallCurrent = value;
return this;
}
/**
* <code>optional double free_current = 4;</code>
* @return whether the freeCurrent field is set
*/
public boolean hasFreeCurrent() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>optional double free_current = 4;</code>
* @return this
*/
public ProtobufDCMotor clearFreeCurrent() {
bitField0_ &= ~0x00000008;
freeCurrent = 0D;
return this;
}
/**
* <code>optional double free_current = 4;</code>
* @return the freeCurrent
*/
public double getFreeCurrent() {
return freeCurrent;
}
/**
* <code>optional double free_current = 4;</code>
* @param value the freeCurrent to set
* @return this
*/
public ProtobufDCMotor setFreeCurrent(final double value) {
bitField0_ |= 0x00000008;
freeCurrent = value;
return this;
}
/**
* <code>optional double free_speed = 5;</code>
* @return whether the freeSpeed field is set
*/
public boolean hasFreeSpeed() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>optional double free_speed = 5;</code>
* @return this
*/
public ProtobufDCMotor clearFreeSpeed() {
bitField0_ &= ~0x00000010;
freeSpeed = 0D;
return this;
}
/**
* <code>optional double free_speed = 5;</code>
* @return the freeSpeed
*/
public double getFreeSpeed() {
return freeSpeed;
}
/**
* <code>optional double free_speed = 5;</code>
* @param value the freeSpeed to set
* @return this
*/
public ProtobufDCMotor setFreeSpeed(final double value) {
bitField0_ |= 0x00000010;
freeSpeed = value;
return this;
}
@Override
public ProtobufDCMotor copyFrom(final ProtobufDCMotor other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
nominalVoltage = other.nominalVoltage;
stallTorque = other.stallTorque;
stallCurrent = other.stallCurrent;
freeCurrent = other.freeCurrent;
freeSpeed = other.freeSpeed;
}
return this;
}
@Override
public ProtobufDCMotor mergeFrom(final ProtobufDCMotor other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasNominalVoltage()) {
setNominalVoltage(other.nominalVoltage);
}
if (other.hasStallTorque()) {
setStallTorque(other.stallTorque);
}
if (other.hasStallCurrent()) {
setStallCurrent(other.stallCurrent);
}
if (other.hasFreeCurrent()) {
setFreeCurrent(other.freeCurrent);
}
if (other.hasFreeSpeed()) {
setFreeSpeed(other.freeSpeed);
}
return this;
}
@Override
public ProtobufDCMotor clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
nominalVoltage = 0D;
stallTorque = 0D;
stallCurrent = 0D;
freeCurrent = 0D;
freeSpeed = 0D;
return this;
}
@Override
public ProtobufDCMotor clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ProtobufDCMotor)) {
return false;
}
ProtobufDCMotor other = (ProtobufDCMotor) o;
return bitField0_ == other.bitField0_
&& (!hasNominalVoltage() || ProtoUtil.isEqual(nominalVoltage, other.nominalVoltage))
&& (!hasStallTorque() || ProtoUtil.isEqual(stallTorque, other.stallTorque))
&& (!hasStallCurrent() || ProtoUtil.isEqual(stallCurrent, other.stallCurrent))
&& (!hasFreeCurrent() || ProtoUtil.isEqual(freeCurrent, other.freeCurrent))
&& (!hasFreeSpeed() || ProtoUtil.isEqual(freeSpeed, other.freeSpeed));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 9);
output.writeDoubleNoTag(nominalVoltage);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 17);
output.writeDoubleNoTag(stallTorque);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 25);
output.writeDoubleNoTag(stallCurrent);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 33);
output.writeDoubleNoTag(freeCurrent);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeRawByte((byte) 41);
output.writeDoubleNoTag(freeSpeed);
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 9;
}
if ((bitField0_ & 0x00000002) != 0) {
size += 9;
}
if ((bitField0_ & 0x00000004) != 0) {
size += 9;
}
if ((bitField0_ & 0x00000008) != 0) {
size += 9;
}
if ((bitField0_ & 0x00000010) != 0) {
size += 9;
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ProtobufDCMotor mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 9: {
// nominalVoltage
nominalVoltage = input.readDouble();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 17) {
break;
}
}
case 17: {
// stallTorque
stallTorque = input.readDouble();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 25) {
break;
}
}
case 25: {
// stallCurrent
stallCurrent = input.readDouble();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 33) {
break;
}
}
case 33: {
// freeCurrent
freeCurrent = input.readDouble();
bitField0_ |= 0x00000008;
tag = input.readTag();
if (tag != 41) {
break;
}
}
case 41: {
// freeSpeed
freeSpeed = input.readDouble();
bitField0_ |= 0x00000010;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeDouble(FieldNames.nominalVoltage, nominalVoltage);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeDouble(FieldNames.stallTorque, stallTorque);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeDouble(FieldNames.stallCurrent, stallCurrent);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeDouble(FieldNames.freeCurrent, freeCurrent);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeDouble(FieldNames.freeSpeed, freeSpeed);
}
output.endObject();
}
@Override
public ProtobufDCMotor mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 1374862050:
case 173092603: {
if (input.isAtField(FieldNames.nominalVoltage)) {
if (!input.trySkipNullValue()) {
nominalVoltage = input.readDouble();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 2075810250:
case 1238615945: {
if (input.isAtField(FieldNames.stallTorque)) {
if (!input.trySkipNullValue()) {
stallTorque = input.readDouble();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -2105262663:
case 2006484954: {
if (input.isAtField(FieldNames.stallCurrent)) {
if (!input.trySkipNullValue()) {
stallCurrent = input.readDouble();
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case 1024355693:
case 240406182: {
if (input.isAtField(FieldNames.freeCurrent)) {
if (!input.trySkipNullValue()) {
freeCurrent = input.readDouble();
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
case -444654277:
case -552732492: {
if (input.isAtField(FieldNames.freeSpeed)) {
if (!input.trySkipNullValue()) {
freeSpeed = input.readDouble();
bitField0_ |= 0x00000010;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ProtobufDCMotor clone() {
return new ProtobufDCMotor().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ProtobufDCMotor parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ProtobufDCMotor(), data).checkInitialized();
}
public static ProtobufDCMotor parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufDCMotor(), input).checkInitialized();
}
public static ProtobufDCMotor parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufDCMotor(), input).checkInitialized();
}
/**
* @return factory for creating ProtobufDCMotor messages
*/
public static MessageFactory<ProtobufDCMotor> getFactory() {
return ProtobufDCMotorFactory.INSTANCE;
}
/**
* @return this type's descriptor.
*/
public static Descriptors.Descriptor getDescriptor() {
return Plant.wpi_proto_ProtobufDCMotor_descriptor;
}
private enum ProtobufDCMotorFactory implements MessageFactory<ProtobufDCMotor> {
INSTANCE;
@Override
public ProtobufDCMotor create() {
return ProtobufDCMotor.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName nominalVoltage = FieldName.forField("nominalVoltage", "nominal_voltage");
static final FieldName stallTorque = FieldName.forField("stallTorque", "stall_torque");
static final FieldName stallCurrent = FieldName.forField("stallCurrent", "stall_current");
static final FieldName freeCurrent = FieldName.forField("freeCurrent", "free_current");
static final FieldName freeSpeed = FieldName.forField("freeSpeed", "free_speed");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,866 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// Code generated by protocol buffer compiler. Do not edit!
package edu.wpi.first.math.proto;
import java.io.IOException;
import us.hebi.quickbuf.Descriptors;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.RepeatedByte;
public final class System {
private static final RepeatedByte descriptorData = ProtoUtil.decodeBase64(832,
"CgxzeXN0ZW0ucHJvdG8SCXdwaS5wcm90bxoNd3BpbWF0aC5wcm90byKZAgoUUHJvdG9idWZMaW5lYXJT" +
"eXN0ZW0SHQoKbnVtX3N0YXRlcxgBIAEoDVIJbnVtU3RhdGVzEh0KCm51bV9pbnB1dHMYAiABKA1SCW51" +
"bUlucHV0cxIfCgtudW1fb3V0cHV0cxgDIAEoDVIKbnVtT3V0cHV0cxInCgFhGAQgASgLMhkud3BpLnBy" +
"b3RvLlByb3RvYnVmTWF0cml4UgFhEicKAWIYBSABKAsyGS53cGkucHJvdG8uUHJvdG9idWZNYXRyaXhS" +
"AWISJwoBYxgGIAEoCzIZLndwaS5wcm90by5Qcm90b2J1Zk1hdHJpeFIBYxInCgFkGAcgASgLMhkud3Bp" +
"LnByb3RvLlByb3RvYnVmTWF0cml4UgFkQhoKGGVkdS53cGkuZmlyc3QubWF0aC5wcm90b0rVAwoGEgQA" +
"ABABCggKAQwSAwAAEgoICgECEgMCABIKCQoCAwASAwQAFwoICgEIEgMGADEKCQoCCAESAwYAMQoKCgIE" +
"ABIECAAQAQoKCgMEAAESAwgIHAoLCgQEAAIAEgMJAhgKDAoFBAACAAUSAwkCCAoMCgUEAAIAARIDCQkT" +
"CgwKBQQAAgADEgMJFhcKCwoEBAACARIDCgIYCgwKBQQAAgEFEgMKAggKDAoFBAACAQESAwoJEwoMCgUE" +
"AAIBAxIDChYXCgsKBAQAAgISAwsCGQoMCgUEAAICBRIDCwIICgwKBQQAAgIBEgMLCRQKDAoFBAACAgMS" +
"AwsXGAoLCgQEAAIDEgMMAhcKDAoFBAACAwYSAwwCEAoMCgUEAAIDARIDDBESCgwKBQQAAgMDEgMMFRYK" +
"CwoEBAACBBIDDQIXCgwKBQQAAgQGEgMNAhAKDAoFBAACBAESAw0REgoMCgUEAAIEAxIDDRUWCgsKBAQA" +
"AgUSAw4CFwoMCgUEAAIFBhIDDgIQCgwKBQQAAgUBEgMOERIKDAoFBAACBQMSAw4VFgoLCgQEAAIGEgMP" +
"AhcKDAoFBAACBgYSAw8CEAoMCgUEAAIGARIDDxESCgwKBQQAAgYDEgMPFRZiBnByb3RvMw==");
static final Descriptors.FileDescriptor descriptor = Descriptors.FileDescriptor.internalBuildGeneratedFileFrom("system.proto", "wpi.proto", descriptorData, Wpimath.getDescriptor());
static final Descriptors.Descriptor wpi_proto_ProtobufLinearSystem_descriptor = descriptor.internalContainedType(43, 281, "ProtobufLinearSystem", "wpi.proto.ProtobufLinearSystem");
/**
* @return this proto file's descriptor.
*/
public static Descriptors.FileDescriptor getDescriptor() {
return descriptor;
}
/**
* Protobuf type {@code ProtobufLinearSystem}
*/
public static final class ProtobufLinearSystem extends ProtoMessage<ProtobufLinearSystem> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 num_states = 1;</code>
*/
private int numStates;
/**
* <code>optional uint32 num_inputs = 2;</code>
*/
private int numInputs;
/**
* <code>optional uint32 num_outputs = 3;</code>
*/
private int numOutputs;
/**
* <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
*/
private final Wpimath.ProtobufMatrix a = Wpimath.ProtobufMatrix.newInstance();
/**
* <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
*/
private final Wpimath.ProtobufMatrix b = Wpimath.ProtobufMatrix.newInstance();
/**
* <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
*/
private final Wpimath.ProtobufMatrix c = Wpimath.ProtobufMatrix.newInstance();
/**
* <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
*/
private final Wpimath.ProtobufMatrix d = Wpimath.ProtobufMatrix.newInstance();
private ProtobufLinearSystem() {
}
/**
* @return a new empty instance of {@code ProtobufLinearSystem}
*/
public static ProtobufLinearSystem newInstance() {
return new ProtobufLinearSystem();
}
/**
* <code>optional uint32 num_states = 1;</code>
* @return whether the numStates field is set
*/
public boolean hasNumStates() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 num_states = 1;</code>
* @return this
*/
public ProtobufLinearSystem clearNumStates() {
bitField0_ &= ~0x00000001;
numStates = 0;
return this;
}
/**
* <code>optional uint32 num_states = 1;</code>
* @return the numStates
*/
public int getNumStates() {
return numStates;
}
/**
* <code>optional uint32 num_states = 1;</code>
* @param value the numStates to set
* @return this
*/
public ProtobufLinearSystem setNumStates(final int value) {
bitField0_ |= 0x00000001;
numStates = value;
return this;
}
/**
* <code>optional uint32 num_inputs = 2;</code>
* @return whether the numInputs field is set
*/
public boolean hasNumInputs() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 num_inputs = 2;</code>
* @return this
*/
public ProtobufLinearSystem clearNumInputs() {
bitField0_ &= ~0x00000002;
numInputs = 0;
return this;
}
/**
* <code>optional uint32 num_inputs = 2;</code>
* @return the numInputs
*/
public int getNumInputs() {
return numInputs;
}
/**
* <code>optional uint32 num_inputs = 2;</code>
* @param value the numInputs to set
* @return this
*/
public ProtobufLinearSystem setNumInputs(final int value) {
bitField0_ |= 0x00000002;
numInputs = value;
return this;
}
/**
* <code>optional uint32 num_outputs = 3;</code>
* @return whether the numOutputs field is set
*/
public boolean hasNumOutputs() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional uint32 num_outputs = 3;</code>
* @return this
*/
public ProtobufLinearSystem clearNumOutputs() {
bitField0_ &= ~0x00000004;
numOutputs = 0;
return this;
}
/**
* <code>optional uint32 num_outputs = 3;</code>
* @return the numOutputs
*/
public int getNumOutputs() {
return numOutputs;
}
/**
* <code>optional uint32 num_outputs = 3;</code>
* @param value the numOutputs to set
* @return this
*/
public ProtobufLinearSystem setNumOutputs(final int value) {
bitField0_ |= 0x00000004;
numOutputs = value;
return this;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
* @return whether the a field is set
*/
public boolean hasA() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
* @return this
*/
public ProtobufLinearSystem clearA() {
bitField0_ &= ~0x00000008;
a.clear();
return this;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableA()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Wpimath.ProtobufMatrix getA() {
return a;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public Wpimath.ProtobufMatrix getMutableA() {
bitField0_ |= 0x00000008;
return a;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix a = 4;</code>
* @param value the a to set
* @return this
*/
public ProtobufLinearSystem setA(final Wpimath.ProtobufMatrix value) {
bitField0_ |= 0x00000008;
a.copyFrom(value);
return this;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
* @return whether the b field is set
*/
public boolean hasB() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
* @return this
*/
public ProtobufLinearSystem clearB() {
bitField0_ &= ~0x00000010;
b.clear();
return this;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableB()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Wpimath.ProtobufMatrix getB() {
return b;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public Wpimath.ProtobufMatrix getMutableB() {
bitField0_ |= 0x00000010;
return b;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix b = 5;</code>
* @param value the b to set
* @return this
*/
public ProtobufLinearSystem setB(final Wpimath.ProtobufMatrix value) {
bitField0_ |= 0x00000010;
b.copyFrom(value);
return this;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
* @return whether the c field is set
*/
public boolean hasC() {
return (bitField0_ & 0x00000020) != 0;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
* @return this
*/
public ProtobufLinearSystem clearC() {
bitField0_ &= ~0x00000020;
c.clear();
return this;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableC()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Wpimath.ProtobufMatrix getC() {
return c;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public Wpimath.ProtobufMatrix getMutableC() {
bitField0_ |= 0x00000020;
return c;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix c = 6;</code>
* @param value the c to set
* @return this
*/
public ProtobufLinearSystem setC(final Wpimath.ProtobufMatrix value) {
bitField0_ |= 0x00000020;
c.copyFrom(value);
return this;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
* @return whether the d field is set
*/
public boolean hasD() {
return (bitField0_ & 0x00000040) != 0;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
* @return this
*/
public ProtobufLinearSystem clearD() {
bitField0_ &= ~0x00000040;
d.clear();
return this;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableD()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Wpimath.ProtobufMatrix getD() {
return d;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public Wpimath.ProtobufMatrix getMutableD() {
bitField0_ |= 0x00000040;
return d;
}
/**
* <code>optional .wpi.proto.ProtobufMatrix d = 7;</code>
* @param value the d to set
* @return this
*/
public ProtobufLinearSystem setD(final Wpimath.ProtobufMatrix value) {
bitField0_ |= 0x00000040;
d.copyFrom(value);
return this;
}
@Override
public ProtobufLinearSystem copyFrom(final ProtobufLinearSystem other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
numStates = other.numStates;
numInputs = other.numInputs;
numOutputs = other.numOutputs;
a.copyFrom(other.a);
b.copyFrom(other.b);
c.copyFrom(other.c);
d.copyFrom(other.d);
}
return this;
}
@Override
public ProtobufLinearSystem mergeFrom(final ProtobufLinearSystem other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasNumStates()) {
setNumStates(other.numStates);
}
if (other.hasNumInputs()) {
setNumInputs(other.numInputs);
}
if (other.hasNumOutputs()) {
setNumOutputs(other.numOutputs);
}
if (other.hasA()) {
getMutableA().mergeFrom(other.a);
}
if (other.hasB()) {
getMutableB().mergeFrom(other.b);
}
if (other.hasC()) {
getMutableC().mergeFrom(other.c);
}
if (other.hasD()) {
getMutableD().mergeFrom(other.d);
}
return this;
}
@Override
public ProtobufLinearSystem clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
numStates = 0;
numInputs = 0;
numOutputs = 0;
a.clear();
b.clear();
c.clear();
d.clear();
return this;
}
@Override
public ProtobufLinearSystem clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
a.clearQuick();
b.clearQuick();
c.clearQuick();
d.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ProtobufLinearSystem)) {
return false;
}
ProtobufLinearSystem other = (ProtobufLinearSystem) o;
return bitField0_ == other.bitField0_
&& (!hasNumStates() || numStates == other.numStates)
&& (!hasNumInputs() || numInputs == other.numInputs)
&& (!hasNumOutputs() || numOutputs == other.numOutputs)
&& (!hasA() || a.equals(other.a))
&& (!hasB() || b.equals(other.b))
&& (!hasC() || c.equals(other.c))
&& (!hasD() || d.equals(other.d));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 8);
output.writeUInt32NoTag(numStates);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 16);
output.writeUInt32NoTag(numInputs);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 24);
output.writeUInt32NoTag(numOutputs);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 34);
output.writeMessageNoTag(a);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeRawByte((byte) 42);
output.writeMessageNoTag(b);
}
if ((bitField0_ & 0x00000020) != 0) {
output.writeRawByte((byte) 50);
output.writeMessageNoTag(c);
}
if ((bitField0_ & 0x00000040) != 0) {
output.writeRawByte((byte) 58);
output.writeMessageNoTag(d);
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(numStates);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(numInputs);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(numOutputs);
}
if ((bitField0_ & 0x00000008) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(a);
}
if ((bitField0_ & 0x00000010) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(b);
}
if ((bitField0_ & 0x00000020) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(c);
}
if ((bitField0_ & 0x00000040) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(d);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ProtobufLinearSystem mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 8: {
// numStates
numStates = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 16) {
break;
}
}
case 16: {
// numInputs
numInputs = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 24) {
break;
}
}
case 24: {
// numOutputs
numOutputs = input.readUInt32();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 34) {
break;
}
}
case 34: {
// a
input.readMessage(a);
bitField0_ |= 0x00000008;
tag = input.readTag();
if (tag != 42) {
break;
}
}
case 42: {
// b
input.readMessage(b);
bitField0_ |= 0x00000010;
tag = input.readTag();
if (tag != 50) {
break;
}
}
case 50: {
// c
input.readMessage(c);
bitField0_ |= 0x00000020;
tag = input.readTag();
if (tag != 58) {
break;
}
}
case 58: {
// d
input.readMessage(d);
bitField0_ |= 0x00000040;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.numStates, numStates);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.numInputs, numInputs);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeUInt32(FieldNames.numOutputs, numOutputs);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeMessage(FieldNames.a, a);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeMessage(FieldNames.b, b);
}
if ((bitField0_ & 0x00000020) != 0) {
output.writeMessage(FieldNames.c, c);
}
if ((bitField0_ & 0x00000040) != 0) {
output.writeMessage(FieldNames.d, d);
}
output.endObject();
}
@Override
public ProtobufLinearSystem mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 1233856808:
case 1643330779: {
if (input.isAtField(FieldNames.numStates)) {
if (!input.trySkipNullValue()) {
numStates = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 942472463:
case 1351946434: {
if (input.isAtField(FieldNames.numInputs)) {
if (!input.trySkipNullValue()) {
numInputs = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case 385880364:
case 194671577: {
if (input.isAtField(FieldNames.numOutputs)) {
if (!input.trySkipNullValue()) {
numOutputs = input.readUInt32();
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case 97: {
if (input.isAtField(FieldNames.a)) {
if (!input.trySkipNullValue()) {
input.readMessage(a);
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
case 98: {
if (input.isAtField(FieldNames.b)) {
if (!input.trySkipNullValue()) {
input.readMessage(b);
bitField0_ |= 0x00000010;
}
} else {
input.skipUnknownField();
}
break;
}
case 99: {
if (input.isAtField(FieldNames.c)) {
if (!input.trySkipNullValue()) {
input.readMessage(c);
bitField0_ |= 0x00000020;
}
} else {
input.skipUnknownField();
}
break;
}
case 100: {
if (input.isAtField(FieldNames.d)) {
if (!input.trySkipNullValue()) {
input.readMessage(d);
bitField0_ |= 0x00000040;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ProtobufLinearSystem clone() {
return new ProtobufLinearSystem().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ProtobufLinearSystem parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ProtobufLinearSystem(), data).checkInitialized();
}
public static ProtobufLinearSystem parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufLinearSystem(), input).checkInitialized();
}
public static ProtobufLinearSystem parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufLinearSystem(), input).checkInitialized();
}
/**
* @return factory for creating ProtobufLinearSystem messages
*/
public static MessageFactory<ProtobufLinearSystem> getFactory() {
return ProtobufLinearSystemFactory.INSTANCE;
}
/**
* @return this type's descriptor.
*/
public static Descriptors.Descriptor getDescriptor() {
return System.wpi_proto_ProtobufLinearSystem_descriptor;
}
private enum ProtobufLinearSystemFactory implements MessageFactory<ProtobufLinearSystem> {
INSTANCE;
@Override
public ProtobufLinearSystem create() {
return ProtobufLinearSystem.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName numStates = FieldName.forField("numStates", "num_states");
static final FieldName numInputs = FieldName.forField("numInputs", "num_inputs");
static final FieldName numOutputs = FieldName.forField("numOutputs", "num_outputs");
static final FieldName a = FieldName.forField("a");
static final FieldName b = FieldName.forField("b");
static final FieldName c = FieldName.forField("c");
static final FieldName d = FieldName.forField("d");
}
}
}

View File

@@ -0,0 +1,928 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// Code generated by protocol buffer compiler. Do not edit!
package edu.wpi.first.math.proto;
import java.io.IOException;
import us.hebi.quickbuf.Descriptors;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.RepeatedByte;
import us.hebi.quickbuf.RepeatedMessage;
public final class Trajectory {
private static final RepeatedByte descriptorData = ProtoUtil.decodeBase64(809,
"ChB0cmFqZWN0b3J5LnByb3RvEgl3cGkucHJvdG8aEGdlb21ldHJ5MmQucHJvdG8iugEKF1Byb3RvYnVm" +
"VHJhamVjdG9yeVN0YXRlEhIKBHRpbWUYASABKAFSBHRpbWUSGgoIdmVsb2NpdHkYAiABKAFSCHZlbG9j" +
"aXR5EiIKDGFjY2VsZXJhdGlvbhgDIAEoAVIMYWNjZWxlcmF0aW9uEi0KBHBvc2UYBCABKAsyGS53cGku" +
"cHJvdG8uUHJvdG9idWZQb3NlMmRSBHBvc2USHAoJY3VydmF0dXJlGAUgASgBUgljdXJ2YXR1cmUiUAoS" +
"UHJvdG9idWZUcmFqZWN0b3J5EjoKBnN0YXRlcxgCIAMoCzIiLndwaS5wcm90by5Qcm90b2J1ZlRyYWpl" +
"Y3RvcnlTdGF0ZVIGc3RhdGVzQhoKGGVkdS53cGkuZmlyc3QubWF0aC5wcm90b0rEAwoGEgQAABIBCggK" +
"AQwSAwAAEgoICgECEgMCABIKCQoCAwASAwQAGgoICgEIEgMGADEKCQoCCAESAwYAMQoKCgIEABIECAAO" +
"AQoKCgMEAAESAwgIHwoLCgQEAAIAEgMJAhIKDAoFBAACAAUSAwkCCAoMCgUEAAIAARIDCQkNCgwKBQQA" +
"AgADEgMJEBEKCwoEBAACARIDCgIWCgwKBQQAAgEFEgMKAggKDAoFBAACAQESAwoJEQoMCgUEAAIBAxID" +
"ChQVCgsKBAQAAgISAwsCGgoMCgUEAAICBRIDCwIICgwKBQQAAgIBEgMLCRUKDAoFBAACAgMSAwsYGQoL" +
"CgQEAAIDEgMMAhoKDAoFBAACAwYSAwwCEAoMCgUEAAIDARIDDBEVCgwKBQQAAgMDEgMMGBkKCwoEBAAC" +
"BBIDDQIXCgwKBQQAAgQFEgMNAggKDAoFBAACBAESAw0JEgoMCgUEAAIEAxIDDRUWCgoKAgQBEgQQABIB" +
"CgoKAwQBARIDEAgaCgsKBAQBAgASAxECLgoMCgUEAQIABBIDEQIKCgwKBQQBAgAGEgMRCyIKDAoFBAEC" +
"AAESAxEjKQoMCgUEAQIAAxIDESwtYgZwcm90bzM=");
static final Descriptors.FileDescriptor descriptor = Descriptors.FileDescriptor.internalBuildGeneratedFileFrom("trajectory.proto", "wpi.proto", descriptorData, Geometry2D.getDescriptor());
static final Descriptors.Descriptor wpi_proto_ProtobufTrajectoryState_descriptor = descriptor.internalContainedType(50, 186, "ProtobufTrajectoryState", "wpi.proto.ProtobufTrajectoryState");
static final Descriptors.Descriptor wpi_proto_ProtobufTrajectory_descriptor = descriptor.internalContainedType(238, 80, "ProtobufTrajectory", "wpi.proto.ProtobufTrajectory");
/**
* @return this proto file's descriptor.
*/
public static Descriptors.FileDescriptor getDescriptor() {
return descriptor;
}
/**
* Protobuf type {@code ProtobufTrajectoryState}
*/
public static final class ProtobufTrajectoryState extends ProtoMessage<ProtobufTrajectoryState> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional double time = 1;</code>
*/
private double time;
/**
* <code>optional double velocity = 2;</code>
*/
private double velocity;
/**
* <code>optional double acceleration = 3;</code>
*/
private double acceleration;
/**
* <code>optional double curvature = 5;</code>
*/
private double curvature;
/**
* <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
*/
private final Geometry2D.ProtobufPose2d pose = Geometry2D.ProtobufPose2d.newInstance();
private ProtobufTrajectoryState() {
}
/**
* @return a new empty instance of {@code ProtobufTrajectoryState}
*/
public static ProtobufTrajectoryState newInstance() {
return new ProtobufTrajectoryState();
}
/**
* <code>optional double time = 1;</code>
* @return whether the time field is set
*/
public boolean hasTime() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional double time = 1;</code>
* @return this
*/
public ProtobufTrajectoryState clearTime() {
bitField0_ &= ~0x00000001;
time = 0D;
return this;
}
/**
* <code>optional double time = 1;</code>
* @return the time
*/
public double getTime() {
return time;
}
/**
* <code>optional double time = 1;</code>
* @param value the time to set
* @return this
*/
public ProtobufTrajectoryState setTime(final double value) {
bitField0_ |= 0x00000001;
time = value;
return this;
}
/**
* <code>optional double velocity = 2;</code>
* @return whether the velocity field is set
*/
public boolean hasVelocity() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional double velocity = 2;</code>
* @return this
*/
public ProtobufTrajectoryState clearVelocity() {
bitField0_ &= ~0x00000002;
velocity = 0D;
return this;
}
/**
* <code>optional double velocity = 2;</code>
* @return the velocity
*/
public double getVelocity() {
return velocity;
}
/**
* <code>optional double velocity = 2;</code>
* @param value the velocity to set
* @return this
*/
public ProtobufTrajectoryState setVelocity(final double value) {
bitField0_ |= 0x00000002;
velocity = value;
return this;
}
/**
* <code>optional double acceleration = 3;</code>
* @return whether the acceleration field is set
*/
public boolean hasAcceleration() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional double acceleration = 3;</code>
* @return this
*/
public ProtobufTrajectoryState clearAcceleration() {
bitField0_ &= ~0x00000004;
acceleration = 0D;
return this;
}
/**
* <code>optional double acceleration = 3;</code>
* @return the acceleration
*/
public double getAcceleration() {
return acceleration;
}
/**
* <code>optional double acceleration = 3;</code>
* @param value the acceleration to set
* @return this
*/
public ProtobufTrajectoryState setAcceleration(final double value) {
bitField0_ |= 0x00000004;
acceleration = value;
return this;
}
/**
* <code>optional double curvature = 5;</code>
* @return whether the curvature field is set
*/
public boolean hasCurvature() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>optional double curvature = 5;</code>
* @return this
*/
public ProtobufTrajectoryState clearCurvature() {
bitField0_ &= ~0x00000008;
curvature = 0D;
return this;
}
/**
* <code>optional double curvature = 5;</code>
* @return the curvature
*/
public double getCurvature() {
return curvature;
}
/**
* <code>optional double curvature = 5;</code>
* @param value the curvature to set
* @return this
*/
public ProtobufTrajectoryState setCurvature(final double value) {
bitField0_ |= 0x00000008;
curvature = value;
return this;
}
/**
* <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
* @return whether the pose field is set
*/
public boolean hasPose() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
* @return this
*/
public ProtobufTrajectoryState clearPose() {
bitField0_ &= ~0x00000010;
pose.clear();
return this;
}
/**
* <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutablePose()} if you want to modify it.
*
* @return internal storage object for reading
*/
public Geometry2D.ProtobufPose2d getPose() {
return pose;
}
/**
* <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public Geometry2D.ProtobufPose2d getMutablePose() {
bitField0_ |= 0x00000010;
return pose;
}
/**
* <code>optional .wpi.proto.ProtobufPose2d pose = 4;</code>
* @param value the pose to set
* @return this
*/
public ProtobufTrajectoryState setPose(final Geometry2D.ProtobufPose2d value) {
bitField0_ |= 0x00000010;
pose.copyFrom(value);
return this;
}
@Override
public ProtobufTrajectoryState copyFrom(final ProtobufTrajectoryState other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
time = other.time;
velocity = other.velocity;
acceleration = other.acceleration;
curvature = other.curvature;
pose.copyFrom(other.pose);
}
return this;
}
@Override
public ProtobufTrajectoryState mergeFrom(final ProtobufTrajectoryState other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasTime()) {
setTime(other.time);
}
if (other.hasVelocity()) {
setVelocity(other.velocity);
}
if (other.hasAcceleration()) {
setAcceleration(other.acceleration);
}
if (other.hasCurvature()) {
setCurvature(other.curvature);
}
if (other.hasPose()) {
getMutablePose().mergeFrom(other.pose);
}
return this;
}
@Override
public ProtobufTrajectoryState clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
time = 0D;
velocity = 0D;
acceleration = 0D;
curvature = 0D;
pose.clear();
return this;
}
@Override
public ProtobufTrajectoryState clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
pose.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ProtobufTrajectoryState)) {
return false;
}
ProtobufTrajectoryState other = (ProtobufTrajectoryState) o;
return bitField0_ == other.bitField0_
&& (!hasTime() || ProtoUtil.isEqual(time, other.time))
&& (!hasVelocity() || ProtoUtil.isEqual(velocity, other.velocity))
&& (!hasAcceleration() || ProtoUtil.isEqual(acceleration, other.acceleration))
&& (!hasCurvature() || ProtoUtil.isEqual(curvature, other.curvature))
&& (!hasPose() || pose.equals(other.pose));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 9);
output.writeDoubleNoTag(time);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 17);
output.writeDoubleNoTag(velocity);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 25);
output.writeDoubleNoTag(acceleration);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 41);
output.writeDoubleNoTag(curvature);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeRawByte((byte) 34);
output.writeMessageNoTag(pose);
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 9;
}
if ((bitField0_ & 0x00000002) != 0) {
size += 9;
}
if ((bitField0_ & 0x00000004) != 0) {
size += 9;
}
if ((bitField0_ & 0x00000008) != 0) {
size += 9;
}
if ((bitField0_ & 0x00000010) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(pose);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ProtobufTrajectoryState mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 9: {
// time
time = input.readDouble();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 17) {
break;
}
}
case 17: {
// velocity
velocity = input.readDouble();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 25) {
break;
}
}
case 25: {
// acceleration
acceleration = input.readDouble();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 41) {
break;
}
}
case 41: {
// curvature
curvature = input.readDouble();
bitField0_ |= 0x00000008;
tag = input.readTag();
if (tag != 34) {
break;
}
}
case 34: {
// pose
input.readMessage(pose);
bitField0_ |= 0x00000010;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeDouble(FieldNames.time, time);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeDouble(FieldNames.velocity, velocity);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeDouble(FieldNames.acceleration, acceleration);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeDouble(FieldNames.curvature, curvature);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeMessage(FieldNames.pose, pose);
}
output.endObject();
}
@Override
public ProtobufTrajectoryState mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 3560141: {
if (input.isAtField(FieldNames.time)) {
if (!input.trySkipNullValue()) {
time = input.readDouble();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 2134260957: {
if (input.isAtField(FieldNames.velocity)) {
if (!input.trySkipNullValue()) {
velocity = input.readDouble();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -267299712: {
if (input.isAtField(FieldNames.acceleration)) {
if (!input.trySkipNullValue()) {
acceleration = input.readDouble();
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case 768611295: {
if (input.isAtField(FieldNames.curvature)) {
if (!input.trySkipNullValue()) {
curvature = input.readDouble();
bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
}
break;
}
case 3446929: {
if (input.isAtField(FieldNames.pose)) {
if (!input.trySkipNullValue()) {
input.readMessage(pose);
bitField0_ |= 0x00000010;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ProtobufTrajectoryState clone() {
return new ProtobufTrajectoryState().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ProtobufTrajectoryState parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ProtobufTrajectoryState(), data).checkInitialized();
}
public static ProtobufTrajectoryState parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufTrajectoryState(), input).checkInitialized();
}
public static ProtobufTrajectoryState parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufTrajectoryState(), input).checkInitialized();
}
/**
* @return factory for creating ProtobufTrajectoryState messages
*/
public static MessageFactory<ProtobufTrajectoryState> getFactory() {
return ProtobufTrajectoryStateFactory.INSTANCE;
}
/**
* @return this type's descriptor.
*/
public static Descriptors.Descriptor getDescriptor() {
return Trajectory.wpi_proto_ProtobufTrajectoryState_descriptor;
}
private enum ProtobufTrajectoryStateFactory implements MessageFactory<ProtobufTrajectoryState> {
INSTANCE;
@Override
public ProtobufTrajectoryState create() {
return ProtobufTrajectoryState.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName time = FieldName.forField("time");
static final FieldName velocity = FieldName.forField("velocity");
static final FieldName acceleration = FieldName.forField("acceleration");
static final FieldName curvature = FieldName.forField("curvature");
static final FieldName pose = FieldName.forField("pose");
}
}
/**
* Protobuf type {@code ProtobufTrajectory}
*/
public static final class ProtobufTrajectory extends ProtoMessage<ProtobufTrajectory> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
*/
private final RepeatedMessage<ProtobufTrajectoryState> states = RepeatedMessage.newEmptyInstance(ProtobufTrajectoryState.getFactory());
private ProtobufTrajectory() {
}
/**
* @return a new empty instance of {@code ProtobufTrajectory}
*/
public static ProtobufTrajectory newInstance() {
return new ProtobufTrajectory();
}
/**
* <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
* @return whether the states field is set
*/
public boolean hasStates() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
* @return this
*/
public ProtobufTrajectory clearStates() {
bitField0_ &= ~0x00000001;
states.clear();
return this;
}
/**
* <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableStates()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<ProtobufTrajectoryState> getStates() {
return states;
}
/**
* <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedMessage<ProtobufTrajectoryState> getMutableStates() {
bitField0_ |= 0x00000001;
return states;
}
/**
* <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
* @param value the states to add
* @return this
*/
public ProtobufTrajectory addStates(final ProtobufTrajectoryState value) {
bitField0_ |= 0x00000001;
states.add(value);
return this;
}
/**
* <code>repeated .wpi.proto.ProtobufTrajectoryState states = 2;</code>
* @param values the states to add
* @return this
*/
public ProtobufTrajectory addAllStates(final ProtobufTrajectoryState... values) {
bitField0_ |= 0x00000001;
states.addAll(values);
return this;
}
@Override
public ProtobufTrajectory copyFrom(final ProtobufTrajectory other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
states.copyFrom(other.states);
}
return this;
}
@Override
public ProtobufTrajectory mergeFrom(final ProtobufTrajectory other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasStates()) {
getMutableStates().addAll(other.states);
}
return this;
}
@Override
public ProtobufTrajectory clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
states.clear();
return this;
}
@Override
public ProtobufTrajectory clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
states.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ProtobufTrajectory)) {
return false;
}
ProtobufTrajectory other = (ProtobufTrajectory) o;
return bitField0_ == other.bitField0_
&& (!hasStates() || states.equals(other.states));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
for (int i = 0; i < states.length(); i++) {
output.writeRawByte((byte) 18);
output.writeMessageNoTag(states.get(i));
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += (1 * states.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(states);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ProtobufTrajectory mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 18: {
// states
tag = input.readRepeatedMessage(states, tag);
bitField0_ |= 0x00000001;
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeRepeatedMessage(FieldNames.states, states);
}
output.endObject();
}
@Override
public ProtobufTrajectory mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case -892482046: {
if (input.isAtField(FieldNames.states)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(states);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ProtobufTrajectory clone() {
return new ProtobufTrajectory().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ProtobufTrajectory parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ProtobufTrajectory(), data).checkInitialized();
}
public static ProtobufTrajectory parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufTrajectory(), input).checkInitialized();
}
public static ProtobufTrajectory parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufTrajectory(), input).checkInitialized();
}
/**
* @return factory for creating ProtobufTrajectory messages
*/
public static MessageFactory<ProtobufTrajectory> getFactory() {
return ProtobufTrajectoryFactory.INSTANCE;
}
/**
* @return this type's descriptor.
*/
public static Descriptors.Descriptor getDescriptor() {
return Trajectory.wpi_proto_ProtobufTrajectory_descriptor;
}
private enum ProtobufTrajectoryFactory implements MessageFactory<ProtobufTrajectory> {
INSTANCE;
@Override
public ProtobufTrajectory create() {
return ProtobufTrajectory.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName states = FieldName.forField("states");
}
}
}

View File

@@ -0,0 +1,791 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
// Code generated by protocol buffer compiler. Do not edit!
package edu.wpi.first.math.proto;
import java.io.IOException;
import us.hebi.quickbuf.Descriptors;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.RepeatedByte;
import us.hebi.quickbuf.RepeatedDouble;
public final class Wpimath {
private static final RepeatedByte descriptorData = ProtoUtil.decodeBase64(540,
"Cg13cGltYXRoLnByb3RvEgl3cGkucHJvdG8iWgoOUHJvdG9idWZNYXRyaXgSGQoIbnVtX3Jvd3MYASAB" +
"KA1SB251bVJvd3MSGQoIbnVtX2NvbHMYAiABKA1SB251bUNvbHMSEgoEZGF0YRgDIAMoAVIEZGF0YSIk" +
"Cg5Qcm90b2J1ZlZlY3RvchISCgRyb3dzGAEgAygBUgRyb3dzQhoKGGVkdS53cGkuZmlyc3QubWF0aC5w" +
"cm90b0rZAgoGEgQAAA4BCggKAQwSAwAAEgoICgECEgMCABIKCAoBCBIDBAAxCgkKAggBEgMEADEKCgoC" +
"BAASBAYACgEKCgoDBAABEgMGCBYKCwoEBAACABIDBwIWCgwKBQQAAgAFEgMHAggKDAoFBAACAAESAwcJ" +
"EQoMCgUEAAIAAxIDBxQVCgsKBAQAAgESAwgCFgoMCgUEAAIBBRIDCAIICgwKBQQAAgEBEgMICREKDAoF" +
"BAACAQMSAwgUFQoLCgQEAAICEgMJAhsKDAoFBAACAgQSAwkCCgoMCgUEAAICBRIDCQsRCgwKBQQAAgIB" +
"EgMJEhYKDAoFBAACAgMSAwkZGgoKCgIEARIEDAAOAQoKCgMEAQESAwwIFgoLCgQEAQIAEgMNAhsKDAoF" +
"BAECAAQSAw0CCgoMCgUEAQIABRIDDQsRCgwKBQQBAgABEgMNEhYKDAoFBAECAAMSAw0ZGmIGcHJvdG8z");
static final Descriptors.FileDescriptor descriptor = Descriptors.FileDescriptor.internalBuildGeneratedFileFrom("wpimath.proto", "wpi.proto", descriptorData);
static final Descriptors.Descriptor wpi_proto_ProtobufMatrix_descriptor = descriptor.internalContainedType(28, 90, "ProtobufMatrix", "wpi.proto.ProtobufMatrix");
static final Descriptors.Descriptor wpi_proto_ProtobufVector_descriptor = descriptor.internalContainedType(120, 36, "ProtobufVector", "wpi.proto.ProtobufVector");
/**
* @return this proto file's descriptor.
*/
public static Descriptors.FileDescriptor getDescriptor() {
return descriptor;
}
/**
* Protobuf type {@code ProtobufMatrix}
*/
public static final class ProtobufMatrix extends ProtoMessage<ProtobufMatrix> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 num_rows = 1;</code>
*/
private int numRows;
/**
* <code>optional uint32 num_cols = 2;</code>
*/
private int numCols;
/**
* <code>repeated double data = 3;</code>
*/
private final RepeatedDouble data = RepeatedDouble.newEmptyInstance();
private ProtobufMatrix() {
}
/**
* @return a new empty instance of {@code ProtobufMatrix}
*/
public static ProtobufMatrix newInstance() {
return new ProtobufMatrix();
}
/**
* <code>optional uint32 num_rows = 1;</code>
* @return whether the numRows field is set
*/
public boolean hasNumRows() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 num_rows = 1;</code>
* @return this
*/
public ProtobufMatrix clearNumRows() {
bitField0_ &= ~0x00000001;
numRows = 0;
return this;
}
/**
* <code>optional uint32 num_rows = 1;</code>
* @return the numRows
*/
public int getNumRows() {
return numRows;
}
/**
* <code>optional uint32 num_rows = 1;</code>
* @param value the numRows to set
* @return this
*/
public ProtobufMatrix setNumRows(final int value) {
bitField0_ |= 0x00000001;
numRows = value;
return this;
}
/**
* <code>optional uint32 num_cols = 2;</code>
* @return whether the numCols field is set
*/
public boolean hasNumCols() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 num_cols = 2;</code>
* @return this
*/
public ProtobufMatrix clearNumCols() {
bitField0_ &= ~0x00000002;
numCols = 0;
return this;
}
/**
* <code>optional uint32 num_cols = 2;</code>
* @return the numCols
*/
public int getNumCols() {
return numCols;
}
/**
* <code>optional uint32 num_cols = 2;</code>
* @param value the numCols to set
* @return this
*/
public ProtobufMatrix setNumCols(final int value) {
bitField0_ |= 0x00000002;
numCols = value;
return this;
}
/**
* <code>repeated double data = 3;</code>
* @return whether the data field is set
*/
public boolean hasData() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>repeated double data = 3;</code>
* @return this
*/
public ProtobufMatrix clearData() {
bitField0_ &= ~0x00000004;
data.clear();
return this;
}
/**
* <code>repeated double data = 3;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableData()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedDouble getData() {
return data;
}
/**
* <code>repeated double data = 3;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedDouble getMutableData() {
bitField0_ |= 0x00000004;
return data;
}
/**
* <code>repeated double data = 3;</code>
* @param value the data to add
* @return this
*/
public ProtobufMatrix addData(final double value) {
bitField0_ |= 0x00000004;
data.add(value);
return this;
}
/**
* <code>repeated double data = 3;</code>
* @param values the data to add
* @return this
*/
public ProtobufMatrix addAllData(final double... values) {
bitField0_ |= 0x00000004;
data.addAll(values);
return this;
}
@Override
public ProtobufMatrix copyFrom(final ProtobufMatrix other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
numRows = other.numRows;
numCols = other.numCols;
data.copyFrom(other.data);
}
return this;
}
@Override
public ProtobufMatrix mergeFrom(final ProtobufMatrix other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasNumRows()) {
setNumRows(other.numRows);
}
if (other.hasNumCols()) {
setNumCols(other.numCols);
}
if (other.hasData()) {
getMutableData().addAll(other.data);
}
return this;
}
@Override
public ProtobufMatrix clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
numRows = 0;
numCols = 0;
data.clear();
return this;
}
@Override
public ProtobufMatrix clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
data.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ProtobufMatrix)) {
return false;
}
ProtobufMatrix other = (ProtobufMatrix) o;
return bitField0_ == other.bitField0_
&& (!hasNumRows() || numRows == other.numRows)
&& (!hasNumCols() || numCols == other.numCols)
&& (!hasData() || data.equals(other.data));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 8);
output.writeUInt32NoTag(numRows);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 16);
output.writeUInt32NoTag(numCols);
}
if ((bitField0_ & 0x00000004) != 0) {
for (int i = 0; i < data.length(); i++) {
output.writeRawByte((byte) 25);
output.writeDoubleNoTag(data.array()[i]);
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(numRows);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(numCols);
}
if ((bitField0_ & 0x00000004) != 0) {
size += (1 + 8) * data.length();
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ProtobufMatrix mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 8: {
// numRows
numRows = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 16) {
break;
}
}
case 16: {
// numCols
numCols = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 26) {
break;
}
}
case 26: {
// data [packed=true]
input.readPackedDouble(data);
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
case 25: {
// data [packed=false]
tag = input.readRepeatedDouble(data, tag);
bitField0_ |= 0x00000004;
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.numRows, numRows);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.numCols, numCols);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRepeatedDouble(FieldNames.data, data);
}
output.endObject();
}
@Override
public ProtobufMatrix mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case -2000982401:
case -1888824590: {
if (input.isAtField(FieldNames.numRows)) {
if (!input.trySkipNullValue()) {
numRows = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case -2001429607:
case -1889271796: {
if (input.isAtField(FieldNames.numCols)) {
if (!input.trySkipNullValue()) {
numCols = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case 3076010: {
if (input.isAtField(FieldNames.data)) {
if (!input.trySkipNullValue()) {
input.readRepeatedDouble(data);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ProtobufMatrix clone() {
return new ProtobufMatrix().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ProtobufMatrix parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ProtobufMatrix(), data).checkInitialized();
}
public static ProtobufMatrix parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufMatrix(), input).checkInitialized();
}
public static ProtobufMatrix parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufMatrix(), input).checkInitialized();
}
/**
* @return factory for creating ProtobufMatrix messages
*/
public static MessageFactory<ProtobufMatrix> getFactory() {
return ProtobufMatrixFactory.INSTANCE;
}
/**
* @return this type's descriptor.
*/
public static Descriptors.Descriptor getDescriptor() {
return Wpimath.wpi_proto_ProtobufMatrix_descriptor;
}
private enum ProtobufMatrixFactory implements MessageFactory<ProtobufMatrix> {
INSTANCE;
@Override
public ProtobufMatrix create() {
return ProtobufMatrix.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName numRows = FieldName.forField("numRows", "num_rows");
static final FieldName numCols = FieldName.forField("numCols", "num_cols");
static final FieldName data = FieldName.forField("data");
}
}
/**
* Protobuf type {@code ProtobufVector}
*/
public static final class ProtobufVector extends ProtoMessage<ProtobufVector> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>repeated double rows = 1;</code>
*/
private final RepeatedDouble rows = RepeatedDouble.newEmptyInstance();
private ProtobufVector() {
}
/**
* @return a new empty instance of {@code ProtobufVector}
*/
public static ProtobufVector newInstance() {
return new ProtobufVector();
}
/**
* <code>repeated double rows = 1;</code>
* @return whether the rows field is set
*/
public boolean hasRows() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>repeated double rows = 1;</code>
* @return this
*/
public ProtobufVector clearRows() {
bitField0_ &= ~0x00000001;
rows.clear();
return this;
}
/**
* <code>repeated double rows = 1;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableRows()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedDouble getRows() {
return rows;
}
/**
* <code>repeated double rows = 1;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedDouble getMutableRows() {
bitField0_ |= 0x00000001;
return rows;
}
/**
* <code>repeated double rows = 1;</code>
* @param value the rows to add
* @return this
*/
public ProtobufVector addRows(final double value) {
bitField0_ |= 0x00000001;
rows.add(value);
return this;
}
/**
* <code>repeated double rows = 1;</code>
* @param values the rows to add
* @return this
*/
public ProtobufVector addAllRows(final double... values) {
bitField0_ |= 0x00000001;
rows.addAll(values);
return this;
}
@Override
public ProtobufVector copyFrom(final ProtobufVector other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
rows.copyFrom(other.rows);
}
return this;
}
@Override
public ProtobufVector mergeFrom(final ProtobufVector other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasRows()) {
getMutableRows().addAll(other.rows);
}
return this;
}
@Override
public ProtobufVector clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
rows.clear();
return this;
}
@Override
public ProtobufVector clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
rows.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ProtobufVector)) {
return false;
}
ProtobufVector other = (ProtobufVector) o;
return bitField0_ == other.bitField0_
&& (!hasRows() || rows.equals(other.rows));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
for (int i = 0; i < rows.length(); i++) {
output.writeRawByte((byte) 9);
output.writeDoubleNoTag(rows.array()[i]);
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += (1 + 8) * rows.length();
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ProtobufVector mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 10: {
// rows [packed=true]
input.readPackedDouble(rows);
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
case 9: {
// rows [packed=false]
tag = input.readRepeatedDouble(rows, tag);
bitField0_ |= 0x00000001;
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeRepeatedDouble(FieldNames.rows, rows);
}
output.endObject();
}
@Override
public ProtobufVector mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 3506649: {
if (input.isAtField(FieldNames.rows)) {
if (!input.trySkipNullValue()) {
input.readRepeatedDouble(rows);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ProtobufVector clone() {
return new ProtobufVector().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ProtobufVector parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ProtobufVector(), data).checkInitialized();
}
public static ProtobufVector parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufVector(), input).checkInitialized();
}
public static ProtobufVector parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new ProtobufVector(), input).checkInitialized();
}
/**
* @return factory for creating ProtobufVector messages
*/
public static MessageFactory<ProtobufVector> getFactory() {
return ProtobufVectorFactory.INSTANCE;
}
/**
* @return this type's descriptor.
*/
public static Descriptors.Descriptor getDescriptor() {
return Wpimath.wpi_proto_ProtobufVector_descriptor;
}
private enum ProtobufVectorFactory implements MessageFactory<ProtobufVector> {
INSTANCE;
@Override
public ProtobufVector create() {
return ProtobufVector.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName rows = FieldName.forField("rows");
}
}
}