Dimension

Kind of class:public class
Package:com.bourre.structures
Inherits from:none
Author:Cédric Néhémie
Classpath:com.bourre.structures.Dimension
File last modified:Friday, 15 February 2008, 21:35:40
The Dimension class encapsulates the width and height
of an object (in double precision) in a single object.

Normally the values of width and height are non-negative
integers. The constructors that allow you to create
a dimension do not prevent you from setting a negative
value for these properties. If the value of width or height
is negative, the behavior of some methods defined by other
objects is undefined.

Summary


Constructor
  • Dimension (width:Number = 0, height:Number = 0)
    • Constructs a Dimension and initializes it
Instance properties
  • width : Number
    • The width dimension, negative values can be used.
  • height : Number
    • The height dimension, negative values can be used.
Instance methods
  • equals (dimension:Dimension) : Boolean
    • Checks whether two dimension objects have equal values.
  • setSize (dimension:Dimension) : void
    • Sets the size of this Dimension object to the specified size.
  • setSizeWH (width:Number, height:Number) : void
    • Sets the size of this Dimension object to the specified width and height.
  • clone : Dimension
    • Returns a copy of this Dimension object.
  • scale (n:Number) : Dimension
  • toPoint : Point
    • Returns a Point object with its x and y sets
  • toString : String
    • Returns the String representation of this object/

Constructor

Dimension

public function Dimension (
width:Number = 0, height:Number = 0)

Constructs a Dimension and initializes it
to the specified width and specified height.
Parameters:
width :
specified width
height:
specified height

Instance properties

height

public height:Number
(read)

The height dimension, negative values can be used.

width

public width:Number
(read)

The width dimension, negative values can be used.

Instance methods

clone

public function clone (

Returns a copy of this Dimension object.
Returns:
  • a copy of this Dimension object

equals

public function equals (
dimension:Dimension) : Boolean

Checks whether two dimension objects have equal values.
Parameters:
dimension:
the reference object with which to compare.
Returns:
  • true if this object is the same as the obj
    argument, false otherwise.

scale

public function scale (
n:Number) : Dimension

setSize

public function setSize (
dimension:Dimension) : void

Sets the size of this Dimension object to the specified size.
Parameters:
dimension:
the new size for this Dimension object

setSizeWH

public function setSizeWH (
width:Number, height:Number) : void

Sets the size of this Dimension object to the specified width and height.
Parameters:
width :
the new width for this Dimension object
height:
the new height for this Dimension object

toPoint

public function toPoint (
) : Point

Returns a Point object with its x and y sets
respectively on width and height of this
Dimension.
Returns:
  • a Point object which contains values
    of this Dimension

toString

public function toString (
) : String

Returns the String representation of this object/
Returns:
  • the String representation of this object