6package com.google.ortools.sat;
15public final class LinearObjective
extends
16 com.google.protobuf.GeneratedMessage implements
19private static final long serialVersionUID = 0L;
21 com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
22 com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
27 LinearObjective.class.getName());
30 private LinearObjective(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
33 private LinearObjective() {
34 literals_ = emptyIntList();
35 coefficients_ = emptyLongList();
39 public static final com.google.protobuf.Descriptors.Descriptor
41 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_descriptor;
45 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
47 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_fieldAccessorTable
48 .ensureFieldAccessorsInitialized(
49 com.google.ortools.sat.LinearObjective.class, com.google.ortools.sat.LinearObjective.Builder.class);
52 private int bitField0_;
54 @SuppressWarnings(
"serial")
55 private com.google.protobuf.Internal.IntList literals_ =
71 public java.
util.List<java.lang.Integer>
89 return literals_.size();
106 return literals_.getInt(index);
110 @SuppressWarnings(
"serial")
111 private com.google.protobuf.Internal.LongList coefficients_ =
118 public java.
util.List<java.lang.Long>
120 return coefficients_;
127 return coefficients_.size();
135 return coefficients_.getLong(index);
139 private double offset_ = 0D;
156 return ((bitField0_ & 0x00000001) != 0);
178 private double scalingFactor_ = 1D;
185 return ((bitField0_ & 0x00000002) != 0);
193 return scalingFactor_;
196 private byte memoizedIsInitialized = -1;
203 memoizedIsInitialized = 1;
208 public void writeTo(com.google.protobuf.CodedOutputStream output)
209 throws java.io.IOException {
210 for (
int i = 0; i < literals_.size(); i++) {
211 output.writeInt32(1, literals_.getInt(i));
213 for (
int i = 0; i < coefficients_.size(); i++) {
214 output.writeInt64(2, coefficients_.getLong(i));
216 if (((bitField0_ & 0x00000001) != 0)) {
217 output.writeDouble(3, offset_);
219 if (((bitField0_ & 0x00000002) != 0)) {
220 output.writeDouble(4, scalingFactor_);
222 getUnknownFields().writeTo(output);
227 int size = memoizedSize;
228 if (size != -1)
return size;
233 for (
int i = 0; i < literals_.size(); i++) {
234 dataSize += com.google.protobuf.CodedOutputStream
235 .computeInt32SizeNoTag(literals_.getInt(i));
242 for (
int i = 0; i < coefficients_.size(); i++) {
243 dataSize += com.google.protobuf.CodedOutputStream
244 .computeInt64SizeNoTag(coefficients_.getLong(i));
249 if (((bitField0_ & 0x00000001) != 0)) {
250 size += com.google.protobuf.CodedOutputStream
251 .computeDoubleSize(3, offset_);
253 if (((bitField0_ & 0x00000002) != 0)) {
254 size += com.google.protobuf.CodedOutputStream
255 .computeDoubleSize(4, scalingFactor_);
257 size += getUnknownFields().getSerializedSize();
263 public boolean equals(
final java.lang.Object obj) {
267 if (!(obj instanceof com.google.ortools.sat.LinearObjective)) {
268 return super.equals(obj);
278 if (java.lang.Double.doubleToLongBits(
getOffset())
279 != java.lang.Double.doubleToLongBits(
285 != java.lang.Double.doubleToLongBits(
288 if (!getUnknownFields().
equals(other.getUnknownFields()))
return false;
294 if (memoizedHashCode != 0) {
295 return memoizedHashCode;
309 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
310 java.lang.Double.doubleToLongBits(
getOffset()));
314 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
317 hash = (29 * hash) + getUnknownFields().hashCode();
318 memoizedHashCode = hash;
323 java.nio.ByteBuffer data)
324 throws com.google.protobuf.InvalidProtocolBufferException {
325 return PARSER.parseFrom(data);
328 java.nio.ByteBuffer data,
329 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
330 throws com.google.protobuf.InvalidProtocolBufferException {
331 return PARSER.parseFrom(data, extensionRegistry);
334 com.google.protobuf.ByteString data)
335 throws com.google.protobuf.InvalidProtocolBufferException {
336 return PARSER.parseFrom(data);
339 com.google.protobuf.ByteString data,
340 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
341 throws com.google.protobuf.InvalidProtocolBufferException {
342 return PARSER.parseFrom(data, extensionRegistry);
345 throws com.google.protobuf.InvalidProtocolBufferException {
346 return PARSER.parseFrom(data);
350 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
351 throws com.google.protobuf.InvalidProtocolBufferException {
352 return PARSER.parseFrom(data, extensionRegistry);
355 throws java.io.IOException {
356 return com.google.protobuf.GeneratedMessage
357 .parseWithIOException(PARSER, input);
360 java.io.InputStream input,
361 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
362 throws java.io.IOException {
363 return com.google.protobuf.GeneratedMessage
364 .parseWithIOException(PARSER, input, extensionRegistry);
368 throws java.io.IOException {
369 return com.google.protobuf.GeneratedMessage
370 .parseDelimitedWithIOException(PARSER, input);
374 java.io.InputStream input,
375 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
376 throws java.io.IOException {
377 return com.google.protobuf.GeneratedMessage
378 .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
381 com.google.protobuf.CodedInputStream input)
382 throws java.io.IOException {
383 return com.google.protobuf.GeneratedMessage
384 .parseWithIOException(PARSER, input);
387 com.google.protobuf.CodedInputStream input,
388 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
389 throws java.io.IOException {
390 return com.google.protobuf.GeneratedMessage
391 .parseWithIOException(PARSER, input, extensionRegistry);
397 return DEFAULT_INSTANCE.toBuilder();
400 return DEFAULT_INSTANCE.toBuilder().
mergeFrom(prototype);
404 return this == DEFAULT_INSTANCE
410 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
421 public static final class Builder
extends
422 com.google.protobuf.GeneratedMessage.Builder<Builder> implements
425 public static final com.google.protobuf.Descriptors.Descriptor
427 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_descriptor;
431 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
433 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_fieldAccessorTable
434 .ensureFieldAccessorsInitialized(
435 com.google.ortools.sat.LinearObjective.class, com.google.ortools.sat.LinearObjective.Builder.class);
444 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
452 literals_ = emptyIntList();
453 coefficients_ = emptyLongList();
460 public com.google.protobuf.Descriptors.Descriptor
462 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_descriptor;
467 return com.google.ortools.sat.LinearObjective.getDefaultInstance();
474 throw newUninitializedMessageException(result);
482 if (bitField0_ != 0) { buildPartial0(result); }
487 private void buildPartial0(com.google.ortools.sat.LinearObjective result) {
488 int from_bitField0_ = bitField0_;
489 if (((from_bitField0_ & 0x00000001) != 0)) {
490 literals_.makeImmutable();
491 result.literals_ = literals_;
493 if (((from_bitField0_ & 0x00000002) != 0)) {
494 coefficients_.makeImmutable();
495 result.coefficients_ = coefficients_;
497 int to_bitField0_ = 0;
498 if (((from_bitField0_ & 0x00000004) != 0)) {
499 result.offset_ = offset_;
500 to_bitField0_ |= 0x00000001;
502 if (((from_bitField0_ & 0x00000008) != 0)) {
503 result.scalingFactor_ = scalingFactor_;
504 to_bitField0_ |= 0x00000002;
506 result.bitField0_ |= to_bitField0_;
510 public Builder
mergeFrom(com.google.protobuf.Message other) {
511 if (other instanceof com.google.ortools.sat.LinearObjective) {
512 return mergeFrom((com.google.ortools.sat.LinearObjective)other);
514 super.mergeFrom(other);
519 public Builder
mergeFrom(com.google.ortools.sat.LinearObjective other) {
520 if (other == com.google.ortools.sat.LinearObjective.getDefaultInstance())
return this;
521 if (!other.literals_.isEmpty()) {
522 if (literals_.isEmpty()) {
523 literals_ = other.literals_;
524 literals_.makeImmutable();
525 bitField0_ |= 0x00000001;
527 ensureLiteralsIsMutable();
528 literals_.addAll(other.literals_);
532 if (!other.coefficients_.isEmpty()) {
533 if (coefficients_.isEmpty()) {
534 coefficients_ = other.coefficients_;
535 coefficients_.makeImmutable();
536 bitField0_ |= 0x00000002;
538 ensureCoefficientsIsMutable();
539 coefficients_.addAll(other.coefficients_);
543 if (other.hasOffset()) {
546 if (other.hasScalingFactor()) {
549 this.mergeUnknownFields(other.getUnknownFields());
561 com.google.protobuf.CodedInputStream input,
562 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
563 throws java.io.IOException {
564 if (extensionRegistry ==
null) {
565 throw new java.lang.NullPointerException();
568 boolean done =
false;
570 int tag = input.readTag();
576 int v = input.readInt32();
577 ensureLiteralsIsMutable();
582 int length = input.readRawVarint32();
583 int limit = input.pushLimit(length);
584 ensureLiteralsIsMutable();
585 while (input.getBytesUntilLimit() > 0) {
586 literals_.addInt(input.readInt32());
588 input.popLimit(limit);
592 long v = input.readInt64();
593 ensureCoefficientsIsMutable();
594 coefficients_.addLong(v);
598 int length = input.readRawVarint32();
599 int limit = input.pushLimit(length);
600 ensureCoefficientsIsMutable();
601 while (input.getBytesUntilLimit() > 0) {
602 coefficients_.addLong(input.readInt64());
604 input.popLimit(limit);
608 offset_ = input.readDouble();
609 bitField0_ |= 0x00000004;
613 scalingFactor_ = input.readDouble();
614 bitField0_ |= 0x00000008;
618 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
625 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
626 throw e.unwrapIOException();
632 private int bitField0_;
634 private com.google.protobuf.Internal.IntList literals_ = emptyIntList();
635 private void ensureLiteralsIsMutable() {
636 if (!literals_.isModifiable()) {
637 literals_ = makeMutableCopy(literals_);
639 bitField0_ |= 0x00000001;
654 public java.util.List<java.lang.Integer>
656 literals_.makeImmutable();
673 return literals_.size();
690 return literals_.getInt(index);
708 int index,
int value) {
710 ensureLiteralsIsMutable();
711 literals_.setInt(index, value);
712 bitField0_ |= 0x00000001;
732 ensureLiteralsIsMutable();
733 literals_.addInt(value);
734 bitField0_ |= 0x00000001;
753 java.lang.Iterable<? extends java.lang.Integer> values) {
754 ensureLiteralsIsMutable();
755 com.google.protobuf.AbstractMessageLite.Builder.addAll(
757 bitField0_ |= 0x00000001;
775 literals_ = emptyIntList();
776 bitField0_ = (bitField0_ & ~0x00000001);
781 private com.google.protobuf.Internal.LongList coefficients_ = emptyLongList();
782 private void ensureCoefficientsIsMutable() {
783 if (!coefficients_.isModifiable()) {
784 coefficients_ = makeMutableCopy(coefficients_);
786 bitField0_ |= 0x00000002;
792 public java.util.List<java.lang.Long>
794 coefficients_.makeImmutable();
795 return coefficients_;
802 return coefficients_.size();
810 return coefficients_.getLong(index);
819 int index,
long value) {
821 ensureCoefficientsIsMutable();
822 coefficients_.setLong(index, value);
823 bitField0_ |= 0x00000002;
834 ensureCoefficientsIsMutable();
835 coefficients_.addLong(value);
836 bitField0_ |= 0x00000002;
846 java.lang.Iterable<? extends java.lang.Long> values) {
847 ensureCoefficientsIsMutable();
848 com.google.protobuf.AbstractMessageLite.Builder.addAll(
849 values, coefficients_);
850 bitField0_ |= 0x00000002;
859 coefficients_ = emptyLongList();
860 bitField0_ = (bitField0_ & ~0x00000002);
865 private double offset_ ;
882 return ((bitField0_ & 0x00000004) != 0);
920 bitField0_ |= 0x00000004;
939 bitField0_ = (bitField0_ & ~0x00000004);
945 private double scalingFactor_ = 1D;
952 return ((bitField0_ & 0x00000008) != 0);
960 return scalingFactor_;
969 scalingFactor_ = value;
970 bitField0_ |= 0x00000008;
979 bitField0_ = (bitField0_ & ~0x00000008);
991 DEFAULT_INSTANCE =
new com.google.ortools.sat.LinearObjective();
995 return DEFAULT_INSTANCE;
1002 com.google.protobuf.CodedInputStream input,
1003 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1004 throws com.google.protobuf.InvalidProtocolBufferException {
1007 builder.mergeFrom(input, extensionRegistry);
1008 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
1009 throw e.setUnfinishedMessage(builder.buildPartial());
1010 }
catch (com.google.protobuf.UninitializedMessageException e) {
1011 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1012 }
catch (java.io.IOException e) {
1013 throw new com.google.protobuf.InvalidProtocolBufferException(e)
1014 .setUnfinishedMessage(builder.buildPartial());
1016 return builder.buildPartial();
1020 public static com.google.protobuf.Parser<LinearObjective>
parser() {
1031 return DEFAULT_INSTANCE;