Class ConstantSurface

  • All Implemented Interfaces:
    ParameterizedData, Surface, java.io.Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class ConstantSurface
    extends java.lang.Object
    implements Surface, org.joda.beans.ImmutableBean, java.io.Serializable
    A surface based on a single constant value.

    This class defines a surface in terms of a single parameter, the constant value. When queried, zValue(double, double) always returns the constant value. The sensitivity is 1 and the first derivative is 0.

    The surface has one parameter, the value of the constant.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static ConstantSurface of​(java.lang.String name,
                                         double zValue)
        Creates a constant surface with a specific value.
        Parameters:
        name - the surface name
        zValue - the constant z-value
        Returns:
        the surface
      • of

        public static ConstantSurface of​(SurfaceName name,
                                         double zValue)
        Creates a constant surface with a specific value.
        Parameters:
        name - the surface name
        zValue - the constant z-value
        Returns:
        the surface
      • of

        public static ConstantSurface of​(SurfaceMetadata metadata,
                                         double zValue)
        Creates a constant surface with a specific value.
        Parameters:
        metadata - the surface metadata
        zValue - the constant z-value
        Returns:
        the surface
      • getParameterCount

        public int getParameterCount()
        Description copied from interface: ParameterizedData
        Gets the number of parameters.

        This returns the number of parameters, which can be used to create a loop to access the other methods on this interface.

        Specified by:
        getParameterCount in interface ParameterizedData
        Returns:
        the number of parameters
      • getParameter

        public double getParameter​(int parameterIndex)
        Description copied from interface: ParameterizedData
        Gets the value of the parameter at the specified index.
        Specified by:
        getParameter in interface ParameterizedData
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        Returns:
        the value of the parameter
      • withParameter

        public ConstantSurface withParameter​(int parameterIndex,
                                             double newValue)
        Description copied from interface: ParameterizedData
        Returns a copy of the data with the value at the specified index altered.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withParameter in interface ParameterizedData
        Specified by:
        withParameter in interface Surface
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        newValue - the new value for the specified parameter
        Returns:
        a parameterized data instance based on this with the specified parameter altered
      • withPerturbation

        public ConstantSurface withPerturbation​(ParameterPerturbation perturbation)
        Description copied from interface: ParameterizedData
        Returns a perturbed copy of the data.

        The perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withPerturbation in interface ParameterizedData
        Specified by:
        withPerturbation in interface Surface
        Parameters:
        perturbation - the perturbation to apply
        Returns:
        a parameterized data instance based on this with the specified perturbation applied
      • zValue

        public double zValue​(double x,
                             double y)
        Description copied from interface: Surface
        Computes the z-value for the specified x-value and y-value.
        Specified by:
        zValue in interface Surface
        Parameters:
        x - the x-value to find the z-value for
        y - the y-value to find the z-value for
        Returns:
        the value at the x/y point
      • zValueParameterSensitivity

        public UnitParameterSensitivity zValueParameterSensitivity​(double x,
                                                                   double y)
        Description copied from interface: Surface
        Computes the sensitivity of the z-value with respect to the surface parameters.

        This returns an array with one element for each x-y parameter of the surface. The array contains one a sensitivity value for each parameter used to create the surface.

        Specified by:
        zValueParameterSensitivity in interface Surface
        Parameters:
        x - the x-value at which the parameter sensitivity is computed
        y - the y-value at which the parameter sensitivity is computed
        Returns:
        the sensitivity at the x/y/ point
      • withMetadata

        public ConstantSurface withMetadata​(SurfaceMetadata metadata)
        Description copied from interface: Surface
        Returns a new surface with the specified metadata.

        This allows the metadata of the surface to be changed while retaining all other information. If parameter metadata is present, the size of the list must match the number of parameters of this surface.

        Specified by:
        withMetadata in interface Surface
        Parameters:
        metadata - the new metadata for the surface
        Returns:
        the new surface
      • meta

        public static ConstantSurface.Meta meta()
        The meta-bean for ConstantSurface.
        Returns:
        the meta-bean, not null
      • metaBean

        public ConstantSurface.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getMetadata

        public SurfaceMetadata getMetadata()
        Gets the surface metadata.

        The metadata will have not have parameter metadata.

        Specified by:
        getMetadata in interface Surface
        Returns:
        the value of the property, not null
      • getZValue

        public double getZValue()
        Gets the single z-value.
        Returns:
        the value of the property
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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