edu.rit.slides.items
Class Size

java.lang.Object
  extended by edu.rit.slides.items.Size
All Implemented Interfaces:
Externalizable, Serializable

public class Size
extends Object
implements Externalizable

Class Size provides a size (width,height) for a SlideItem.

See Also:
Serialized Form

Constructor Summary
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
 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(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(ObjectInput in)
          Read this size from the given object input stream.
 String toString()
          Returns a string version of this size.
 double width()
          Returns this size's width.
 void writeExternal(ObjectOutput out)
          Write this size to the given object output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, 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.


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(ObjectOutput out)
                   throws IOException
Write this size to the given object output stream.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - Object output stream.
Throws:
IOException - Thrown if an I/O error occurred.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException
Read this size from the given object input stream.

Specified by:
readExternal in interface Externalizable
Parameters:
in - Object input stream.
Throws:
IOException - Thrown if an I/O error occurred.

equals

public boolean equals(Object obj)
Determine if this size is equal to the given object.

Overrides:
equals in class 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 Object

toString

public String toString()
Returns a string version of this size.

Overrides:
toString in class Object


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.