|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPinBallDomain.Target
public class Target
The goal in the PinBallDomain.
Constructor Summary | |
---|---|
Target(Point P,
double rad)
Create a new target. |
Method Summary | |
---|---|
boolean |
collision(Ball b)
Determine whether a collision takes place with the ball. |
double[] |
collisionEffect(Ball b)
Compute collision effect with the ball. |
static Target |
create(java.lang.String line)
Create a new target given a line of config file text. |
Point |
getCenter()
Get the center of the target. |
Point |
getIntercept()
Get a point of intersection. |
double |
getRadius()
Get the target's radius. |
double |
getX()
Get the target's X coordinate. |
double |
getY()
Get the target's Y coordinate. |
boolean |
inside(Point p)
Determine whether a point is inside the target. |
static boolean |
matchTag(java.lang.String line)
Determine whether a line of the config file refers to the target. |
void |
write(java.io.FileWriter f)
Write the target object to a file. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Target(Point P, double rad)
P
- centerrad
- radiusMethod Detail |
---|
public double[] collisionEffect(Ball b)
collisionEffect
in interface Obstacle
b
- the ball
public Point getCenter()
public boolean collision(Ball b)
collision
in interface Obstacle
b
- the ball
true
if there has been a collision, false
otherwisepublic boolean inside(Point p)
inside
in interface Obstacle
p
- point to check
true
if p
lies within the target, false
otherwise.public static boolean matchTag(java.lang.String line)
line
- the line of config file text
true
if the line matches, false
if it doesn'tpublic static Target create(java.lang.String line)
line
- the config file line
public void write(java.io.FileWriter f) throws java.io.IOException
write
in interface Obstacle
f
- the file
java.io.IOException
public Point getIntercept()
getIntercept
in interface Obstacle
null
, alwayspublic double getX()
public double getY()
public double getRadius()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |