Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367752 - PrecisionRectangle.shrinkPrecise() should be public not private
Summary: PrecisionRectangle.shrinkPrecise() should be public not private
Status: RESOLVED FIXED
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.8.0 (Juno)   Edit
Assignee: Alexander Nyßen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-03 07:29 EST by Justin Dolezy CLA
Modified: 2012-02-02 17:09 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.