org.concord.collisions.engine
Class JWall

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

public class JWall
extends JWorldElement

one of implementation of JWorldElement abstract class

Author:
Dmitry Markman
See Also:
Serialized Form

Field Summary
static float DEFAULT_MASS
           
static float DEFAULT_THICKNESS
           
protected  int dragMode
           
 boolean faceCollision
          is true if collision with the wall occures from the face
 int halfThickness
          wall's thickness/2 default value is 5
static boolean HORIZONTAL_WALL
           
 float thickness
          wall's thickness.
static boolean VERTICAL_WALL
           
static int WALL_MODE_FREE
           
static int WALL_MODE_HORIZONTAL
           
static int WALL_MODE_VERTICAL
           
static int WALL_TEMP_CONST
           
static int WALL_TEMP_NONE
           
 int wallMode
           
 float x1
          x coordinate of first wall's side
 float x2
          x coordinate of second wall's side
 float y1
          y coordinate of first wall's side
 float y2
          y coordinate of second wall's side
 
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
JWall()
           
 
Method Summary
 void applyForce(CCForce force)
          JWall doesn't support applying forces
 float calcEnergyKoeff(float atomTemperature)
           
static JWall createSlopedWall(float wx, float wy, float length, float angle, float wt)
          factory method
static JWall createWall(float wx0, float wy0, float length, float wt, boolean isVertical)
          factory method
static JWall createWall(float wx1, float wy1, float wx2, float wy2, float wt)
          factory method
static JWall createWall(GUIPanel panel, float wx0, float wy0, float length, float wt, boolean isVertical)
          factory method
static JWall createWall(GUIPanel panel, float wx1, float wy1, float wx2, float wy2, float wt)
          factory method
 void doDrag(CCCoordinateTuner tuner, int x, int y)
           
 void down(float delta, float constrain, javax.swing.JComponent c)
          shift wall down
 void endDrag(CCCoordinateTuner tuner, int x, int y)
           
 float getCMPointX()
          calculates X coordinate of center of mass
 float getCMPointY()
          calculates Y coordinate of center of mass
 java.awt.Color getColor()
           
 float getCosA()
           
static float getDefaultHeatConductKoeff()
           
static float getDefaultThickness()
          retrieves default thickness
 float getDownConstraint()
           
 java.lang.Object getDraggableOwner()
           
 int getDragMode()
           
static int getHalfThickness(float t)
           
 float getHeatConductKoeff()
           
 float getLeftConstraint()
           
 float getRightConstraint()
           
 float getSinA()
           
 float getTemperature()
           
 float getThickness()
           
 float getUpConstraint()
           
 int getWallTemperatureMode()
           
 float getX()
           
 float getXPotentialEnergy()
           
 float getXTemperature()
           
 float getY()
           
 float getYPotentialEnergy()
           
 float getYTemperature()
           
 void initElement()
           
 boolean isMoveable()
           
 boolean isPointInside(float x, float y)
           
 boolean isPointOnTheWall(float x, float y)
          check whether or not point with coordinates x,y belong to wall
 boolean isWallHorizontal()
           
 boolean isWallVertical()
           
 void left(float delta, float constrain, javax.swing.JComponent c)
          shift wall left
 void paint(java.awt.Graphics g, java.awt.Graphics sg)
           
 void paintSelection(java.awt.Graphics g)
           
 boolean panelInfoSupport()
           
 void rememberCurrPosAsInit()
           
 void rememberCurrVelAsInit()
           
 void right(float delta, float constrain, javax.swing.JComponent c)
          shift wall right
 void setCMPointX(float x)
          set X coordinate of center of mass
 void setCMPointY(float y)
          set Y coordinate of center of mass
 void setConstraints(float xLeft, float yUp, float xRight, float yDown)
          setting wall's constraints
 void setDragMode(int dragMode)
           
 void setGeometry(float x1, float y1, float x2, float y2)
          set geometry's parameters for the wall with default thickness
 void setGeometry(float x1, float y1, float x2, float y2, float thickness)
          set geometry's parameters for the wall
 void setGeometry(GUIPanel panel, float x1, float y1, float x2, float y2)
          set geometry's parameters for the wall with default thickness
 void setGeometry(GUIPanel panel, float x1, float y1, float x2, float y2, float thickness)
          set geometry's parameters for the wall
 void setGeometry(java.lang.Object object)
           
 void setHeatConductKoeff(float koeff)
          set heat conducting koeff.
 void setInfoDrawer(CCInfoDrawer infoDrawer)
           
 void setMoveable(boolean moveable)
          set moveable property
 void setThickness(float thickness)
           
 void setWallTemperature(float temperature)
          set wall's "temperature"
 void setWallTemperatureMode(int wallTemperatureMode)
           
 void setXConstraints(float xLeft, float xRight)
          setting horizontal wall's constraints
 void setYConstraints(float yUp, float yDown)
          setting vertical wall's constraints
 void startDrag(int x, int y)
           
 void up(float delta, float constrain, javax.swing.JComponent c)
          shift wall up
 
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, closeEverything, createDefaultCalculator, findDraggable, getAccelerationKoeff, getCollidedParticle, getDoProjection, getFlashingColor, getFullEnergy, getFullXEnergy, getFullYEnergy, getGravityX, getGravityY, getIcon, getIconHeight, getIconWidth, getIndex, getIndNumber, getMass, getName, getNthForce, getNumbAppliedForces, getOwner, getPositionChanger, getPotentialEnergy, getQTIcon, getQTMovie, getShowAcceleration, getShowVelocity, getVelScale, getVx, getVy, getWorldModel, getX, getXacceleration, getXNeighbors, getY, getYacceleration, getYNeighbors, isCollisionSensitive, isConstraintsWasSet, isControllable, isDraggable, isEnabled, isFlashing, 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, 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, unselect, wasCollision
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WALL_MODE_HORIZONTAL

public static final int WALL_MODE_HORIZONTAL

WALL_MODE_VERTICAL

public static final int WALL_MODE_VERTICAL

WALL_MODE_FREE

public static final int WALL_MODE_FREE

wallMode

public int wallMode

x1

public float x1
x coordinate of first wall's side

y1

public float y1
y coordinate of first wall's side

x2

public float x2
x coordinate of second wall's side

y2

public float y2
y coordinate of second wall's side

thickness

public float thickness
wall's thickness. default value is 5

halfThickness

public int halfThickness
wall's thickness/2 default value is 5

VERTICAL_WALL

public static final boolean VERTICAL_WALL

HORIZONTAL_WALL

public static final boolean HORIZONTAL_WALL

DEFAULT_MASS

public static final float DEFAULT_MASS

DEFAULT_THICKNESS

public static final float DEFAULT_THICKNESS

dragMode

protected int dragMode

faceCollision

public boolean faceCollision
is true if collision with the wall occures from the face

WALL_TEMP_NONE

public static final int WALL_TEMP_NONE

WALL_TEMP_CONST

public static final int WALL_TEMP_CONST
Constructor Detail

JWall

public JWall()
Method Detail

initElement

public void initElement()
Overrides:
initElement in class JWorldElement

rememberCurrPosAsInit

public void rememberCurrPosAsInit()
Overrides:
rememberCurrPosAsInit in class JWorldElement

rememberCurrVelAsInit

public void rememberCurrVelAsInit()
Overrides:
rememberCurrVelAsInit in class JWorldElement

getCosA

public float getCosA()

getSinA

public float getSinA()

createWall

public static JWall createWall(float wx0,
                               float wy0,
                               float length,
                               float wt,
                               boolean isVertical)
factory method
Parameters:
wx0 - x coordinate of first wall's side
wy0 - y coordinate of first wall's side
length0 - walls length
wt - walls thickness
isVertical - if true wall will be vertical
Returns:
JWall instance

createWall

public static JWall createWall(float wx1,
                               float wy1,
                               float wx2,
                               float wy2,
                               float wt)
factory method
Parameters:
wx1 - x coordinate of first wall's side
wy1 - y coordinate of first wall's side
wx2 - x coordinate of second wall's side
wy2 - y coordinate of second wall's side
wt - walls thickness
Returns:
JWall instance

createSlopedWall

public static JWall createSlopedWall(float wx,
                                     float wy,
                                     float length,
                                     float angle,
                                     float wt)
factory method
Parameters:
wx - x coordinate of first wall's side
wy - y coordinate of first wall's side
length - walls length
angle - wall's slope (degree) , should be more/equal than 0 and less/equal than 180
wt - walls thickness
Returns:
JWall instance

createWall

public static JWall createWall(GUIPanel panel,
                               float wx0,
                               float wy0,
                               float length,
                               float wt,
                               boolean isVertical)
factory method
Parameters:
wx0 - x coordinate of first wall's side
wy0 - y coordinate of first wall's side
length0 - walls length
wt - walls thickness
isVertical - if true wall will be vertical
Returns:
JWall instance

createWall

public static JWall createWall(GUIPanel panel,
                               float wx1,
                               float wy1,
                               float wx2,
                               float wy2,
                               float wt)
factory method
Parameters:
wx1 - x coordinate of first wall's side
wy1 - y coordinate of first wall's side
wx2 - x coordinate of second wall's side
wy2 - y coordinate of second wall's side
wt - walls thickness
Returns:
JWall instance

setGeometry

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

getHalfThickness

public static int getHalfThickness(float t)

setGeometry

public void setGeometry(GUIPanel panel,
                        float x1,
                        float y1,
                        float x2,
                        float y2,
                        float thickness)
                 throws java.lang.Exception
set geometry's parameters for the wall
Parameters:
x1 - x coordinate of first wall's side
y1 - y coordinate of first wall's side
x2 - x coordinate of second wall's side
y2 - y coordinate of second wall's side
thickness - walls thickness

setGeometry

public void setGeometry(float x1,
                        float y1,
                        float x2,
                        float y2,
                        float thickness)
                 throws java.lang.Exception
set geometry's parameters for the wall
Parameters:
x1 - x coordinate of first wall's side
y1 - y coordinate of first wall's side
x2 - x coordinate of second wall's side
y2 - y coordinate of second wall's side
thickness - walls thickness

setGeometry

public void setGeometry(float x1,
                        float y1,
                        float x2,
                        float y2)
                 throws java.lang.Exception
set geometry's parameters for the wall with default thickness
Parameters:
x1 - x coordinate of first wall's side
y1 - y coordinate of first wall's side
x2 - x coordinate of second wall's side
y2 - y coordinate of second wall's side

setGeometry

public void setGeometry(GUIPanel panel,
                        float x1,
                        float y1,
                        float x2,
                        float y2)
                 throws java.lang.Exception
set geometry's parameters for the wall with default thickness
Parameters:
x1 - x coordinate of first wall's side
y1 - y coordinate of first wall's side
x2 - x coordinate of second wall's side
y2 - y coordinate of second wall's side

getColor

public java.awt.Color getColor()
Overrides:
getColor in class JWorldElement

paintSelection

public void paintSelection(java.awt.Graphics g)
Overrides:
paintSelection in class JWorldElement

paint

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

getDefaultThickness

public static float getDefaultThickness()
retrieves default thickness
Returns:
default thickness

up

public void up(float delta,
               float constrain,
               javax.swing.JComponent c)
shift wall up
Parameters:
delta - distance to be shifted in up direction
constrain - up constrain
c - component to be upfdated. could be null

down

public void down(float delta,
                 float constrain,
                 javax.swing.JComponent c)
shift wall down
Parameters:
delta - distance to be shifted in down direction
constrain - down constrain
c - component to be upfdated. could be null

left

public void left(float delta,
                 float constrain,
                 javax.swing.JComponent c)
shift wall left
Parameters:
delta - distance to be shifted in left direction
constrain - left constrain
c - component to be upfdated. could be null

right

public void right(float delta,
                  float constrain,
                  javax.swing.JComponent c)
shift wall right
Parameters:
delta - distance to be shifted in right direction
constrain - right constrain
c - component to be upfdated. could be null

setMoveable

public void setMoveable(boolean moveable)
set moveable property
Parameters:
moveable - if(code>false wall couldn't be moved for any internal reason (collision) you still can shift the wall via down,up,left,right methods

isMoveable

public boolean isMoveable()
Overrides:
isMoveable in class JWorldElement
Returns:
retrieves moveable property, if(code>false wall couldn't be moved for any internal reason (collision)

isWallVertical

public boolean isWallVertical()

isWallHorizontal

public boolean isWallHorizontal()

setConstraints

public void setConstraints(float xLeft,
                           float yUp,
                           float xRight,
                           float yDown)
setting wall's constraints
Overrides:
setConstraints in class JWorldElement
Parameters:
xLeft - left constrain
yUp - up constrain
xRight - right constrain
yDown - bottom constrain

setYConstraints

public void setYConstraints(float yUp,
                            float yDown)
setting vertical wall's constraints
Overrides:
setYConstraints in class JWorldElement
Parameters:
yUp - up constrain
yDown - bottom constrain

setXConstraints

public void setXConstraints(float xLeft,
                            float xRight)
setting horizontal wall's constraints
Overrides:
setXConstraints in class JWorldElement
Parameters:
xLeft - left constrain
xRight - right constrain

getLeftConstraint

public float getLeftConstraint()
Overrides:
getLeftConstraint in class JWorldElement
Returns:
left constrain

getUpConstraint

public float getUpConstraint()
Overrides:
getUpConstraint in class JWorldElement
Returns:
top constrain

getRightConstraint

public float getRightConstraint()
Overrides:
getRightConstraint in class JWorldElement
Returns:
right constrain

getDownConstraint

public float getDownConstraint()
Overrides:
getDownConstraint in class JWorldElement
Returns:
bottom constrain

setWallTemperature

public void setWallTemperature(float temperature)
set wall's "temperature"
Parameters:
desired - wall's "temperature"

getTemperature

public float getTemperature()
Overrides:
getTemperature in class JWorldElement
Returns:
wall's "temperature"

getXTemperature

public float getXTemperature()
Overrides:
getXTemperature in class JWorldElement

getYTemperature

public float getYTemperature()
Overrides:
getYTemperature in class JWorldElement

getXPotentialEnergy

public float getXPotentialEnergy()
Overrides:
getXPotentialEnergy in class JWorldElement

getYPotentialEnergy

public float getYPotentialEnergy()
Overrides:
getYPotentialEnergy in class JWorldElement

setWallTemperatureMode

public void setWallTemperatureMode(int wallTemperatureMode)

getWallTemperatureMode

public int getWallTemperatureMode()

getDefaultHeatConductKoeff

public static float getDefaultHeatConductKoeff()

getHeatConductKoeff

public float getHeatConductKoeff()

setHeatConductKoeff

public void setHeatConductKoeff(float koeff)
set heat conducting koeff. it can't be less than 0 and more than 1
Parameters:
koeff - desired heat conducting koeff. parameter less than 0 or more than 1 default value will be assigned

calcEnergyKoeff

public float calcEnergyKoeff(float atomTemperature)

getX

public float getX()
Overrides:
getX in class JWorldElement

getY

public float getY()
Overrides:
getY in class JWorldElement

getCMPointX

public float getCMPointX()
calculates X coordinate of center of mass
Returns:
x coordinate of wall's center of mass

getCMPointY

public float getCMPointY()
calculates Y coordinate of center of mass
Returns:
y coordinate of wall's center of mass

setCMPointX

public void setCMPointX(float x)
                 throws CCUnimplOperationException
Description copied from interface: CCMassive
set X coordinate of center of mass
Following copied from interface: org.concord.collisions.engine.CCMassive
Parameters:
x - desired X coordinate of center of mass

setCMPointY

public void setCMPointY(float y)
                 throws CCUnimplOperationException
Description copied from interface: CCMassive
set Y coordinate of center of mass
Following copied from interface: org.concord.collisions.engine.CCMassive
Parameters:
y - desired Y coordinate of center of mass

applyForce

public void applyForce(CCForce force)
JWall doesn't support applying forces
Overrides:
applyForce in class JWorldElement
Throws:
CCUnsuppOperationException -  

isPointOnTheWall

public boolean isPointOnTheWall(float x,
                                float y)
check whether or not point with coordinates x,y belong to wall
Parameters:
x - point's x coordinate
y - point's y coordinate
Returns:
true if point lies on the wall

isPointInside

public boolean isPointInside(float x,
                             float y)
Overrides:
isPointInside in class JWorldElement

startDrag

public void startDrag(int x,
                      int y)

doDrag

public void doDrag(CCCoordinateTuner tuner,
                   int x,
                   int y)

endDrag

public void endDrag(CCCoordinateTuner tuner,
                    int x,
                    int y)

getDraggableOwner

public java.lang.Object getDraggableOwner()

panelInfoSupport

public boolean panelInfoSupport()

setInfoDrawer

public void setInfoDrawer(CCInfoDrawer infoDrawer)

getDragMode

public int getDragMode()

setDragMode

public void setDragMode(int dragMode)

getThickness

public float getThickness()

setThickness

public void setThickness(float thickness)