public class DefaultTurtleShape extends Object implements TurtleShape
| Constructor and Description |
|---|
DefaultTurtleShape()
Constructs the basic turtle shape (triangle).
|
DefaultTurtleShape(int size)
Constructs the basic turtle shape (triangle) with defined length of the
side.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getFrameCount()
Returns immutable number of animation frames defined for each view of the
shape.
|
long |
getFrameDuration()
Returns immutable animation delay (time period between animation frames)
in milliseconds.
|
int |
getSize()
Returns the size of the shape.
|
int |
getViewCount()
Returns immutable number of views provided by the shape.
|
boolean |
isPointOfShape(Turtle t,
double x,
double y)
Returns whether a given point is internal point of current turtle's
shape.
|
void |
paintTurtle(Turtle t,
Graphics2D g)
Paints the turtle shape.
|
public DefaultTurtleShape()
public DefaultTurtleShape(int size)
size - the length of the triangle sidepublic void paintTurtle(Turtle t, Graphics2D g)
TurtleShapepaintTurtle in interface TurtleShapet - the turtle whose shape is paintg - the graphics where the turtle's shape should be paintpublic int getViewCount()
TurtleShapegetViewCount in interface TurtleShapepublic int getFrameCount()
TurtleShapegetFrameCount in interface TurtleShapepublic boolean isPointOfShape(Turtle t, double x, double y)
TurtleShapeisPointOfShape in interface TurtleShapet - the turtle whose shape is consideredx - the x coordinate of pointy - the y coordinate of pointpublic long getFrameDuration()
TurtleShapegetFrameDuration in interface TurtleShapepublic int getSize()
Copyright © 2017. All rights reserved.