Class LinearBooleanConstraint.Builder

  • All Implemented Interfaces:
    LinearBooleanConstraintOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.lang.Cloneable
    Enclosing class:
    LinearBooleanConstraint

    public static final class LinearBooleanConstraint.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
    implements LinearBooleanConstraintOrBuilder
     A linear Boolean constraint which is a bounded sum of linear terms. Each term
     beeing a literal times an integer coefficient. If we assume that a literal
     takes the value 1 if it is true and 0 otherwise, the constraint is:
       lower_bound <= ... + coefficients[i] * literals[i] + ... <= upper_bound
     
    Protobuf type operations_research.sat.LinearBooleanConstraint
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • clear

        public LinearBooleanConstraint.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • getDefaultInstanceForType

        public LinearBooleanConstraint getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public LinearBooleanConstraint build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public LinearBooleanConstraint buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public LinearBooleanConstraint.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • setField

        public LinearBooleanConstraint.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                        java.lang.Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • clearField

        public LinearBooleanConstraint.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • clearOneof

        public LinearBooleanConstraint.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • setRepeatedField

        public LinearBooleanConstraint.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                                int index,
                                                                java.lang.Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • addRepeatedField

        public LinearBooleanConstraint.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                                java.lang.Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • mergeFrom

        public LinearBooleanConstraint.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                                         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                  throws java.io.IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<LinearBooleanConstraint.Builder>
        Throws:
        java.io.IOException
      • getLiteralsList

        public java.util.List<java.lang.Integer> getLiteralsList()
         Linear terms involved in this constraint.
        
         literals[i] is the signed representation of the i-th literal of the
         constraint and coefficients[i] its coefficients. The signed representation
         is as follow: for a 0-based variable index x, (x + 1) represents the
         variable x and -(x + 1) represents its negation.
        
         Note that the same variable shouldn't appear twice and that zero
         coefficients are not allowed.
         
        repeated int32 literals = 1;
        Specified by:
        getLiteralsList in interface LinearBooleanConstraintOrBuilder
        Returns:
        A list containing the literals.
      • getLiteralsCount

        public int getLiteralsCount()
         Linear terms involved in this constraint.
        
         literals[i] is the signed representation of the i-th literal of the
         constraint and coefficients[i] its coefficients. The signed representation
         is as follow: for a 0-based variable index x, (x + 1) represents the
         variable x and -(x + 1) represents its negation.
        
         Note that the same variable shouldn't appear twice and that zero
         coefficients are not allowed.
         
        repeated int32 literals = 1;
        Specified by:
        getLiteralsCount in interface LinearBooleanConstraintOrBuilder
        Returns:
        The count of literals.
      • getLiterals

        public int getLiterals​(int index)
         Linear terms involved in this constraint.
        
         literals[i] is the signed representation of the i-th literal of the
         constraint and coefficients[i] its coefficients. The signed representation
         is as follow: for a 0-based variable index x, (x + 1) represents the
         variable x and -(x + 1) represents its negation.
        
         Note that the same variable shouldn't appear twice and that zero
         coefficients are not allowed.
         
        repeated int32 literals = 1;
        Specified by:
        getLiterals in interface LinearBooleanConstraintOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The literals at the given index.
      • setLiterals

        public LinearBooleanConstraint.Builder setLiterals​(int index,
                                                           int value)
         Linear terms involved in this constraint.
        
         literals[i] is the signed representation of the i-th literal of the
         constraint and coefficients[i] its coefficients. The signed representation
         is as follow: for a 0-based variable index x, (x + 1) represents the
         variable x and -(x + 1) represents its negation.
        
         Note that the same variable shouldn't appear twice and that zero
         coefficients are not allowed.
         
        repeated int32 literals = 1;
        Parameters:
        index - The index to set the value at.
        value - The literals to set.
        Returns:
        This builder for chaining.
      • addLiterals

        public LinearBooleanConstraint.Builder addLiterals​(int value)
         Linear terms involved in this constraint.
        
         literals[i] is the signed representation of the i-th literal of the
         constraint and coefficients[i] its coefficients. The signed representation
         is as follow: for a 0-based variable index x, (x + 1) represents the
         variable x and -(x + 1) represents its negation.
        
         Note that the same variable shouldn't appear twice and that zero
         coefficients are not allowed.
         
        repeated int32 literals = 1;
        Parameters:
        value - The literals to add.
        Returns:
        This builder for chaining.
      • addAllLiterals

        public LinearBooleanConstraint.Builder addAllLiterals​(java.lang.Iterable<? extends java.lang.Integer> values)
         Linear terms involved in this constraint.
        
         literals[i] is the signed representation of the i-th literal of the
         constraint and coefficients[i] its coefficients. The signed representation
         is as follow: for a 0-based variable index x, (x + 1) represents the
         variable x and -(x + 1) represents its negation.
        
         Note that the same variable shouldn't appear twice and that zero
         coefficients are not allowed.
         
        repeated int32 literals = 1;
        Parameters:
        values - The literals to add.
        Returns:
        This builder for chaining.
      • clearLiterals

        public LinearBooleanConstraint.Builder clearLiterals()
         Linear terms involved in this constraint.
        
         literals[i] is the signed representation of the i-th literal of the
         constraint and coefficients[i] its coefficients. The signed representation
         is as follow: for a 0-based variable index x, (x + 1) represents the
         variable x and -(x + 1) represents its negation.
        
         Note that the same variable shouldn't appear twice and that zero
         coefficients are not allowed.
         
        repeated int32 literals = 1;
        Returns:
        This builder for chaining.
      • getCoefficients

        public long getCoefficients​(int index)
        repeated int64 coefficients = 2;
        Specified by:
        getCoefficients in interface LinearBooleanConstraintOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The coefficients at the given index.
      • setCoefficients

        public LinearBooleanConstraint.Builder setCoefficients​(int index,
                                                               long value)
        repeated int64 coefficients = 2;
        Parameters:
        index - The index to set the value at.
        value - The coefficients to set.
        Returns:
        This builder for chaining.
      • addCoefficients

        public LinearBooleanConstraint.Builder addCoefficients​(long value)
        repeated int64 coefficients = 2;
        Parameters:
        value - The coefficients to add.
        Returns:
        This builder for chaining.
      • addAllCoefficients

        public LinearBooleanConstraint.Builder addAllCoefficients​(java.lang.Iterable<? extends java.lang.Long> values)
        repeated int64 coefficients = 2;
        Parameters:
        values - The coefficients to add.
        Returns:
        This builder for chaining.
      • hasLowerBound

        public boolean hasLowerBound()
         Optional lower (resp. upper) bound of the constraint. If not present, it
         means that the constraint is not bounded in this direction. The bounds
         are INCLUSIVE.
         
        optional int64 lower_bound = 3;
        Specified by:
        hasLowerBound in interface LinearBooleanConstraintOrBuilder
        Returns:
        Whether the lowerBound field is set.
      • getLowerBound

        public long getLowerBound()
         Optional lower (resp. upper) bound of the constraint. If not present, it
         means that the constraint is not bounded in this direction. The bounds
         are INCLUSIVE.
         
        optional int64 lower_bound = 3;
        Specified by:
        getLowerBound in interface LinearBooleanConstraintOrBuilder
        Returns:
        The lowerBound.
      • setLowerBound

        public LinearBooleanConstraint.Builder setLowerBound​(long value)
         Optional lower (resp. upper) bound of the constraint. If not present, it
         means that the constraint is not bounded in this direction. The bounds
         are INCLUSIVE.
         
        optional int64 lower_bound = 3;
        Parameters:
        value - The lowerBound to set.
        Returns:
        This builder for chaining.
      • clearLowerBound

        public LinearBooleanConstraint.Builder clearLowerBound()
         Optional lower (resp. upper) bound of the constraint. If not present, it
         means that the constraint is not bounded in this direction. The bounds
         are INCLUSIVE.
         
        optional int64 lower_bound = 3;
        Returns:
        This builder for chaining.
      • setUpperBound

        public LinearBooleanConstraint.Builder setUpperBound​(long value)
        optional int64 upper_bound = 4;
        Parameters:
        value - The upperBound to set.
        Returns:
        This builder for chaining.
      • hasName

        public boolean hasName()
         The name of this constraint.
         
        optional string name = 5 [default = ""];
        Specified by:
        hasName in interface LinearBooleanConstraintOrBuilder
        Returns:
        Whether the name field is set.
      • getName

        public java.lang.String getName()
         The name of this constraint.
         
        optional string name = 5 [default = ""];
        Specified by:
        getName in interface LinearBooleanConstraintOrBuilder
        Returns:
        The name.
      • getNameBytes

        public com.google.protobuf.ByteString getNameBytes()
         The name of this constraint.
         
        optional string name = 5 [default = ""];
        Specified by:
        getNameBytes in interface LinearBooleanConstraintOrBuilder
        Returns:
        The bytes for name.
      • setName

        public LinearBooleanConstraint.Builder setName​(java.lang.String value)
         The name of this constraint.
         
        optional string name = 5 [default = ""];
        Parameters:
        value - The name to set.
        Returns:
        This builder for chaining.
      • clearName

        public LinearBooleanConstraint.Builder clearName()
         The name of this constraint.
         
        optional string name = 5 [default = ""];
        Returns:
        This builder for chaining.
      • setNameBytes

        public LinearBooleanConstraint.Builder setNameBytes​(com.google.protobuf.ByteString value)
         The name of this constraint.
         
        optional string name = 5 [default = ""];
        Parameters:
        value - The bytes for name to set.
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final LinearBooleanConstraint.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>
      • mergeUnknownFields

        public final LinearBooleanConstraint.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<LinearBooleanConstraint.Builder>