6package com.google.ortools.sat;
15@com.google.protobuf.Generated
16public final class LinearObjective
extends
17 com.google.protobuf.GeneratedMessage implements
20private static final long serialVersionUID = 0L;
22 com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
23 com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
28 LinearObjective.class.getName());
31 private LinearObjective(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
34 private LinearObjective() {
35 literals_ = emptyIntList();
36 coefficients_ = emptyLongList();
40 public static final com.google.protobuf.Descriptors.Descriptor
42 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_descriptor;
46 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
48 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_fieldAccessorTable
49 .ensureFieldAccessorsInitialized(
50 com.google.ortools.sat.LinearObjective.class, com.google.ortools.sat.LinearObjective.Builder.class);
53 private int bitField0_;
55 @SuppressWarnings(
"serial")
56 private com.google.protobuf.Internal.IntList literals_ =
72 public java.
util.List<java.lang.Integer>
90 return literals_.size();
107 return literals_.getInt(index);
111 @SuppressWarnings(
"serial")
112 private com.google.protobuf.Internal.LongList coefficients_ =
119 public java.
util.List<java.lang.Long>
121 return coefficients_;
128 return coefficients_.size();
136 return coefficients_.getLong(index);
140 private double offset_ = 0D;
157 return ((bitField0_ & 0x00000001) != 0);
179 private double scalingFactor_ = 1D;
186 return ((bitField0_ & 0x00000002) != 0);
194 return scalingFactor_;
197 private byte memoizedIsInitialized = -1;
204 memoizedIsInitialized = 1;
209 public void writeTo(com.google.protobuf.CodedOutputStream output)
210 throws java.io.IOException {
211 for (
int i = 0; i < literals_.size(); i++) {
212 output.writeInt32(1, literals_.getInt(i));
214 for (
int i = 0; i < coefficients_.size(); i++) {
215 output.writeInt64(2, coefficients_.getLong(i));
217 if (((bitField0_ & 0x00000001) != 0)) {
218 output.writeDouble(3, offset_);
220 if (((bitField0_ & 0x00000002) != 0)) {
221 output.writeDouble(4, scalingFactor_);
223 getUnknownFields().writeTo(output);
228 int size = memoizedSize;
229 if (size != -1)
return size;
234 for (
int i = 0; i < literals_.size(); i++) {
235 dataSize += com.google.protobuf.CodedOutputStream
236 .computeInt32SizeNoTag(literals_.getInt(i));
243 for (
int i = 0; i < coefficients_.size(); i++) {
244 dataSize += com.google.protobuf.CodedOutputStream
245 .computeInt64SizeNoTag(coefficients_.getLong(i));
250 if (((bitField0_ & 0x00000001) != 0)) {
251 size += com.google.protobuf.CodedOutputStream
252 .computeDoubleSize(3, offset_);
254 if (((bitField0_ & 0x00000002) != 0)) {
255 size += com.google.protobuf.CodedOutputStream
256 .computeDoubleSize(4, scalingFactor_);
258 size += getUnknownFields().getSerializedSize();
264 public boolean equals(
final java.lang.Object obj) {
268 if (!(obj instanceof com.google.ortools.sat.LinearObjective)) {
269 return super.equals(obj);
279 if (java.lang.Double.doubleToLongBits(
getOffset())
280 != java.lang.Double.doubleToLongBits(
286 != java.lang.Double.doubleToLongBits(
289 if (!getUnknownFields().
equals(other.getUnknownFields()))
return false;
295 if (memoizedHashCode != 0) {
296 return memoizedHashCode;
310 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
311 java.lang.Double.doubleToLongBits(
getOffset()));
315 hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
318 hash = (29 * hash) + getUnknownFields().hashCode();
319 memoizedHashCode = hash;
324 java.nio.ByteBuffer data)
325 throws com.google.protobuf.InvalidProtocolBufferException {
326 return PARSER.parseFrom(data);
329 java.nio.ByteBuffer data,
330 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
331 throws com.google.protobuf.InvalidProtocolBufferException {
332 return PARSER.parseFrom(data, extensionRegistry);
335 com.google.protobuf.ByteString data)
336 throws com.google.protobuf.InvalidProtocolBufferException {
337 return PARSER.parseFrom(data);
340 com.google.protobuf.ByteString data,
341 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
342 throws com.google.protobuf.InvalidProtocolBufferException {
343 return PARSER.parseFrom(data, extensionRegistry);
346 throws com.google.protobuf.InvalidProtocolBufferException {
347 return PARSER.parseFrom(data);
351 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
352 throws com.google.protobuf.InvalidProtocolBufferException {
353 return PARSER.parseFrom(data, extensionRegistry);
356 throws java.io.IOException {
357 return com.google.protobuf.GeneratedMessage
358 .parseWithIOException(PARSER, input);
361 java.io.InputStream input,
362 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
363 throws java.io.IOException {
364 return com.google.protobuf.GeneratedMessage
365 .parseWithIOException(PARSER, input, extensionRegistry);
369 throws java.io.IOException {
370 return com.google.protobuf.GeneratedMessage
371 .parseDelimitedWithIOException(PARSER, input);
375 java.io.InputStream input,
376 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
377 throws java.io.IOException {
378 return com.google.protobuf.GeneratedMessage
379 .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
382 com.google.protobuf.CodedInputStream input)
383 throws java.io.IOException {
384 return com.google.protobuf.GeneratedMessage
385 .parseWithIOException(PARSER, input);
388 com.google.protobuf.CodedInputStream input,
389 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
390 throws java.io.IOException {
391 return com.google.protobuf.GeneratedMessage
392 .parseWithIOException(PARSER, input, extensionRegistry);
398 return DEFAULT_INSTANCE.toBuilder();
401 return DEFAULT_INSTANCE.toBuilder().
mergeFrom(prototype);
405 return this == DEFAULT_INSTANCE
411 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
422 public static final class Builder
extends
423 com.google.protobuf.GeneratedMessage.Builder<Builder> implements
426 public static final com.google.protobuf.Descriptors.Descriptor
428 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_descriptor;
432 protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
434 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_fieldAccessorTable
435 .ensureFieldAccessorsInitialized(
436 com.google.ortools.sat.LinearObjective.class, com.google.ortools.sat.LinearObjective.Builder.class);
445 com.google.protobuf.GeneratedMessage.BuilderParent parent) {
453 literals_ = emptyIntList();
454 coefficients_ = emptyLongList();
461 public com.google.protobuf.Descriptors.Descriptor
463 return com.google.ortools.sat.BooleanProblem.internal_static_operations_research_sat_LinearObjective_descriptor;
468 return com.google.ortools.sat.LinearObjective.getDefaultInstance();
475 throw newUninitializedMessageException(result);
483 if (bitField0_ != 0) { buildPartial0(result); }
488 private void buildPartial0(com.google.ortools.sat.LinearObjective result) {
489 int from_bitField0_ = bitField0_;
490 if (((from_bitField0_ & 0x00000001) != 0)) {
491 literals_.makeImmutable();
492 result.literals_ = literals_;
494 if (((from_bitField0_ & 0x00000002) != 0)) {
495 coefficients_.makeImmutable();
496 result.coefficients_ = coefficients_;
498 int to_bitField0_ = 0;
499 if (((from_bitField0_ & 0x00000004) != 0)) {
500 result.offset_ = offset_;
501 to_bitField0_ |= 0x00000001;
503 if (((from_bitField0_ & 0x00000008) != 0)) {
504 result.scalingFactor_ = scalingFactor_;
505 to_bitField0_ |= 0x00000002;
507 result.bitField0_ |= to_bitField0_;
511 public Builder
mergeFrom(com.google.protobuf.Message other) {
512 if (other instanceof com.google.ortools.sat.LinearObjective) {
513 return mergeFrom((com.google.ortools.sat.LinearObjective)other);
515 super.mergeFrom(other);
520 public Builder
mergeFrom(com.google.ortools.sat.LinearObjective other) {
521 if (other == com.google.ortools.sat.LinearObjective.getDefaultInstance())
return this;
522 if (!other.literals_.isEmpty()) {
523 if (literals_.isEmpty()) {
524 literals_ = other.literals_;
525 literals_.makeImmutable();
526 bitField0_ |= 0x00000001;
528 ensureLiteralsIsMutable();
529 literals_.addAll(other.literals_);
533 if (!other.coefficients_.isEmpty()) {
534 if (coefficients_.isEmpty()) {
535 coefficients_ = other.coefficients_;
536 coefficients_.makeImmutable();
537 bitField0_ |= 0x00000002;
539 ensureCoefficientsIsMutable();
540 coefficients_.addAll(other.coefficients_);
544 if (other.hasOffset()) {
547 if (other.hasScalingFactor()) {
550 this.mergeUnknownFields(other.getUnknownFields());
562 com.google.protobuf.CodedInputStream input,
563 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
564 throws java.io.IOException {
565 if (extensionRegistry ==
null) {
566 throw new java.lang.NullPointerException();
569 boolean done =
false;
571 int tag = input.readTag();
577 int v = input.readInt32();
578 ensureLiteralsIsMutable();
583 int length = input.readRawVarint32();
584 int limit = input.pushLimit(length);
585 ensureLiteralsIsMutable();
586 while (input.getBytesUntilLimit() > 0) {
587 literals_.addInt(input.readInt32());
589 input.popLimit(limit);
593 long v = input.readInt64();
594 ensureCoefficientsIsMutable();
595 coefficients_.addLong(v);
599 int length = input.readRawVarint32();
600 int limit = input.pushLimit(length);
601 ensureCoefficientsIsMutable();
602 while (input.getBytesUntilLimit() > 0) {
603 coefficients_.addLong(input.readInt64());
605 input.popLimit(limit);
609 offset_ = input.readDouble();
610 bitField0_ |= 0x00000004;
614 scalingFactor_ = input.readDouble();
615 bitField0_ |= 0x00000008;
619 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
626 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
627 throw e.unwrapIOException();
633 private int bitField0_;
635 private com.google.protobuf.Internal.IntList literals_ = emptyIntList();
636 private void ensureLiteralsIsMutable() {
637 if (!literals_.isModifiable()) {
638 literals_ = makeMutableCopy(literals_);
640 bitField0_ |= 0x00000001;
655 public java.util.List<java.lang.Integer>
657 literals_.makeImmutable();
674 return literals_.size();
691 return literals_.getInt(index);
709 int index,
int value) {
711 ensureLiteralsIsMutable();
712 literals_.setInt(index, value);
713 bitField0_ |= 0x00000001;
733 ensureLiteralsIsMutable();
734 literals_.addInt(value);
735 bitField0_ |= 0x00000001;
754 java.lang.Iterable<? extends java.lang.Integer> values) {
755 ensureLiteralsIsMutable();
756 com.google.protobuf.AbstractMessageLite.Builder.addAll(
758 bitField0_ |= 0x00000001;
776 literals_ = emptyIntList();
777 bitField0_ = (bitField0_ & ~0x00000001);
782 private com.google.protobuf.Internal.LongList coefficients_ = emptyLongList();
783 private void ensureCoefficientsIsMutable() {
784 if (!coefficients_.isModifiable()) {
785 coefficients_ = makeMutableCopy(coefficients_);
787 bitField0_ |= 0x00000002;
793 public java.util.List<java.lang.Long>
795 coefficients_.makeImmutable();
796 return coefficients_;
803 return coefficients_.size();
811 return coefficients_.getLong(index);
820 int index,
long value) {
822 ensureCoefficientsIsMutable();
823 coefficients_.setLong(index, value);
824 bitField0_ |= 0x00000002;
835 ensureCoefficientsIsMutable();
836 coefficients_.addLong(value);
837 bitField0_ |= 0x00000002;
847 java.lang.Iterable<? extends java.lang.Long> values) {
848 ensureCoefficientsIsMutable();
849 com.google.protobuf.AbstractMessageLite.Builder.addAll(
850 values, coefficients_);
851 bitField0_ |= 0x00000002;
860 coefficients_ = emptyLongList();
861 bitField0_ = (bitField0_ & ~0x00000002);
866 private double offset_ ;
883 return ((bitField0_ & 0x00000004) != 0);
921 bitField0_ |= 0x00000004;
940 bitField0_ = (bitField0_ & ~0x00000004);
946 private double scalingFactor_ = 1D;
953 return ((bitField0_ & 0x00000008) != 0);
961 return scalingFactor_;
970 scalingFactor_ = value;
971 bitField0_ |= 0x00000008;
980 bitField0_ = (bitField0_ & ~0x00000008);
992 DEFAULT_INSTANCE =
new com.google.ortools.sat.LinearObjective();
996 return DEFAULT_INSTANCE;
1003 com.google.protobuf.CodedInputStream input,
1004 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1005 throws com.google.protobuf.InvalidProtocolBufferException {
1008 builder.mergeFrom(input, extensionRegistry);
1009 }
catch (com.google.protobuf.InvalidProtocolBufferException e) {
1010 throw e.setUnfinishedMessage(builder.buildPartial());
1011 }
catch (com.google.protobuf.UninitializedMessageException e) {
1012 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1013 }
catch (java.io.IOException e) {
1014 throw new com.google.protobuf.InvalidProtocolBufferException(e)
1015 .setUnfinishedMessage(builder.buildPartial());
1017 return builder.buildPartial();
1021 public static com.google.protobuf.Parser<LinearObjective>
parser() {
1032 return DEFAULT_INSTANCE;