Class GSize

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

    public class GSize
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    Simple immutable size class for multiple use accepting negative width and height.
    Author:
    Christopher Mindus
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static GSize[] EMPTY_ARRAY
      Empty array of Rect's.
      static GSize ZERO
      Zero size.
    • Constructor Summary

      Constructors 
      Constructor Description
      GSize()
      Constructor for cx=cy=0.
      GSize​(int cx, int cy)
      Constructor.
      GSize​(ReadTransaction trans)
      Constructor from a Transaction.
      GSize​(java.lang.String string)
      Constructor from a String formatted as "cx,cy".
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(SendTransaction trans)
      Appends the size to a transaction.
      GSize clone()
      Clones this instance.
      boolean equals​(java.lang.Object o)
      Checks if two sizes are equal.
      int getCX()
      Gets the width.
      int getCY()
      Gets the height.
      int getHeight()
      Gets the height.
      int getWidth()
      Gets the width.
      int hashCode()
      Hash code.
      java.lang.String toString()
      Formats to a string as "cx,cy".
      • Methods inherited from class java.lang.Object

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

      • EMPTY_ARRAY

        public static final GSize[] EMPTY_ARRAY
        Empty array of Rect's.
      • ZERO

        public static final GSize ZERO
        Zero size.
    • Constructor Detail

      • GSize

        public GSize()
        Constructor for cx=cy=0.
      • GSize

        public GSize​(java.lang.String string)
        Constructor from a String formatted as "cx,cy".
        Parameters:
        string - The string.
        Throws:
        java.lang.IllegalArgumentException - If the string is not well formatted.
      • GSize

        public GSize​(ReadTransaction trans)
        Constructor from a Transaction.
        Parameters:
        trans - The transaction.
      • GSize

        public GSize​(int cx,
                     int cy)
        Constructor.
        Parameters:
        cx - Width.
        cy - Height.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Checks if two sizes are equal. Supports comparison with Size.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - The compare-to object (instance of GSize or Size).
        Returns:
        true if equal, false otherwise.
      • clone

        public GSize clone()
        Clones this instance.
        Overrides:
        clone in class java.lang.Object
        Returns:
        As GSize is immutable, cloning will return "this".
      • hashCode

        public int hashCode()
        Hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        Returns the hash code.
      • toString

        public java.lang.String toString()
        Formats to a string as "cx,cy".
        Overrides:
        toString in class java.lang.Object
      • append

        public void append​(SendTransaction trans)
        Appends the size to a transaction.
        Parameters:
        trans - Transaction to append to.
      • getCX

        public int getCX()
        Gets the width.
        Returns:
        The width.
      • getCY

        public int getCY()
        Gets the height.
        Returns:
        The height.
      • getWidth

        public int getWidth()
        Gets the width.
        Returns:
        The width.
      • getHeight

        public int getHeight()
        Gets the height.
        Returns:
        The height.