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)
TurtleShape
paintTurtle
in interface TurtleShape
t
- the turtle whose shape is paintg
- the graphics where the turtle's shape should be paintpublic int getViewCount()
TurtleShape
getViewCount
in interface TurtleShape
public int getFrameCount()
TurtleShape
getFrameCount
in interface TurtleShape
public boolean isPointOfShape(Turtle t, double x, double y)
TurtleShape
isPointOfShape
in interface TurtleShape
t
- the turtle whose shape is consideredx
- the x coordinate of pointy
- the y coordinate of pointpublic long getFrameDuration()
TurtleShape
getFrameDuration
in interface TurtleShape
public int getSize()
Copyright © 2017. All rights reserved.