Class AbsoluteSize

  • All Implemented Interfaces:
    Size

    public class AbsoluteSize
    extends java.lang.Object
    implements Size
    A Size object which indicates that the size of the enclosed object should be the specified absolute size.
    Since:
    0.3.4
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.Dimension size
      The size of the object.
    • Constructor Summary

      Constructors 
      Constructor Description
      AbsoluteSize​(int width, int height)
      Instantiates an object which indicates size of an object.
      AbsoluteSize​(java.awt.Dimension size)
      Instantiates an object which indicates size of an object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Dimension calculate​(int width, int height)
      Calculates the size of the object.
      java.lang.String toString()
      Returns a String representation of this object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • size

        private final java.awt.Dimension size
        The size of the object.
    • Constructor Detail

      • AbsoluteSize

        public AbsoluteSize​(java.awt.Dimension size)
        Instantiates an object which indicates size of an object.
        Parameters:
        size - Size of the enclosed object.
        Throws:
        java.lang.NullPointerException - If the size is null.
      • AbsoluteSize

        public AbsoluteSize​(int width,
                            int height)
        Instantiates an object which indicates size of an object.
        Parameters:
        width - Width of the enclosed object.
        height - Height of the enclosed object.
        Throws:
        java.lang.IllegalArgumentException - If the width and/or height is less than or equal to 0.
    • Method Detail

      • calculate

        public java.awt.Dimension calculate​(int width,
                                            int height)
        Description copied from interface: Size
        Calculates the size of the object.
        Specified by:
        calculate in interface Size
        Parameters:
        width - Width of the object which encloses the object for which the size should be determined.
        height - Height of the object which encloses the object for which the size should be determined.
        Returns:
        Calculated size of the object.
      • toString

        public java.lang.String toString()
        Returns a String representation of this object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation of this object.