Package edu.jas.root

Class Rectangle<C extends RingElem<C> & Rational>

  • Type Parameters:
    C - coefficient type.
    All Implemented Interfaces:
    java.io.Serializable

    public class Rectangle<C extends RingElem<C> & Rational>
    extends java.lang.Object
    implements java.io.Serializable
    Rectangle. For example isolating rectangle for complex roots.
    Author:
    Heinz Kredel
    See Also:
    Serialized Form
    • Method Detail

      • toString

        public java.lang.String toString()
        String representation of Rectangle.
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • toScript

        public java.lang.String toScript()
        Get a scripting compatible string representation.
        Returns:
        script compatible representation for this Rectangle.
      • getNW

        public Complex<CgetNW()
        Get north west corner.
        Returns:
        north west corner of this rectangle.
      • getSW

        public Complex<CgetSW()
        Get south west corner.
        Returns:
        south west corner of this rectangle.
      • getSE

        public Complex<CgetSE()
        Get south east corner.
        Returns:
        south east corner of this rectangle.
      • getNE

        public Complex<CgetNE()
        Get north east corner.
        Returns:
        north east corner of this rectangle.
      • exchangeNW

        public Rectangle<CexchangeNW​(Complex<C> c)
        Exchange NW corner.
        Parameters:
        c - new NW corner.
        Returns:
        rectangle with north west corner c of this rectangle.
      • exchangeSW

        public Rectangle<CexchangeSW​(Complex<C> c)
        Exchange SW corner.
        Parameters:
        c - new SW corner.
        Returns:
        rectangle with south west corner c of this rectangle.
      • exchangeSE

        public Rectangle<CexchangeSE​(Complex<C> c)
        Exchange SE corner.
        Parameters:
        c - new SE corner.
        Returns:
        rectangle with south east corner c of this rectangle.
      • exchangeNE

        public Rectangle<CexchangeNE​(Complex<C> c)
        Exchange NE corner.
        Parameters:
        c - new NE corner.
        Returns:
        rectangle with north east corner c of this rectangle.
      • contains

        public boolean contains​(Complex<C> c)
        Contains a point.
        Parameters:
        c - point.
        Returns:
        true if c is contained in this rectangle, else false.
      • contains

        public boolean contains​(Rectangle<C> r)
        Contains a rectangle.
        Parameters:
        r - rectangle.
        Returns:
        true if r is contained in this rectangle, else false.
      • randomPoint

        public Complex<CrandomPoint()
        Random point of recatangle.
        Returns:
        a random point contained in this rectangle.
      • copy

        public Rectangle<Ccopy()
        Copy this.
        Returns:
        a copy of this.
      • equals

        public boolean equals​(java.lang.Object b)
        Comparison with any other object.
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Hash code for this Rectangle.
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • getCenter

        public Complex<CgetCenter()
        Complex center.
        Returns:
        r + i m of the center.
      • getRationalCenter

        public Complex<BigRationalgetRationalCenter()
        Complex of BigRational approximation of center.
        Returns:
        r + i m as rational approximation of the center.
      • getDecimalCenter

        public Complex<BigDecimalgetDecimalCenter()
        Complex of BigDecimal approximation of center.
        Returns:
        r + i m as decimal approximation of the center.
      • centerApprox

        public java.lang.String centerApprox()
        Approximation of center.
        Returns:
        r + i m as string of decimal approximation of the center.
      • length

        public C length()
        Length.
        Returns:
        |ne-sw|**2;
      • lengthReal

        public C lengthReal()
        Length real side.
        Returns:
        |re(ne)-re(sw)|;
      • lengthImag

        public C lengthImag()
        Length imaginary side.
        Returns:
        |im(ne)-im(sw)|;