Skip to content
Snippets Groups Projects
Commit 54904bc7 authored by AREZKI Celia's avatar AREZKI Celia
Browse files

ADD of The abstract class AbstractShape implements the Shape interface and...

ADD of The abstract class AbstractShape implements the Shape interface and provides common functionality for managing points
parent c195287b
Branches
No related tags found
No related merge requests found
package shape;
import javafx.geometry.Point2D;
import javafx.scene.canvas.GraphicsContext;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractShape implements Shape {
protected List<Point2D> points = new ArrayList<>();
public void addPoints(Point2D... points) {
for (Point2D point : points) {
this.points.add(point);
}
}
@Override
public int pointsCount() {
return points.size();
}
@Override
public Point2D point(int index) {
return points.get(index);
}
@Override
public abstract void draw(GraphicsContext graphicsContext);
}
......@@ -3,8 +3,10 @@ package shape;
import javafx.geometry.Point2D;
import javafx.scene.canvas.GraphicsContext;
public interface Shape {
int pointsCount();
Point2D point(int index);
void draw(GraphicsContext context);
void draw(GraphicsContext graphicsContext);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment