6package com.google.ortools.sat;
18public final class LinearBooleanConstraint
extends
19 com.google.protobuf.GeneratedMessage implements
22private static final long serialVersionUID = 0L;
24 com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
25 com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
30 LinearBooleanConstraint.class.getName());
33 private LinearBooleanConstraint(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
36 private LinearBooleanConstraint() {
37 literals_ = emptyIntList();
38 coefficients_ = emptyLongList();
42 public static final com.google.protobuf.Descriptors.Descriptor
44 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearBooleanConstraint_descriptor;
48 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
50 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearBooleanConstraint_fieldAccessorTable
51 .ensureFieldAccessorsInitialized(
52 com.google.ortools.sat.LinearBooleanConstraint.class, com.google.ortools.sat.LinearBooleanConstraint.Builder.class);
55 private int bitField0_;
57 @SuppressWarnings(
"serial")
58 private com.google.protobuf.Internal.IntList literals_ =
77 public java.
util.List<java.lang.Integer>
98 return literals_.size();
118 return literals_.getInt(index);
122 @SuppressWarnings(
"serial")
123 private com.google.protobuf.Internal.LongList coefficients_ =
130 public java.
util.List<java.lang.Long>
132 return coefficients_;
139 return coefficients_.size();
147 return coefficients_.getLong(index);
151 private long lowerBound_ = 0L;
164 return ((bitField0_ & 0x00000001) != 0);
182 private long upperBound_ = 0L;
189 return ((bitField0_ & 0x00000002) != 0);
201 @SuppressWarnings(
"serial")
202 private volatile java.lang.Object name_ =
"";
213 return ((bitField0_ & 0x00000004) != 0);
225 java.lang.Object ref = name_;
226 if (ref instanceof java.lang.String) {
227 return (java.lang.String) ref;
229 com.google.protobuf.ByteString bs =
230 (com.google.protobuf.ByteString) ref;
231 java.lang.String s = bs.toStringUtf8();
232 if (bs.isValidUtf8()) {
247 public com.google.protobuf.ByteString
249 java.lang.Object ref = name_;
250 if (ref instanceof java.lang.String) {
251 com.google.protobuf.ByteString b =
252 com.google.protobuf.ByteString.copyFromUtf8(
253 (java.lang.String) ref);
257 return (com.google.protobuf.ByteString) ref;
261 private byte memoizedIsInitialized = -1;
268 memoizedIsInitialized = 1;
273 public void writeTo(com.google.protobuf.CodedOutputStream output)
274 throws java.io.IOException {
275 for (
int i = 0; i < literals_.size(); i++) {
276 output.writeInt32(1, literals_.getInt(i));
278 for (
int i = 0; i < coefficients_.size(); i++) {
279 output.writeInt64(2, coefficients_.getLong(i));
281 if (((bitField0_ & 0x00000001) != 0)) {
282 output.writeInt64(3, lowerBound_);
284 if (((bitField0_ & 0x00000002) != 0)) {
285 output.writeInt64(4, upperBound_);
287 if (((bitField0_ & 0x00000004) != 0)) {
288 com.google.protobuf.GeneratedMessage.writeString(output, 5, name_);
290 getUnknownFields().writeTo(output);
295 int size = memoizedSize;
296 if (size != -1)
return size;
301 for (
int i = 0; i < literals_.size(); i++) {
302 dataSize += com.google.protobuf.CodedOutputStream
303 .computeInt32SizeNoTag(literals_.getInt(i));
310 for (
int i = 0; i < coefficients_.size(); i++) {
311 dataSize += com.google.protobuf.CodedOutputStream
312 .computeInt64SizeNoTag(coefficients_.getLong(i));
317 if (((bitField0_ & 0x00000001) != 0)) {
318 size += com.google.protobuf.CodedOutputStream
319 .computeInt64Size(3, lowerBound_);
321 if (((bitField0_ & 0x00000002) != 0)) {
322 size += com.google.protobuf.CodedOutputStream
323 .computeInt64Size(4, upperBound_);
325 if (((bitField0_ & 0x00000004) != 0)) {
326 size += com.google.protobuf.GeneratedMessage.computeStringSize(5, name_);
328 size += getUnknownFields().getSerializedSize();
334 public boolean equals(
final java.lang.Object obj) {
338 if (!(obj instanceof com.google.ortools.sat.LinearBooleanConstraint)) {
339 return super.equals(obj);
362 if (!getUnknownFields().
equals(other.getUnknownFields()))
return false;
368 if (memoizedHashCode != 0) {
369 return memoizedHashCode;
383 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
388 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
393 hash = (53 * hash) +
getName().hashCode();
395 hash = (29 * hash) + getUnknownFields().hashCode();
396 memoizedHashCode = hash;
401 java.nio.ByteBuffer data)
402 throws com.google.protobuf.InvalidProtocolBufferException {
403 return PARSER.parseFrom(data);
406 java.nio.ByteBuffer data,
407 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
408 throws com.google.protobuf.InvalidProtocolBufferException {
409 return PARSER.parseFrom(data, extensionRegistry);
412 com.google.protobuf.ByteString data)
413 throws com.google.protobuf.InvalidProtocolBufferException {
414 return PARSER.parseFrom(data);
417 com.google.protobuf.ByteString data,
418 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
419 throws com.google.protobuf.InvalidProtocolBufferException {
420 return PARSER.parseFrom(data, extensionRegistry);
423 throws com.google.protobuf.InvalidProtocolBufferException {
424 return PARSER.parseFrom(data);
428 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
429 throws com.google.protobuf.InvalidProtocolBufferException {
430 return PARSER.parseFrom(data, extensionRegistry);
433 throws java.io.IOException {
434 return com.google.protobuf.GeneratedMessage
435 .parseWithIOException(PARSER, input);
438 java.io.InputStream input,
439 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
440 throws java.io.IOException {
441 return com.google.protobuf.GeneratedMessage
442 .parseWithIOException(PARSER, input, extensionRegistry);
446 throws java.io.IOException {
447 return com.google.protobuf.GeneratedMessage
448 .parseDelimitedWithIOException(PARSER, input);
452 java.io.InputStream input,
453 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
454 throws java.io.IOException {
455 return com.google.protobuf.GeneratedMessage
456 .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
459 com.google.protobuf.CodedInputStream input)
460 throws java.io.IOException {
461 return com.google.protobuf.GeneratedMessage
462 .parseWithIOException(PARSER, input);
465 com.google.protobuf.CodedInputStream input,
466 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
467 throws java.io.IOException {
468 return com.google.protobuf.GeneratedMessage
469 .parseWithIOException(PARSER, input, extensionRegistry);
475 return DEFAULT_INSTANCE.toBuilder();
478 return DEFAULT_INSTANCE.toBuilder().
mergeFrom(prototype);
482 return this == DEFAULT_INSTANCE
488 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
502 public static final class Builder
extends
503 com.google.protobuf.GeneratedMessage.Builder<Builder> implements
506 public static final com.google.protobuf.Descriptors.Descriptor
508 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearBooleanConstraint_descriptor;
512 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
514 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearBooleanConstraint_fieldAccessorTable
515 .ensureFieldAccessorsInitialized(
516 com.google.ortools.sat.LinearBooleanConstraint.class, com.google.ortools.sat.LinearBooleanConstraint.Builder.class);
525 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
533 literals_ = emptyIntList();
534 coefficients_ = emptyLongList();
542 public com.google.protobuf.Descriptors.Descriptor
544 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearBooleanConstraint_descriptor;
549 return com.google.ortools.sat.LinearBooleanConstraint.getDefaultInstance();
556 throw newUninitializedMessageException(result);
564 if (bitField0_ != 0) { buildPartial0(result); }
569 private void buildPartial0(com.google.ortools.sat.LinearBooleanConstraint result) {
570 int from_bitField0_ = bitField0_;
571 if (((from_bitField0_ & 0x00000001) != 0)) {
572 literals_.makeImmutable();
573 result.literals_ = literals_;
575 if (((from_bitField0_ & 0x00000002) != 0)) {
576 coefficients_.makeImmutable();
577 result.coefficients_ = coefficients_;
579 int to_bitField0_ = 0;
580 if (((from_bitField0_ & 0x00000004) != 0)) {
581 result.lowerBound_ = lowerBound_;
582 to_bitField0_ |= 0x00000001;
584 if (((from_bitField0_ & 0x00000008) != 0)) {
585 result.upperBound_ = upperBound_;
586 to_bitField0_ |= 0x00000002;
588 if (((from_bitField0_ & 0x00000010) != 0)) {
589 result.name_ = name_;
590 to_bitField0_ |= 0x00000004;
592 result.bitField0_ |= to_bitField0_;
596 public Builder
mergeFrom(com.google.protobuf.Message other) {
597 if (other instanceof com.google.ortools.sat.LinearBooleanConstraint) {
598 return mergeFrom((com.google.ortools.sat.LinearBooleanConstraint)other);
600 super.mergeFrom(other);
605 public Builder
mergeFrom(com.google.ortools.sat.LinearBooleanConstraint other) {
606 if (other == com.google.ortools.sat.LinearBooleanConstraint.getDefaultInstance())
return this;
607 if (!other.literals_.isEmpty()) {
608 if (literals_.isEmpty()) {
609 literals_ = other.literals_;
610 literals_.makeImmutable();
611 bitField0_ |= 0x00000001;
613 ensureLiteralsIsMutable();
614 literals_.addAll(other.literals_);
618 if (!other.coefficients_.isEmpty()) {
619 if (coefficients_.isEmpty()) {
620 coefficients_ = other.coefficients_;
621 coefficients_.makeImmutable();
622 bitField0_ |= 0x00000002;
624 ensureCoefficientsIsMutable();
625 coefficients_.addAll(other.coefficients_);
629 if (other.hasLowerBound()) {
632 if (other.hasUpperBound()) {
635 if (other.hasName()) {
637 bitField0_ |= 0x00000010;
640 this.mergeUnknownFields(other.getUnknownFields());
652 com.google.protobuf.CodedInputStream input,
653 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
654 throws java.io.IOException {
655 if (extensionRegistry ==
null) {
656 throw new java.lang.NullPointerException();
659 boolean done =
false;
661 int tag = input.readTag();
667 int v = input.readInt32();
668 ensureLiteralsIsMutable();
673 int length = input.readRawVarint32();
674 int limit = input.pushLimit(length);
675 ensureLiteralsIsMutable();
676 while (input.getBytesUntilLimit() > 0) {
677 literals_.addInt(input.readInt32());
679 input.popLimit(limit);
683 long v = input.readInt64();
684 ensureCoefficientsIsMutable();
685 coefficients_.addLong(v);
689 int length = input.readRawVarint32();
690 int limit = input.pushLimit(length);
691 ensureCoefficientsIsMutable();
692 while (input.getBytesUntilLimit() > 0) {
693 coefficients_.addLong(input.readInt64());
695 input.popLimit(limit);
699 lowerBound_ = input.readInt64();
700 bitField0_ |= 0x00000004;
704 upperBound_ = input.readInt64();
705 bitField0_ |= 0x00000008;
709 name_ = input.readBytes();
710 bitField0_ |= 0x00000010;
714 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
721 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
722 throw e.unwrapIOException();
728 private int bitField0_;
730 private com.google.protobuf.Internal.IntList literals_ = emptyIntList();
731 private void ensureLiteralsIsMutable() {
732 if (!literals_.isModifiable()) {
733 literals_ = makeMutableCopy(literals_);
735 bitField0_ |= 0x00000001;
753 public java.util.List<java.lang.Integer>
755 literals_.makeImmutable();
775 return literals_.size();
795 return literals_.getInt(index);
816 int index,
int value) {
818 ensureLiteralsIsMutable();
819 literals_.setInt(index, value);
820 bitField0_ |= 0x00000001;
843 ensureLiteralsIsMutable();
844 literals_.addInt(value);
845 bitField0_ |= 0x00000001;
867 java.lang.Iterable<? extends java.lang.Integer> values) {
868 ensureLiteralsIsMutable();
869 com.google.protobuf.AbstractMessageLite.Builder.addAll(
871 bitField0_ |= 0x00000001;
892 literals_ = emptyIntList();
893 bitField0_ = (bitField0_ & ~0x00000001);
898 private com.google.protobuf.Internal.LongList coefficients_ = emptyLongList();
899 private void ensureCoefficientsIsMutable() {
900 if (!coefficients_.isModifiable()) {
901 coefficients_ = makeMutableCopy(coefficients_);
903 bitField0_ |= 0x00000002;
909 public java.util.List<java.lang.Long>
911 coefficients_.makeImmutable();
912 return coefficients_;
919 return coefficients_.size();
927 return coefficients_.getLong(index);
936 int index,
long value) {
938 ensureCoefficientsIsMutable();
939 coefficients_.setLong(index, value);
940 bitField0_ |= 0x00000002;
951 ensureCoefficientsIsMutable();
952 coefficients_.addLong(value);
953 bitField0_ |= 0x00000002;
963 java.lang.Iterable<? extends java.lang.Long> values) {
964 ensureCoefficientsIsMutable();
965 com.google.protobuf.AbstractMessageLite.Builder.addAll(
966 values, coefficients_);
967 bitField0_ |= 0x00000002;
976 coefficients_ = emptyLongList();
977 bitField0_ = (bitField0_ & ~0x00000002);
982 private long lowerBound_ ;
995 return ((bitField0_ & 0x00000004) != 0);
1024 lowerBound_ = value;
1025 bitField0_ |= 0x00000004;
1040 bitField0_ = (bitField0_ & ~0x00000004);
1046 private long upperBound_ ;
1053 return ((bitField0_ & 0x00000008) != 0);
1070 upperBound_ = value;
1071 bitField0_ |= 0x00000008;
1080 bitField0_ = (bitField0_ & ~0x00000008);
1086 private java.lang.Object name_ =
"";
1096 return ((bitField0_ & 0x00000010) != 0);
1107 java.lang.Object ref = name_;
1108 if (!(ref instanceof java.lang.String)) {
1109 com.google.protobuf.ByteString bs =
1110 (com.google.protobuf.ByteString) ref;
1111 java.lang.String s = bs.toStringUtf8();
1112 if (bs.isValidUtf8()) {
1117 return (java.lang.String) ref;
1128 public com.google.protobuf.ByteString
1130 java.lang.Object ref = name_;
1131 if (ref instanceof String) {
1132 com.google.protobuf.ByteString b =
1133 com.google.protobuf.ByteString.copyFromUtf8(
1134 (java.lang.String) ref);
1138 return (com.google.protobuf.ByteString) ref;
1151 java.lang.String value) {
1152 if (value ==
null) {
throw new NullPointerException(); }
1154 bitField0_ |= 0x00000010;
1168 bitField0_ = (bitField0_ & ~0x00000010);
1182 com.google.protobuf.ByteString value) {
1183 if (value ==
null) {
throw new NullPointerException(); }
1185 bitField0_ |= 0x00000010;
1196 DEFAULT_INSTANCE =
new com.google.ortools.sat.LinearBooleanConstraint();
1200 return DEFAULT_INSTANCE;
1207 com.google.protobuf.CodedInputStream input,
1208 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1209 throws com.google.protobuf.InvalidProtocolBufferException {
1212 builder.mergeFrom(input, extensionRegistry);
1213 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
1214 throw e.setUnfinishedMessage(builder.buildPartial());
1215 }
catch (com.google.protobuf.UninitializedMessageException e) {
1216 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1217 }
catch (java.io.IOException e) {
1218 throw new com.google.protobuf.InvalidProtocolBufferException(e)
1219 .setUnfinishedMessage(builder.buildPartial());
1221 return builder.buildPartial();
1225 public static com.google.protobuf.Parser<LinearBooleanConstraint>
parser() {
1236 return DEFAULT_INSTANCE;