Size

Inheritance: java.lang.Object

public class Size

Represents a size.

Constructors

Constructor Description
Size(double width, double height) Initializes a new instance of the Size class.

Methods

Method Description
getWidth() Gets the width.
getHeight() Gets the height.
isEmpty() Gets a value that indicates whether the size is empty.
parse(String s) Converts the string representation of a size to its class equivalent.
toString()

Size(double width, double height)

public Size(double width, double height)

Initializes a new instance of the Size class.

Parameters:

Parameter Type Description
width double The width in pixels.
height double The height in pixels.

getWidth()

public double getWidth()

Gets the width.

Returns: double - A double value that represents the width in pixels.

getHeight()

public double getHeight()

Gets the height.

Returns: double - A double value that represents the height in pixels.

isEmpty()

public boolean isEmpty()

Gets a value that indicates whether the size is empty.

Returns: boolean - true if the width and height are zero; otherwise, false .

parse(String s)

public static Size parse(String s)

Converts the string representation of a size to its class equivalent. A return value indicates whether the conversion is succeeded or failed.

Parameters:

Parameter Type Description
s java.lang.String A string containing a size to convert.

Returns: Size - The instance of Size class that is equivalent to the value specified in s parameter.

toString()

public String toString()

Returns: java.lang.String