Class ConstantExpression

  • All Implemented Interfaces:
    LinearArgument, LinearExpr

    public final class ConstantExpression
    extends java.lang.Object
    implements LinearExpr
    A specialized constant linear expression.
    • Constructor Summary

      Constructors 
      Constructor Description
      ConstantExpression​(double offset)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      LinearExpr build()
      Builds a linear expression.
      double getCoefficient​(int index)
      Returns the ith coefficient.
      double getOffset()
      Returns the constant part of the expression.
      int getVariableIndex​(int index)
      Returns the index of the ith variable.
      int numElements()
      Returns the number of terms (excluding the constant one) in this expression.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ConstantExpression

        public ConstantExpression​(double offset)
    • Method Detail

      • numElements

        public int numElements()
        Description copied from interface: LinearExpr
        Returns the number of terms (excluding the constant one) in this expression.
        Specified by:
        numElements in interface LinearExpr
      • getVariableIndex

        public int getVariableIndex​(int index)
        Description copied from interface: LinearExpr
        Returns the index of the ith variable.
        Specified by:
        getVariableIndex in interface LinearExpr
      • getCoefficient

        public double getCoefficient​(int index)
        Description copied from interface: LinearExpr
        Returns the ith coefficient.
        Specified by:
        getCoefficient in interface LinearExpr
      • getOffset

        public double getOffset()
        Description copied from interface: LinearExpr
        Returns the constant part of the expression.
        Specified by:
        getOffset in interface LinearExpr
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object