Package com.iizix

Class DSize

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class DSize
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    A size with double's.
    Author:
    Christopher Mindus
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double height
      The height.
      double width
      The width.
    • Constructor Summary

      Constructors 
      Constructor Description
      DSize()
      Constructs a size initialized to 0,0.
      DSize​(double width, double height)
      Constructs and initializes position.
      DSize​(DSize s)
      Constructs and initializes position.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DSize clone()
      Clones this instance.
      static int compareWidthThenHeight​(DSize s1, DSize s2)
      Compares to sizes by first the width, then the height.
      boolean equals​(java.lang.Object o)
      Check for equality.
      int hashCode()
      Hash code.
      java.lang.String toString()
      Creates the string representation of this position as className[width=NN,height=NN].
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • width

        public double width
        The width.
      • height

        public double height
        The height.
    • Constructor Detail

      • DSize

        public DSize()
        Constructs a size initialized to 0,0.
      • DSize

        public DSize​(double width,
                     double height)
        Constructs and initializes position.
        Parameters:
        width - The width.
        height - The height.
      • DSize

        public DSize​(DSize s)
        Constructs and initializes position.
        Parameters:
        s - Another size.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Check for equality.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - Another size DSize, but Size and GSize are also supported.
        Returns:
        true if equal.
      • clone

        public DSize clone()
        Clones this instance.
        Overrides:
        clone in class java.lang.Object
        Returns:
        As cloned instance of DSize.
      • hashCode

        public int hashCode()
        Hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        Returns the hash code. If the width and height equals to Integers, this hashCode will be the same as for {@link Size}.
      • toString

        public java.lang.String toString()
        Creates the string representation of this position as className[width=NN,height=NN].
        Overrides:
        toString in class java.lang.Object
      • compareWidthThenHeight

        public static int compareWidthThenHeight​(DSize s1,
                                                 DSize s2)
        Compares to sizes by first the width, then the height.
        Parameters:
        s1 - Size 1 (null allowed).
        s2 - Size 2 (null allowed).
        Returns:
        1 if s2 is wider then higher than s1 (or s2 is null), -1 if smaller (or s1 is null), 0 if equal (or both null).