com.maryanovsky.gwtutils.client.geom
Class Size

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.geom.Size
All Implemented Interfaces:
SizeView

public final class Size
extends Object
implements SizeView

Defines two dimensional bounds, with integer coordinates.

Author:
Maryanovsky Alexander

Constructor Summary
Size()
          Creates a new 0x0 Size.
Size(int width, int height)
          Creates a new Size with the specified width and height.
Size(SizeView size)
          Creates a new Size of the same size as the specified one.
 
Method Summary
 boolean equals(int width, int height)
          Returns whether this Size object is of the specified width and height.
 boolean equals(Object o)
          Returns whether this Size object has the same width and height as the specified one.
 boolean equals(SizeView size)
          Returns whether this Size object has the same width and height as the specified one.
 int getHeight()
          Returns the height.
 int getWidth()
          Returns the width.
 int hashCode()
          Returns the hashcode of this object.
 boolean isEmpty()
          Returns true if either the width or height are 0.
static Size make(int width, int height, Size reusable)
          Returns a Size with the specified size.
 Size multiplyBy(double coefficient)
          Multiplies the dimensions of the Size by the specified coefficient.
 Size set(int width, int height)
          Sets the size of this Size object.
 Size set(SizeView size)
          Sets the size of this Size object from the values of the specified one.
 Size setHeight(int height)
          Sets the height.
 Size setWidth(int width)
          Sets the width.
 String toString()
          Returns a textual representation of this size.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Size

public Size(int width,
            int height)
Creates a new Size with the specified width and height.


Size

public Size()
Creates a new 0x0 Size.


Size

public Size(SizeView size)
Creates a new Size of the same size as the specified one.

Method Detail

make

public static Size make(int width,
                        int height,
                        Size reusable)
Returns a Size with the specified size. If the given Size object is not null, it is reused and returned.


set

public Size set(int width,
                int height)
Sets the size of this Size object.

Returns:
this.

set

public Size set(SizeView size)
Sets the size of this Size object from the values of the specified one.

Returns:
this.

multiplyBy

public Size multiplyBy(double coefficient)
Multiplies the dimensions of the Size by the specified coefficient.

Returns:
this.

getWidth

public int getWidth()
Returns the width.

Specified by:
getWidth in interface SizeView

setWidth

public Size setWidth(int width)
Sets the width.

Returns:
this.

getHeight

public int getHeight()
Returns the height.

Specified by:
getHeight in interface SizeView

setHeight

public Size setHeight(int height)
Sets the height.

Returns:
this.

isEmpty

public boolean isEmpty()
Returns true if either the width or height are 0.

Specified by:
isEmpty in interface SizeView

equals

public boolean equals(int width,
                      int height)
Returns whether this Size object is of the specified width and height.


equals

public boolean equals(SizeView size)
Returns whether this Size object has the same width and height as the specified one.


equals

public boolean equals(Object o)
Returns whether this Size object has the same width and height as the specified one.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns the hashcode of this object.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a textual representation of this size.

Overrides:
toString in class Object