Documentation of 'edu.rit.draw.item.Size' Java class
Size
edu.rit.draw.item

Class Size

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable


    public class Size
    extends java.lang.Object
    implements java.io.Externalizable
    Class Size provides a size (width,height) for a DrawingItem.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      Size()
      Construct a new size with width = height = 0.
      Size(double width, double height)
      Construct a new size with the given width and height.
      Size(Size theSize)
      Construct a new size with the same width and height as the given size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Size add(double incr)
      Returns a new size equal to this size increased by the given amount in both width and height.
      Size add(double wincr, double hincr)
      Returns a new size equal to this size increased by the given amounts in width and height.
      Size ceil()
      Returns a new size with its width and height set to the ceiling of this size's width and height, respectively.
      Size div(double scale)
      Returns a new size equal to this size divided by the given scale factor.
      Size div(double wscale, double hscale)
      Returns a new size equal to this size divided by the given scale factors.
      boolean equals(java.lang.Object obj)
      Determine if this size is equal to the given object.
      int hashCode()
      Returns a hash code for this size.
      double height()
      Returns this size's height.
      Size mul(double scale)
      Returns a new size equal to this size multiplied by the given scale factor.
      Size mul(double wscale, double hscale)
      Returns a new size equal to this size multiplied by the given scale factors.
      void readExternal(java.io.ObjectInput in)
      Read this size from the given object input stream.
      Size sub(double decr)
      Returns a new size equal to this size decreased by the given amount in both width and height.
      Size sub(double wdecr, double hdecr)
      Returns a new size equal to this size decreased by the given amounts in width and height.
      java.lang.String toString()
      Returns a string version of this size.
      double width()
      Returns this size's width.
      void writeExternal(java.io.ObjectOutput out)
      Write this size to the given object output stream.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Size

        public Size()
        Construct a new size with width = height = 0.
      • Size

        public Size(double width,
                    double height)
        Construct a new size with the given width and height.
        Parameters:
        width - Width.
        height - Height.
      • Size

        public Size(Size theSize)
        Construct a new size with the same width and height as the given size.
        Parameters:
        theSize - Size to copy.
    • Method Detail

      • width

        public double width()
        Returns this size's width.
      • height

        public double height()
        Returns this size's height.
      • ceil

        public Size ceil()
        Returns a new size with its width and height set to the ceiling of this size's width and height, respectively.
      • add

        public Size add(double incr)
        Returns a new size equal to this size increased by the given amount in both width and height.
        Parameters:
        incr - Increment.
      • add

        public Size add(double wincr,
                        double hincr)
        Returns a new size equal to this size increased by the given amounts in width and height.
        Parameters:
        wincr - Width increment.
        hincr - Height increment.
      • sub

        public Size sub(double decr)
        Returns a new size equal to this size decreased by the given amount in both width and height.
        Parameters:
        decr - Decrement.
      • sub

        public Size sub(double wdecr,
                        double hdecr)
        Returns a new size equal to this size decreased by the given amounts in width and height.
        Parameters:
        wdecr - Width decrement.
        hdecr - Height decrement.
      • mul

        public Size mul(double scale)
        Returns a new size equal to this size multiplied by the given scale factor.
        Parameters:
        scale - Scale factor.
      • mul

        public Size mul(double wscale,
                        double hscale)
        Returns a new size equal to this size multiplied by the given scale factors.
        Parameters:
        wscale - Width scale factor.
        hscale - Height scale factor.
      • div

        public Size div(double scale)
        Returns a new size equal to this size divided by the given scale factor.
        Parameters:
        scale - Scale factor.
      • div

        public Size div(double wscale,
                        double hscale)
        Returns a new size equal to this size divided by the given scale factors.
        Parameters:
        wscale - Width scale factor.
        hscale - Height scale factor.
      • writeExternal

        public void writeExternal(java.io.ObjectOutput out)
                           throws java.io.IOException
        Write this size to the given object output stream.
        Specified by:
        writeExternal in interface java.io.Externalizable
        Parameters:
        out - Object output stream.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • readExternal

        public void readExternal(java.io.ObjectInput in)
                          throws java.io.IOException
        Read this size from the given object input stream.
        Specified by:
        readExternal in interface java.io.Externalizable
        Parameters:
        in - Object input stream.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • equals

        public boolean equals(java.lang.Object obj)
        Determine if this size is equal to the given object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - Object to test.
        Returns:
        True if this size is equal to obj, false otherwise.
      • hashCode

        public int hashCode()
        Returns a hash code for this size.
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Returns a string version of this size.
        Overrides:
        toString in class java.lang.Object

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.