physics
Class CollisionObject

java.lang.Object
  extended by physics.CollisionObject

public class CollisionObject
extends Object


Constructor Summary
CollisionObject(IGraphic shape)
          Creates a new CollisionObject instance.
 
Method Summary
 double calculateMomentum()
          Returns the calculated momentum using the mass and velocity of the object
 void collisionReact(CollisionObject co)
          Changes the collided boolean value to false Must be overridden to do more
 void detectCollision()
          Checks for a collision within the group
 boolean getCollided()
          Returns whether the Object has collided with another object in the current time interval
 DrawingCanvas getDP()
          getDP Returns the DrawingPanel this object is drawn upon
 boolean getEWall()
          Gets the EastWall boolean value returns true if it is the SouthWall, false otherwise
 LineFormula getLine()
          Returns the Line that the object is traveling on
 int getMass()
          Returns the mass of the object
 IMotion getMotion()
          Returns the motion of this object
 boolean getNWall()
          Gets the NorthWall boolean value returns true if it is the SouthWall, false otherwise
 IGraphic getShape()
          Returns the shape of this object
 boolean getSWall()
          Gets the SouthWall boolean value returns true if it is the SouthWall, false otherwise
 boolean getWWall()
          Gets the WestWall boolean value returns true if it is the SouthWall, false otherwise
 void setEastWall(boolean bool)
          Sets the EastWall boolean value Set true if it is the SouthWall, false otherwise
 void setGroup(CollisionGroup cg)
          Sets the CollisionGroup for this Object
 void setLine(LineFormula line)
          Describe setLine Sets the line for the Collision Object
 void setMass(int mass)
          Sets the mass of the object
 void setMotion(IMotion im)
          Changes the motion for the object and starts the motion's timer
 void setNorthWall(boolean bool)
          Sets the NorthWall boolean value Set true if it is the SouthWall, false otherwise
 void setShape(IGraphic rs)
          Sets the shape for this collision object
 void setSouthWall(boolean bool)
          Sets the SouthWall boolean value Set true if it is the SouthWall, false otherwise
 void setWall(boolean b)
          Set the boolean value describing if the object is a wall
 void setWestWall(boolean bool)
          Sets the WestWall boolean value Set true if it is the SouthWall, false otherwise
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollisionObject

public CollisionObject(IGraphic shape)
Creates a new CollisionObject instance.

Parameters:
shape - a NGP.Graphics.RectangularShape to use as the Shape
Method Detail

collisionReact

public void collisionReact(CollisionObject co)
Changes the collided boolean value to false Must be overridden to do more


setSouthWall

public void setSouthWall(boolean bool)
Sets the SouthWall boolean value Set true if it is the SouthWall, false otherwise

Parameters:
bool -

setNorthWall

public void setNorthWall(boolean bool)
Sets the NorthWall boolean value Set true if it is the SouthWall, false otherwise

Parameters:
bool -

setEastWall

public void setEastWall(boolean bool)
Sets the EastWall boolean value Set true if it is the SouthWall, false otherwise

Parameters:
bool -

setWestWall

public void setWestWall(boolean bool)
Sets the WestWall boolean value Set true if it is the SouthWall, false otherwise

Parameters:
bool -

getSWall

public boolean getSWall()
Gets the SouthWall boolean value returns true if it is the SouthWall, false otherwise

Parameters:
bool -

getNWall

public boolean getNWall()
Gets the NorthWall boolean value returns true if it is the SouthWall, false otherwise

Parameters:
bool -

getEWall

public boolean getEWall()
Gets the EastWall boolean value returns true if it is the SouthWall, false otherwise

Parameters:
bool -

getWWall

public boolean getWWall()
Gets the WestWall boolean value returns true if it is the SouthWall, false otherwise

Parameters:
bool -

detectCollision

public void detectCollision()
Checks for a collision within the group


setGroup

public void setGroup(CollisionGroup cg)
Sets the CollisionGroup for this Object

Parameters:
cg - a CollisionGroup

getCollided

public boolean getCollided()
Returns whether the Object has collided with another object in the current time interval

Returns:
a boolean value

setMotion

public void setMotion(IMotion im)
Changes the motion for the object and starts the motion's timer

Parameters:
im - an IMotion

getShape

public IGraphic getShape()
Returns the shape of this object

Returns:
a NGP.Graphics.RectangularShape

setShape

public void setShape(IGraphic rs)
Sets the shape for this collision object

Parameters:
rs - a NGP.Graphics.RectangularShape

getMotion

public IMotion getMotion()
Returns the motion of this object

Returns:
an IMotion

getDP

public DrawingCanvas getDP()
getDP Returns the DrawingPanel this object is drawn upon

Returns:
a NGP.Containers.DrawingPanel

calculateMomentum

public double calculateMomentum()
Returns the calculated momentum using the mass and velocity of the object

Returns:
a double

getLine

public LineFormula getLine()
Returns the Line that the object is traveling on

Returns:
a LineFormula

setLine

public void setLine(LineFormula line)
Describe setLine Sets the line for the Collision Object

Parameters:
line - a LineFormula

setMass

public void setMass(int mass)
Sets the mass of the object

Parameters:
mass - an int

getMass

public int getMass()
Returns the mass of the object

Returns:
an int

setWall

public void setWall(boolean b)
Set the boolean value describing if the object is a wall

Parameters:
b - a boolean