6package com.google.ortools.linearsolver;
17public final class MPSosConstraint
extends
18 com.google.protobuf.GeneratedMessage implements
21private static final long serialVersionUID = 0L;
23 com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
24 com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
29 MPSosConstraint.class.getName());
32 private MPSosConstraint(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
35 private MPSosConstraint() {
37 varIndex_ = emptyIntList();
38 weight_ = emptyDoubleList();
41 public static final com.google.protobuf.Descriptors.Descriptor
43 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSosConstraint_descriptor;
47 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
49 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSosConstraint_fieldAccessorTable
50 .ensureFieldAccessorsInitialized(
51 com.google.ortools.linearsolver.MPSosConstraint.class, com.google.ortools.linearsolver.MPSosConstraint.Builder.class);
58 implements com.google.protobuf.ProtocolMessageEnum {
80 com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
81 com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
86 Type.class.getName());
117 @java.lang.Deprecated
130 default:
return null;
134 public static com.google.protobuf.Internal.EnumLiteMap<
Type>
136 return internalValueMap;
138 private static final com.google.protobuf.Internal.EnumLiteMap<
139 Type> internalValueMap =
140 new com.google.protobuf.Internal.EnumLiteMap<
Type>() {
141 public Type findValueByNumber(
int number) {
146 public final com.google.protobuf.Descriptors.EnumValueDescriptor
150 public final com.google.protobuf.Descriptors.EnumDescriptor
154 public static final com.google.protobuf.Descriptors.EnumDescriptor
156 return com.google.ortools.linearsolver.MPSosConstraint.getDescriptor().getEnumTypes().get(0);
159 private static final Type[] VALUES = values();
162 com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
164 throw new java.lang.IllegalArgumentException(
165 "EnumValueDescriptor is not for this type.");
167 return VALUES[desc.getIndex()];
170 private final int value;
172 private Type(
int value) {
179 private int bitField0_;
181 private int type_ = 0;
186 @java.lang.Override
public boolean hasType() {
187 return ((bitField0_ & 0x00000001) != 0);
199 @SuppressWarnings(
"serial")
200 private com.google.protobuf.Internal.IntList varIndex_ =
212 public java.
util.List<java.lang.Integer>
226 return varIndex_.size();
239 return varIndex_.getInt(index);
243 @SuppressWarnings(
"serial")
244 private com.google.protobuf.Internal.DoubleList weight_ =
264 public java.
util.List<java.lang.Double>
286 return weight_.size();
307 return weight_.getDouble(index);
310 private byte memoizedIsInitialized = -1;
317 memoizedIsInitialized = 1;
322 public void writeTo(com.google.protobuf.CodedOutputStream output)
323 throws java.io.IOException {
324 if (((bitField0_ & 0x00000001) != 0)) {
325 output.writeEnum(1, type_);
327 for (
int i = 0; i < varIndex_.size(); i++) {
328 output.writeInt32(2, varIndex_.getInt(i));
330 for (
int i = 0; i < weight_.size(); i++) {
331 output.writeDouble(3, weight_.getDouble(i));
333 getUnknownFields().writeTo(output);
338 int size = memoizedSize;
339 if (size != -1)
return size;
342 if (((bitField0_ & 0x00000001) != 0)) {
343 size += com.google.protobuf.CodedOutputStream
344 .computeEnumSize(1, type_);
348 for (
int i = 0; i < varIndex_.size(); i++) {
349 dataSize += com.google.protobuf.CodedOutputStream
350 .computeInt32SizeNoTag(varIndex_.getInt(i));
361 size += getUnknownFields().getSerializedSize();
367 public boolean equals(
final java.lang.Object obj) {
371 if (!(obj instanceof com.google.ortools.linearsolver.MPSosConstraint)) {
372 return super.equals(obj);
378 if (type_ != other.type_)
return false;
384 if (!getUnknownFields().
equals(other.getUnknownFields()))
return false;
390 if (memoizedHashCode != 0) {
391 return memoizedHashCode;
397 hash = (53 * hash) + type_;
407 hash = (29 * hash) + getUnknownFields().hashCode();
408 memoizedHashCode = hash;
413 java.nio.ByteBuffer data)
414 throws com.google.protobuf.InvalidProtocolBufferException {
415 return PARSER.parseFrom(data);
418 java.nio.ByteBuffer data,
419 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
420 throws com.google.protobuf.InvalidProtocolBufferException {
421 return PARSER.parseFrom(data, extensionRegistry);
424 com.google.protobuf.ByteString data)
425 throws com.google.protobuf.InvalidProtocolBufferException {
426 return PARSER.parseFrom(data);
429 com.google.protobuf.ByteString data,
430 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
431 throws com.google.protobuf.InvalidProtocolBufferException {
432 return PARSER.parseFrom(data, extensionRegistry);
435 throws com.google.protobuf.InvalidProtocolBufferException {
436 return PARSER.parseFrom(data);
440 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
441 throws com.google.protobuf.InvalidProtocolBufferException {
442 return PARSER.parseFrom(data, extensionRegistry);
445 throws java.io.IOException {
446 return com.google.protobuf.GeneratedMessage
447 .parseWithIOException(PARSER, input);
450 java.io.InputStream input,
451 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
452 throws java.io.IOException {
453 return com.google.protobuf.GeneratedMessage
454 .parseWithIOException(PARSER, input, extensionRegistry);
458 throws java.io.IOException {
459 return com.google.protobuf.GeneratedMessage
460 .parseDelimitedWithIOException(PARSER, input);
464 java.io.InputStream input,
465 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
466 throws java.io.IOException {
467 return com.google.protobuf.GeneratedMessage
468 .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
471 com.google.protobuf.CodedInputStream input)
472 throws java.io.IOException {
473 return com.google.protobuf.GeneratedMessage
474 .parseWithIOException(PARSER, input);
477 com.google.protobuf.CodedInputStream input,
478 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
479 throws java.io.IOException {
480 return com.google.protobuf.GeneratedMessage
481 .parseWithIOException(PARSER, input, extensionRegistry);
487 return DEFAULT_INSTANCE.toBuilder();
490 return DEFAULT_INSTANCE.toBuilder().
mergeFrom(prototype);
494 return this == DEFAULT_INSTANCE
500 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
513 public static final class Builder
extends
514 com.google.protobuf.GeneratedMessage.Builder<Builder> implements
517 public static final com.google.protobuf.Descriptors.Descriptor
519 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSosConstraint_descriptor;
523 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
525 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSosConstraint_fieldAccessorTable
526 .ensureFieldAccessorsInitialized(
527 com.google.ortools.linearsolver.MPSosConstraint.class, com.google.ortools.linearsolver.MPSosConstraint.Builder.class);
536 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
545 varIndex_ = emptyIntList();
546 weight_ = emptyDoubleList();
551 public com.google.protobuf.Descriptors.Descriptor
553 return com.google.ortools.linearsolver.LinearSolver.internal_static_operations_research_MPSosConstraint_descriptor;
558 return com.google.ortools.linearsolver.MPSosConstraint.getDefaultInstance();
565 throw newUninitializedMessageException(result);
573 if (bitField0_ != 0) { buildPartial0(result); }
578 private void buildPartial0(com.google.ortools.linearsolver.MPSosConstraint result) {
579 int from_bitField0_ = bitField0_;
580 int to_bitField0_ = 0;
581 if (((from_bitField0_ & 0x00000001) != 0)) {
582 result.type_ = type_;
583 to_bitField0_ |= 0x00000001;
585 if (((from_bitField0_ & 0x00000002) != 0)) {
586 varIndex_.makeImmutable();
587 result.varIndex_ = varIndex_;
589 if (((from_bitField0_ & 0x00000004) != 0)) {
590 weight_.makeImmutable();
591 result.weight_ = weight_;
593 result.bitField0_ |= to_bitField0_;
597 public Builder
mergeFrom(com.google.protobuf.Message other) {
598 if (other instanceof com.google.ortools.linearsolver.MPSosConstraint) {
599 return mergeFrom((com.google.ortools.linearsolver.MPSosConstraint)other);
601 super.mergeFrom(other);
606 public Builder
mergeFrom(com.google.ortools.linearsolver.MPSosConstraint other) {
607 if (other == com.google.ortools.linearsolver.MPSosConstraint.getDefaultInstance())
return this;
608 if (other.hasType()) {
611 if (!other.varIndex_.isEmpty()) {
612 if (varIndex_.isEmpty()) {
613 varIndex_ = other.varIndex_;
614 varIndex_.makeImmutable();
615 bitField0_ |= 0x00000002;
617 ensureVarIndexIsMutable();
618 varIndex_.addAll(other.varIndex_);
622 if (!other.weight_.isEmpty()) {
623 if (weight_.isEmpty()) {
624 weight_ = other.weight_;
625 weight_.makeImmutable();
626 bitField0_ |= 0x00000004;
628 ensureWeightIsMutable();
629 weight_.addAll(other.weight_);
633 this.mergeUnknownFields(other.getUnknownFields());
645 com.google.protobuf.CodedInputStream input,
646 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
647 throws java.io.IOException {
648 if (extensionRegistry ==
null) {
649 throw new java.lang.NullPointerException();
652 boolean done =
false;
654 int tag = input.readTag();
660 int tmpRaw = input.readEnum();
662 com.google.ortools.linearsolver.MPSosConstraint.Type.forNumber(tmpRaw);
663 if (tmpValue ==
null) {
664 mergeUnknownVarintField(1, tmpRaw);
667 bitField0_ |= 0x00000001;
672 int v = input.readInt32();
673 ensureVarIndexIsMutable();
678 int length = input.readRawVarint32();
679 int limit = input.pushLimit(length);
680 ensureVarIndexIsMutable();
681 while (input.getBytesUntilLimit() > 0) {
682 varIndex_.addInt(input.readInt32());
684 input.popLimit(limit);
688 double v = input.readDouble();
689 ensureWeightIsMutable();
690 weight_.addDouble(v);
694 int length = input.readRawVarint32();
695 int limit = input.pushLimit(length);
696 int alloc = length > 4096 ? 4096 : length;
697 ensureWeightIsMutable(alloc / 8);
698 while (input.getBytesUntilLimit() > 0) {
699 weight_.addDouble(input.readDouble());
701 input.popLimit(limit);
705 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
712 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
713 throw e.unwrapIOException();
719 private int bitField0_;
721 private int type_ = 0;
726 @java.lang.Override
public boolean hasType() {
727 return ((bitField0_ & 0x00000001) != 0);
743 public Builder
setType(com.google.ortools.linearsolver.MPSosConstraint.Type value) {
745 throw new NullPointerException();
747 bitField0_ |= 0x00000001;
748 type_ = value.getNumber();
757 bitField0_ = (bitField0_ & ~0x00000001);
763 private com.google.protobuf.Internal.IntList varIndex_ = emptyIntList();
764 private void ensureVarIndexIsMutable() {
765 if (!varIndex_.isModifiable()) {
766 varIndex_ = makeMutableCopy(varIndex_);
768 bitField0_ |= 0x00000002;
779 public java.util.List<java.lang.Integer>
781 varIndex_.makeImmutable();
794 return varIndex_.size();
807 return varIndex_.getInt(index);
821 int index,
int value) {
823 ensureVarIndexIsMutable();
824 varIndex_.setInt(index, value);
825 bitField0_ |= 0x00000002;
841 ensureVarIndexIsMutable();
842 varIndex_.addInt(value);
843 bitField0_ |= 0x00000002;
858 java.lang.Iterable<? extends java.lang.Integer> values) {
859 ensureVarIndexIsMutable();
860 com.google.protobuf.AbstractMessageLite.Builder.addAll(
862 bitField0_ |= 0x00000002;
876 varIndex_ = emptyIntList();
877 bitField0_ = (bitField0_ & ~0x00000002);
882 private com.google.protobuf.Internal.DoubleList weight_ = emptyDoubleList();
883 private void ensureWeightIsMutable() {
884 if (!weight_.isModifiable()) {
885 weight_ = makeMutableCopy(weight_);
887 bitField0_ |= 0x00000004;
889 private void ensureWeightIsMutable(
int capacity) {
890 if (!weight_.isModifiable()) {
891 weight_ = makeMutableCopy(weight_, capacity);
893 bitField0_ |= 0x00000004;
912 public java.util.List<java.lang.Double>
914 weight_.makeImmutable();
935 return weight_.size();
956 return weight_.getDouble(index);
978 int index,
double value) {
980 ensureWeightIsMutable();
981 weight_.setDouble(index, value);
982 bitField0_ |= 0x00000004;
1006 ensureWeightIsMutable();
1007 weight_.addDouble(value);
1008 bitField0_ |= 0x00000004;
1031 java.lang.Iterable<? extends java.lang.Double> values) {
1032 ensureWeightIsMutable();
1033 com.google.protobuf.AbstractMessageLite.Builder.addAll(
1035 bitField0_ |= 0x00000004;
1057 weight_ = emptyDoubleList();
1058 bitField0_ = (bitField0_ & ~0x00000004);
1069 DEFAULT_INSTANCE =
new com.google.ortools.linearsolver.MPSosConstraint();
1073 return DEFAULT_INSTANCE;
1080 com.google.protobuf.CodedInputStream input,
1081 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1082 throws com.google.protobuf.InvalidProtocolBufferException {
1085 builder.mergeFrom(input, extensionRegistry);
1086 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
1087 throw e.setUnfinishedMessage(builder.buildPartial());
1088 }
catch (com.google.protobuf.UninitializedMessageException e) {
1089 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1090 }
catch (java.io.IOException e) {
1091 throw new com.google.protobuf.InvalidProtocolBufferException(e)
1092 .setUnfinishedMessage(builder.buildPartial());
1094 return builder.buildPartial();
1098 public static com.google.protobuf.Parser<MPSosConstraint>
parser() {
1109 return DEFAULT_INSTANCE;