Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
MPArrayWithConstantConstraint.java
Go to the documentation of this file.
1// Generated by the protocol buffer compiler. DO NOT EDIT!
2// source: ortools/linear_solver/linear_solver.proto
3
4// Protobuf Java Version: 4.26.1
5package com.google.ortools.linearsolver;
6
15public final class MPArrayWithConstantConstraint extends
16 com.google.protobuf.GeneratedMessage implements
17 // @@protoc_insertion_point(message_implements:operations_research.MPArrayWithConstantConstraint)
19private static final long serialVersionUID = 0L;
20 static {
21 com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
22 com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
23 /* major= */ 4,
24 /* minor= */ 26,
25 /* patch= */ 1,
26 /* suffix= */ "",
27 MPArrayWithConstantConstraint.class.getName());
28 }
29 // Use MPArrayWithConstantConstraint.newBuilder() to construct.
30 private MPArrayWithConstantConstraint(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
31 super(builder);
32 }
34 varIndex_ = emptyIntList();
35 }
36
37 public static final com.google.protobuf.Descriptors.Descriptor
39 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPArrayWithConstantConstraint_descriptor;
40 }
41
42 @java.lang.Override
43 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
45 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPArrayWithConstantConstraint_fieldAccessorTable
46 .ensureFieldAccessorsInitialized(
47 com.google.ortools.linearsolver.MPArrayWithConstantConstraint.class, com.google.ortools.linearsolver.MPArrayWithConstantConstraint.Builder.class);
48 }
49
50 private int bitField0_;
51 public static final int VAR_INDEX_FIELD_NUMBER = 1;
52 @SuppressWarnings("serial")
53 private com.google.protobuf.Internal.IntList varIndex_ =
54 emptyIntList();
64 @java.lang.Override
65 public java.util.List<java.lang.Integer>
67 return varIndex_;
68 }
78 public int getVarIndexCount() {
79 return varIndex_.size();
80 }
91 public int getVarIndex(int index) {
92 return varIndex_.getInt(index);
93 }
94
95 public static final int CONSTANT_FIELD_NUMBER = 2;
96 private double constant_ = 0D;
101 @java.lang.Override
102 public boolean hasConstant() {
103 return ((bitField0_ & 0x00000001) != 0);
104 }
109 @java.lang.Override
110 public double getConstant() {
111 return constant_;
112 }
113
114 public static final int RESULTANT_VAR_INDEX_FIELD_NUMBER = 3;
115 private int resultantVarIndex_ = 0;
120 @java.lang.Override
121 public boolean hasResultantVarIndex() {
122 return ((bitField0_ & 0x00000002) != 0);
123 }
128 @java.lang.Override
129 public int getResultantVarIndex() {
130 return resultantVarIndex_;
131 }
132
133 private byte memoizedIsInitialized = -1;
134 @java.lang.Override
135 public final boolean isInitialized() {
136 byte isInitialized = memoizedIsInitialized;
137 if (isInitialized == 1) return true;
138 if (isInitialized == 0) return false;
139
140 memoizedIsInitialized = 1;
141 return true;
142 }
143
144 @java.lang.Override
145 public void writeTo(com.google.protobuf.CodedOutputStream output)
146 throws java.io.IOException {
147 for (int i = 0; i < varIndex_.size(); i++) {
148 output.writeInt32(1, varIndex_.getInt(i));
149 }
150 if (((bitField0_ & 0x00000001) != 0)) {
151 output.writeDouble(2, constant_);
152 }
153 if (((bitField0_ & 0x00000002) != 0)) {
154 output.writeInt32(3, resultantVarIndex_);
155 }
156 getUnknownFields().writeTo(output);
157 }
158
159 @java.lang.Override
160 public int getSerializedSize() {
161 int size = memoizedSize;
162 if (size != -1) return size;
163
164 size = 0;
165 {
166 int dataSize = 0;
167 for (int i = 0; i < varIndex_.size(); i++) {
168 dataSize += com.google.protobuf.CodedOutputStream
169 .computeInt32SizeNoTag(varIndex_.getInt(i));
170 }
171 size += dataSize;
172 size += 1 * getVarIndexList().size();
173 }
174 if (((bitField0_ & 0x00000001) != 0)) {
175 size += com.google.protobuf.CodedOutputStream
176 .computeDoubleSize(2, constant_);
177 }
178 if (((bitField0_ & 0x00000002) != 0)) {
179 size += com.google.protobuf.CodedOutputStream
180 .computeInt32Size(3, resultantVarIndex_);
181 }
182 size += getUnknownFields().getSerializedSize();
183 memoizedSize = size;
184 return size;
185 }
186
187 @java.lang.Override
188 public boolean equals(final java.lang.Object obj) {
189 if (obj == this) {
190 return true;
191 }
192 if (!(obj instanceof com.google.ortools.linearsolver.MPArrayWithConstantConstraint)) {
193 return super.equals(obj);
194 }
195 com.google.ortools.linearsolver.MPArrayWithConstantConstraint other = (com.google.ortools.linearsolver.MPArrayWithConstantConstraint) obj;
196
197 if (!getVarIndexList()
198 .equals(other.getVarIndexList())) return false;
199 if (hasConstant() != other.hasConstant()) return false;
200 if (hasConstant()) {
201 if (java.lang.Double.doubleToLongBits(getConstant())
202 != java.lang.Double.doubleToLongBits(
203 other.getConstant())) return false;
204 }
205 if (hasResultantVarIndex() != other.hasResultantVarIndex()) return false;
206 if (hasResultantVarIndex()) {
208 != other.getResultantVarIndex()) return false;
209 }
210 if (!getUnknownFields().equals(other.getUnknownFields())) return false;
211 return true;
212 }
213
214 @java.lang.Override
215 public int hashCode() {
216 if (memoizedHashCode != 0) {
217 return memoizedHashCode;
218 }
219 int hash = 41;
220 hash = (19 * hash) + getDescriptor().hashCode();
221 if (getVarIndexCount() > 0) {
222 hash = (37 * hash) + VAR_INDEX_FIELD_NUMBER;
223 hash = (53 * hash) + getVarIndexList().hashCode();
224 }
225 if (hasConstant()) {
226 hash = (37 * hash) + CONSTANT_FIELD_NUMBER;
227 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
228 java.lang.Double.doubleToLongBits(getConstant()));
229 }
230 if (hasResultantVarIndex()) {
231 hash = (37 * hash) + RESULTANT_VAR_INDEX_FIELD_NUMBER;
232 hash = (53 * hash) + getResultantVarIndex();
233 }
234 hash = (29 * hash) + getUnknownFields().hashCode();
235 memoizedHashCode = hash;
236 return hash;
237 }
238
240 java.nio.ByteBuffer data)
241 throws com.google.protobuf.InvalidProtocolBufferException {
242 return PARSER.parseFrom(data);
243 }
245 java.nio.ByteBuffer data,
246 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
247 throws com.google.protobuf.InvalidProtocolBufferException {
248 return PARSER.parseFrom(data, extensionRegistry);
249 }
251 com.google.protobuf.ByteString data)
252 throws com.google.protobuf.InvalidProtocolBufferException {
253 return PARSER.parseFrom(data);
254 }
256 com.google.protobuf.ByteString data,
257 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
258 throws com.google.protobuf.InvalidProtocolBufferException {
259 return PARSER.parseFrom(data, extensionRegistry);
260 }
262 throws com.google.protobuf.InvalidProtocolBufferException {
263 return PARSER.parseFrom(data);
264 }
266 byte[] data,
267 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
268 throws com.google.protobuf.InvalidProtocolBufferException {
269 return PARSER.parseFrom(data, extensionRegistry);
270 }
272 throws java.io.IOException {
273 return com.google.protobuf.GeneratedMessage
274 .parseWithIOException(PARSER, input);
275 }
277 java.io.InputStream input,
278 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
279 throws java.io.IOException {
280 return com.google.protobuf.GeneratedMessage
281 .parseWithIOException(PARSER, input, extensionRegistry);
282 }
283
285 throws java.io.IOException {
286 return com.google.protobuf.GeneratedMessage
287 .parseDelimitedWithIOException(PARSER, input);
288 }
289
291 java.io.InputStream input,
292 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
293 throws java.io.IOException {
294 return com.google.protobuf.GeneratedMessage
295 .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
296 }
298 com.google.protobuf.CodedInputStream input)
299 throws java.io.IOException {
300 return com.google.protobuf.GeneratedMessage
301 .parseWithIOException(PARSER, input);
302 }
304 com.google.protobuf.CodedInputStream input,
305 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
306 throws java.io.IOException {
307 return com.google.protobuf.GeneratedMessage
308 .parseWithIOException(PARSER, input, extensionRegistry);
309 }
310
311 @java.lang.Override
312 public Builder newBuilderForType() { return newBuilder(); }
313 public static Builder newBuilder() {
314 return DEFAULT_INSTANCE.toBuilder();
315 }
316 public static Builder newBuilder(com.google.ortools.linearsolver.MPArrayWithConstantConstraint prototype) {
317 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
318 }
319 @java.lang.Override
321 return this == DEFAULT_INSTANCE
322 ? new Builder() : new Builder().mergeFrom(this);
323 }
324
325 @java.lang.Override
327 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
328 Builder builder = new Builder(parent);
329 return builder;
330 }
339 public static final class Builder extends
340 com.google.protobuf.GeneratedMessage.Builder<Builder> implements
341 // @@protoc_insertion_point(builder_implements:operations_research.MPArrayWithConstantConstraint)
342 com.google.ortools.linearsolver.MPArrayWithConstantConstraintOrBuilder {
343 public static final com.google.protobuf.Descriptors.Descriptor
345 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPArrayWithConstantConstraint_descriptor;
346 }
347
348 @java.lang.Override
349 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
351 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPArrayWithConstantConstraint_fieldAccessorTable
352 .ensureFieldAccessorsInitialized(
353 com.google.ortools.linearsolver.MPArrayWithConstantConstraint.class, com.google.ortools.linearsolver.MPArrayWithConstantConstraint.Builder.class);
354 }
355
356 // Construct using com.google.ortools.linearsolver.MPArrayWithConstantConstraint.newBuilder()
357 private Builder() {
358
359 }
360
361 private Builder(
362 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
363 super(parent);
364
365 }
366 @java.lang.Override
367 public Builder clear() {
368 super.clear();
369 bitField0_ = 0;
370 varIndex_ = emptyIntList();
371 constant_ = 0D;
372 resultantVarIndex_ = 0;
373 return this;
374 }
375
376 @java.lang.Override
377 public com.google.protobuf.Descriptors.Descriptor
379 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPArrayWithConstantConstraint_descriptor;
380 }
381
382 @java.lang.Override
384 return com.google.ortools.linearsolver.MPArrayWithConstantConstraint.getDefaultInstance();
385 }
386
387 @java.lang.Override
390 if (!result.isInitialized()) {
391 throw newUninitializedMessageException(result);
392 }
393 return result;
394 }
395
396 @java.lang.Override
398 com.google.ortools.linearsolver.MPArrayWithConstantConstraint result = new com.google.ortools.linearsolver.MPArrayWithConstantConstraint(this);
399 if (bitField0_ != 0) { buildPartial0(result); }
400 onBuilt();
401 return result;
402 }
403
404 private void buildPartial0(com.google.ortools.linearsolver.MPArrayWithConstantConstraint result) {
405 int from_bitField0_ = bitField0_;
406 if (((from_bitField0_ & 0x00000001) != 0)) {
407 varIndex_.makeImmutable();
408 result.varIndex_ = varIndex_;
409 }
410 int to_bitField0_ = 0;
411 if (((from_bitField0_ & 0x00000002) != 0)) {
412 result.constant_ = constant_;
413 to_bitField0_ |= 0x00000001;
414 }
415 if (((from_bitField0_ & 0x00000004) != 0)) {
416 result.resultantVarIndex_ = resultantVarIndex_;
417 to_bitField0_ |= 0x00000002;
418 }
419 result.bitField0_ |= to_bitField0_;
420 }
421
422 @java.lang.Override
423 public Builder mergeFrom(com.google.protobuf.Message other) {
424 if (other instanceof com.google.ortools.linearsolver.MPArrayWithConstantConstraint) {
425 return mergeFrom((com.google.ortools.linearsolver.MPArrayWithConstantConstraint)other);
426 } else {
427 super.mergeFrom(other);
428 return this;
429 }
430 }
431
432 public Builder mergeFrom(com.google.ortools.linearsolver.MPArrayWithConstantConstraint other) {
433 if (other == com.google.ortools.linearsolver.MPArrayWithConstantConstraint.getDefaultInstance()) return this;
434 if (!other.varIndex_.isEmpty()) {
435 if (varIndex_.isEmpty()) {
436 varIndex_ = other.varIndex_;
437 varIndex_.makeImmutable();
438 bitField0_ |= 0x00000001;
439 } else {
440 ensureVarIndexIsMutable();
441 varIndex_.addAll(other.varIndex_);
442 }
443 onChanged();
444 }
445 if (other.hasConstant()) {
446 setConstant(other.getConstant());
447 }
448 if (other.hasResultantVarIndex()) {
449 setResultantVarIndex(other.getResultantVarIndex());
450 }
451 this.mergeUnknownFields(other.getUnknownFields());
452 onChanged();
453 return this;
454 }
455
456 @java.lang.Override
457 public final boolean isInitialized() {
458 return true;
459 }
460
461 @java.lang.Override
463 com.google.protobuf.CodedInputStream input,
464 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
465 throws java.io.IOException {
466 if (extensionRegistry == null) {
467 throw new java.lang.NullPointerException();
468 }
469 try {
470 boolean done = false;
471 while (!done) {
472 int tag = input.readTag();
473 switch (tag) {
474 case 0:
475 done = true;
476 break;
477 case 8: {
478 int v = input.readInt32();
479 ensureVarIndexIsMutable();
480 varIndex_.addInt(v);
481 break;
482 } // case 8
483 case 10: {
484 int length = input.readRawVarint32();
485 int limit = input.pushLimit(length);
486 ensureVarIndexIsMutable();
487 while (input.getBytesUntilLimit() > 0) {
488 varIndex_.addInt(input.readInt32());
489 }
490 input.popLimit(limit);
491 break;
492 } // case 10
493 case 17: {
494 constant_ = input.readDouble();
495 bitField0_ |= 0x00000002;
496 break;
497 } // case 17
498 case 24: {
499 resultantVarIndex_ = input.readInt32();
500 bitField0_ |= 0x00000004;
501 break;
502 } // case 24
503 default: {
504 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
505 done = true; // was an endgroup tag
506 }
507 break;
508 } // default:
509 } // switch (tag)
510 } // while (!done)
511 } catch (com.google.protobuf.InvalidProtocolBufferException e) {
512 throw e.unwrapIOException();
513 } finally {
514 onChanged();
515 } // finally
516 return this;
517 }
518 private int bitField0_;
519
520 private com.google.protobuf.Internal.IntList varIndex_ = emptyIntList();
521 private void ensureVarIndexIsMutable() {
522 if (!varIndex_.isModifiable()) {
523 varIndex_ = makeMutableCopy(varIndex_);
524 }
525 bitField0_ |= 0x00000001;
526 }
536 public java.util.List<java.lang.Integer>
538 varIndex_.makeImmutable();
539 return varIndex_;
540 }
550 public int getVarIndexCount() {
551 return varIndex_.size();
552 }
563 public int getVarIndex(int index) {
564 return varIndex_.getInt(index);
565 }
578 int index, int value) {
579
580 ensureVarIndexIsMutable();
581 varIndex_.setInt(index, value);
582 bitField0_ |= 0x00000001;
583 onChanged();
584 return this;
585 }
596 public Builder addVarIndex(int value) {
597
598 ensureVarIndexIsMutable();
599 varIndex_.addInt(value);
600 bitField0_ |= 0x00000001;
601 onChanged();
602 return this;
603 }
615 java.lang.Iterable<? extends java.lang.Integer> values) {
616 ensureVarIndexIsMutable();
617 com.google.protobuf.AbstractMessageLite.Builder.addAll(
618 values, varIndex_);
619 bitField0_ |= 0x00000001;
620 onChanged();
621 return this;
622 }
633 varIndex_ = emptyIntList();
634 bitField0_ = (bitField0_ & ~0x00000001);
635 onChanged();
636 return this;
637 }
638
639 private double constant_ ;
644 @java.lang.Override
645 public boolean hasConstant() {
646 return ((bitField0_ & 0x00000002) != 0);
647 }
652 @java.lang.Override
653 public double getConstant() {
654 return constant_;
655 }
661 public Builder setConstant(double value) {
662
663 constant_ = value;
664 bitField0_ |= 0x00000002;
665 onChanged();
666 return this;
667 }
673 bitField0_ = (bitField0_ & ~0x00000002);
674 constant_ = 0D;
675 onChanged();
676 return this;
677 }
678
679 private int resultantVarIndex_ ;
684 @java.lang.Override
685 public boolean hasResultantVarIndex() {
686 return ((bitField0_ & 0x00000004) != 0);
687 }
692 @java.lang.Override
693 public int getResultantVarIndex() {
694 return resultantVarIndex_;
695 }
701 public Builder setResultantVarIndex(int value) {
702
703 resultantVarIndex_ = value;
704 bitField0_ |= 0x00000004;
705 onChanged();
706 return this;
707 }
713 bitField0_ = (bitField0_ & ~0x00000004);
714 resultantVarIndex_ = 0;
715 onChanged();
716 return this;
717 }
718
719 // @@protoc_insertion_point(builder_scope:operations_research.MPArrayWithConstantConstraint)
720 }
721
722 // @@protoc_insertion_point(class_scope:operations_research.MPArrayWithConstantConstraint)
723 private static final com.google.ortools.linearsolver.MPArrayWithConstantConstraint DEFAULT_INSTANCE;
724 static {
725 DEFAULT_INSTANCE = new com.google.ortools.linearsolver.MPArrayWithConstantConstraint();
726 }
727
729 return DEFAULT_INSTANCE;
730 }
731
732 private static final com.google.protobuf.Parser<MPArrayWithConstantConstraint>
733 PARSER = new com.google.protobuf.AbstractParser<MPArrayWithConstantConstraint>() {
734 @java.lang.Override
735 public MPArrayWithConstantConstraint parsePartialFrom(
736 com.google.protobuf.CodedInputStream input,
737 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
738 throws com.google.protobuf.InvalidProtocolBufferException {
739 Builder builder = newBuilder();
740 try {
741 builder.mergeFrom(input, extensionRegistry);
742 } catch (com.google.protobuf.InvalidProtocolBufferException e) {
743 throw e.setUnfinishedMessage(builder.buildPartial());
744 } catch (com.google.protobuf.UninitializedMessageException e) {
745 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
746 } catch (java.io.IOException e) {
747 throw new com.google.protobuf.InvalidProtocolBufferException(e)
748 .setUnfinishedMessage(builder.buildPartial());
749 }
750 return builder.buildPartial();
751 }
752 };
753
754 public static com.google.protobuf.Parser<MPArrayWithConstantConstraint> parser() {
755 return PARSER;
756 }
757
758 @java.lang.Override
759 public com.google.protobuf.Parser<MPArrayWithConstantConstraint> getParserForType() {
760 return PARSER;
761 }
762
763 @java.lang.Override
767
768}
769
com.google.ortools.linearsolver.MPArrayWithConstantConstraint build()
Builder mergeFrom(com.google.ortools.linearsolver.MPArrayWithConstantConstraint other)
com.google.ortools.linearsolver.MPArrayWithConstantConstraint getDefaultInstanceForType()
com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
com.google.ortools.linearsolver.MPArrayWithConstantConstraint buildPartial()
Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
Builder addAllVarIndex(java.lang.Iterable<? extends java.lang.Integer > values)
static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static Builder newBuilder(com.google.ortools.linearsolver.MPArrayWithConstantConstraint prototype)
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(com.google.protobuf.ByteString data)
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(com.google.protobuf.CodedInputStream input)
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(byte[] data)
Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent)
com.google.ortools.linearsolver.MPArrayWithConstantConstraint getDefaultInstanceForType()
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(java.io.InputStream input)
com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint getDefaultInstance()
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
com.google.protobuf.Parser< MPArrayWithConstantConstraint > getParserForType()
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseFrom(java.nio.ByteBuffer data)
static com.google.ortools.linearsolver.MPArrayWithConstantConstraint parseDelimitedFrom(java.io.InputStream input)
static com.google.protobuf.Parser< MPArrayWithConstantConstraint > parser()