org.concord.collisions.engine
Class JBooster

java.lang.Object
  |
  +--org.concord.collisions.engine.JWorldElement
        |
        +--org.concord.collisions.engine.JDaemon
              |
              +--org.concord.collisions.engine.JBooster
All Implemented Interfaces:
CCDraggable, CCMassive, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable

public class JBooster
extends JDaemon

Booster element in the world

A booster is a special daemon that affects only atoms when they collide with it.

It changes instantly the velocity of the atom, adding to it its specific deltaVx and deltaVy.

Author:
Ingrid Moncada, Dmitry Markman
See Also:
JDaemon, Serialized Form

Field Summary
protected  boolean dragDeltaVx
           
protected  boolean dragDeltaVy
           
 
Fields inherited from class org.concord.collisions.engine.JDaemon
activationSteps, activeColor, collisionHistory, currentActivationStep, DEFAULT_PAINT_RADIUS, doCollisionsHistory, minDistance, timeColor
 
Fields inherited from class org.concord.collisions.engine.JWorldElement
acx, acy, areaListener, areaTables, collSensitive, controllable, DEFAULT_MAX_CONSTRAINT, DEFAULT_MIN_CONSTRAINT, doProjection, draggable, elementListeners, flashing, iconHeight, iconWidth, index, iviewer, mass, name, pressedState, propertyListeners, qtIcon, qtMovie, rectsForListener, scaleIcon, showAcceleration, showVelocity, showVelocityNumber, suggestedCollisionTime, swingIcon, vel_scale, vx, vy, wasLastStepCollision
 
Constructor Summary
JBooster()
           
 
Method Summary
static JBooster createBooster(float x, float y, float width, float height, float deltaVx, float deltaVy)
          Creates a new booster
 void doDrag(CCCoordinateTuner tuner, int x, int y)
           
 int getArrowThickness()
          Get the thickness of the delta velocity arrows
 java.awt.Color getDeltaVelColor()
          Returns the color of the arrows for the delta velocity of the daemon
 float getDeltaVx()
          Returns the delta velocity on the x component
 float getDeltaVy()
          Returns the delta velocity on the y component
 float getXTemperature()
           
 float getYTemperature()
           
 boolean isCollisionSensitive()
           
 boolean isPointInside(float px, float py)
          Returns if a specific world coordinates point is inside the element or not
 boolean manageCollision(JWorldElement element)
          This method is called by JPartWorld when the booster collides with an element
 boolean manageNoCollision(JWorldElement element)
          This method is called by JPartWorld every step while the booster is colliding with an element
 void paint(java.awt.Graphics g, java.awt.Graphics sg)
           
 void resetDefaultColors()
          Reset default colors for the booster.
 void setArrowThickness(int thick)
          Set the thickness of the delta velocity arrows
 void setDeltaVelColor(java.awt.Color col)
          Sets the color that will be displayed for the delta velocity's arrows
 void setDeltaVx(float v)
          Sets the delta velocity on the x component for the daemon
 void setDeltaVy(float v)
          Sets the delta velocity on the y component for the daemon
 void setGeometry(java.lang.Object object)
           
 
Methods inherited from class org.concord.collisions.engine.JDaemon
activate, addActivationStep, addActivationStep, addActivationStep, addDaemonListener, applyForce, checkingCollisionsSensitive, clearConditionExpression, clearFilter, closeEverything, deactivate, endDrag, evaluateExpression, getActivationStepTime, getActivationStepTime, getActiveCollision, getActiveColor, getCMPointX, getCMPointY, getCollisionHistory, getColor, getConditionExpression, getDraggableOwner, getDragMode, getEffectiveCollisionsRadius, getHeight, getInactiveColor, getNuclearElement, getWidth, getX, getXPotentialEnergy, getY, getYPotentialEnergy, hasCollided, hasCollidedWith, hasCollidedWithAt, initElement, isActive, isActiveCollision, isAlive, isAutomaticStart, isElemInDaemon, isLooping, isPointInsideCenter, isTimed, paint, paintIcon, paintSelection, panelInfoSupport, rememberCurrPosAsInit, rememberCurrVelAsInit, removeActivationStep, removeActivationStep, removeActivationStep, removeAllActivationSteps, removeDaemonListener, reset, resetCollisionsSensitive, setActivationStepTime, setActiveColor, setAutomaticStart, setCMPointX, setCMPointY, setColorFilter, setConditionExpression, setDragMode, setEffectiveCollisionsRadius, setFilter, setGeometry, setGeometry, setIcon, setInactiveColor, setInfoDrawer, setLooping, shift, shiftV, start, startDrag, step
 
Methods inherited from class org.concord.collisions.engine.JWorldElement
addAreaListener, addAreaListener, addAreaListener, addAreaListener, addAreaToListen, addAreaToListen, addAreaToListen, addAreaToListen, addElementListener, addElemMouseListener, addNeighborX, addNeighborY, addPropertyChangeListener, assignIndNumber, clearConstraints, clearForces, clearIcon, createDefaultCalculator, findDraggable, getAccelerationKoeff, getCollidedParticle, getDoProjection, getDownConstraint, getFlashingColor, getFullEnergy, getFullXEnergy, getFullYEnergy, getGravityX, getGravityY, getIcon, getIconHeight, getIconWidth, getIndex, getIndNumber, getLeftConstraint, getMass, getName, getNthForce, getNumbAppliedForces, getOwner, getPositionChanger, getPotentialEnergy, getQTIcon, getQTMovie, getRightConstraint, getShowAcceleration, getShowVelocity, getTemperature, getUpConstraint, getVelScale, getVx, getVy, getWorldModel, getX, getXacceleration, getXNeighbors, getY, getYacceleration, getYNeighbors, isConstraintsWasSet, isControllable, isDraggable, isEnabled, isFlashing, isMoveable, isPointInside, isPressedState, isSelected, isVisible, notifyAreaListener, notifyElementListeners, notifyMouseListeners, notifyPropertyListeners, paintSelection, propertyChange, rememberCurrAllAsInit, rememberCurrPropAsInit, rememberCurrPropAsInit, removeAreaListener, removeAreaToListen, removeAreaToListen, removeElementListener, removeElemMouseListener, removeForce, removeForce, removePositionChanger, removePropertyChangeListener, reverseVx, reverseVy, select, setAnimIcon, setCollidedParticle, setCollisionSensitive, setColor, setColor, setConstraints, setControllable, setDoProjection, setDraggable, setEnabled, setFlashing, setForceCalculator, setIcon, setIcon, setIcon, setIconSize, setIndex, setMass, setName, setOwner, setPositionChanger, setPressedState, setProperty, setQTIcon, setQTIcon, setQTMovie, setShowAcceleration, setShowVelocity, setVisible, setVx, setVy, setWorldModel, setXConstraints, setYConstraints, unselect, wasCollision
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dragDeltaVx

protected boolean dragDeltaVx

dragDeltaVy

protected boolean dragDeltaVy
Constructor Detail

JBooster

public JBooster()
Method Detail

createBooster

public static JBooster createBooster(float x,
                                     float y,
                                     float width,
                                     float height,
                                     float deltaVx,
                                     float deltaVy)
Creates a new booster
Parameters:
x - booster's x coordinate in pixels
y - booster's y coordinate in pixels
w - booster's width (minimum 1) in pixels
h - booster's height (minimum 1) inpixels
deltaVx - x coordinate of booster's delta velocity (in Cm)
deltaVy - y coordinate of booster's delta velocity (in Cm)

setGeometry

public void setGeometry(java.lang.Object object)
                 throws java.lang.Exception
Overrides:
setGeometry in class JWorldElement

paint

public void paint(java.awt.Graphics g,
                  java.awt.Graphics sg)
Overrides:
paint in class JWorldElement

getXTemperature

public float getXTemperature()
Overrides:
getXTemperature in class JWorldElement

getYTemperature

public float getYTemperature()
Overrides:
getYTemperature in class JWorldElement

manageCollision

public boolean manageCollision(JWorldElement element)
This method is called by JPartWorld when the booster collides with an element
Overrides:
manageCollision in class JDaemon
Parameters:
element - element the booster collided with

manageNoCollision

public boolean manageNoCollision(JWorldElement element)
This method is called by JPartWorld every step while the booster is colliding with an element
Overrides:
manageNoCollision in class JDaemon
Parameters:
element - element the booster is colliding with

setDeltaVx

public void setDeltaVx(float v)
Sets the delta velocity on the x component for the daemon
Parameters:
v - x coordinate of delta velocity

setDeltaVy

public void setDeltaVy(float v)
Sets the delta velocity on the y component for the daemon
Parameters:
v - y coordinate of delta velocity

getDeltaVx

public float getDeltaVx()
Returns the delta velocity on the x component
Returns:
deltaVx value

getDeltaVy

public float getDeltaVy()
Returns the delta velocity on the y component
Returns:
deltaVy value

getDeltaVelColor

public java.awt.Color getDeltaVelColor()
Returns the color of the arrows for the delta velocity of the daemon

By default, the delta vel arrows have the same color as the daemon.

Returns:
color of the delta velocity's arrows

setDeltaVelColor

public void setDeltaVelColor(java.awt.Color col)
Sets the color that will be displayed for the delta velocity's arrows
Parameters:
color - to be set

resetDefaultColors

public void resetDefaultColors()
Reset default colors for the booster.

Sets the default colors for boosters: Orange for inactive, green for active.


getArrowThickness

public int getArrowThickness()
Get the thickness of the delta velocity arrows

setArrowThickness

public void setArrowThickness(int thick)
Set the thickness of the delta velocity arrows

isCollisionSensitive

public boolean isCollisionSensitive()
Overrides:
isCollisionSensitive in class JWorldElement

doDrag

public void doDrag(CCCoordinateTuner tuner,
                   int x,
                   int y)
Overrides:
doDrag in class JDaemon

isPointInside

public boolean isPointInside(float px,
                             float py)
Returns if a specific world coordinates point is inside the element or not
Overrides:
isPointInside in class JDaemon
Parameters:
px - world x coordinate of the point
py - world y coordinate of the point
See Also:
JDaemon.isPointInside(float, float)