Class Complex.NonPropagatingImmutableComplex

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    ImmutableComplex
    Enclosing class:
    Complex

    public static class Complex.NonPropagatingImmutableComplex
    extends Complex
    An immutable version of the Complex class. In this class the number cannot be changed, but numbers derived from it can be modified. This is largely done to not break existing code, and is used for the three constants Complex.ONE, Complex.ZERO and Complex.I. Hence I cannot be changes but I.neg() can be changed. Use ImmutableComplex for a version where the results of all operations cannot be changed.
    See Also:
    Serialized Form
    • Constructor Detail

      • NonPropagatingImmutableComplex

        public NonPropagatingImmutableComplex()
      • NonPropagatingImmutableComplex

        public NonPropagatingImmutableComplex​(Complex z)
      • NonPropagatingImmutableComplex

        public NonPropagatingImmutableComplex​(double x,
                                              double y)
      • NonPropagatingImmutableComplex

        public NonPropagatingImmutableComplex​(double x)
      • NonPropagatingImmutableComplex

        public NonPropagatingImmutableComplex​(java.lang.Number x)
    • Method Detail

      • set

        public final void set​(Complex z)
        Description copied from class: Complex
        Copies the values from the parameter object to this object
        Overrides:
        set in class Complex
        Parameters:
        z - complex number to copy from
      • set

        public final void set​(double x,
                              double y)
        Description copied from class: Complex
        Sets the real and imaginary values of the object.
        Overrides:
        set in class Complex
        Parameters:
        x - real part
        y - imaginary part
      • setRe

        public final void setRe​(double x)
        Description copied from class: Complex
        Sets the real component of the object
        Overrides:
        setRe in class Complex
        Parameters:
        x - real part
      • setIm

        public final void setIm​(double y)
        Description copied from class: Complex
        Sets the imaginary component of the object
        Overrides:
        setIm in class Complex
        Parameters:
        y - imaginary part