Skip to content
Snippets Groups Projects

Full Laboratornaya

Open aap167 requested to merge SecondGen into master
Files
21
+ 51
0
package Lab1.graphics.NonAbstract;
import Lab1.graphics.NonJavaCloneable;
import Lab1.graphics.Vector2;
public class Circle extends Ellipse implements NonJavaCloneable {
final float radius;
Circle(float x, float y, float radius) {
super(x, y, radius, radius, 0);
this.radius = radius;
}
Circle(Vector2 center, float radius) {
super(center, radius, radius, 0);
this.radius = radius;
}
Circle(Point center, float radius) {
super(center.getLocation(), radius, radius, 0);
this.radius = radius;
}
Circle(Circle og) {
this(og.center, og.radius);
}
public Circle moveTo(float x, float y) {
Point center = new Point(x, y);
return new Circle(center, radius);
}
public Circle moveBy(float x, float y) {
Vector2 center = getCenter();
Point newCenter = new Point(center.X() + x, center.Y() + y);
return new Circle(newCenter, radius);
}
@Override
public Circle clone(){
return new Circle(this);
}
@Override
public String toString() {
return "Circle" + "{" +
"center=" + center +
", Rad=" + radius +
'}';
}
}
Loading