23public final class ProtobufVector extends ProtoMessage<ProtobufVector> implements Cloneable {
24 private static final long serialVersionUID = 0L;
29 private final RepeatedDouble rows = RepeatedDouble.newEmptyInstance();
31 private ProtobufVector() {
38 return new ProtobufVector();
46 return (bitField0_ & 0x00000001) != 0;
54 bitField0_ &= ~0x00000001;
83 bitField0_ |= 0x00000001;
92 public ProtobufVector
addRows(
final double value) {
93 bitField0_ |= 0x00000001;
104 bitField0_ |= 0x00000001;
111 cachedSize = other.cachedSize;
112 if ((bitField0_ | other.bitField0_) != 0) {
113 bitField0_ = other.bitField0_;
114 rows.copyFrom(other.rows);
120 public ProtobufVector mergeFrom(
final ProtobufVector other) {
121 if (other.isEmpty()) {
125 if (other.hasRows()) {
126 getMutableRows().addAll(other.rows);
132 public ProtobufVector clear() {
154 public boolean equals(Object o) {
162 return bitField0_ == other.bitField0_
163 && (!hasRows() || rows.equals(other.rows));
167 public void writeTo(
final ProtoSink output)
throws IOException {
168 if ((bitField0_ & 0x00000001) != 0) {
169 for (
int i = 0; i < rows.length(); i++) {
170 output.writeRawByte((
byte) 9);
171 output.writeDoubleNoTag(rows.array()[i]);
177 protected int computeSerializedSize() {
179 if ((bitField0_ & 0x00000001) != 0) {
180 size += (1 + 8) * rows.length();
186 @SuppressWarnings(
"fallthrough")
187 public
ProtobufVector mergeFrom(final ProtoSource input) throws IOException {
189 int tag = input.readTag();
194 input.readPackedDouble(rows);
195 bitField0_ |= 0x00000001;
196 tag = input.readTag();
205 if (!input.skipField(tag)) {
208 tag = input.readTag();
213 tag = input.readRepeatedDouble(rows, tag);
214 bitField0_ |= 0x00000001;
222 public void writeTo(
final JsonSink output)
throws IOException {
223 output.beginObject();
224 if ((bitField0_ & 0x00000001) != 0) {
225 output.writeRepeatedDouble(FieldNames.rows, rows);
231 public ProtobufVector mergeFrom(
final JsonSource input)
throws IOException {
232 if (!input.beginObject()) {
235 while (!input.isAtEnd()) {
236 switch (input.readFieldHash()) {
238 if (input.isAtField(FieldNames.rows)) {
239 if (!input.trySkipNullValue()) {
240 input.readRepeatedDouble(rows);
241 bitField0_ |= 0x00000001;
244 input.skipUnknownField();
249 input.skipUnknownField();
264 public boolean isEmpty() {
265 return ((bitField0_) == 0);
268 public static ProtobufVector parseFrom(
final byte[] data)
throws InvalidProtocolBufferException {
269 return ProtoMessage.mergeFrom(
new ProtobufVector(), data).checkInitialized();
272 public static ProtobufVector parseFrom(
final ProtoSource input)
throws IOException {
273 return ProtoMessage.mergeFrom(
new ProtobufVector(), input).checkInitialized();
276 public static ProtobufVector parseFrom(
final JsonSource input)
throws IOException {
277 return ProtoMessage.mergeFrom(
new ProtobufVector(), input).checkInitialized();
298 public ProtobufVector create() {
299 return ProtobufVector.newInstance();
306 static class FieldNames {
307 static final FieldName rows = FieldName.forField(
"rows");