Packagesekati.geom
Classpublic class Dimension

Store width and height integer Dimensions and provides various methods of manipulations.



Public Properties
 PropertyDefined by
  height : int
Dimension
  width : int
Dimension
Public Methods
 MethodDefined by
  
Dimension(w:int = 0, h:int = 0)
Dimension Constructor
Dimension
  
Creates and returns a copy of this Dimension.
Dimension
  
contains(d:Dimension):Boolean
Returns true if the passed Dimension fits within the bounds of this Dimension.
Dimension
  
Returns true if this Dimension properly contains the one specified.
Dimension
  
equals(d:Dimension):Boolean
Returns whether the input Object is equivalent to this Dimension.
Dimension
  
expand(w:Number = 0, h:Number = 0):Dimension
Expands the size of this Dimension by the specified width and height.
Dimension
  
getArea():Number
Returns the area of this Dimension.
Dimension
  
This Dimension is intersected with the one specified.
Dimension
  
isEmpty():Boolean
Returns true if the Dimension has width or height greater than 0.
Dimension
  
scale(w:Number = 0, h:Number = 0):Dimension
Scales the width of this Dimension by w and scales the height of this Dimension by h.
Dimension
  
shrink(w:Number = 0, h:Number = 0):Dimension
Reduces the width of this Dimension by w, and reduces the height of this Dimension by h.
Dimension
  
toString():String
Dimension
  
Sets the width of this Dimension to the greater of this Dimension's width and d.width.
Dimension
Property detail
heightproperty
public var height:int
widthproperty 
public var width:int
Constructor detail
Dimension()constructor
public function Dimension(w:int = 0, h:int = 0)

Dimension Constructor

Parameters
w:int (default = 0) — the width
 
h:int (default = 0) — the height
Method detail
clone()method
public function clone():Dimension

Creates and returns a copy of this Dimension.

Returns
Dimension — a copy of this Dimension
contains()method 
public function contains(d:Dimension):Boolean

Returns true if the passed Dimension fits within the bounds of this Dimension. A Dimension of the same size is considered to "fit".

Parameters
d:Dimension — the dimension being tested

Returns
Boolean — Boolean
containsProper()method 
public function containsProper(d:Dimension):Boolean

Returns true if this Dimension properly contains the one specified. Proper containment is defined as containment using "<", instead of "<=".

Parameters
d:Dimension — the dimension being tested

Returns
Booleantrue if this Dimension properly contains the one specified
equals()method 
public function equals(d:Dimension):Boolean

Returns whether the input Object is equivalent to this Dimension. true if the Object is a Dimension and its width and height are equal to this Dimension's width and height, false otherwise.

Parameters
d:Dimension — the Object being tested for equality

Returns
Booleantrue if the given object is equal to this dimension
expand()method 
public function expand(w:Number = 0, h:Number = 0):Dimension

Expands the size of this Dimension by the specified width and height.

Parameters
w:Number (default = 0) — Value by which the width should be increased
 
h:Number (default = 0) — Value by which the height should be increased

Returns
Dimensionthis for convenience
getArea()method 
public function getArea():Number

Returns the area of this Dimension.

Returns
Number — the area
intersect()method 
public function intersect(d:Dimension):Dimension

This Dimension is intersected with the one specified. intersection is performed by taking the min() of the values from each dimension.

Parameters
d:Dimension — the Dimension used to perform the min()

Returns
Dimensionthis for convenience
isEmpty()method 
public function isEmpty():Boolean

Returns true if the Dimension has width or height greater than 0.

Returns
Booleantrue if this Dimension is empty
scale()method 
public function scale(w:Number = 0, h:Number = 0):Dimension

Scales the width of this Dimension by w and scales the height of this Dimension by h. Returns this for convenience.

Parameters
w:Number (default = 0) — the value by which the width is to be scaled
 
h:Number (default = 0) — the value by which the height is to be scaled

Returns
Dimensionthis for convenience
shrink()method 
public function shrink(w:Number = 0, h:Number = 0):Dimension

Reduces the width of this Dimension by w, and reduces the height of this Dimension by h. Returns this for convenience.

Parameters
w:Number (default = 0) — the value by which the width is to be reduced
 
h:Number (default = 0) — the value by which the height is to be reduced

Returns
Dimensionthis for convenience
toString()method 
public function toString():String

Returns
String
union()method 
public function union(d:Dimension):Dimension

Sets the width of this Dimension to the greater of this Dimension's width and d.width. Likewise for this Dimension's height.

Parameters
d:Dimension — the Dimension to union with this Dimension

Returns
Dimensionthis for convenience