Class SingleReal

    • Constructor Summary

      Constructors 
      Constructor Description
      SingleReal()
      Initializes to 0.0.
      SingleReal​(double x)
      Initializes to a specified value.
      SingleReal​(SingleReal other)
      Initializes as a copy of another.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SingleReal copy()
      Creates an identical copy of this object.
      boolean equals​(Object other)
      Indicates whether some other object is "equal to" this one.
      double get()
      Accesses the current value.
      double get​(int i)
      Accesses the current value.
      int hashCode()
      Returns a hash code value for the function input object.
      int length()
      Gets the number of parameters.
      void set​(double x)
      Sets to a specified value.
      void set​(int i, double x)
      Sets this function input to a specified value.
      double[] toArray​(double[] values)
      Accesses the current values of all of the parameters.
    • Constructor Detail

      • SingleReal

        public SingleReal()
        Initializes to 0.0.
      • SingleReal

        public SingleReal​(double x)
        Initializes to a specified value.
        Parameters:
        x - The initial value.
      • SingleReal

        public SingleReal​(SingleReal other)
        Initializes as a copy of another.
        Parameters:
        other - The other to copy.
    • Method Detail

      • length

        public final int length()
        Description copied from interface: RealValued
        Gets the number of parameters.
        Specified by:
        length in interface RealValued
        Returns:
        The number of parameters for this function.
      • get

        public final double get()
        Accesses the current value.
        Returns:
        The current value.
      • get

        public final double get​(int i)
        Accesses the current value. This method originates with the RealValued interface. Since this is a univariate function, there is only 1 input variable by definition. Rather than throw an exception for values of i other than 0, this method ignores the i parameter and is equivalent to the get() method regardless of value passed for i.
        Specified by:
        get in interface RealValued
        Parameters:
        i - The input to get (ignored by this implementation since this is an input for a univariate function).
        Returns:
        The current value of this function input.
      • toArray

        public final double[] toArray​(double[] values)
        Description copied from interface: RealValued
        Accesses the current values of all of the parameters.
        Specified by:
        toArray in interface RealValued
        Parameters:
        values - An array to hold the result. If values is null or if values.length is not equal to this.length(), then a new array is constructed for the result.
        Returns:
        An array containing the current values of all of the parameters.
      • set

        public void set​(double x)
        Sets to a specified value.
        Parameters:
        x - The new value.
      • set

        public final void set​(int i,
                              double x)

        Sets this function input to a specified value. This method originates with the RealValued interface. Since this is a univariate function, there is only 1 input variable by definition. Rather than throw an exception for values of i other than 0, this method ignores the i parameter and is equivalent to the set(double) method regardless of value passed for i.

        This method delegates work to the set(double) method, so the behavior of this method will be consistent with any subclasses that override set(double).

        Specified by:
        set in interface RealValued
        Parameters:
        i - The input variable to set (ignored by this implementation since this is an input for a univariate function).
        x - The new value for this function input.
      • copy

        public SingleReal copy()
        Creates an identical copy of this object.
        Specified by:
        copy in interface Copyable<SingleReal>
        Returns:
        an identical copy of this object
      • equals

        public boolean equals​(Object other)
        Indicates whether some other object is "equal to" this one. To be equal, the other object must be of the same runtime type and contain the same value of the function input.
        Overrides:
        equals in class Object
        Parameters:
        other - The other object to compare.
        Returns:
        true if other is not null, is of the same runtime type as this, and contains the same function input value.
      • hashCode

        public int hashCode()
        Returns a hash code value for the function input object.
        Overrides:
        hashCode in class Object
        Returns:
        a hash code value