|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgizmoball.board.Gizmo
gizmoball.board.Ball
public class Ball
This class represents a ball gizmo that extends the abstract Gizmo class. A ball has a velocity that can be changed, and the ball can move around. A ball can be a "ghost ball" which then does not collide with other balls.
| Field Summary |
|---|
| Fields inherited from class gizmoball.board.Gizmo |
|---|
color, connections, name, reverseConnections |
| Constructor Summary | |
|---|---|
Ball(java.lang.String name,
java.awt.Color color,
double radius,
Vect initialLocation,
Vect velocity,
boolean inAbsorber,
boolean ghostBall)
constructs a Ball object. |
|
| Method Summary | |
|---|---|
void |
action()
a ball does not have an action. |
void |
changeCenter(Vect loc)
moves the center of the ball to a new location. |
double |
getMass()
returns the mass of the ball. |
Circle09 |
getShape()
returns the shape of the ball. |
Vect |
getVelocity()
returns the velocity of the ball. |
boolean |
isGhostBall()
checks if the ball is a ghost ball. |
boolean |
isInAbsorber()
returns if the ball is in an absorber or not. |
void |
setInAbsorber(boolean bool)
sets the state of whether the ball is in an absorber. |
void |
setVelocity(Vect v)
sets the velocity of the ball. |
| Methods inherited from class gizmoball.board.Gizmo |
|---|
getColor, getName, getTriggeredGizmos, getTriggeringGizmos, setColor, triggerConnections |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Ball(java.lang.String name,
java.awt.Color color,
double radius,
Vect initialLocation,
Vect velocity,
boolean inAbsorber,
boolean ghostBall)
name - the name of the ballcolor - the color of the ballradius - the radius of the ballinitialLocation - the initial location of the ballvelocity - the initial velocity of the ballinAbsorber - a boolean that specifies whether the ball is absorbed by an absorberghostBall - a boolean that specifies whether the ball is a ghost ball| Method Detail |
|---|
public Circle09 getShape()
getShape in class Gizmopublic double getMass()
public void setVelocity(Vect v)
v - the new velocity of the ballpublic boolean isGhostBall()
public Vect getVelocity()
public boolean isInAbsorber()
public void setInAbsorber(boolean bool)
bool - a boolean that states if the ball is in an absorberpublic void changeCenter(Vect loc)
loc - the new location of the center of the ballpublic void action()
action in class Gizmo
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||