Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367752

Summary: PrecisionRectangle.shrinkPrecise() should be public not private
Product: [Tools] GEF Reporter: Justin Dolezy <justin>
Component: GEF-Legacy Draw2dAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: unspecified   
Target Milestone: 3.8.0 (Juno)   
Hardware: All   
OS: All   
Whiteboard:

Description Justin Dolezy CLA 2012-01-03 07:29:29 EST
Build Identifier: 20110615-0604

shrink(double h, double v) has been deprecated, with the JavaDoc suggesting to use shrinkPrecise instead:

	 * @deprecated Use {@link #shrink(int, int)} or
	 *             {@link #shrinkPrecise(double, double)} instead.

However shrinkPrecise() is private, even though it has itself been JavaDoc'd like a public method.

The result is deprecation warnings in my code that I can't get rid of!

Reproducible: Always

Steps to Reproduce:
1. Look at org.eclipse.draw2d.geometry.PrecisionRectangle
2. Examine shrink(double,double)
3. Examine shrinkPrecise(double,double)
Comment 1 Alexander Nyßen CLA 2012-01-03 07:42:15 EST
Yes, that's indeed inconsistent. I will take care of it in the 3.8.0 stream, after having completed bug #363394 (i.e. merged back the changes there).
Comment 2 Alexander Nyßen CLA 2012-02-02 17:09:37 EST
I made the following changes to increase consistency:

Point:
Added getScaled(double, double), getTranslated(double, double), translate(double, double).
Changed toString() implementation to access preciseX() instead of x and preciseY() instead of y.

Dimension:
Added expand(double, double), getExpanded(double, double), getShrinked(double, double), shrink(double, double)
Changed toString() implementation to access preciseWidth() instead of width and preciseHeight() instead of height

Rectangle:
Added contains(double, double), expand(double, double), getExpanded(double, double), getResized(double, double), getShrinked(double, double), getTranslated(double, double), resize(double, double). 

These methods all cast the doubles to integer and perform all computations in integer precision.

PrecisionPoint:
Overwrote translate(double, double) to calculate with double precision (getTranslated will automatically do so, as implementation within Point delegates to translate(double, double).

PrecisionDimension:
Overwrote expand(double, double) and shrink(double, double) to calculate with double precision (getShrinked and getExpanded will automatically to so, as implementation within Dimension delegates to them already).

PrecisionRectangle:
Overwrote contains(double, double), resize(double, double), translate(double, double), union(double, double, double, double), union(double, double) to calculate with double precision.
Overwrote union(int, int, int, int) to also calculate with double precision (this was left out when performing the last refactoring).
De-deprecated expand(double, double) and shrink(double, double).

Added test cases to PointTests, RectangleTests, PrecisionPointTests, PrecisionDimensionTests, and PrecisionRectangleTests. Added DimensionTests.

All changes committed to cvs HEAD (3.8M6). Resolving as fixed.