|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.OneSideWallStrategy
public class OneSideWallStrategy
Creates a wall of finite length where balls bounce of only one side. Use multiple one sided walls to create barriers of arbitrary shapes with interior and exterior bouncing surfaces.
Field Summary | |
---|---|
private IBallCmd |
bounceCmd
|
private Ball |
host
|
private IPaintStrategy |
paintStrategy
|
private Point2DDouble |
ptA
One end of the wall |
private Point2DDouble |
vecS
Vector to the other end of the wall. |
private Color |
wallColor
|
Fields inherited from interface ballwar.model.IUpdateStrategy |
---|
NullObject |
Constructor Summary | |
---|---|
OneSideWallStrategy()
|
|
OneSideWallStrategy(Point2DDouble ptA,
Point2DDouble vecS,
Color wallColor)
|
Method Summary | |
---|---|
private double |
crossProd(Point2DDouble vec1,
Point2DDouble vec2)
scalar value of the cross product of vec1 cross vec2. |
IPaintStrategy |
getPaintStrategy()
|
void |
init(Ball context)
No-op |
private double |
innerProd(Point2DDouble vec1,
Point2DDouble vec2)
Inner product between two vectors |
void |
updateState(Ball context)
No-op |
Methods inherited from class ballwar.model.strategy.ANoOpStrategy |
---|
kill, updateCollision |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Ball host
private Point2DDouble ptA
private Point2DDouble vecS
private IBallCmd bounceCmd
private Color wallColor
private IPaintStrategy paintStrategy
Constructor Detail |
---|
public OneSideWallStrategy(Point2DDouble ptA, Point2DDouble vecS, Color wallColor)
public OneSideWallStrategy()
Method Detail |
---|
public void updateState(Ball context)
ANoOpStrategy
updateState
in interface IUpdateStrategy
updateState
in class ANoOpStrategy
context
- The ball to update.public void init(Ball context)
ANoOpStrategy
init
in interface IUpdateStrategy
init
in class ANoOpStrategy
context
- The ball to initialize.public IPaintStrategy getPaintStrategy()
private double crossProd(Point2DDouble vec1, Point2DDouble vec2)
private double innerProd(Point2DDouble vec1, Point2DDouble vec2)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |