Draw2d
3.9.100.201405261516

org.eclipse.draw2d.geometry
Class PrecisionDimension

java.lang.Object
  extended by org.eclipse.draw2d.geometry.Dimension
      extended by org.eclipse.draw2d.geometry.PrecisionDimension
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Translatable

public class PrecisionDimension
extends Dimension

See Also:
Serialized Form

Field Summary
 double preciseHeight
          Deprecated. Use setPreciseHeight(double) and preciseHeight() instead. This field will become private in the future.
 double preciseWidth
          Deprecated. Use setPreciseWidth(double) and preciseWidth() instead. This field will become private in the future.
 
Fields inherited from class org.eclipse.draw2d.geometry.Dimension
height, SINGLETON, width
 
Constructor Summary
PrecisionDimension()
          Constructs a new precision dimension.
PrecisionDimension(Dimension d)
          Constructs a precision representation of the given dimension.
PrecisionDimension(double w, double h)
          Constructs a new precision dimension with the given values.
 
Method Summary
 boolean contains(Dimension d)
          Returns true if the input Dimension fits into this Dimension.
 boolean containsProper(Dimension d)
          Returns true if this Dimension properly contains the one specified.
 boolean equals(java.lang.Object o)
          Returns whether the input Object is equivalent to this Dimension.
 Dimension expand(Dimension d)
          Expands the size of this Dimension by the specified amount.
 Dimension expand(double w, double h)
          Expands the size of this Dimension by the specified width and height.
 Dimension expand(int w, int h)
          Expands the size of this Dimension by the specified width and height.
 Dimension getCopy()
          Creates and returns a copy of this Dimension.
 PrecisionDimension getPreciseCopy()
          Returns a precise copy of this.
 Dimension intersect(Dimension d)
          This Dimension is intersected with the one specified.
 void performScale(double factor)
          Scales this object by the scale factor.
 double preciseHeight()
          Returns double height
 double preciseWidth()
          Returns double width
 Dimension scale(double widthFactor, double heightFactor)
          Scales the width of this Dimension by w and scales the height of this Dimension by h.
 Dimension setHeight(int h)
          Sets the height of this Rectangle to the specified one.
 PrecisionDimension setPreciseHeight(double h)
          Sets the height.
 PrecisionDimension setPreciseSize(double w, double h)
          Sets the size of this PrecisionDimension to the given width and height.
 PrecisionDimension setPreciseSize(PrecisionDimension d)
          Sets the size of this Dimension to the width and height of the given one.
 PrecisionDimension setPreciseWidth(double w)
          Sets the width.
 void setSize(Dimension d)
          Copies the width and height values of the input Dimension to this Dimension.
 Dimension setSize(int w, int h)
          Sets the size of this dimension to the specified width and height.
 Dimension setWidth(int width)
          Sets the width of this Rectangle to the specified one.
 Dimension shrink(Dimension d)
          Shrinks the size of this Dimension by the width and height values of the given Dimension.
 Dimension shrink(double w, double h)
          Reduces the width of this Dimension by w, and reduces the height of this Dimension by h.
 Dimension shrink(int w, int h)
          Reduces the width of this Dimension by w, and reduces the height of this Dimension by h.
 Dimension transpose()
          Swaps the width and height of this Dimension, and returns this for convenience.
 Dimension union(Dimension d)
          Sets the width of this Dimension to the greater of this Dimension's width and d.width.
 void updateInts()
          Deprecated. This method should not be accessed by clients any more (it will be made private in future releases). The update of integer and precision fields is performed automatically if preciseWidth and preciseHeight field values are not manipulated directly, but only via respective methods offered by this class.
 
Methods inherited from class org.eclipse.draw2d.geometry.Dimension
equals, expand, getArea, getDifference, getExpanded, getExpanded, getExpanded, getIntersected, getNegated, getScaled, getShrinked, getShrinked, getShrinked, getTransposed, getUnioned, hashCode, height, isEmpty, max, min, negate, performTranslate, scale, toString, width
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

preciseHeight

public double preciseHeight
Deprecated. Use setPreciseHeight(double) and preciseHeight() instead. This field will become private in the future.
The height in double precision.


preciseWidth

public double preciseWidth
Deprecated. Use setPreciseWidth(double) and preciseWidth() instead. This field will become private in the future.
The width in double precision.

Constructor Detail

PrecisionDimension

public PrecisionDimension()
Constructs a new precision dimension.


PrecisionDimension

public PrecisionDimension(Dimension d)
Constructs a precision representation of the given dimension.

Parameters:
d - the reference dimension

PrecisionDimension

public PrecisionDimension(double w,
                          double h)
Constructs a new precision dimension with the given values.

Parameters:
w - the width
h - the height
Method Detail

contains

public boolean contains(Dimension d)
Description copied from class: Dimension
Returns true if the input Dimension fits into this Dimension. A Dimension of the same size is considered to "fit".

Overrides:
contains in class Dimension
Parameters:
d - the dimension being tested
Returns:
true if this Dimension contains d
See Also:
Dimension.contains(org.eclipse.draw2d.geometry.Dimension)

containsProper

public boolean containsProper(Dimension d)
Description copied from class: Dimension
Returns true if this Dimension properly contains the one specified. Proper containment is defined as containment using \"<\", instead of \"<=\".

Overrides:
containsProper in class Dimension
Parameters:
d - the dimension being tested
Returns:
true if this Dimension properly contains the one specified
See Also:
Dimension.containsProper(org.eclipse.draw2d.geometry.Dimension)

equals

public boolean equals(java.lang.Object o)
Description copied from class: Dimension
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.

Overrides:
equals in class Dimension
Parameters:
o - the Object being tested for equality
Returns:
true if the given object is equal to this dimension
See Also:
Dimension.equals(java.lang.Object)

expand

public Dimension expand(Dimension d)
Description copied from class: Dimension
Expands the size of this Dimension by the specified amount.

Overrides:
expand in class Dimension
Parameters:
d - the Dimension providing the expansion width and height
Returns:
this for convenience
See Also:
Dimension.expand(org.eclipse.draw2d.geometry.Dimension)

expand

public Dimension expand(double w,
                        double h)
Description copied from class: Dimension
Expands the size of this Dimension by the specified width and height.

Overrides:
expand in class Dimension
Parameters:
w - Value by which the width should be increased
h - Value by which the height should be increased
Returns:
this for convenience
See Also:
Dimension.expand(double, double)

expand

public Dimension expand(int w,
                        int h)
Description copied from class: Dimension
Expands the size of this Dimension by the specified width and height.

Overrides:
expand in class Dimension
Parameters:
w - Value by which the width should be increased
h - Value by which the height should be increased
Returns:
this for convenience
See Also:
Dimension.expand(int, int)

getCopy

public Dimension getCopy()
Description copied from class: Dimension
Creates and returns a copy of this Dimension.

Overrides:
getCopy in class Dimension
Returns:
a copy of this Dimension
See Also:
Dimension.getCopy()

getPreciseCopy

public PrecisionDimension getPreciseCopy()
Returns a precise copy of this.

Returns:
a precise copy
Since:
3.7

intersect

public Dimension intersect(Dimension d)
Description copied from class: Dimension
This Dimension is intersected with the one specified. Intersection is performed by taking the min() of the values from each dimension.

Overrides:
intersect in class Dimension
Parameters:
d - the Dimension used to perform the min()
Returns:
this for convenience
See Also:
Dimension.intersect(org.eclipse.draw2d.geometry.Dimension)

performScale

public void performScale(double factor)
Description copied from interface: Translatable
Scales this object by the scale factor.

Specified by:
performScale in interface Translatable
Overrides:
performScale in class Dimension
Parameters:
factor - The scale factor
See Also:
Dimension.performScale(double)

preciseHeight

public double preciseHeight()
Description copied from class: Dimension
Returns double height

Overrides:
preciseHeight in class Dimension
Returns:
double height
See Also:
Dimension.preciseHeight()

preciseWidth

public double preciseWidth()
Description copied from class: Dimension
Returns double width

Overrides:
preciseWidth in class Dimension
Returns:
double width
See Also:
Dimension.preciseWidth()

scale

public Dimension scale(double widthFactor,
                       double heightFactor)
Description copied from class: Dimension
Scales the width of this Dimension by w and scales the height of this Dimension by h. Returns this for convenience.

Overrides:
scale in class Dimension
Parameters:
widthFactor - the value by which the width is to be scaled
heightFactor - the value by which the height is to be scaled
Returns:
this for convenience
See Also:
Dimension.scale(double, double)

setHeight

public Dimension setHeight(int h)
Description copied from class: Dimension
Sets the height of this Rectangle to the specified one.

Overrides:
setHeight in class Dimension
Parameters:
h - The new height
Returns:
this for convenience
See Also:
Dimension.setHeight(int)

setPreciseHeight

public PrecisionDimension setPreciseHeight(double h)
Sets the height.

Parameters:
h - the new height
Returns:
this for convenience
Since:
3.7

setPreciseSize

public PrecisionDimension setPreciseSize(double w,
                                         double h)
Sets the size of this PrecisionDimension to the given width and height.

Parameters:
w - The new width
h - The new height
Returns:
this for convenience
Since:
3.7

setPreciseSize

public PrecisionDimension setPreciseSize(PrecisionDimension d)
Sets the size of this Dimension to the width and height of the given one.

Parameters:
d - The PrecisionDimension specifying the new width and height values.
Returns:
This for convenience
Since:
3.7

setPreciseWidth

public PrecisionDimension setPreciseWidth(double w)
Sets the width.

Parameters:
w - the new width
Returns:
this for convenience
Since:
3.7

setSize

public void setSize(Dimension d)
Description copied from class: Dimension
Copies the width and height values of the input Dimension to this Dimension.

Overrides:
setSize in class Dimension
Parameters:
d - the dimension supplying the values
See Also:
Dimension.setSize(org.eclipse.draw2d.geometry.Dimension)

setSize

public Dimension setSize(int w,
                         int h)
Description copied from class: Dimension
Sets the size of this dimension to the specified width and height.

Overrides:
setSize in class Dimension
Parameters:
w - The new width
h - The new height
See Also:
Dimension.setSize(int, int)

setWidth

public Dimension setWidth(int width)
Description copied from class: Dimension
Sets the width of this Rectangle to the specified one.

Overrides:
setWidth in class Dimension
Parameters:
width - The new width
Returns:
this for convenience
See Also:
Dimension.setWidth(int)

shrink

public Dimension shrink(Dimension d)
Description copied from class: Dimension
Shrinks the size of this Dimension by the width and height values of the given Dimension.

Overrides:
shrink in class Dimension
Parameters:
d - The dimension whose width and height values are to be used
Returns:
this for convenience
See Also:
Dimension.shrink(org.eclipse.draw2d.geometry.Dimension)

shrink

public Dimension shrink(int w,
                        int h)
Description copied from class: Dimension
Reduces the width of this Dimension by w, and reduces the height of this Dimension by h. Returns this for convenience.

Overrides:
shrink in class Dimension
Parameters:
w - the value by which the width is to be reduced
h - the value by which the height is to be reduced
Returns:
this for convenience
See Also:
Dimension.shrink(int, int)

shrink

public Dimension shrink(double w,
                        double h)
Description copied from class: Dimension
Reduces the width of this Dimension by w, and reduces the height of this Dimension by h. Returns this for convenience.

Overrides:
shrink in class Dimension
Parameters:
w - the value by which the width is to be reduced
h - the value by which the height is to be reduced
Returns:
this for convenience
See Also:
Dimension.shrink(double, double)

transpose

public Dimension transpose()
Description copied from class: Dimension
Swaps the width and height of this Dimension, and returns this for convenience. Can be useful in orientation changes.

Overrides:
transpose in class Dimension
Returns:
this for convenience
See Also:
Dimension.transpose()

union

public Dimension union(Dimension d)
Description copied from class: Dimension
Sets the width of this Dimension to the greater of this Dimension's width and d.width. Likewise for this Dimension's height.

Overrides:
union in class Dimension
Parameters:
d - the Dimension to union with this Dimension
Returns:
this for convenience
See Also:
Dimension.union(org.eclipse.draw2d.geometry.Dimension)

updateInts

public final void updateInts()
Deprecated. This method should not be accessed by clients any more (it will be made private in future releases). The update of integer and precision fields is performed automatically if preciseWidth and preciseHeight field values are not manipulated directly, but only via respective methods offered by this class.

Updates the integer fields using the precise versions.


Draw2d
3.9.100.201405261516

Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.