| 32 | /// |
| 33 | /// @author Chen Fishbein |
| 34 | public class Rectangle implements Shape { |
| 35 | |
| 36 | private static final int MAX_POOL_SIZE = 20; |
| 37 | private static ArrayList<Rectangle> pool; |
| 38 | private final Dimension size; |
| 39 | private int x; |
| 40 | private int y; |
| 41 | private GeneralPath path; |
| 42 | |
| 43 | /// Creates a new instance of Rectangle |
| 44 | public Rectangle() { |
| 45 | size = new Dimension(); |
| 46 | } |
| 47 | |
| 48 | /// Creates a new instance of Rectangle at position (x, y) and with |
| 49 | /// predefine dimension |
| 50 | /// |
| 51 | /// #### Parameters |
| 52 | /// |
| 53 | /// - `x`: the x coordinate of the rectangle |
| 54 | /// |
| 55 | /// - `y`: the y coordinate of the rectangle |
| 56 | /// |
| 57 | /// - `size`: the `Dimension` of the rectangle |
| 58 | public Rectangle(int x, int y, Dimension size) { |
| 59 | this.x = x; |
| 60 | this.y = y; |
| 61 | this.size = size; |
| 62 | } |
| 63 | |
| 64 | /// Creates a new instance of Rectangle at position (x, y) and with |
| 65 | /// predefine width and height |
| 66 | /// |
| 67 | /// #### Parameters |
| 68 | /// |
| 69 | /// - `x`: the x coordinate of the rectangle |
| 70 | /// |
| 71 | /// - `y`: the y coordinate of the rectangle |
| 72 | /// |
| 73 | /// - `w`: the width of the rectangle |
| 74 | /// |
| 75 | /// - `h`: the height of the rectangle |
| 76 | public Rectangle(int x, int y, int w, int h) { |
| 77 | this.x = x; |
| 78 | this.y = y; |
| 79 | this.size = new Dimension(w, h); |
| 80 | } |
| 81 | |
| 82 | /// A copy Constructor |
| 83 | /// |
| 84 | /// #### Parameters |
| 85 | /// |
| 86 | /// - `rect`: the Rectangle to copy |
| 87 | public Rectangle(Rectangle rect) { |
| 88 | this(rect.getX(), rect.getY(), |
| 89 | rect.getSize().getWidth(), rect.getSize().getHeight()); |
| 90 | } |
| 91 |
nothing calls this directly
no outgoing calls
no test coverage detected