接口 Shape
public interface Shape
Shape interface representing a graphical shape element.
This is part of the Visitor pattern (accepts visitors) and
will be instantiated through Factory pattern.
-
方法概要
修饰符和类型方法说明void
accept
(ShapeVisitor visitor) Accept method for the Visitor patternclone()
Clone the shapeint
getX()
Get the x coordinate of the shapeint
getY()
Get the y coordinate of the shapevoid
setPosition
(int x, int y) Set the position of the shape
-
方法详细资料
-
getX
int getX()Get the x coordinate of the shape- 返回:
- x coordinate
-
getY
int getY()Get the y coordinate of the shape- 返回:
- y coordinate
-
setPosition
void setPosition(int x, int y) Set the position of the shape- 参数:
x
- the x coordinatey
- the y coordinate
-
accept
Accept method for the Visitor pattern- 参数:
visitor
- the visitor to accept
-
clone
Shape clone()Clone the shape- 返回:
- a clone of this shape
-