SmartFrog 3.10.000

org.smartfrog.examples.pong
Class Mass

java.lang.Object
  extended by org.smartfrog.examples.pong.Mass
Direct Known Subclasses:
Obstacle

public class Mass
extends java.lang.Object

Defines the mass object.


Constructor Summary
Mass()
          Constructor.
Mass(int initialMass, java.awt.geom.Point2D initialPosition)
          Constructor.
 
Method Summary
protected  void draw(java.awt.Graphics2D g2d)
          Draws the graphics object.
 java.awt.geom.Point2D getAccel()
          Gets the acceleration.
 int getMass()
          Gets the initial mass.
 java.awt.geom.Point2D getPosition()
          Gets the initial position.
 java.awt.geom.Point2D getSpeed()
          Gets the speed.
protected  void setAccel(double accelX, double accelY)
          Sets the acceleration.
protected  void setMass(int mass)
          Sets the mass.
protected  void setPosition(double xpos, double ypos)
          Sets the position.
protected  void setPosition(java.awt.geom.Point2D position)
          Sets the position.
protected  void setSpeed(double xspeed, double yspeed)
          Sets the speed.
protected  void setSpeed(java.awt.geom.Point2D speed)
          Sets the speed.
 java.lang.String toString()
          Returns the textual representation.
protected  void updatePosition(double elapsed)
          Updates the position.
protected  void updateSpeed(double elapsed)
          Updates the speed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mass

public Mass()
Constructor.


Mass

public Mass(int initialMass,
            java.awt.geom.Point2D initialPosition)
Constructor.

Parameters:
initialMass - the mass of the ball
initialPosition - the initial position of the ball
Method Detail

getAccel

public final java.awt.geom.Point2D getAccel()
Gets the acceleration.

Returns:
the acceleration
See Also:
setAccel(double, double)

getSpeed

public final java.awt.geom.Point2D getSpeed()
Gets the speed.

Returns:
the speed
See Also:
setSpeed(java.awt.geom.Point2D)

getPosition

public final java.awt.geom.Point2D getPosition()
Gets the initial position.

Returns:
the initial position
See Also:
setPosition(java.awt.geom.Point2D)

getMass

public final int getMass()
Gets the initial mass.

Returns:
the initial mass
See Also:
setMass(int)

setMass

protected void setMass(int mass)
Sets the mass.

Parameters:
mass - the mass
See Also:
getMass()

setAccel

protected void setAccel(double accelX,
                        double accelY)
Sets the acceleration.

Parameters:
accelX - the xpos
accelY - the ypos
See Also:
getAccel()

setSpeed

protected void setSpeed(java.awt.geom.Point2D speed)
Sets the speed.

Parameters:
speed - the speed
See Also:
getSpeed()

setSpeed

protected void setSpeed(double xspeed,
                        double yspeed)
Sets the speed.

Parameters:
xspeed - the x speed
yspeed - the y speed
See Also:
getSpeed()

setPosition

protected void setPosition(java.awt.geom.Point2D position)
Sets the position.

Parameters:
position - the position
See Also:
getPosition()

setPosition

protected void setPosition(double xpos,
                           double ypos)
Sets the position.

Parameters:
xpos - the x position
ypos - the y position
See Also:
getPosition()

updateSpeed

protected void updateSpeed(double elapsed)
Updates the speed.

Parameters:
elapsed - the updating factor

updatePosition

protected void updatePosition(double elapsed)
Updates the position.

Parameters:
elapsed - the updating factor

draw

protected void draw(java.awt.Graphics2D g2d)
Draws the graphics object.

Parameters:
g2d - the graphics object

toString

public java.lang.String toString()
Returns the textual representation.

Overrides:
toString in class java.lang.Object
Returns:
textual representation

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP